Skip to content

Commit a5bee82

Browse files
fdumontet6WINDton31337
authored andcommitted
tests: bgp_snmp_bgp4v2mib fix some random failure
avoid to consider additionnal traps randomly received later Signed-off-by: Francois Dumontet <[email protected]>
1 parent b84476e commit a5bee82

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

tests/topotests/bgp_snmp_bgp4v2mib/test_bgp_snmp_bgp4v2mib.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def _snmpwalk_origin():
207207
# bgp4V2NlriOrigin
208208
# tgen.mininet_cli()
209209
output, _ = snmp.walk(".1.3.6.1.3.5.1.1.9.1.9")
210-
logger.info(output)
211210
return output == expected
212211

213212
_, result = topotest.run_and_expect(_snmpwalk_origin, True, count=10, wait=1)
@@ -284,13 +283,35 @@ def _snmptrap_ipv6():
284283
("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"),
285284
]
286285

286+
expected2 = [
287+
("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"),
288+
("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"),
289+
("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"),
290+
("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"),
291+
(
292+
"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",
293+
'"00 "',
294+
),
295+
("1.3.6.1.3.5.1.1.2.1.13.1.1.192.168.12.1", "7"),
296+
("1.3.6.1.3.5.1.1.2.1.6.1.1.192.168.12.1", "179"),
297+
("1.3.6.1.3.5.1.1.3.1.1.1.1.192.168.12.1", "6"),
298+
("1.3.6.1.3.5.1.1.3.1.2.1.1.192.168.12.1", "4"),
299+
("1.3.6.1.3.5.1.1.3.1.4.1.1.192.168.12.1", '"00 "'),
300+
("1.3.6.1.3.5.1.1.2.1.13.1.1.192.168.12.1", "6"),
301+
("1.3.6.1.3.5.1.1.2.1.6.1.1.192.168.12.1", "179"),
302+
("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"),
303+
("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"),
304+
]
305+
287306
# load trapd resulting file
288307
# tgen.mininet_cli()
289308

290309
snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
291310
outputfile = open(snmptrapfile).read()
292311
output = snmp.trap(outputfile)
293-
return output == expected
312+
logger.info(output)
313+
output_cut = output[:14]
314+
return output_cut == expected or output_cut == expected2
294315

295316
snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
296317
trap_file = open(snmptrapfile, "w")

0 commit comments

Comments
 (0)