Skip to content
Merged
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
22 changes: 0 additions & 22 deletions tests/network/l2_bridge/libl2bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,28 +312,6 @@ def get_primary_and_hot_plugged_mac_addresses(vm, hot_plugged_interface):
]


def create_vm_with_hot_plugged_sriov_interface(
namespace_name,
vm_name,
sriov_network_for_hot_plug,
ipv4_address,
client,
):
with create_vm_for_hot_plug(
namespace_name=namespace_name,
vm_name=vm_name,
client=client,
) as vm:
hot_plug_interface_and_set_address(
vm=vm,
hot_plugged_interface_name=sriov_network_for_hot_plug.name,
net_attach_def_name=f"{namespace_name}/{sriov_network_for_hot_plug.name}",
ipv4_address=ipv4_address,
sriov=True,
)
yield vm


def wait_for_no_packet_loss_after_connection(src_vm, dst_ip, interface=None):
sleep_count_value = 10

Expand Down
53 changes: 28 additions & 25 deletions tests/network/l2_bridge/test_bridge_nic_hot_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
check_mac_released,
create_bridge_interface_for_hot_plug,
create_vm_for_hot_plug,
create_vm_with_hot_plugged_sriov_interface,
create_vm_with_secondary_interface_on_setup,
get_kubemacpool_controller_log,
get_primary_and_hot_plugged_mac_addresses,
Expand Down Expand Up @@ -395,35 +394,23 @@ def hot_unplug_secondary_interface_from_setup(


@pytest.fixture()
def vm1_with_hot_plugged_sriov_interface(
namespace,
unprivileged_client,
sriov_network_for_hot_plug,
index_number,
):
yield from create_vm_with_hot_plugged_sriov_interface(
def sriov_hot_plug_vm1(namespace, unprivileged_client):
with create_vm_for_hot_plug(
namespace_name=namespace.name,
vm_name=f"{SRIOV}-{HOT_PLUG_STR}-vm1",
sriov_network_for_hot_plug=sriov_network_for_hot_plug,
ipv4_address=random_ipv4_address(net_seed=0, host_address=next(index_number)),
client=unprivileged_client,
)
) as vm:
yield vm


@pytest.fixture()
def vm2_with_hot_plugged_sriov_interface(
namespace,
unprivileged_client,
sriov_network_for_hot_plug,
index_number,
):
yield from create_vm_with_hot_plugged_sriov_interface(
def sriov_hot_plug_vm2(namespace, unprivileged_client):
with create_vm_for_hot_plug(
namespace_name=namespace.name,
vm_name=f"{SRIOV}-{HOT_PLUG_STR}-vm2",
sriov_network_for_hot_plug=sriov_network_for_hot_plug,
ipv4_address=random_ipv4_address(net_seed=0, host_address=next(index_number)),
client=unprivileged_client,
)
) as vm:
yield vm


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -584,14 +571,30 @@ def test_mac_of_hot_plugged_interface_returned_to_kubemacpool_after_vm_delete(
@pytest.mark.polarion("CNV-10647")
def test_connectivity_of_hot_plugged_sriov_interface(
self,
vm1_with_hot_plugged_sriov_interface,
vm2_with_hot_plugged_sriov_interface,
sriov_hot_plug_vm1,
sriov_hot_plug_vm2,
sriov_network_for_hot_plug,
namespace,
index_number,
):
hot_plug_interface_and_set_address(
vm=sriov_hot_plug_vm1,
hot_plugged_interface_name=sriov_network_for_hot_plug.name,
net_attach_def_name=f"{namespace.name}/{sriov_network_for_hot_plug.name}",
ipv4_address=random_ipv4_address(net_seed=0, host_address=next(index_number)),
sriov=True,
)
hot_plug_interface_and_set_address(
vm=sriov_hot_plug_vm2,
hot_plugged_interface_name=sriov_network_for_hot_plug.name,
net_attach_def_name=f"{namespace.name}/{sriov_network_for_hot_plug.name}",
ipv4_address=random_ipv4_address(net_seed=0, host_address=next(index_number)),
sriov=True,
)
assert_ping_successful(
src_vm=vm1_with_hot_plugged_sriov_interface,
src_vm=sriov_hot_plug_vm1,
dst_ip=lookup_iface_status_ip(
vm=vm2_with_hot_plugged_sriov_interface,
vm=sriov_hot_plug_vm2,
iface_name=sriov_network_for_hot_plug.name,
ip_family=4,
),
Expand Down