Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: bgp_snmp_bgp4v2mib fix some random failure #14830

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions tests/topotests/bgp_snmp_bgp4v2mib/test_bgp_snmp_bgp4v2mib.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def _snmpwalk_origin():
# bgp4V2NlriOrigin
# tgen.mininet_cli()
output, _ = snmp.walk(".1.3.6.1.3.5.1.1.9.1.9")
logger.info(output)
return output == expected

_, result = topotest.run_and_expect(_snmpwalk_origin, True, count=10, wait=1)
Expand Down Expand Up @@ -284,13 +283,35 @@ def _snmptrap_ipv6():
("1.3.6.1.3.5.1.1.2.1.6.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "179"),
]

expected2 = [
("1.3.6.1.3.5.1.1.2.1.13.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "7"),
("1.3.6.1.3.5.1.1.2.1.6.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "179"),
("1.3.6.1.3.5.1.1.3.1.1.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "6"),
("1.3.6.1.3.5.1.1.3.1.2.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "4"),
(
"1.3.6.1.3.5.1.1.3.1.4.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1",
'"00 "',
),
("1.3.6.1.3.5.1.1.2.1.13.1.1.192.168.12.1", "7"),
("1.3.6.1.3.5.1.1.2.1.6.1.1.192.168.12.1", "179"),
("1.3.6.1.3.5.1.1.3.1.1.1.1.192.168.12.1", "6"),
("1.3.6.1.3.5.1.1.3.1.2.1.1.192.168.12.1", "4"),
("1.3.6.1.3.5.1.1.3.1.4.1.1.192.168.12.1", '"00 "'),
("1.3.6.1.3.5.1.1.2.1.13.1.1.192.168.12.1", "6"),
("1.3.6.1.3.5.1.1.2.1.6.1.1.192.168.12.1", "179"),
("1.3.6.1.3.5.1.1.2.1.13.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "6"),
("1.3.6.1.3.5.1.1.2.1.6.1.2.32.1.13.184.0.0.0.0.0.0.0.0.0.18.0.1", "179"),
]

# load trapd resulting file
# tgen.mininet_cli()

snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
outputfile = open(snmptrapfile).read()
output = snmp.trap(outputfile)
return output == expected
logger.info(output)
output_cut = output[:14]
return output_cut == expected or output_cut == expected2

snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
trap_file = open(snmptrapfile, "w")
Expand Down
Loading