mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-03 01:32:31 +00:00
tests: extend tests for aspath exclude
adding a tests about:
"no bgp as-path access-list" command.
the folloxing "clear bgp *" command leads to the
crash exhibited above.
a sleep had been added to capture the crash befor the end of scenario.
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f5f05cbb9c0 (LWP 1371086))]
(gdb) bt
context=0x7ffcf2c216c0) at lib/sigevent.c:248
acl_list=0x55c976ec03c0) at bgpd/bgp_aspath.c:1688
dummy=0x7ffcf2c22340, object=0x7ffcf2c21e70) at bgpd/bgp_routemap.c:2401
match_object=0x7ffcf2c21e70, set_object=0x7ffcf2c21e70, pref=0x0)
at lib/routemap.c:2687
attr=0x7ffcf2c220b0, afi=AFI_IP, safi=SAFI_UNICAST, rmap_name=0x0, label=0x0,
num_labels=0, dest=0x55c976ebeaf0) at bgpd/bgp_route.c:1807
addpath_id=0, attr=0x7ffcf2c22450, afi=AFI_IP, safi=SAFI_UNICAST, type=10,
sub_type=0, prd=0x0, label=0x0, num_labels=0, soft_reconfig=0, evpn=0x0)
at bgpd/bgp_route.c:4424
packet=0x7ffcf2c22410) at bgpd/bgp_route.c:6266
packet=0x7ffcf2c22410, mp_withdraw=false) at bgpd/bgp_packet.c:341
peer=0x55c976e89ed0, size=43) at bgpd/bgp_packet.c:2414
at bgpd/bgp_packet.c:3899
Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit 324fa21015
)
This commit is contained in:
parent
ac6a3bfc78
commit
f00d489ec4
@ -62,23 +62,48 @@ def teardown_module(mod):
|
||||
tgen.stop_topology()
|
||||
|
||||
|
||||
expected_1 = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": "65002"}],
|
||||
"172.16.255.32/32": [{"path": ""}],
|
||||
}
|
||||
}
|
||||
|
||||
expected_2 = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": ""}],
|
||||
"172.16.255.32/32": [{"path": ""}],
|
||||
}
|
||||
}
|
||||
|
||||
expected_3 = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": "65003"}],
|
||||
"172.16.255.32/32": [{"path": "65003"}],
|
||||
}
|
||||
}
|
||||
|
||||
expected_4 = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": "65002 65003"}],
|
||||
"172.16.255.32/32": [{"path": "65002 65003"}],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def bgp_converge(router, expected):
|
||||
output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast json"))
|
||||
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
|
||||
def test_bgp_set_aspath_exclude():
|
||||
tgen = get_topogen()
|
||||
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
def _bgp_converge(router):
|
||||
output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast json"))
|
||||
expected = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": "65002"}],
|
||||
"172.16.255.32/32": [{"path": ""}],
|
||||
}
|
||||
}
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
test_func = functools.partial(_bgp_converge, tgen.gears["r1"])
|
||||
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_1)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
|
||||
|
||||
assert result is None, "Failed overriding incoming AS-PATH with route-map"
|
||||
@ -102,19 +127,7 @@ conf
|
||||
"""
|
||||
)
|
||||
|
||||
expected = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": ""}],
|
||||
"172.16.255.32/32": [{"path": ""}],
|
||||
}
|
||||
}
|
||||
|
||||
def _bgp_regexp_1(router):
|
||||
output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast json"))
|
||||
|
||||
return topotest.json_cmp(output, expected)
|
||||
|
||||
test_func = functools.partial(_bgp_regexp_1, tgen.gears["r1"])
|
||||
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_2)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
|
||||
|
||||
assert result is None, "Failed overriding incoming AS-PATH with regex 1 route-map"
|
||||
@ -127,19 +140,46 @@ conf
|
||||
"""
|
||||
)
|
||||
|
||||
expected = {
|
||||
"routes": {
|
||||
"172.16.255.31/32": [{"path": "65003"}],
|
||||
"172.16.255.32/32": [{"path": "65003"}],
|
||||
}
|
||||
}
|
||||
|
||||
test_func = functools.partial(_bgp_regexp_1, tgen.gears["r1"])
|
||||
# tgen.mininet_cli()
|
||||
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
|
||||
|
||||
assert result is None, "Failed overriding incoming AS-PATH with regex 2 route-map"
|
||||
|
||||
|
||||
def test_no_bgp_set_aspath_exclude_access_list():
|
||||
tgen = get_topogen()
|
||||
|
||||
if tgen.routers_have_failure():
|
||||
pytest.skip(tgen.errors)
|
||||
|
||||
rname = "r1"
|
||||
r1 = tgen.gears[rname]
|
||||
|
||||
r1.vtysh_cmd(
|
||||
"""
|
||||
conf
|
||||
no bgp as-path access-list SECOND permit 2
|
||||
"""
|
||||
)
|
||||
|
||||
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
|
||||
|
||||
assert result is None, "Failed removing bgp as-path access-list"
|
||||
|
||||
r1.vtysh_cmd(
|
||||
"""
|
||||
clear bgp *
|
||||
"""
|
||||
)
|
||||
|
||||
test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_4)
|
||||
_, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5)
|
||||
|
||||
assert result is None, "Failed to renegotiate with peers"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = ["-s"] + sys.argv[1:]
|
||||
sys.exit(pytest.main(args))
|
||||
|
Loading…
Reference in New Issue
Block a user