Trying to make LinuxNS3Simulator to deploy remotely ....
[nepi.git] / test / resources / linux / ns3 / ns3simulation.py
similarity index 81%
rename from test/resources/linux/ns3/ns3simulator.py
rename to test/resources/linux/ns3/ns3simulation.py
index a4a97e0..cf08f0e 100644 (file)
 
 
 from nepi.execution.ec import ExperimentController 
-from nepi.resources.ns3.ns3server import run_server
 
 import os
-import threading
 import time
 import unittest
 
 class LinuxNS3ClientTest(unittest.TestCase):
-    def setUp(self):
-        self.socket_name = os.path.join("/", "tmp", "NS3WrapperServerSimu.sock")
-        if os.path.exists(self.socket_name):
-            os.remove(self.socket_name) 
-
-    def tearDown(self):
-        os.remove(self.socket_name) 
-
     def test_runtime_attr_modify(self):
-        thread = threading.Thread(target = run_server,
-                args = [self.socket_name], 
-                kwargs = {"verbose" : True,
-                    "ns_log": "V4Ping:Node"})
-
-        thread.setDaemon(True)
-        thread.start()
-
-        time.sleep(1)
+        ssh_key = "%s/.ssh/id_rsa_planetlab" % (os.environ['HOME'])
 
         ec = ExperimentController(exp_id = "test-ns3-simu")
         
         node = ec.register_resource("LinuxNode")
-        ec.set(node, "hostname", "localhost")
-
-        simu = ec.register_resource("LinuxNS3Simulator")
-        ec.set(simu, "socketName", self.socket_name)
+        #ec.set(node, "hostname", "roseval.pl.sophia.inria.fr")
+        #ec.set(node, "username", "alina")
+        ec.set(node, "hostname", "peeramide.irisa.fr")
+        #ec.set(node, "hostname", "planetlab2.upc.es")
+        ec.set(node, "username", "inria_alina")
+        ec.set(node, "identity", ssh_key)
+        ec.set(node, "cleanProcesses", True)
+
+        simu = ec.register_resource("LinuxNS3Simulation")
+        ec.set(simu, "verbose", True)
         ec.register_connection(simu, node)
 
         nsnode1 = ec.register_resource("ns3::Node")
@@ -121,10 +109,11 @@ class LinuxNS3ClientTest(unittest.TestCase):
 
         ec.deploy()
 
-        time.sleep(30)
+        #time.sleep(60)
+        ec.wait_started([ping])
+        #ec.wait_finised([ping])
 
         ec.shutdown()
 
 if __name__ == '__main__':
     unittest.main()