"git@developer.sourcefind.cn:gaoqiong/composable_kernel.git" did not exist on "72d9bd744093e5ab8be77eb3594758d5bdd16c54"
Commit d77ff487 authored by Jialin Li's avatar Jialin Li
Browse files

experiments: allow sleep after a host is instantiated; add ns3 sequencer network

parent ce47eac6
...@@ -104,6 +104,9 @@ class Experiment(object): ...@@ -104,6 +104,9 @@ class Experiment(object):
if host.wait: if host.wait:
wait_hosts.append(sc) wait_hosts.append(sc)
if host.sleep > 0:
await asyncio.sleep(host.sleep)
if verbose: if verbose:
print('%s: waiting for hosts to terminate' % self.name) print('%s: waiting for hosts to terminate' % self.name)
for sc in wait_hosts: for sc in wait_hosts:
......
...@@ -18,6 +18,7 @@ class HostSim(Simulator): ...@@ -18,6 +18,7 @@ class HostSim(Simulator):
disk_image = 'base' disk_image = 'base'
name = '' name = ''
wait = False wait = False
sleep = 0
def __init__(self): def __init__(self):
self.nics = [] self.nics = []
...@@ -189,6 +190,22 @@ class NS3DumbbellNet(NetSim): ...@@ -189,6 +190,22 @@ class NS3DumbbellNet(NetSim):
return cmd return cmd
class NS3SequencerNet(NetSim):
def run_cmd(self, env):
ports = ''
for n in self.nics:
if 'client' in n.name:
ports += '--ClientPort=' + env.nic_eth_path(n) + ' '
elif 'replica' in n.name:
ports += '--ServerPort=' + env.nic_eth_path(n) + ' '
elif 'sequencer' in n.name:
ports += '--EndhostSequencerPort=' + env.nic_eth_path(n) + ' '
else:
raise Exception('Wrong NIC type')
cmd = env.repodir + '/ns-3' + '/cosim-run.sh sequencer sequencer-single-switch-example ' + ports + ' ' + self.opt
return cmd
def create_basic_hosts(e, num, name_prefix, net, nic_class, host_class, def create_basic_hosts(e, num, name_prefix, net, nic_class, host_class,
nc_class, app_class, ip_start=1): nc_class, app_class, ip_start=1):
hosts = [] hosts = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment