return c
- def generate_conversations(self, scale, duration, replay_speed=1,
- server=1, client=2):
- """Generate a list of conversations from the model."""
+ def generate_conversation_sequences(self, scale, duration, replay_speed=1):
+ """Generate a list of conversation descriptions from the model."""
# We run the simulation for ten times as long as our desired
# duration, and take the section at the end.
% (n_packets, target_packets, len(conversations), scale)),
file=sys.stderr)
conversations.sort() # sorts by first element == start time
- return seq_to_conversations(conversations)
+ return conversations
def seq_to_conversations(seq, server=1, client=2):
for i, opts in enumerate((["--random-seed=3"],
["--random-seed=4"],
- ["--random-seed=3",
- "--conversation-persistence=0.5"],
- ["--random-seed=3",
- "--old-scale",
- "--conversation-persistence=0.95"],
)):
with temp_file(self.tempdir) as output:
command = ([SCRIPT, MODEL,
logger.info(("Using the specified model file to "
"generate conversations"))
- conversations = model.generate_conversations(opts.scale_traffic,
- opts.duration,
- opts.replay_rate)
+ conversations = model.generate_conversation_sequences(opts.scale_traffic,
+ opts.duration,
+ opts.replay_rate)
except ValueError:
logger.error(("Could not parse %s, which does not seem to be "
"a model generated by script/traffic_learner."
conversations = []
if debuglevel > 5:
- for c in conversations:
+ for c in traffic.seq_to_conversations(conversations):
for p in c.packets:
print(" ", p, file=sys.stderr)
logger.info("Writing traffic summary")
summaries = []
- for c in conversations:
+ for c in traffic.seq_to_conversations(conversations):
summaries += c.replay_as_summary_lines()
summaries.sort()
exit(0)
- traffic.replay(conversations, host,
+ traffic.replay(traffic.seq_to_conversations(conversations),
+ host,
lp=lp,
creds=creds,
accounts=accounts,