s/dedicatedSlice/cleanProc/g
[nepi.git] / test / testbeds / planetlab / integration_cross.py
index 978745c..30143d0 100755 (executable)
@@ -7,16 +7,15 @@ from nepi.core.execute import ExperimentController
 from nepi.util import proxy
 from nepi.util.constants import DeploymentConfiguration as DC, ATTR_NEPI_TESTBED_ENVIRONMENT_SETUP
 import os
+import re
 import shutil
 import tempfile
 import test_util
 import time
 import unittest
-import re
 
 class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
     testbed_id = "planetlab"
-    testbed_version = "01"
     
     slicename1 = "inria_nepi"
     plchost1 = "nepiplc.pl.sophia.inria.fr"
@@ -27,11 +26,14 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
     host1pl1 = "nepi1.pl.sophia.inria.fr"
     host2pl1 = "nepi2.pl.sophia.inria.fr"
 
-    host1pl2 = "onelab11.pl.sophia.inria.fr"
-    host2pl2 = "onelab10.pl.sophia.inria.fr"
+    host1pl2 = "planetlab1.utt.fr"
+    host2pl2 = "planetlab2.utt.fr"
 
+    port_base = 2000 + (os.getpid() % 1000) * 13
+    
     def setUp(self):
         self.root_dir = tempfile.mkdtemp()
+        self.__class__.port_base = self.port_base + 100
 
     def tearDown(self):
         try:
@@ -43,7 +45,6 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
 
     def make_experiment_desc(self):
         testbed_id = self.testbed_id
-        testbed_version = self.testbed_version
         
         slicename1 = self.slicename1
         plchost1 = self.plchost1
@@ -57,7 +58,7 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         pl_user, pl_pwd = test_util.pl_auth()
 
         exp_desc = ExperimentDescription()
-        pl_provider = FactoriesProvider(testbed_id, testbed_version)
+        pl_provider = FactoriesProvider(testbed_id)
         pl_desc = exp_desc.add_testbed_description(pl_provider)
         pl_desc.set_attribute_value("homeDirectory", self.root_dir)
         pl_desc.set_attribute_value("slice", slicename1)
@@ -65,6 +66,9 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         pl_desc.set_attribute_value("authUser", pl_user)
         pl_desc.set_attribute_value("authPass", pl_pwd)
         pl_desc.set_attribute_value("plcHost", plchost1)
+        pl_desc.set_attribute_value("tapPortBase", self.port_base)
+        pl_desc.set_attribute_value("p2pDeployment", False) # it's interactive, we don't want it in tests
+        pl_desc.set_attribute_value("cleanProc", True)
 
         pl_desc2 = exp_desc.add_testbed_description(pl_provider)
         pl_desc2.set_attribute_value("homeDirectory", self.root_dir+"v2")
@@ -73,6 +77,9 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         pl_desc2.set_attribute_value("authUser", pl_user)
         pl_desc2.set_attribute_value("authPass", pl_pwd)
         pl_desc2.set_attribute_value("plcHost", plchost2)
+        pl_desc2.set_attribute_value("tapPortBase", self.port_base+500)
+        pl_desc2.set_attribute_value("p2pDeployment", False) # it's interactive, we don't want it in tests
+        pl_desc2.set_attribute_value("cleanProc", True)
         
         return pl_desc, pl_desc2, exp_desc
     
@@ -80,7 +87,6 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         node1 = pl.create("Node")
         node1.set_attribute_value("hostname", hostname)
         node1.set_attribute_value("label", label_prefix)
-        node1.set_attribute_value("emulation", True) # require emulation
         iface1 = pl.create("NodeInterface")
         iface1.set_attribute_value("label", label_prefix+"iface")
         if tapip:
@@ -105,7 +111,6 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
 
     def make_ns_in_pl(self, pl, exp, node1, iface1, root):
         ns3_testbed_id = "ns3"
-        ns3_testbed_version = "3_9"
         
         # Add NS3 support in node1
         plnepi = pl.create("NepiDependency")
@@ -114,7 +119,7 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         plns3.connector("node").connect(node1.connector("deps"))
 
         # Create NS3 testbed running in node1
-        ns3_provider = FactoriesProvider(ns3_testbed_id, ns3_testbed_version)
+        ns3_provider = FactoriesProvider(ns3_testbed_id)
         ns3_desc = exp.add_testbed_description(ns3_provider)
         ns3_desc.set_attribute_value("rootDirectory", root)
         ns3_desc.set_attribute_value("SimulatorImplementationType", "ns3::RealtimeSimulatorImpl")
@@ -156,8 +161,8 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
         ns1.connector("protos").connect(ipv41.connector("node"))
         ns1.connector("protos").connect(arp1.connector("node"))
         ns1.connector("protos").connect(icmp1.connector("node"))
-        ns1if = ns3.create("ns3::FileDescriptorNetDevice")
-        ns1if.enable_trace("FileDescriptorPcapTrace")
+        ns1if = ns3.create("ns3::FdNetDevice")
+        ns1if.enable_trace("FdPcapTrace")
         ns1if.set_attribute_value("label", "ns1if")
         ns1tc = ns3.create("ns3::Nepi::TunChannel")
         ns1.connector("devs").connect(ns1if.connector("node"))
@@ -196,8 +201,16 @@ class PlanetLabMultiIntegrationTestCase(unittest.TestCase):
             ping_result = controller.trace(ping.guid, "stdout")
             tap2_trace = controller.trace(tap2.guid, "packets")
         finally:
-            controller.stop()
-            controller.shutdown()
+            try:
+                controller.stop()
+            except:
+                import traceback
+                traceback.print_exc()
+            try:
+                controller.shutdown()
+            except:
+                import traceback
+                traceback.print_exc()
 
         # asserts at the end, to make sure there's proper cleanup
         self.assertTrue(re.match(comp_result, ping_result, re.MULTILINE),