import time
import logging
-ATTRIBUTE_PATTERN_BASE = re.compile(r"\{#\[(?P<label>[-a-zA-Z0-9._]*)\](?P<expr>(?P<component>\.addr\[[0-9]+\]|\.route\[[0-9]+\]|\.trace\[[0-9]+\])?.\[(?P<attribute>[-a-zA-Z0-9._]*)\])#}")
+ATTRIBUTE_PATTERN_BASE = re.compile(r"\{#\[(?P<label>[-a-zA-Z0-9._]*)\](?P<expr>(?P<component>\.addr\[[0-9]+\]|\.route\[[0-9]+\]|\.trace\[[-a-zA-Z0-9._]+\])?.\[(?P<attribute>[-a-zA-Z0-9._]*)\])#}")
ATTRIBUTE_PATTERN_GUID_SUB = r"{#[%(guid)s]%(expr)s#}"
COMPONENT_PATTERN = re.compile(r"(?P<kind>[a-z]*)\[(?P<index>.*)\]")
testbed.get_route(guid, int(index), name),
'trace' :
lambda testbed, guid, index, name:
- testbed.trace(guid, index, name),
+ testbed.trace(guid, index, attribute = name),
'' :
lambda testbed, guid, index, name:
testbed.get(guid, name),
elem_cross_data[attr_name] = _undefer(attr_value)
return cross_data
-
+
+ """
+class ExperimentSuite(object):
+ def __init__(self, experiment_xml, access_config, nexp,
+ duration, wait_guids):
+ self._experiment_xml = experiment_xml
+ self._access_config = access_config
+ self._experiments = dict()
+ self._nexp = nexp
+ self._duration = duration
+ self._wait_guids = wait_guids
+ self._curr = None
+
+
+ def _run_one_exp(self):
+ access_config = proxy.AccessConfiguration()
+ controller = proxy.create_experiment_controller(self._experiment_xml,
+ access_config)
+ self._experiments[self._curr] = controller
+ controller.start()
+ started_at = time.time()
+ if self._wait_guids:
+ while not controller.is_finished(92) and \
+ not controller.is_finished(108) and \
+ not controller.is_finished(126) and \
+ not controller.is_finished(84):
+ time.sleep(0.5)
+ # add results to instructions
+ controller.stop()
+ #download results!!
+ controller.shutdown()
+ """
+
+
+
+
+
+
+
+
fd.close()
elif attribute == 'path':
content = self.trace_filepath(guid, trace_id)
+ elif attribute == 'filename':
+ content = self.trace_filename(guid, trace_id)
else:
content = None
return content
"""
raise NotImplementedError
+ def trace_filename(self, guid, trace_id):
+ """
+ Return a trace's file name, for TestbedController's default
+ implementation of trace()
+ """
+ raise NotImplementedError
+
#shutdown: NotImplementedError
def get_connected(self, guid, connector_type_name,
(trace, filename) = self._traces[guid][trace_id]
return os.path.join(self.home_directory, filename)
+ def trace_filename(self, guid, trace_id):
+ (trace, filename) = self._traces[guid][trace_id]
+ return filename
+
+
def follow_trace(self, guid, trace_id, trace, filename):
if not guid in self._traces:
self._traces[guid] = dict()
filename = self._traces[guid][trace_id]
return os.path.join(self.home_directory, filename)
+ def trace_filename(self, guid, trace_id):
+ return self._traces[guid][trace_id]
+
def follow_trace(self, guid, trace_id, filename):
if not guid in self._traces:
self._traces[guid] = dict()
tracefile = None
return tracefile
-
+
+ def remote_trace_name(self, whichtrace):
+ if whichtrace in self.TRACES:
+ return whichtrace
+ return None
+
def sync_trace(self, local_dir, whichtrace):
tracefile = self.remote_trace_path(whichtrace)
if not tracefile:
It adds the output of that command as traces.
"""
- TRACES = ('stdout','stderr','buildlog')
+ TRACES = ('stdout','stderr','buildlog', 'output')
def __init__(self, api=None):
super(Application,self).__init__(api)
self.stdin = None
self.stdout = None
self.stderr = None
+ self.output = None
# Those are filled when the app is started
# Having both pid and ppid makes it harder
content = None
elif attribute == 'path':
content = app.remote_trace_path(trace_id)
+ elif attribute == 'name':
+ content = app.remote_trace_name(trace_id)
else:
content = None
return content
app.stdout = "stdout" in traces
app.stderr = "stderr" in traces
app.buildlog = "buildlog" in traces
+ app.outout = "output" in traces
app.start()
"name": "pcap",
"help": "PCAP trace of all packets going through the interface",
}),
+ "output": dict({
+ "name": "output",
+ "help": "Extra output trace for applications. When activated this trace can be referenced with wildcard a reference from an Application command line. Ex: command: 'tcpdump -w {#[elemet-label].trace[trace-id].[name|path]#}' ",
+ }),
})
create_order = [ INTERNET, NODE, NODEIFACE, TUNFILTER, TAPIFACE, TUNIFACE, NETPIPE, NEPIDEPENDENCY, NS3DEPENDENCY, DEPENDENCY, APPLICATION ]
"depends", "build-depends", "build", "install",
"sources", "rpm-fusion" ],
"connector_types": ["node"],
- "traces": ["stdout", "stderr", "buildlog"],
+ "traces": ["stdout", "stderr", "buildlog", "output"],
"tags": [tags.APPLICATION],
}),
DEPENDENCY: dict({