Skip to content

Commit f58a727

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 fb4bae1 commit f58a727

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,74 @@ def test_bgp_vrf_routes():
344344
_test_bgp_vrf_routes(router, vrf)
345345

346346

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

0 commit comments

Comments
 (0)