Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lisa/microsoft/testsuites/core/provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,9 @@ def check_sriov(self, log: Logger, node: RemoteNode) -> None:
pci_nic_check = True
if pci_nic_check:
log.info(
f"check_sriov: PCI nic count {len(node_nic_info.get_lower_nics())}"
f"check_sriov: PCI nic count {len(node_nic_info.get_pci_nics())}"
)
assert_that(len(node_nic_info.get_lower_nics())).described_as(
f"VF count inside VM is {len(node_nic_info.get_lower_nics())},"
assert_that(len(node_nic_info.get_pci_nics())).described_as(
f"VF count inside VM is {len(node_nic_info.get_pci_nics())}, "
f"actual sriov nic count is {sriov_count}"
).is_equal_to(sriov_count)
3 changes: 1 addition & 2 deletions lisa/microsoft/testsuites/kselftest/kselftest-suite.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Any, Dict

from microsoft.testsuites.kselftest.kselftest import Kselftest

from lisa import Node, TestCaseMetadata, TestSuite, TestSuiteMetadata
from lisa.testsuite import TestResult, simple_requirement
from lisa.util import SkippedException, UnsupportedDistroException
from microsoft.testsuites.kselftest.kselftest import Kselftest


@TestSuiteMetadata(
Expand Down
3 changes: 1 addition & 2 deletions lisa/microsoft/testsuites/ltp/ltpsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from logging import Logger
from typing import Any, Dict

from microsoft.testsuites.ltp.ltp import Ltp

from lisa import (
Node,
TestCaseMetadata,
Expand All @@ -18,6 +16,7 @@
from lisa.operating_system import BSD, Windows
from lisa.testsuite import TestResult
from lisa.tools import Lsblk, Swap
from microsoft.testsuites.ltp.ltp import Ltp


@TestSuiteMetadata(
Expand Down
12 changes: 6 additions & 6 deletions lisa/microsoft/testsuites/network/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ def _setup_nic_monitoring(
dest_synthetic_nic = dest_nic_info.name

# Determine which NIC to monitor for packet counts
if source_nic_info.lower and source_nic_info.pci_device_name:
if source_nic_info.is_pci_module_enabled and source_nic_info.pci_device_name:
source_pci_nic = source_nic_info.pci_device_name
source_nic = source_pci_nic
else:
source_pci_nic = source_nic_info.name
source_nic = source_synthetic_nic

if dest_nic_info.lower and dest_nic_info.pci_device_name:
if dest_nic_info.is_pci_module_enabled and dest_nic_info.pci_device_name:
dest_pci_nic = dest_nic_info.pci_device_name
dest_nic = dest_pci_nic
else:
Expand Down Expand Up @@ -291,9 +291,9 @@ def sriov_vf_connection_test(

# turn off lower device
if turn_off_lower:
if source_nic_info.lower:
if source_nic_info.is_pci_module_enabled:
source_node.tools[Ip].down(source_pci_nic)
if dest_nic_info.lower:
if dest_nic_info.is_pci_module_enabled:
dest_node.tools[Ip].down(dest_pci_nic)

# Perform file transfer to test connectivity
Expand All @@ -309,9 +309,9 @@ def sriov_vf_connection_test(

# turn on lower device, if turned off before
if turn_off_lower:
if source_nic_info.lower:
if source_nic_info.is_pci_module_enabled:
source_node.tools[Ip].up(source_pci_nic)
if dest_nic_info.lower:
if dest_nic_info.is_pci_module_enabled:
dest_node.tools[Ip].up(dest_pci_nic)

# After testing all NICs, ensure at least one valid pair was tested
Expand Down
41 changes: 37 additions & 4 deletions lisa/microsoft/testsuites/network/networksettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class NetworkSettings(TestSuite):
),
)
def verify_ringbuffer_settings_change(self, node: Node) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")
ethtool = node.tools[Ethtool]
try:
devices_settings = ethtool.get_all_device_ring_buffer_settings()
Expand Down Expand Up @@ -188,6 +191,10 @@ def verify_ringbuffer_settings_change(self, node: Node) -> None:
requirement=simple_requirement(unsupported_os=[BSD, Windows]),
)
def verify_device_channels_change(self, node: Node, log: Logger) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

kernel_ver = node.tools[Uname].get_linux_information().kernel_version
if (
isinstance(node.os, Ubuntu)
Expand Down Expand Up @@ -258,6 +265,10 @@ def verify_device_channels_change(self, node: Node, log: Logger) -> None:
priority=1,
)
def verify_device_enabled_features(self, node: Node) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

required_features = [
"rx-checksumming",
"tx-checksumming",
Expand Down Expand Up @@ -298,6 +309,10 @@ def verify_device_enabled_features(self, node: Node) -> None:
requirement=simple_requirement(unsupported_os=[BSD, Windows]),
)
def verify_device_gro_lro_settings_change(self, node: Node, log: Logger) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

ethtool = node.tools[Ethtool]

skip_test = True
Expand Down Expand Up @@ -370,6 +385,10 @@ def verify_device_gro_lro_settings_change(self, node: Node, log: Logger) -> None
requirement=simple_requirement(unsupported_os=[BSD, Windows]),
)
def verify_device_rss_hash_key_change(self, node: Node, log: Logger) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

uname = node.tools[Uname]
linux_info = uname.get_linux_information()

Expand Down Expand Up @@ -435,6 +454,10 @@ def verify_device_rss_hash_key_change(self, node: Node, log: Logger) -> None:
priority=2,
)
def verify_device_rx_hash_level_change(self, node: Node, log: Logger) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

ethtool = node.tools[Ethtool]

# Run the test for both TCP and UDP
Expand Down Expand Up @@ -494,6 +517,10 @@ def verify_device_rx_hash_level_change(self, node: Node, log: Logger) -> None:
),
)
def verify_device_msg_level_change(self, node: Node, log: Logger) -> None:
# Skip test if no synthetic NICs are available
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

