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 When providing the interface name and mac address at the same time in the network connections for configuring the parent and the vlan connection, and applying the same network connections multiple times, the network role will raise an error - “profile specifies interface_name 'eno2' and mac 'ec:f4:bb:d3:ec:92' but no such interface exists”. The reason for the issue is that `SysUtil._link_infos_fetch()` will create a dictionary containing all the available link infos in the `/sys/class/net/`, each dictionary element has the structure - {“ifname”: {“ifindex”, “ifname”, “address”, “perm-address”}}, later on, in the `SysUtil.link_info_find()` function, the code iterates through all the link info in the aforementioned dictionary, and tries to compare if the mac address that the user specified in the network connections appeared either as the “perm-address” or “address” (current address) in the link info, return such link info if appeared. However, if the mac address that the user specified matches only the “address” but not the “perm-address”, the function will still return. In this case, the returned link info will contain a different “ifname” than the interface name that the user specified in the network connections, as a result, the error is raised. 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 the test requires to know the permanent mac address to match when configuring vlan's parent. Resolves: https://issues.redhat.com/browse/RHEL-74211 Signed-off-by: Wen Liang <[email protected]>
- Loading branch information