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
e41360ad
Commit
e41360ad
authored
Nov 10, 2020
by
Hejing Li
Browse files
simulators.py: add ns-3 dumbbell class
parent
150d860f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
experiments/modes/simulators.py
experiments/modes/simulators.py
+17
-0
No files found.
experiments/modes/simulators.py
View file @
e41360ad
...
@@ -50,6 +50,7 @@ class NICSim(Simulator):
...
@@ -50,6 +50,7 @@ class NICSim(Simulator):
class
NetSim
(
Simulator
):
class
NetSim
(
Simulator
):
name
=
''
name
=
''
opt
=
''
def
__init__
(
self
):
def
__init__
(
self
):
self
.
nics
=
[]
self
.
nics
=
[]
...
@@ -173,11 +174,27 @@ class SwitchNet(NetSim):
...
@@ -173,11 +174,27 @@ class SwitchNet(NetSim):
return
cmd
return
cmd
class
NS3DumbbellNet
(
NetSim
):
def
run_cmd
(
self
,
env
):
ports
=
''
for
n
in
self
.
nics
:
if
'server'
in
n
.
name
:
ports
+=
'--CosimPortLeft='
+
env
.
nic_eth_path
(
n
)
+
' '
else
:
ports
+=
'--CosimPortRight='
+
env
.
nic_eth_path
(
n
)
+
' '
cmd
=
env
.
repodir
+
'/ns-3'
+
'/cosim-run.sh cosim cosim-dumbbell-example '
+
ports
+
' '
+
self
.
opt
print
(
cmd
)
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
=
[]
for
i
in
range
(
0
,
num
):
for
i
in
range
(
0
,
num
):
nic
=
nic_class
()
nic
=
nic_class
()
#nic.name = '%s.%d' % (name_prefix, i)
nic
.
set_network
(
net
)
nic
.
set_network
(
net
)
host
=
host_class
()
host
=
host_class
()
...
...
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