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
6daef993
Unverified
Commit
6daef993
authored
Dec 11, 2024
by
Antoine Kaufmann
Browse files
experiments: add minimal example with helpers
parent
7e9743de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
experiments/pyexps/minimal_net.py
experiments/pyexps/minimal_net.py
+47
-0
No files found.
experiments/pyexps/minimal_net.py
0 → 100644
View file @
6daef993
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
simulation
as
sim
from
simbricks.orchestration.helpers
import
simulation
as
sim_helpers
from
simbricks.orchestration.helpers
import
instantiation
as
inst_helpers
sys
=
system
.
System
()
# create a host instance and a NIC instance then install the NIC on the host
# host0 = system.CorundumLinuxHost(sys)
host0
=
system
.
I40ELinuxHost
(
sys
)
host0
.
add_disk
(
system
.
DistroDiskImage
(
h
=
host0
,
name
=
"base"
))
host0
.
add_disk
(
system
.
LinuxConfigDiskImage
(
h
=
host0
))
nic0
=
system
.
IntelI40eNIC
(
sys
)
nic0
.
add_ipv4
(
"10.0.0.1"
)
host0
.
connect_pcie_dev
(
nic0
)
# create a host instance and a NIC instance then install the NIC on the host
host1
=
system
.
I40ELinuxHost
(
sys
)
host1
.
add_disk
(
system
.
DistroDiskImage
(
h
=
host1
,
name
=
"base"
))
host1
.
add_disk
(
system
.
LinuxConfigDiskImage
(
h
=
host1
))
nic1
=
system
.
IntelI40eNIC
(
sys
)
nic1
.
add_ipv4
(
"10.0.0.2"
)
host1
.
connect_pcie_dev
(
nic1
)
switch0
=
system
.
EthSwitch
(
sys
)
switch0
.
connect_eth_peer_if
(
nic0
.
_eth_if
)
switch0
.
connect_eth_peer_if
(
nic1
.
_eth_if
)
# configure the software to run on the host
ping_client_app
=
system
.
PingClient
(
host0
,
nic1
.
_ip
)
ping_client_app
.
wait
=
True
host0
.
add_app
(
ping_client_app
)
host1
.
add_app
(
system
.
Sleep
(
host1
,
infinite
=
True
))
simulation
=
sim_helpers
.
simple_simulation
(
sys
,
compmap
=
{
system
.
FullSystemHost
:
sim
.
QemuSim
,
system
.
IntelI40eNIC
:
sim
.
I40eNicSim
,
system
.
EthSwitch
:
sim
.
SwitchNet
,
})
instantiations
=
[
inst_helpers
.
simple_instantiation
(
simulation
)]
\ No newline at end of file
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