Skip to content

Commit 496f510

Browse files
test: add a configuration providing crasho to "bgp_remove_private_as"
we add a configuration: configure terminal route-map OLDCORE-INTERNET-IN-IPv4 permit 5 set as-path replace any 65398 exit route-map OLDCORE-INTERNET-OUT-IPv4 permit 5 set as-path replace any 65399 exit router bgp 65002 bgp deterministic-med address-family ipv4 unicast neighbor 203.0.113.0 remove-private-AS all neighbor 203.0.113.0 soft-reconfiguration inbound neighbor 203.0.113.0 route-map OLDCORE-INTERNET-IN-IPv4 in neighbor 203.0.113.0 route-map OLDCORE-INTERNET-OUT-IPv4 out exit-address-family that leads to a crash. Signed-off-by: Francois Dumontet <[email protected]>
1 parent ad7ad68 commit 496f510

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/topotests/bgp_remove_private_as/test_bgp_remove_private_as.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from lib import topotest
4242
from lib.topogen import Topogen, TopoRouter, get_topogen
4343
from functools import partial
44+
from lib.topolog import logger
4445

4546
pytestmark = [pytest.mark.bgpd]
4647

@@ -389,6 +390,44 @@ def _validate_paths(remove_type):
389390
real_path = adj_rib_in["receivedRoutes"][pfx]["path"]
390391
return real_path == good_path
391392

393+
def __no_crash():
394+
output = json.loads(
395+
tgen.gears["r2"].vtysh_cmd(
396+
"show ip bgp neighbor 203.0.113.0 advertised-routes detail json"
397+
)
398+
)
399+
logger.info(output)
400+
logger.info(output["totalPrefixCounter"])
401+
if output["totalPrefixCounter"] != 0 :
402+
return True
403+
return False
404+
405+
def _crash_scenario():
406+
""" add list of command making """
407+
tgen = get_topogen()
408+
tgen.gears["r2"].vtysh_cmd(
409+
"""
410+
configure terminal
411+
route-map OLDCORE-INTERNET-IN-IPv4 permit 5
412+
set as-path replace any 65398
413+
exit
414+
route-map OLDCORE-INTERNET-OUT-IPv4 permit 5
415+
set as-path replace any 65399
416+
exit
417+
router bgp 65002
418+
bgp deterministic-med
419+
address-family ipv4 unicast
420+
neighbor 203.0.113.0 remove-private-AS all
421+
neighbor 203.0.113.0 soft-reconfiguration inbound
422+
neighbor 203.0.113.0 route-map OLDCORE-INTERNET-IN-IPv4 in
423+
neighbor 203.0.113.0 route-map OLDCORE-INTERNET-OUT-IPv4 out
424+
exit-address-family
425+
"""
426+
)
427+
test_func = partial(__no_crash)
428+
_, result = topotest.run_and_expect(test_func, True, count=60, wait=0.5)
429+
assert result == True, "bgpd may has major failure"
430+
392431
#######################
393432
# Begin Test
394433
#######################
@@ -408,6 +447,12 @@ def _validate_paths(remove_type):
408447
# the old flag after each iteration so we only test the flags we expect.
409448
_change_remove_type(rmv_type, "del")
410449

450+
# verify that nulled as_path don't make a crash.
451+
_change_remove_type("remove-private-AS all", "add")
452+
_crash_scenario()
453+
454+
exit
455+
411456

412457
if __name__ == "__main__":
413458
args = ["-s"] + sys.argv[1:]

0 commit comments

Comments
 (0)