]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgp_vrf_netns: attempt cleanup of previous test abnormal exit. skip test if setup...
authorLou Berger <lberger@labn.net>
Mon, 12 Mar 2018 21:17:54 +0000 (17:17 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:13 +0000 (20:22 -0500)
Signed-off-by: Lou Berger <lberger@labn.net>
tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py

index 58e0857546bdf4c2ccaf67a1ef2118559b533c83..780a62e2e93f36ad875887c8f6a7580cfa7af6c4 100755 (executable)
@@ -103,13 +103,17 @@ def setup_module(module):
 
     # create VRF r1-cust1
     # move r1-eth0 to VRF r1-cust1
-    cmds = ['ip netns add {0}-cust1',
+    cmds = ['if [ -e /var/run/netns/{0}-cust1 ] ; then ip netns del {0}-cust1 ; fi',
+            'ip netns add {0}-cust1',
             'ip link set dev {0}-eth0 netns {0}-cust1',
             'ip netns exec {0}-cust1 ifconfig {0}-eth0 up']
     for cmd in cmds:
+        cmd = cmd.format('r1')
+        logger.info('cmd: '+cmd);
         output = router.run(cmd.format('r1'))
         if output != None and len(output) > 0:
-            logger.info('unexpected output: cmd="{}" output=\n{}'.format(cmd, output))
+            logger.info('Aborting due to unexpected output: cmd="{}" output=\n{}'.format(cmd, output))
+            return pytest.skip('Skipping BGP VRF NETNS Test. Unexpected output to command: '+cmd)
     #run daemons
     router.load_config(
         TopoRouter.RD_ZEBRA,