# Import topogen and topotest helpers
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.snmptest import SnmpTester
-
+from time import sleep
+from lib.topolog import logger
pytestmark = [pytest.mark.bgpd, pytest.mark.isisd, pytest.mark.snmp]
# For all registered routers, load the zebra configuration file
for rname, router in router_list.items():
router.load_config(
- TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ TopoRouter.RD_ZEBRA,
+ os.path.join(CWD, "{}/zebra.conf".format(rname)),
+ "-M snmp",
)
router.load_config(
- TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname))
+ TopoRouter.RD_ISIS,
+ os.path.join(CWD, "{}/isisd.conf".format(rname)),
+ "-M snmp",
)
router.load_config(
TopoRouter.RD_BGP,
os.path.join(CWD, "{}/bgpd.conf".format(rname)),
"-M snmp",
)
+ router.load_config(
+ TopoRouter.RD_RIP,
+ os.path.join(CWD, "{}/ripd.conf".format(rname)),
+ "-M snmp",
+ )
+ router.load_config(
+ TopoRouter.RD_OSPF,
+ os.path.join(CWD, "{}/ospfd.conf".format(rname)),
+ "-M snmp",
+ )
+ router.load_config(
+ TopoRouter.RD_OSPF6,
+ os.path.join(CWD, "{}/ospf6d.conf".format(rname)),
+ "-M snmp",
+ )
router.load_config(
TopoRouter.RD_SNMP,
os.path.join(CWD, "{}/snmpd.conf".format(rname)),
# After loading the configurations, this function loads configured daemons.
tgen.start_router()
+ # Why this sleep? If you are using zebra w/ snmp we have a chicken
+ # and egg problem with the snmpd. snmpd is being started up with
+ # ip addresses, and as such snmpd may not be ready to listen yet
+ # (see startup stuff in topotest.py ) with the 2 second delay
+ # on starting snmpd after zebra. As such if we want to test
+ # anything in zebra we need to sleep a bit to allow the connection
+ # to happen. I have no good way to test to see if zebra is up
+ # and running with snmp at this point in time. So this will have
+ # to do.
+ sleep(17)
def teardown_module():
assert r1_snmp.test_oid_walk("bgpVersion", ["10"])
assert r1_snmp.test_oid_walk("bgpVersion", ["10"], ["0"])
+ assert r1_snmp.test_oid(
+ "IP-FORWARD-MIB::ipForwardDest.192.168.12.0", "192.168.12.0"
+ )
+
+ assert r1_snmp.test_oid("ISIS-MIB::isisSysVersion", "one(1)")
+ # rip is not auto-loading agentx from mgmtd
+ # assert r1_snmp.test_oid("RIPv2-MIB::rip2GlobalQueries", "0")
+
+ assert r1_snmp.test_oid("OSPF-MIB::ospfVersionNumber", "version2(2)")
+ assert r1_snmp.test_oid("OSPFV3-MIB::ospfv3VersionNumber", "version3(3)")
+
+ # Let's just dump everything and make sure we get some additional test
+ # coverage
+ logger.info("Let's walk everything")
+ logger.info(r1_snmp.walk(".1", raw=True))
+
def test_memory_leak():
"Run the memory leak test and report results."