# Check if feature is supported by the kernel
self._check_msg_level_change_supported(node)

Expand Down Expand Up @@ -605,6 +632,11 @@ def verify_device_msg_level_change(self, node: Node, log: Logger) -> None:
def verify_device_statistics(self, environment: Environment, log: Logger) -> None:
server_node = cast(RemoteNode, environment.nodes[0])
client_node = cast(RemoteNode, environment.nodes[1])

# Skip test if no synthetic NICs are available
if not client_node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

ethtool = client_node.tools[Ethtool]

self._verify_stats_exists(server_node, client_node)
Expand All @@ -614,10 +646,10 @@ def verify_device_statistics(self, environment: Environment, log: Logger) -> Non

device = client_node.nics.default_nic
nic = client_node.nics.get_nic(device)
if nic.lower:
if nic.is_pci_module_enabled:
# If AN is enabled on this interface then use VF nic stats.
an_enabled = True
device = nic.lower
device = nic.pci_device_name

timeout = 300
timer = create_timer()
Expand Down Expand Up @@ -773,9 +805,10 @@ def _verify_stats_exists(
per_vf_queue_stats = 0
for device_stats in devices_statistics:
nic = client_node.nics.get_nic(device_stats.interface)
if nic.lower:
if nic.is_pci_module_enabled:
try:
device_stats = ethtool.get_device_statistics(nic.lower, True)
device_name = nic.pci_device_name
device_stats = ethtool.get_device_statistics(device_name, True)
except UnsupportedOperationException as e:
raise SkippedException(e)

Expand Down
27 changes: 27 additions & 0 deletions lisa/microsoft/testsuites/network/sriov.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ def verify_sriov_max_vf_connection_max_cpu(self, environment: Environment) -> No
),
)
def verify_sriov_disable_enable(self, environment: Environment) -> None:
# Skip test if any node has PCI-only NICs (AN without synthetic pairing)
for node in environment.nodes.list():
for nic in node.nics.nics.values():
if nic.is_pci_only_nic:
raise SkippedException(
f"SRIOV disable/enable test not applicable for "
f"PCI-only NIC {nic.name} on node {node.name}."
)

sriov_disable_enable(environment)

@TestCaseMetadata(
Expand All @@ -290,6 +299,15 @@ def verify_sriov_disable_enable(self, environment: Environment) -> None:
),
)
def verify_sriov_disable_enable_pci(self, environment: Environment) -> None:
# Skip test if any node has PCI-only NICs (AN without synthetic pairing)
for node in environment.nodes.list():
for nic in node.nics.nics.values():
if nic.is_pci_only_nic:
raise SkippedException(
f"SRIOV disable/enable PCI test not applicable for "
f"PCI-only NIC {nic.name} on node {node.name}."
)

