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 Given that a network connection specifies both an interface name and a MAC address for configuring a parent and VLAN connection, and the physical interface has the same permanent and current MAC address, when the configuration is applied multiple times, then 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. When running the integration test `tests_mac_address_match.yml`, it is essential to provide an Ethernet interface of which the permanent MAC address matches the current MAC address. Typically, the vritual interface like VLAN lacks a valid permanent MAC address and inherits the current MAC address of its parent interface instead of the permanent MAC. Thus, the test can 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. Notice that the test `tests_mac_address_match.yml` will be skipped in upstream testing in short term until the upstream testing machine is set up with two extra NICs. Resolves: https://issues.redhat.com/browse/RHEL-74211 Signed-off-by: Wen Liang <[email protected]>
- Loading branch information