Skip to content

Commit 7980eca

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 d3483f4 commit 7980eca

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
@@ -338,6 +338,78 @@ def test_bgp_vrf_routes():
338338
_test_bgp_vrf_routes(router, vrf)
339339

340340

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

0 commit comments

Comments
 (0)