-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Prioritize find link info by permanent MAC address, with fallb…
…ack to current address Add the integration test `tests_mac_address_match.yml` to verify that the commit "Prioritize find link info by permanent MAC address, with fallback to current address" (c341683) can properly resolve the scenarios where multiple network interfaces share the same current MAC address, leading to potential ambiguity in link matching (for example, Virtual interfaces or VLANs, which often lack a valid perm-address and rely on the parent interface's address). Notice that the test `tests_mac_address_match.yml` will be skipped in upstream testing and it will only be manually tested downstream since it requires to know the mac address to match when configuring vlan's parent. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
- Loading branch information
1 parent
2439f44
commit 890a2ad
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,43 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
--- | ||
- name: Play for testing MAC address match on device | ||
hosts: all | ||
vars_prompt: | ||
- name: "interface" | ||
prompt: "Please provide the interface name (e.g., eno2)" | ||
private: no | ||
- name: "mac" | ||
prompt: "Please provide the MAC address to match (e.g., ec:f4:BB:d3:EC:92)" | ||
private: no | ||
vars: | ||
profile: "{{ interface }}" | ||
vlan_profile: "{{ interface }}.3732" | ||
lsr_fail_debug: | ||
- __network_connections_result | ||
tags: | ||
- "tests::mac" | ||
tasks: | ||
- name: Show playbook name | ||
debug: | ||
msg: "this is: playbooks/tests_mac_address_match.yml" | ||
tags: | ||
- always | ||
|
||
- name: Test the MAC address match | ||
tags: | ||
- tests::mac:match | ||
block: | ||
- name: Include the task 'run_test.yml' | ||
include_tasks: tasks/run_test.yml | ||
vars: | ||
lsr_description: Test MAC address match on device | ||
lsr_setup: | ||
- tasks/assert_profile_absent.yml | ||
lsr_test: | ||
- tasks/create_mac_address_match.yml | ||
lsr_assert: | ||
- tasks/assert_profile_present.yml | ||
- tasks/assert_network_connections_succeeded.yml | ||
lsr_cleanup: | ||
- tasks/cleanup_vlan_and_parent_profile+device.yml | ||
- tasks/check_network_dns.yml |
This file contains 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,8 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
--- | ||
- name: Assert that configuring network connections is succeeded | ||
assert: | ||
that: | ||
- __network_connections_result.failed == false | ||
msg: Configuring network connections is failed with the error | ||
"{{ __network_connections_result.stderr }}" |
This file contains 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,23 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
--- | ||
- name: Clean up the test devices and the connection profiles | ||
tags: | ||
- "tests::cleanup" | ||
block: | ||
- name: Import network role | ||
import_role: | ||
name: linux-system-roles.network | ||
vars: | ||
network_connections: | ||
- name: "{{ profile }}" | ||
persistent_state: absent | ||
state: down | ||
- name: "{{ vlan_profile }}" | ||
persistent_state: absent | ||
state: down | ||
failed_when: false | ||
- name: Delete the device '{{ interface }}' | ||
command: ip link del {{ interface }} | ||
failed_when: false | ||
changed_when: false | ||
... |