Skip to content

Commit b40766b

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 c9c8178 commit b40766b

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
@@ -347,6 +347,78 @@ def test_bgp_vrf_routes():
347347
_test_bgp_vrf_routes(router, vrf)
348348

349349

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

0 commit comments

Comments
 (0)