Skip to content

Commit 890a2ad

Browse files
tests: Prioritize find link info by permanent MAC address, with fallback 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 <[email protected]>
1 parent 2439f44 commit 890a2ad

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
---
3+
- name: Play for testing MAC address match on device
4+
hosts: all
5+
vars_prompt:
6+
- name: "interface"
7+
prompt: "Please provide the interface name (e.g., eno2)"
8+
private: no
9+
- name: "mac"
10+
prompt: "Please provide the MAC address to match (e.g., ec:f4:BB:d3:EC:92)"
11+
private: no
12+
vars:
13+
profile: "{{ interface }}"
14+
vlan_profile: "{{ interface }}.3732"
15+
lsr_fail_debug:
16+
- __network_connections_result
17+
tags:
18+
- "tests::mac"
19+
tasks:
20+
- name: Show playbook name
21+
debug:
22+
msg: "this is: playbooks/tests_mac_address_match.yml"
23+
tags:
24+
- always
25+
26+
- name: Test the MAC address match
27+
tags:
28+
- tests::mac:match
29+
block:
30+
- name: Include the task 'run_test.yml'
31+
include_tasks: tasks/run_test.yml
32+
vars:
33+
lsr_description: Test MAC address match on device
34+
lsr_setup:
35+
- tasks/assert_profile_absent.yml
36+
lsr_test:
37+
- tasks/create_mac_address_match.yml
38+
lsr_assert:
39+
- tasks/assert_profile_present.yml
40+
- tasks/assert_network_connections_succeeded.yml
41+
lsr_cleanup:
42+
- tasks/cleanup_vlan_and_parent_profile+device.yml
43+
- tasks/check_network_dns.yml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
---
3+
- name: Assert that configuring network connections is succeeded
4+
assert:
5+
that:
6+
- __network_connections_result.failed == false
7+
msg: Configuring network connections is failed with the error
8+
"{{ __network_connections_result.stderr }}"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
---
3+
- name: Clean up the test devices and the connection profiles
4+
tags:
5+
- "tests::cleanup"
6+
block:
7+
- name: Import network role
8+
import_role:
9+
name: linux-system-roles.network
10+
vars:
11+
network_connections:
12+
- name: "{{ profile }}"
13+
persistent_state: absent
14+
state: down
15+
- name: "{{ vlan_profile }}"
16+
persistent_state: absent
17+
state: down
18+
failed_when: false
19+
- name: Delete the device '{{ interface }}'
20+
command: ip link del {{ interface }}
21+
failed_when: false
22+
changed_when: false
23+
...

0 commit comments

Comments
 (0)