Changing ResourceManager naming for platform::ResourceName
[nepi.git] / src / nepi / resources / linux / ns3 / ns3simulation.py
index dae024f..51da3a2 100644 (file)
@@ -20,7 +20,7 @@
 from nepi.execution.attribute import Attribute, Flags, Types
 from nepi.execution.trace import Trace, TraceAttr
 from nepi.execution.resource import ResourceManager, clsinit_copy, \
-        ResourceState, ResourceFactory, reschedule_delay
+        ResourceState, ResourceFactory
 from nepi.resources.linux.application import LinuxApplication
 from nepi.util.timefuncs import tnow, tdiffsec
 from nepi.resources.ns3.ns3simulation import NS3Simulation
@@ -37,7 +37,7 @@ import threading
 
 @clsinit_copy
 class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
-    _rtype = "LinuxNS3Simulation"
+    _rtype = "linux::ns3::Simulation"
 
     @classmethod
     def _register_attributes(cls):
@@ -104,8 +104,8 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
 
         dce_version = Attribute("dceVersion",
             "Version of dce to install from nsam repo (tag branch for repo)",
-            default = "dce-1.3", 
-            #default = "dce-dev", 
+            #default = "dce-1.3", 
+            default = "dce-dev", 
             flags = Flags.Design)
 
         populate_routing_tables = Attribute("populateRoutingTables",
@@ -114,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)
 
@@ -138,8 +138,6 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
         self._client = None
         self._home = "ns3-simu-%s" % self.guid
         self._socket_name = "ns3-%s.sock" % os.urandom(4).encode('hex')
-        self._dce_manager_helper_uuid = None
-        self._dce_application_helper_uuid = None
         self._enable_dce = None
 
     @property
@@ -257,7 +255,7 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
             self.debug("---- RESCHEDULING DEPLOY ---- node state %s " % self.node.state )
             
             # ccnd needs to wait until node is deployed and running
-            self.ec.schedule(reschedule_delay, self.deploy)
+            self.ec.schedule(self.reschedule_delay, self.deploy)
         else:
             if not self.get("command"):
                 self.set("command", self._start_command)
@@ -306,6 +304,10 @@ class LinuxNS3Simulation(LinuxApplication, NS3Simulation):
             if self.get("populateRoutingTables") == True:
                 self.invoke(IPV4_GLOBAL_ROUTING_HELPER_UUID, "PopulateRoutingTables")
 
+            time = self.get("StopTime")
+            if time:
+                self._client.stop(time=time) 
+
             self._client.start()
 
             self.set_started()
@@ -319,11 +321,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):