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
a7a6ba8e
Commit
a7a6ba8e
authored
Nov 05, 2020
by
Antoine Kaufmann
Browse files
experiments: add and use experiment helper function to create hosts
parent
c84f12b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
experiments/modes/simulators.py
experiments/modes/simulators.py
+21
-0
experiments/pyexps/qemu_i40e_pair.py
experiments/pyexps/qemu_i40e_pair.py
+8
-23
No files found.
experiments/modes/simulators.py
View file @
a7a6ba8e
...
...
@@ -164,3 +164,24 @@ class SwitchNet(NetSim):
for
n
in
self
.
nics
:
cmd
+=
' -s '
+
env
.
nic_eth_path
(
n
)
return
cmd
def
create_basic_hosts
(
e
,
num
,
name_prefix
,
net
,
nic_class
,
host_class
,
nc_class
,
app_class
,
ip_start
=
1
):
hosts
=
[]
for
i
in
range
(
0
,
num
):
nic
=
nic_class
()
nic
.
set_network
(
net
)
host
=
host_class
()
host
.
name
=
'%s.%d'
%
(
name_prefix
,
i
)
host
.
node_config
=
nc_class
()
host
.
node_config
.
ip
=
'10.0.0.%d'
%
(
ip_start
+
i
)
host
.
node_config
.
app
=
app_class
()
host
.
add_nic
(
nic
)
e
.
add_nic
(
nic
)
e
.
add_host
(
host
)
hosts
.
append
(
host
)
return
hosts
experiments/pyexps/qemu_i40e_pair.py
View file @
a7a6ba8e
...
...
@@ -2,35 +2,20 @@ import modes.experiments as exp
import
modes.simulators
as
sim
import
modes.nodeconfig
as
node
e
=
exp
.
Experiment
(
'qemu-i40e-pair'
)
net
=
sim
.
SwitchNet
()
e
.
add_network
(
net
)
nic_a
=
sim
.
I40eNIC
()
nic_a
.
set_network
(
net
)
e
.
add_nic
(
nic_a
)
host_a
=
sim
.
QemuHost
()
host_a
.
name
=
'server'
host_a
.
node_config
=
node
.
I40eLinuxNode
()
host_a
.
node_config
.
ip
=
'10.0.0.1'
host_a
.
node_config
.
app
=
node
.
IperfTCPServer
()
host_a
.
add_nic
(
nic_a
)
e
.
add_host
(
host_a
)
servers
=
sim
.
create_basic_hosts
(
e
,
1
,
'server'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPServer
)
for
i
in
range
(
0
,
2
):
nic_b
=
sim
.
I40eNIC
()
nic_b
.
set_network
(
net
)
e
.
add_nic
(
nic_b
)
clients
=
sim
.
create_basic_hosts
(
e
,
2
,
'client'
,
net
,
sim
.
I40eNIC
,
sim
.
QemuHost
,
node
.
I40eLinuxNode
,
node
.
IperfTCPClient
,
ip_start
=
2
)
host_b
=
sim
.
QemuHost
()
host_b
.
name
=
'client.%d'
%
i
host_b
.
wait
=
True
host_b
.
node_config
=
node
.
I40eLinuxNode
()
host_b
.
node_config
.
ip
=
'10.0.0.%d'
%
(
2
+
i
)
host_b
.
node_config
.
app
=
node
.
IperfTCPClient
()
host_b
.
add_nic
(
nic_b
)
e
.
add_host
(
host_b
)
for
c
in
clients
:
c
.
wait
=
True
c
.
node_config
.
app
.
server_ip
=
servers
[
0
].
node_config
.
ip
experiments
=
[
e
]
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