- if command:
- # We want to make sure the FIB entries are created
- # before the experiment starts.
- # Run the command as a bash script in the background,
- # in the host ( but wait until the command has
- # finished to continue )
- env = env and self.replace_paths(env)
- command = self.replace_paths(command)
-
- (out, err), proc = self.execute_command(command, env)
-
- if proc.poll():
- self._state = ResourceState.FAILED
- msg = "Failed to execute command"
- self.error(msg, out, err)
- raise RuntimeError, msg
-
- def start(self):
- if self._state in [ResourceState.READY, ResourceState.STARTED]:
+ # We want to make sure the FIB entries are created
+ # before the experiment starts.
+ # Run the command as a bash script in the background,
+ # in the host ( but wait until the command has
+ # finished to continue )
+ env = env and self.replace_paths(env)
+ command = self.replace_paths(command)
+
+ # ccndc seems to return exitcode OK even if a (dns) error
+ # occurred, so we need to account for this case here.
+ (out, err), proc = self.execute_command(command,
+ env, blocking = True)
+
+ if proc.poll():
+ msg = "Failed to execute command"
+ self.error(msg, out, err)
+ raise RuntimeError(msg)
+
+ def configure(self):
+ if self.trace_enabled("ping") and not self.ping:
+ self.info("Configuring PING trace")
+ ping = self.ec.register_resource("linux::Ping")
+ self.ec.set(ping, "printTimestamp", True)
+ self.ec.set(ping, "target", self.get("host"))
+ self.ec.set(ping, "earlyStart", True)
+ self.ec.register_connection(ping, self.node.guid)
+ self.ec.register_connection(ping, self.guid)
+ # schedule ping deploy
+ self.ec.deploy(guids=[ping], group = self.deployment_group)
+
+ if self.trace_enabled("traceroute") and not self.traceroute:
+ self.info("Configuring TRACEROUTE trace")
+ traceroute = self.ec.register_resource("linux::Traceroute")
+ self.ec.set(traceroute, "printTimestamp", True)
+ self.ec.set(traceroute, "continuous", True)
+ self.ec.set(traceroute, "target", self.get("host"))
+ self.ec.set(traceroute, "earlyStart", True)
+ self.ec.register_connection(traceroute, self.node.guid)
+ self.ec.register_connection(traceroute, self.guid)
+ # schedule mtr deploy
+ self.ec.deploy(guids=[traceroute], group = self.deployment_group)
+
+ def do_start(self):
+ if self.state == ResourceState.READY: