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
d2d417f8
Unverified
Commit
d2d417f8
authored
Nov 28, 2024
by
Jakob Görgen
Browse files
fixed system.LinuxHost ip link setup error
parent
79b2ee78
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
experiments/simbricks/orchestration/system/host/base.py
experiments/simbricks/orchestration/system/host/base.py
+5
-2
experiments/simbricks/orchestration/utils/base.py
experiments/simbricks/orchestration/utils/base.py
+13
-0
No files found.
experiments/simbricks/orchestration/system/host/base.py
View file @
d2d417f8
...
@@ -28,6 +28,7 @@ import asyncio
...
@@ -28,6 +28,7 @@ import asyncio
import
simbricks.orchestration.instantiation.base
as
instantiation
import
simbricks.orchestration.instantiation.base
as
instantiation
from
simbricks.orchestration.system
import
base
as
base
from
simbricks.orchestration.system
import
base
as
base
from
simbricks.orchestration.system
import
eth
as
eth
from
simbricks.orchestration.system
import
eth
as
eth
from
simbricks.orchestration.system
import
nic
as
nic
from
simbricks.orchestration.system
import
pcie
as
pcie
from
simbricks.orchestration.system
import
pcie
as
pcie
from
simbricks.orchestration.system.host
import
app
from
simbricks.orchestration.system.host
import
app
from
simbricks.orchestration.utils
import
base
as
utils_base
from
simbricks.orchestration.utils
import
base
as
utils_base
...
@@ -271,12 +272,14 @@ class LinuxHost(BaseLinuxHost):
...
@@ -271,12 +272,14 @@ class LinuxHost(BaseLinuxHost):
continue
continue
inf
=
host_inf
.
get_opposing_interface
()
inf
=
host_inf
.
get_opposing_interface
()
if
not
utils_base
.
check_type
(
inf
.
component
,
eth
.
EthSimpleNIC
):
if
not
utils_base
.
check_types
(
inf
.
component
,
eth
.
EthSimpleNIC
,
nic
.
SimplePCIeNIC
):
continue
continue
# Get ifname parameter if set, otherwise default to ethX
# Get ifname parameter if set, otherwise default to ethX
ifn
=
f
"eth
{
index
}
"
ifn
=
f
"eth
{
index
}
"
index
+=
1
index
+=
1
com
:
eth
.
EthSimpleNIC
=
inf
.
component
com
:
eth
.
EthSimpleNIC
|
nic
.
SimplePCIeNIC
=
inf
.
component
# Force MAC if requested TODO: FIXME
# Force MAC if requested TODO: FIXME
# if "force_mac_addr" in i.parameters:
# if "force_mac_addr" in i.parameters:
...
...
experiments/simbricks/orchestration/utils/base.py
View file @
d2d417f8
...
@@ -55,6 +55,19 @@ def check_type(obj, expected_type) -> bool:
...
@@ -55,6 +55,19 @@ def check_type(obj, expected_type) -> bool:
return
isinstance
(
obj
,
expected_type
)
return
isinstance
(
obj
,
expected_type
)
def
check_types
(
obj
,
*
expected_types
)
->
bool
:
"""
Checks if obj has type or is a subtype of any of expected_types
obj: an class object
expected_types: list of type objects
"""
for
exp_ty
in
expected_types
:
if
check_type
(
obj
,
expected_type
=
exp_ty
):
return
True
return
False
def
has_expected_type
(
obj
,
expected_type
)
->
None
:
def
has_expected_type
(
obj
,
expected_type
)
->
None
:
if
not
check_type
(
obj
=
obj
,
expected_type
=
expected_type
):
if
not
check_type
(
obj
=
obj
,
expected_type
=
expected_type
):
raise
Exception
(
raise
Exception
(
...
...
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