Skip to content

Commit 6c2f224

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 54bf58f commit 6c2f224

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
@@ -345,6 +345,78 @@ def test_bgp_vrf_routes():
345345
_test_bgp_vrf_routes(router, vrf)
346346

347347

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

0 commit comments

Comments
 (0)