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
24639e12
Commit
24639e12
authored
Sep 01, 2021
by
Antoine Kaufmann
Browse files
experiments: create_basic_hosts parametrize prefix
parent
447d6613
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+4
-2
No files found.
experiments/simbricks/simulators.py
View file @
24639e12
...
@@ -440,7 +440,7 @@ class NS3SequencerNet(NetSim):
...
@@ -440,7 +440,7 @@ class NS3SequencerNet(NetSim):
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
,
ip_prefix
=
24
):
hosts
=
[]
hosts
=
[]
for
i
in
range
(
0
,
num
):
for
i
in
range
(
0
,
num
):
nic
=
nic_class
()
nic
=
nic_class
()
...
@@ -451,7 +451,9 @@ def create_basic_hosts(e, num, name_prefix, net, nic_class, host_class,
...
@@ -451,7 +451,9 @@ def create_basic_hosts(e, num, name_prefix, net, nic_class, host_class,
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
node_config
=
nc_class
()
node_config
=
nc_class
()
node_config
.
ip
=
'10.0.0.%d'
%
(
ip_start
+
i
)
node_config
.
prefix
=
ip_prefix
ip
=
ip_start
+
i
node_config
.
ip
=
'10.0.%d.%d'
%
(
int
(
ip
/
256
),
ip
%
256
)
node_config
.
app
=
app_class
()
node_config
.
app
=
app_class
()
host
.
set_config
(
node_config
)
host
.
set_config
(
node_config
)
...
...
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