diff --git a/lisa/node.py b/lisa/node.py index 53ce96c45b..1c3e140736 100644 --- a/lisa/node.py +++ b/lisa/node.py @@ -22,7 +22,7 @@ from lisa.executable import Tools from lisa.feature import Features from lisa.nic import Nics, NicsBSD -from lisa.operating_system import BSD, OperatingSystem +from lisa.operating_system import OperatingSystem from lisa.secret import add_secret from lisa.tools import Chmod, Df, Echo, Lsblk, Mkfs, Mount, Reboot, Uname, Wsl from lisa.tools.mkfs import FileSystem @@ -1215,7 +1215,10 @@ def create_nics(node: Node) -> Nics: """ Returns a Nics object for the node based on the OS type. """ - if isinstance(node.os, BSD): + # Uses uname instead of the node.os because sometimes node.os has not been + # populated when this is called. + os = node.execute(cmd="uname", no_error_log=True).stdout + if "FreeBSD" in os: return NicsBSD(node) return Nics(node) diff --git a/microsoft/testsuites/core/provisioning.py b/microsoft/testsuites/core/provisioning.py index e9d6ac6b8f..9e10451ff2 100644 --- a/microsoft/testsuites/core/provisioning.py +++ b/microsoft/testsuites/core/provisioning.py @@ -31,7 +31,6 @@ StartStop, Synthetic, ) -from lisa.nic import Nics from lisa.tools import Lspci from lisa.util import constants from lisa.util.shell import wait_tcp_port_ready @@ -342,7 +341,7 @@ def is_mana_device_discovered(self, node: RemoteNode) -> bool: return all_mana_devices def check_sriov(self, log: Logger, node: RemoteNode) -> None: - node_nic_info = Nics(node) + node_nic_info = node.nics node_nic_info.initialize() network_interface_feature = node.features[NetworkInterface]