disable_enable_devices(environment)
vm_nics = initialize_nic_info(environment)
sriov_basic_test(environment)
Expand All @@ -314,6 +332,15 @@ def verify_sriov_disable_enable_pci(self, environment: Environment) -> None:
),
)
def verify_sriov_disable_enable_on_guest(self, environment: Environment) -> None:
# Skip test if any node has PCI-only NICs (AN without synthetic pairing)
for node in environment.nodes.list():
for nic in node.nics.nics.values():
if nic.is_pci_only_nic:
raise SkippedException(
f"SRIOV disable/enable on guest test not applicable "
f"for PCI-only NIC {nic.name} on node {node.name}."
)

vm_nics = initialize_nic_info(environment)
sriov_basic_test(environment)
sriov_vf_connection_test(environment, vm_nics, turn_off_lower=True)
Expand Down
25 changes: 25 additions & 0 deletions lisa/microsoft/testsuites/network/stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Environment,
Logger,
RemoteNode,
SkippedException,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
Expand Down Expand Up @@ -133,6 +134,15 @@ def stress_sriov_iperf(self, environment: Environment) -> None:
),
)
def stress_sriov_disable_enable(self, environment: Environment) -> None:
# Skip test if any node has PCI-only NICs (AN without synthetic pairing)
for node in environment.nodes.list():
for nic in node.nics.nics.values():
if nic.is_pci_only_nic:
raise SkippedException(
f"SRIOV stress disable/enable test not applicable "
f"for PCI-only NIC {nic.name} on node {node.name}."
)

sriov_disable_enable(environment, times=50)

@TestCaseMetadata(
Expand All @@ -157,6 +167,11 @@ def stress_sriov_disable_enable(self, environment: Environment) -> None:
def stress_synthetic_provision_with_max_nics_reboot(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for _ in range(10):
for node in environment.nodes.list():
Expand Down Expand Up @@ -185,6 +200,11 @@ def stress_synthetic_provision_with_max_nics_reboot(
def stress_synthetic_with_max_nics_reboot_from_platform(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for _ in range(10):
for node in environment.nodes.list():
Expand Down Expand Up @@ -214,6 +234,11 @@ def stress_synthetic_with_max_nics_reboot_from_platform(
def stress_synthetic_with_max_nics_stop_start_from_platform(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for _ in range(10):
for node in environment.nodes.list():
Expand Down
31 changes: 31 additions & 0 deletions lisa/microsoft/testsuites/network/synthetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT license.
from lisa import (
Environment,
SkippedException,
TestCaseMetadata,
TestSuite,
TestSuiteMetadata,
Expand Down Expand Up @@ -42,6 +43,11 @@ class Synthetic(TestSuite):
def verify_synthetic_provision_with_max_nics(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)

@TestCaseMetadata(
Expand All @@ -65,6 +71,11 @@ def verify_synthetic_provision_with_max_nics(
def verify_synthetic_provision_with_max_nics_reboot(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for node in environment.nodes.list():
node.reboot()
Expand All @@ -91,6 +102,11 @@ def verify_synthetic_provision_with_max_nics_reboot(
def verify_synthetic_provision_with_max_nics_reboot_from_platform(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for node in environment.nodes.list():
start_stop = node.features[StartStop]
Expand Down Expand Up @@ -118,6 +134,11 @@ def verify_synthetic_provision_with_max_nics_reboot_from_platform(
def verify_synthetic_provision_with_max_nics_stop_start_from_platform(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

initialize_nic_info(environment, is_sriov=False)
for node in environment.nodes.list():
start_stop = node.features[StartStop]
Expand Down Expand Up @@ -147,6 +168,11 @@ def verify_synthetic_provision_with_max_nics_stop_start_from_platform(
def verify_synthetic_add_max_nics_one_time_after_provision(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

remove_extra_nics(environment)
try:
for node in environment.nodes.list():
Expand Down Expand Up @@ -180,6 +206,11 @@ def verify_synthetic_add_max_nics_one_time_after_provision(
def verify_synthetic_add_max_nics_one_by_one_after_provision(
self, environment: Environment
) -> None:
# Skip test if no synthetic NICs are available on any node
for node in environment.nodes.list():
if not node.nics.get_synthetic_devices():
raise SkippedException("No synthetic NICs available for testing")

remove_extra_nics(environment)
try:
for node in environment.nodes.list():
Expand Down
Loading
Loading