-
Notifications
You must be signed in to change notification settings - Fork 72
net: Introduce dual-stream udn tests #4786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+134
−6
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
tests/network/user_defined_network/rhel9_rhel10_cluster/conftest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| from collections.abc import Generator | ||
|
|
||
| import pytest | ||
| from kubernetes.dynamic import DynamicClient | ||
| from ocp_resources.namespace import Namespace | ||
| from ocp_resources.user_defined_network import Layer2UserDefinedNetwork | ||
|
|
||
| from libs.net.ip import filter_link_local_addresses | ||
| from libs.net.traffic_generator import TcpServer, VMTcpClient, client_server_active_connection | ||
| from libs.net.udn import UDN_BINDING_DEFAULT_PLUGIN_NAME | ||
| from libs.net.vmspec import lookup_iface_status | ||
| from libs.vm.affinity import new_node_affinity | ||
| from libs.vm.vm import BaseVirtualMachine | ||
| from tests.network.libs.nodes import RHCOS9_WORKER_LABEL | ||
| from tests.network.libs.vm_factory import udn_vm | ||
|
|
||
| _UDN_PRIMARY_IFACE_NAME = "udn-primary" | ||
|
|
||
|
|
||
| @pytest.fixture(scope="class") | ||
| def udn_server_vm( | ||
| admin_client: DynamicClient, | ||
| udn_namespace: Namespace, | ||
| namespaced_layer2_user_defined_network: Layer2UserDefinedNetwork, | ||
| ) -> Generator[BaseVirtualMachine]: | ||
| with udn_vm( | ||
| namespace_name=udn_namespace.name, | ||
| name="server-vm", | ||
| client=admin_client, | ||
| binding=UDN_BINDING_DEFAULT_PLUGIN_NAME, | ||
| affinity=new_node_affinity(key=RHCOS9_WORKER_LABEL, exists=True), | ||
| ) as vm: | ||
| vm.start(wait=True) | ||
| vm.wait_for_agent_connected() | ||
| lookup_iface_status( | ||
| vm=vm, | ||
| iface_name=_UDN_PRIMARY_IFACE_NAME, | ||
| predicate=lambda iface: ( | ||
| "guest-agent" in iface["infoSource"] | ||
|
azhivovk marked this conversation as resolved.
|
||
| and bool(filter_link_local_addresses(ip_addresses=iface.get("ipAddresses", []))) | ||
| ), | ||
| ) | ||
| yield vm | ||
|
|
||
|
|
||
| @pytest.fixture(scope="class") | ||
| def udn_client_vm( | ||
| admin_client: DynamicClient, | ||
| udn_namespace: Namespace, | ||
| namespaced_layer2_user_defined_network: Layer2UserDefinedNetwork, | ||
| ) -> Generator[BaseVirtualMachine]: | ||
| with udn_vm( | ||
| namespace_name=udn_namespace.name, | ||
| name="client-vm", | ||
| client=admin_client, | ||
| binding=UDN_BINDING_DEFAULT_PLUGIN_NAME, | ||
| affinity=new_node_affinity(key=RHCOS9_WORKER_LABEL, exists=True), | ||
| ) as vm: | ||
| vm.start(wait=True) | ||
| vm.wait_for_agent_connected() | ||
| lookup_iface_status( | ||
| vm=vm, | ||
| iface_name=_UDN_PRIMARY_IFACE_NAME, | ||
| predicate=lambda iface: ( | ||
| "guest-agent" in iface["infoSource"] | ||
| and bool(filter_link_local_addresses(ip_addresses=iface.get("ipAddresses", []))) | ||
| ), | ||
| ) | ||
| yield vm | ||
|
|
||
|
|
||
| @pytest.fixture(scope="class") | ||
| def udn_active_tcp_connection( | ||
| udn_client_vm: BaseVirtualMachine, | ||
| udn_server_vm: BaseVirtualMachine, | ||
| ) -> Generator[tuple[VMTcpClient, TcpServer]]: | ||
| with client_server_active_connection( | ||
| client_vm=udn_client_vm, | ||
| server_vm=udn_server_vm, | ||
| spec_logical_network=_UDN_PRIMARY_IFACE_NAME, | ||
| ) as connection: | ||
| yield connection | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.