X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fnetns%2Fnetnsapplication.py;h=68d64ef93c4de9a8f82c529b9a2cb4da0f9b1d6f;hb=6285ca51026efb69642eea9dfc7c480e722d84a9;hp=b7904166a1193ca43674699294e8ad9cbc28d3b0;hpb=741b99fe027fe6b54846a0703d26510d9b40a135;p=nepi.git diff --git a/src/nepi/resources/netns/netnsapplication.py b/src/nepi/resources/netns/netnsapplication.py index b7904166..68d64ef9 100644 --- a/src/nepi/resources/netns/netnsapplication.py +++ b/src/nepi/resources/netns/netnsapplication.py @@ -3,9 +3,8 @@ # Copyright (C) 2014 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -18,10 +17,8 @@ # Author: Alina Quereilhac from nepi.execution.attribute import Attribute, Flags, Types -from nepi.execution.resource import clsinit_copy from nepi.resources.netns.netnsbase import NetNSBase -from nepi.execution.resource import clsinit_copy, ResourceState, \ - reschedule_delay +from nepi.execution.resource import clsinit_copy, ResourceState import shlex @@ -50,7 +47,7 @@ class NetNSApplication(NetNSBase): if not node: msg = "Route not connected to Node!!" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) return node[0] @@ -59,9 +56,9 @@ class NetNSApplication(NetNSBase): return [self.node] def do_start(self): - if self.simulation.state < ResourceState.STARTED: + if self.emulation.state < ResourceState.STARTED: self.debug("---- RESCHEDULING START ----" ) - self.ec.schedule(reschedule_delay, self.start) + self.ec.schedule(self.reschedule_delay, self.start) else: self._configure_traces() @@ -76,8 +73,8 @@ class NetNSApplication(NetNSBase): self._start_time = self.emulation.start_time def _configure_traces(self): - stdout = "%s/%d.stdout " % (self.emulation.run_home, self.pid) - stderr = "%s/%d.stderr " % (self.emulation.run_home, self.pid) + stdout = "%s/%d.stdout" % (self.emulation.run_home, self.guid) + stderr = "%s/%d.stderr" % (self.emulation.run_home, self.guid) self._trace_filename["stdout"] = stdout self._trace_filename["stderr"] = stderr self._traces["stdout"] = self.emulation.create("open", stdout, "w") @@ -88,8 +85,8 @@ class NetNSApplication(NetNSBase): if self._state == ResourceState.STARTED: retcode = self.emulation.invoke(self.uuid, "poll") - if retcode: - if ret == 0: + if retcode is not None: + if retcode == 0: self.set_stopped() else: out = ""