X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Flinux%2Fns3%2Fns3simulation.py;h=51da3a295225662b36a6b807d32498f821e5f8a1;hb=d50ba1a08e541ded7a8b322493ebb1d0cc59c6ff;hp=dae024f39c981b497bf2acde90e0efcf0d8d7379;hpb=a4338a678b157a98f4c8e068d1126fa3b515ae1b;p=nepi.git diff --git a/src/nepi/resources/linux/ns3/ns3simulation.py b/src/nepi/resources/linux/ns3/ns3simulation.py index dae024f3..51da3a29 100644 --- a/src/nepi/resources/linux/ns3/ns3simulation.py +++ b/src/nepi/resources/linux/ns3/ns3simulation.py @@ -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):