]> git.puffer.fish Git - mirror/frr.git/commitdiff
test: add snmp skip test 7909/head
authorPat Ruddy <pat@voltanet.io>
Fri, 22 Jan 2021 10:11:22 +0000 (10:11 +0000)
committerPat Ruddy <pat@voltanet.io>
Fri, 22 Jan 2021 10:12:47 +0000 (10:12 +0000)
Since SNMP is a pain to install add a check which will be used
in all SNMP tests in future to silently skip SNMP tests if SNMP
has not been installed on the base system.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
tests/topotests/simple-snmp-test/test_simple_snmp.py

index 2b609ef14c54dd07f34cbc335452a88aeec81153..3dcbfe44a03434ea08e441c638e86ad152d9ef49 100755 (executable)
@@ -76,6 +76,11 @@ class TemplateTopo(Topo):
 
 def setup_module(mod):
     "Sets up the pytest environment"
+
+    # skip tests is SNMP not installed
+    if not os.path.isfile("/usr/sbin/snmpd"):
+        error_msg = "SNMP not installed - skipping"
+        pytest.skip(error_msg)
     # This function initiates the topology build with Topogen...
     tgen = Topogen(TemplateTopo, mod.__name__)
     # ... and here it calls Mininet initialization functions.
@@ -120,7 +125,7 @@ def test_r1_bgp_version():
     "Wait for protocol convergence"
     tgen = get_topogen()
 
-    #tgen.mininet_cli()
+    # tgen.mininet_cli()
     r1 = tgen.net.get("r1")
     r1_snmp = SnmpTester(r1, "1.1.1.1", "public", "2c")
     assert r1_snmp.test_oid("bgpVersin", None)