netns_provider = FactoriesProvider(testbed_id, testbed_version)
netns_desc1 = exp_desc.add_testbed_description(netns_provider)
netns_desc1.set_attribute_value("homeDirectory", self.root_dir)
- #netns_desc1.set_attribute_value("enableDebug", True
+ #netns_desc1.set_attribute_value("enableDebug", True)
# create node 3
node3 = netns_desc1.create("Node")
node3.set_attribute_value("forward_X11", True)
# create vlc server
# DEBUG!! target = "{#[vlc_client].addr[0].[Address]#}"
target = "10.0.2.2"
- command = "vlc -I dummy -vvv %s --sout '#rtp{dst=%s,port=5004,mux=ts}' vlc://quit" \
+ command = "vlc -I dummy %s --sout '#rtp{dst=%s,port=5004,mux=ts}' vlc://quit" \
% (self.movie, target)
vlc_server = netns_desc1.create("Application")
vlc_server.set_attribute_value("command", command)
xml = exp_desc.to_xml()
controller = ExperimentController(xml, self.root_dir)
controller.start()
- while not controller.is_finished(vlc_server.guid):
+ while not controller.is_finished(vlc_server.guid) and \
+ not controller.is_finished(vlc_client.guid):
time.sleep(0.5)
controller.stop()
controller.shutdown()
def shutdown(self):
for trace in self._traces.values():
trace.close()
- for element in self._elements.values():
+ for guid, element in self._elements.iteritems():
if isinstance(element, self.TunChannel):
element.Cleanup()
else:
- element.destroy()
+ factory_id = self._create[guid]
+ if factory_id == "Node":
+ element.destroy()
+ self._elements.clear()
def trace_filename(self, guid, trace_id):
# TODO: Need to be defined inside a home!!!! with and experiment id_code
pass
chan.with_pi = with_pi
-
### Creation functions ###
def create_node(testbed_instance, guid):
(destination, netprefix, nexthop) = route
element.add_route(prefix = destination, prefix_len = netprefix,
nexthop = nexthop)
-
### Factory information ###
self._condition = threading.Condition()
self._simulator_thread = threading.Thread(target = self._simulator_run,
args = [self._condition])
- self._simulator_thread.isDaemon()
+ self._simulator_thread.setDaemon(True)
self._simulator_thread.start()
def stop(self, time = TIME_NOW):
super(TestbedController, self).stop(time)
- # BUG!!!!
- # TODO!! This is not working!!!
+ # BUG!!!! RealtimeSimulatorImpl never stops simulation with Stop()!!!
self.ns3.Simulator.Stop()
#self._stop_simulation(time)
self._elements.clear()
if self.ns3:
self.ns3.Simulator.Stop()
- # BUG!!!!
- # TODO!! This is not working!!! NEVER STOPS THE SIMULATION!!!
- #self._stop_simulation("0s")
- #if self._simulator_thread:
+ ##################################################
+ # BUG!!!! RealtimeSimulatorImpl never stops simulation with Stop()!!!
+ # self._stop_simulation("0s")
+ # if self._simulator_thread:
# print "Joining thread"
# self._simulator_thread.join()
- #print "destroying"
+ #################################################
self.ns3.Simulator.Destroy()
self._ns3 = None
sys.stdout.flush()