Skip to content

Commit

Permalink
topotests: add bgp test to check the ADJ-RIB-IN label value
Browse files Browse the repository at this point in the history
The test is done on r2. A BGP update is received on r2, and is
filtered on r2. The RIB of r2 does not have the BGP update stored,
but the ADJ-RIB-IN is yet present. To demonstrate this, if the
inbound route-map is removed, then the BGP update should be copied
from the the ADJ-RIB-IN and added to the RIB with the label
value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
pguibert6WIND authored and louis-6wind committed Feb 23, 2024
1 parent 6f1e250 commit 1096814
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions tests/topotests/bgp_vpnv4_ebgp/test_bgp_vpnv4_ebgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,93 @@ def test_adj_rib_out_label_change():
assert result is None, assertmsg


def test_adj_rib_in_label_change():
"""
Check that syncinig with ADJ-RIB-in on r2
permits restoring the initial label value
"""
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

logger.info("Enable soft-reconfiguration inbound on r2")

r2 = tgen.gears["r2"]
r2.vtysh_cmd(
"""
configure terminal
router bgp 65501
address-family ipv4 vpn
neighbor 192.168.0.1 soft-reconfiguration inbound
"""
)

logger.info("Applying a deny-all route-map to input on r2")
r2.vtysh_cmd(
"""
configure terminal
route-map DENY-ALL deny 1
!
router bgp 65501
address-family ipv4 vpn
neighbor 192.168.0.1 route-map DENY-ALL in
"""
)

# check that 172.31.0.1 should not be present
logger.info("Check that received update 172.31.0.1 is not present")

expected = {}
test_func = partial(
topotest.router_json_cmp,
r2,
"show bgp ipv4 vpn 172.31.0.1/32 json",
expected,
exact=True,
)
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert success, "r2, vpnv4 update 172.31.0.1 still present"



def test_adj_rib_in_label_change_remove_rmap():
"""
Check that syncinig with ADJ-RIB-in on r2
permits restoring the initial label value
"""
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

logger.info("Removing the deny-all route-map from input on r2")

r2 = tgen.gears["r2"]
r2.vtysh_cmd(
"""
configure terminal
router bgp 65501
address-family ipv4 vpn
no neighbor 192.168.0.1 route-map DENY-ALL in
"""
)
# Check BGP IPv4 route entry for 172.31.0.1 on r1
logger.info(
"Checking that 172.31.0.1 BGP update is present and has valid label on r2"
)
json_file = "{}/{}/bgp_ipv4_vpn_route_1723101.json".format(CWD, r2.name)

expected = json.loads(open(json_file).read())
test_func = partial(
topotest.router_json_cmp,
r2,
"show bgp ipv4 vpn 172.31.0.1/32 json",
expected,
)
_, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assertmsg = '"{}" JSON output mismatches'.format(r2.name)
assert result is None, assertmsg


def test_memory_leak():
"Run the memory leak test and report results."
tgen = get_topogen()
Expand Down

0 comments on commit 1096814

Please sign in to comment.