Skip to content

Commit

Permalink
tests: add bgp4v2 MIB traps test
Browse files Browse the repository at this point in the history
Signed-off-by: Francois Dumontet <[email protected]>
  • Loading branch information
fdumontet6WIND committed Oct 3, 2023
1 parent 05f3a48 commit dd67d45
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/topotests/bgp_snmp_bgp4v2mib/test_bgp_snmp_bgp4v2mib.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _snmpwalk_origin():
}

# bgp4V2NlriOrigin
tgen.mininet_cli()
#tgen.mininet_cli()
output, _ = snmp.walk(".1.3.6.1.3.5.1.1.9.1.9")
logger.info(output)
return output == expected
Expand Down Expand Up @@ -293,12 +293,20 @@ def _snmptrap_ipv6():
snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
outputfile = open(snmptrapfile).read()
output = snmp.trap(outputfile)
logger.info(output)
return output == expected

snmptrapfile = "{}/{}/snmptrapd.log".format(r2.logdir, r2.name)
trap_file = open(snmptrapfile, "w")
trap_file.truncate(0)
trap_file.close()
topotest.sleep(1)
r2.vtysh_cmd("conf\nbgp snmp traps bgp4-mibv2")
r2.vtysh_cmd("conf\nno bgp snmp traps rfc4273")
topotest.sleep(1)
r1.vtysh_cmd("clear bgp *")
_, result = topotest.run_and_expect(_snmptrap_ipv4, True, count=15, wait=2)
assertmsg = "Can't fetch SNMP trap for ipv4"
topotest.sleep(1)
_, result = topotest.run_and_expect(_snmptrap_ipv6, True, count=2, wait=10)
assertmsg = "Can't fetch SNMP trap for ipv6"
assert result, assertmsg


Expand Down

0 comments on commit dd67d45

Please sign in to comment.