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
ebca47be
Unverified
Commit
ebca47be
authored
Sep 12, 2024
by
Jakob Görgen
Browse files
helpers example type error fixes + new helper sugggestion
parent
6584973e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
experiments/pyexps/netperf_sysconf_jakob.py
experiments/pyexps/netperf_sysconf_jakob.py
+8
-7
experiments/simbricks/orchestration/helpers/system.py
experiments/simbricks/orchestration/helpers/system.py
+21
-6
No files found.
experiments/pyexps/netperf_sysconf_jakob.py
View file @
ebca47be
...
@@ -16,17 +16,18 @@ def boilerplate():
...
@@ -16,17 +16,18 @@ def boilerplate():
# create client host
# create client host
host0
=
sys_host_base
.
CorundumLinuxHost
()
host0
=
sys_host_base
.
CorundumLinuxHost
()
host0_app
=
sys_app_base
.
PingClient
(
host0
)
host0_app
=
sys_app_base
.
PingClient
(
host0
)
host0_app
.
server_ip
=
'10.0.0.2'
host0
.
add_app
(
host0_app
)
host0
.
add_app
(
host0_app
)
# create client nic
# create client nic
nic0
=
sys_nic
.
CorundumNIC
()
nic0
=
sys_nic
.
CorundumNIC
()
nic0
.
set
_ipv4
(
"10.0.0.1"
)
nic0
.
add
_ipv4
(
"10.0.0.1"
)
# connect client host and nic
# connect client host and nic
host_pci0
=
sys_pcie
.
PCIeHostInterface
(
host0
)
host_pci0
=
sys_pcie
.
PCIeHostInterface
(
host0
)
host0
.
add_if
(
host_pci0
)
host0
.
add_if
(
host_pci0
)
nic_pci0
=
sys_pcie
.
PCIeDeviceInterface
(
nic0
)
nic_pci0
=
sys_pcie
.
PCIeDeviceInterface
(
nic0
)
nic0
.
set_pcie
_if
(
nic_pci0
)
nic0
.
add
_if
(
nic_pci0
)
host0_nic0_chan
=
sys_pcie
.
PCIeChannel
(
host_pci0
,
nic_pci0
)
host0_nic0_chan
=
sys_pcie
.
PCIeChannel
(
host_pci0
,
nic_pci0
)
# create host server
# create host server
...
@@ -36,13 +37,13 @@ def boilerplate():
...
@@ -36,13 +37,13 @@ def boilerplate():
# create host nic
# create host nic
nic1
=
sys_nic
.
IntelI40eNIC
()
nic1
=
sys_nic
.
IntelI40eNIC
()
nic1
.
set
_ipv4
(
"10.0.0.2"
)
nic1
.
add
_ipv4
(
"10.0.0.2"
)
# connect host server to host client
# connect host server to host client
host_pci1
=
sys_pcie
.
PCIeHostInterface
(
host0
)
host_pci1
=
sys_pcie
.
PCIeHostInterface
(
host0
)
host1
.
add_if
(
host_pci1
)
host1
.
add_if
(
host_pci1
)
nic_pci1
=
sys_pcie
.
PCIeDeviceInterface
(
nic1
)
nic_pci1
=
sys_pcie
.
PCIeDeviceInterface
(
nic1
)
nic1
.
set_pcie
_if
(
nic_pci1
)
nic1
.
add
_if
(
nic_pci1
)
host1_nic1_chan
=
sys_pcie
.
PCIeChannel
(
host_pci1
,
nic_pci1
)
host1_nic1_chan
=
sys_pcie
.
PCIeChannel
(
host_pci1
,
nic_pci1
)
# create first switch
# create first switch
...
@@ -85,7 +86,7 @@ def syntactic_sugar():
...
@@ -85,7 +86,7 @@ def syntactic_sugar():
# create client host
# create client host
host0
=
sys_host_base
.
CorundumLinuxHost
()
host0
=
sys_host_base
.
CorundumLinuxHost
()
install_application
(
host0
,
sys_app_base
.
PingClient
(
host0
)
)
helpers_sys
.
install_app
(
host
=
host0
,
app_ty
=
sys_app_base
.
PingClient
,
server_ip
=
'10.0.0.2'
)
# create client nic
# create client nic
nic0
=
sys_nic
.
CorundumNIC
()
nic0
=
sys_nic
.
CorundumNIC
()
...
@@ -96,11 +97,11 @@ def syntactic_sugar():
...
@@ -96,11 +97,11 @@ def syntactic_sugar():
# create host server
# create host server
host1
=
sys_host_base
.
I40ELinuxHost
()
host1
=
sys_host_base
.
I40ELinuxHost
()
install_application
(
host1
,
system
.
Sleep
(
host1
)
)
helpers_sys
.
install_app
(
host
=
host1
,
app_ty
=
sys_app_base
.
Sleep
,
delay
=
10
)
# create host nic
# create host nic
nic1
=
sys_nic
.
IntelI40eNIC
()
nic1
=
sys_nic
.
IntelI40eNIC
()
nic1
.
set
_ipv4
(
"10.0.0.2"
)
nic1
.
add
_ipv4
(
"10.0.0.2"
)
# connect host server to host client
# connect host server to host client
helpers_sys
.
connect_host_and_device
(
host
=
host1
,
device
=
nic1
)
helpers_sys
.
connect_host_and_device
(
host
=
host1
,
device
=
nic1
)
...
...
experiments/simbricks/orchestration/helpers/system.py
View file @
ebca47be
...
@@ -24,11 +24,12 @@
...
@@ -24,11 +24,12 @@
from
simbricks.orchestration
import
system
from
simbricks.orchestration
import
system
from
simbricks.orchestration.utils
import
base
as
utils_base
from
simbricks.orchestration.utils
import
base
as
utils_base
def
connect_host_and_device
(
def
connect_host_and_device
(
host
:
system
.
host
.
base
.
Host
,
device
:
system
.
base
.
Component
host
:
system
.
Host
,
device
:
system
.
Component
)
->
system
.
pcie
.
PCIeChannel
:
)
->
system
.
pcie
.
PCIeChannel
:
utils_base
.
has_expected_type
(
obj
=
host
,
expected_type
=
system
.
host
.
base
.
Host
)
utils_base
.
has_expected_type
(
obj
=
host
,
expected_type
=
system
.
Host
)
utils_base
.
has_expected_type
(
obj
=
device
,
expected_type
=
system
.
base
.
Component
)
utils_base
.
has_expected_type
(
obj
=
device
,
expected_type
=
system
.
Component
)
host_interface
=
system
.
pcie
.
PCIeHostInterface
(
c
=
host
)
host_interface
=
system
.
pcie
.
PCIeHostInterface
(
c
=
host
)
host
.
add_if
(
interface
=
host_interface
)
host
.
add_if
(
interface
=
host_interface
)
...
@@ -40,9 +41,11 @@ def connect_host_and_device(
...
@@ -40,9 +41,11 @@ def connect_host_and_device(
return
pcie_channel
return
pcie_channel
def
connect_eth_devices
(
device_a
:
system
.
base
.
Component
,
device_b
:
system
.
base
.
Component
)
->
system
.
eth
.
EthChannel
:
def
connect_eth_devices
(
utils_base
.
has_expected_type
(
obj
=
device_a
,
expected_type
=
system
.
base
.
Component
)
device_a
:
system
.
Component
,
device_b
:
system
.
Component
utils_base
.
has_expected_type
(
obj
=
device_b
,
expected_type
=
system
.
base
.
Component
)
)
->
system
.
EthChannel
:
utils_base
.
has_expected_type
(
obj
=
device_a
,
expected_type
=
system
.
Component
)
utils_base
.
has_expected_type
(
obj
=
device_b
,
expected_type
=
system
.
Component
)
eth_inter_a
=
system
.
eth
.
EthInterface
(
c
=
device_a
)
eth_inter_a
=
system
.
eth
.
EthInterface
(
c
=
device_a
)
device_a
.
add_if
(
interface
=
eth_inter_a
)
device_a
.
add_if
(
interface
=
eth_inter_a
)
...
@@ -52,3 +55,15 @@ def connect_eth_devices(device_a: system.base.Component, device_b: system.base.C
...
@@ -52,3 +55,15 @@ def connect_eth_devices(device_a: system.base.Component, device_b: system.base.C
eth_channel
=
system
.
eth
.
EthChannel
(
a
=
eth_inter_a
,
b
=
eth_inter_b
)
eth_channel
=
system
.
eth
.
EthChannel
(
a
=
eth_inter_a
,
b
=
eth_inter_b
)
return
eth_channel
return
eth_channel
def
install_app
(
host
:
system
.
Host
,
app_ty
:
system
.
Application
,
**
kwargs
)
->
system
.
Application
:
utils_base
.
has_expected_type
(
obj
=
host
,
expected_type
=
system
.
Host
)
utils_base
.
has_expected_type
(
obj
=
app_ty
,
expected_type
=
system
.
Application
)
application
=
app_ty
(
h
=
host
,
**
kwargs
)
host
.
add_app
(
a
=
application
)
return
application
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