Fixing nasty ugly bug in DCE ccndc RM. Fix: Adding missing HOME environment set to...
[nepi.git] / src / nepi / resources / linux / ns3 / ns3simulation.py
index 28a4e10..63d8d37 100644 (file)
@@ -92,14 +92,12 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
 
         ns3_version = Attribute("ns3Version",
             "Version of ns-3 to install from nsam repo",
-            #default = "ns-3.19", 
             default = "ns-3.20", 
             #default = "ns-3-dev", 
             flags = Flags.Design)
 
         pybindgen_version = Attribute("pybindgenVersion",
             "Version of pybindgen to install from bazar repo",
-            #default = "864", 
             default = "868", 
             #default = "876", 
             flags = Flags.Design)
@@ -116,7 +114,7 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
             type = Types.Bool,
             flags = Flags.Design)
 
-        stoptime = Attribute("stopTime",
+        stoptime = Attribute("StopTime",
             "Time at which the simulation will stop",
             flags = Flags.Design)
 
@@ -308,26 +306,11 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
             if self.get("populateRoutingTables") == True:
                 self.invoke(IPV4_GLOBAL_ROUTING_HELPER_UUID, "PopulateRoutingTables")
 
-            self._client.start()
+            time = self.get("StopTime")
+            if time:
+                self._client.stop(time=time) 
 
-            """
-            XXX: Is this necessary??
-            # Wait until the Simulation is actually started before setting the state
-            is_running = False
-            for i in xrange(200):
-                is_running = self.invoke(SIMULATOR_UUID, "isRunning")
-                is_finished = self.invoke(SIMULATOR_UUID, "isFinished")
-            
-                if is_running or is_finished:
-                    break
-                else:
-                    time.sleep(1)
-            else:
-                if not is_running:
-                    msg = " Simulation did not start"
-                    self.error(msg)
-                    raise RuntimeError
-            """
+            self._client.start()
 
             self.set_started()
         else:
@@ -340,11 +323,8 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
 
         """
         if self.state == ResourceState.STARTED:
-            time = None
-            if self.get("stopTime"):
-                time = self.get("stopTime")
-
-            self._client.stop(time=time) 
+            if not self.get("StopTime"):
+                self._client.stop() 
             self.set_stopped()
 
     def do_release(self):