Sometimes when controller process cleanup happens concurrently with testbed teardown...
[nepi.git] / test / testbeds / ns3 / execute.py
index 40ed1dd..be7a432 100755 (executable)
@@ -18,7 +18,7 @@ class Ns3ExecuteTestCase(unittest.TestCase):
            "Test requires working ns-3 bindings")
     def test_run_ping_if(self):
         testbed_version = "3_9_RC3"
-        instance = ns3.TestbedInstance(testbed_version)
+        instance = ns3.TestbedController(testbed_version)
         instance.defer_configure("homeDirectory", self.root_dir)
         instance.defer_create(2, "ns3::Node")
         instance.defer_create(3, "ns3::Ipv4L3Protocol")
@@ -64,7 +64,9 @@ class Ns3ExecuteTestCase(unittest.TestCase):
 
         instance.do_setup()
         instance.do_create()
-        instance.do_connect()
+        instance.do_connect_init()
+        instance.do_connect_compl()
+        instance.do_preconfigure()
         instance.do_configure()
         instance.start()
         while instance.status(17) != STATUS_FINISHED:
@@ -76,7 +78,12 @@ class Ns3ExecuteTestCase(unittest.TestCase):
         instance.shutdown()
 
     def tearDown(self):
-        shutil.rmtree(self.root_dir)
+        try:
+            shutil.rmtree(self.root_dir)
+        except:
+            # retry
+            time.sleep(0.1)
+            shutil.rmtree(self.root_dir)
 
 if __name__ == '__main__':
     unittest.main()