Merging with head
[nepi.git] / test / testbeds / planetlab / integration_ns3.py
index 3e8a4c2..2260127 100755 (executable)
@@ -99,7 +99,7 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
     
     def make_ns_in_pl(self, pl, exp, node1, iface1, root):
         ns3_testbed_id = "ns3"
-        ns3_testbed_version = "3_9_RC3"
+        ns3_testbed_version = "3_9"
         
         # Add NS3 support in node1
         plnepi = pl.create("NepiDependency")
@@ -134,9 +134,9 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
         "Test requires PlanetLab authentication info (PL_USER and PL_PASS environment variables)")
     @test_util.skipUnless(os.environ.get('NEPI_FULL_TESTS','').lower() in ('1','yes','true','on'),
         "Test is expensive, requires NEPI_FULL_TESTS=yes")
-    def _test_ns3_in_pl(self):
+    def test_ns3_in_pl(self):
         ns3_testbed_id = "ns3"
-        ns3_testbed_version = "3_9_RC3"
+        ns3_testbed_version = "3_9"
         
         pl, exp = self.make_experiment_desc()
         
@@ -154,17 +154,19 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
 
         xml = exp.to_xml()
 
-        controller = ExperimentController(xml, self.root_dir)
-        controller.start()
-        # just test that it starts...
-        controller.stop()
-        controller.shutdown()
+        try:
+            controller = ExperimentController(xml, self.root_dir)
+            controller.start()
+            # just test that it starts...
+        finally:
+            controller.stop()
+            controller.shutdown()
 
     @test_util.skipUnless(test_util.pl_auth() is not None, 
         "Test requires PlanetLab authentication info (PL_USER and PL_PASS environment variables)")
     @test_util.skipUnless(os.environ.get('NEPI_FULL_TESTS','').lower() in ('1','yes','true','on'),
         "Test is expensive, requires NEPI_FULL_TESTS=yes")
-    def _test_ns3_in_pl_crossconnect(self):
+    def test_ns3_in_pl_crossconnect(self):
         pl, exp = self.make_experiment_desc()
         
         # Create PL node, ifaces, assign addresses
@@ -207,17 +209,19 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
 
         xml = exp.to_xml()
 
-        controller = ExperimentController(xml, self.root_dir)
-        controller.start()
+        try:
+            controller = ExperimentController(xml, self.root_dir)
+            controller.start()
 
-        while not controller.is_finished(ping.guid):
-            time.sleep(0.5)
-          
-        ping_result = controller.trace(pl.guid, ping.guid, "stdout")
-        tap_trace = controller.trace(pl.guid, tap1.guid, "packets")
+            while not controller.is_finished(ping.guid):
+                time.sleep(0.5)
+              
+            ping_result = controller.trace(ping.guid, "stdout")
+            tap_trace = controller.trace(tap1.guid, "packets")
 
-        controller.stop()
-        controller.shutdown()
+        finally:
+            controller.stop()
+            controller.shutdown()
 
         # asserts at the end, to make sure there's proper cleanup
         self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),
@@ -229,7 +233,7 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
         "Test requires PlanetLab authentication info (PL_USER and PL_PASS environment variables)")
     @test_util.skipUnless(os.environ.get('NEPI_FULL_TESTS','').lower() in ('1','yes','true','on'),
         "Test is expensive, requires NEPI_FULL_TESTS=yes")
-    def _test_ns3_in_pl_snat(self):
+    def test_ns3_in_pl_snat(self):
         pl, exp = self.make_experiment_desc()
         
         # Create PL node, ifaces, assign addresses
@@ -284,16 +288,18 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
 
         xml = exp.to_xml()
 
-        controller = ExperimentController(xml, self.root_dir)
-        controller.start()
+        try:
+            controller = ExperimentController(xml, self.root_dir)
+            controller.start()
 
-        while not controller.is_finished(ping.guid):
-            time.sleep(0.5)
-          
-        tap_trace = controller.trace(pl.guid, tap1.guid, "packets")
+            while not controller.is_finished(ping.guid):
+                time.sleep(0.5)
+              
+            tap_trace = controller.trace(tap1.guid, "packets")
 
-        controller.stop()
-        controller.shutdown()
+        finally:
+            controller.stop()
+            controller.shutdown()
         
         # asserts at the end, to make sure there's proper cleanup
         sent = 0
@@ -397,9 +403,9 @@ class PlanetLabCrossIntegrationTestCase(unittest.TestCase):
             tap_trace = []
             for i,tap in enumerate([ tap0, tap1, tap2, tap3, tap4 ]):
                 tap_trace.append("\nTrace for tap%d:\n" % i)
-                tap_trace.append(controller.trace(pl.guid, tap.guid, "packets"))
+                tap_trace.append(controller.trace(tap.guid, "packets"))
             tap_trace = "".join(tap_trace)
-            tap0_trace = controller.trace(pl.guid, tap0.guid, "packets")
+            tap0_trace = controller.trace(tap0.guid, "packets")
 
         finally:
             controller.stop()