Skip to content

Commit c6b5efa

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 3464e18 commit c6b5efa

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

348348

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

0 commit comments

Comments
 (0)