Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
d77ff487
Commit
d77ff487
authored
Nov 11, 2020
by
Jialin Li
Browse files
experiments: allow sleep after a host is instantiated; add ns3 sequencer network
parent
ce47eac6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
experiments/modes/experiments.py
experiments/modes/experiments.py
+3
-0
experiments/modes/simulators.py
experiments/modes/simulators.py
+17
-0
No files found.
experiments/modes/experiments.py
View file @
d77ff487
...
@@ -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
:
...
...
experiments/modes/simulators.py
View file @
d77ff487
...
@@ -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
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment