@@ -79,6 +79,36 @@ def test_router_bgp_as_pretty():
7979 assert "router bgp 65500\n " in output , "router bgp 65500 not found in show run"
8080
8181
82+ def test_vrf_bgp_list ():
83+ logger .info ("Ensure that BGP list does not include non existing VRFs" )
84+ tgen = get_topogen ()
85+ # Don't run this test if we have any failure.
86+ if tgen .routers_have_failure ():
87+ pytest .skip (tgen .errors )
88+
89+ r1 = tgen .gears ["r1" ]
90+
91+ # Configure a VRF that is not going to be used
92+ r1 .cmd ("ip link add MARIA type vrf table 1009" )
93+
94+ # Attempt to remove ANNA VRF that is not present
95+ r1 .vtysh_cmd (
96+ """
97+ configure
98+
99+ router bgp 99 vrf DONNA
100+ address-family ipv4 unicast
101+ no import vrf ANNA
102+ """
103+ )
104+
105+ expect = {"vrfs" : {"DONNA" : {}, "default" : {}, "EVA" : {}}, "totalVrfs" : 3 }
106+
107+ test_func = partial (topotest .router_json_cmp , r1 , "show bgp vrfs json" , expect )
108+ result , diff = topotest .run_and_expect (test_func , None , count = 15 , wait = 1 )
109+ assert result , "BGP VRF list check failed:\n {}" .format (diff )
110+
111+
82112def test_vrf_route_leak_donna ():
83113 logger .info ("Ensure that routes are leaked back and forth" )
84114 tgen = get_topogen ()
@@ -382,6 +412,18 @@ def test_vrf_route_leak_donna_add_vrf_zita():
382412 r1 = tgen .gears ["r1" ]
383413 r1 .cmd ("ip link add ZITA type vrf table 1003" )
384414
415+ r1 .vtysh_cmd (
416+ """
417+ configure
418+
419+ router bgp 65500 vrf ZITA
420+ no bgp ebgp-requires-policy
421+ no bgp network import-check
422+ address-family ipv4 unicast
423+ network 172.16.101.0/24
424+ """
425+ )
426+
385427 # Test DONNA VRF.
386428 expect = {
387429 "172.16.101.0/24" : None ,
@@ -393,6 +435,15 @@ def test_vrf_route_leak_donna_add_vrf_zita():
393435 result , diff = topotest .run_and_expect (test_func , None , count = 15 , wait = 1 )
394436 assert result , "BGP VRF DONNA check failed:\n {}" .format (diff )
395437
438+ expect = {
439+ "vrfs" : {"DONNA" : {}, "default" : {}, "EVA" : {}, "ZITA" : {}},
440+ "totalVrfs" : 4 ,
441+ }
442+
443+ test_func = partial (topotest .router_json_cmp , r1 , "show bgp vrfs json" , expect )
444+ result , diff = topotest .run_and_expect (test_func , None , count = 15 , wait = 1 )
445+ assert result , "BGP VRF list check failed:\n {}" .format (diff )
446+
396447
397448def test_vrf_route_leak_donna_set_zita_up ():
398449 logger .info ("Set VRF ZITA up and ensure that the route from VRF ZITA is updated" )
0 commit comments