Skip to content

Commit ecd7b04

Browse files
committed
topotests: bgp_evpn_rt5, add check on reconfigure evpn instance
Add a test that controls that it is possible to reconfigure a BGP EVPN instance by using the advertise-all-vni command. Negating this command will remove all the EVPN rib entries. Signed-off-by: Philippe Guibert <[email protected]>
1 parent fe981ae commit ecd7b04

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,78 @@ def test_bgp_vrf_routes():
341341
_test_bgp_vrf_routes(router, vrf)
342342

343343

344+
def test_evpn_unconfigure_evpn():
345+
"""
346+
Unconfigure R2 with advertise-all-vni on vrf-evpn instance
347+
Ensure that local L2VPN EVPN entries are removed
348+
"""
349+
global vrf_underlay
350+
351+
tgen = get_topogen()
352+
if tgen.routers_have_failure():
353+
pytest.skip(tgen.errors)
354+
logger.info("==== r2, unconfigure advertise-all-vni from BGP vrf-evpn instance")
355+
router = tgen.gears["r2"]
356+
vrf_to_write = f" vrf {r2_vrf_underlay}" if r2_vrf_underlay else ""
357+
router.vtysh_cmd(
358+
f"""
359+
configure terminal
360+
router bgp 65000{vrf_to_write}
361+
address-family l2vpn evpn
362+
no advertise-all-vni
363+
exit-address-family
364+
exit
365+
"""
366+
)
367+
expected = {}
368+
test_func = partial(
369+
topotest.router_json_cmp,
370+
router,
371+
"show bgp l2vpn evpn json",
372+
expected,
373+
exact=True,
374+
)
375+
_, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
376+
assertmsg = '"{}" JSON output mismatches'.format(router.name)
377+
assert result is None, assertmsg
378+
379+
380+
def test_evpn_reconfigure_evpn():
381+
"""
382+
reconfigure R2 with advertise-all-vni on vrf-evpn instance
383+
Ensure that L2VPN EVPN entries are correctly learned
384+
"""
385+
global vrf_underlay
386+
387+
tgen = get_topogen()
388+
if tgen.routers_have_failure():
389+
pytest.skip(tgen.errors)
390+
logger.info("==== r2, reconfigure advertise-all-vni from BGP vrf-evpn instance")
391+
router = tgen.gears["r2"]
392+
vrf_to_write = f" vrf {r2_vrf_underlay}" if r2_vrf_underlay else ""
393+
router.vtysh_cmd(
394+
f"""
395+
configure terminal
396+
router bgp 65000{vrf_to_write}
397+
address-family l2vpn evpn
398+
advertise-all-vni
399+
exit-address-family
400+
exit
401+
"""
402+
)
403+
json_file = "{}/r2/bgp_l2vpn_evpn_routes.json".format(CWD)
404+
expected = json.loads(open(json_file).read())
405+
test_func = partial(
406+
topotest.router_json_cmp,
407+
router,
408+
"show bgp l2vpn evpn json",
409+
expected,
410+
)
411+
_, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
412+
assertmsg = '"{}" JSON output mismatches'.format(router.name)
413+
assert result is None, assertmsg
414+
415+
344416
def test_router_check_ip():
345417
"""
346418
Check routes are correctly installed

0 commit comments

Comments
 (0)