Apply the interface naming schema only once, when reporting nics - #209
Open
GeertJohan wants to merge 1 commit into
Open
Apply the interface naming schema only once, when reporting nics#209GeertJohan wants to merge 1 commit into
GeertJohan wants to merge 1 commit into
Conversation
…al-api getPortsConfig applied the schema and keyed the port map by the transformed name, and GetNics then applied the schema a second time on the already transformed values. Consequences: - swap swapped twice and behaved like default - under swap and alias the interface blacklist no longer matched, because it is compared against the transformed map keys - GetSwitchPorts returned transformed names, so the phone-home LLDP clients tried to open pcap handles on netdev names that do not exist Keep the port map keyed by the real interface names and apply the schema once, in GetNics.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Targets #208 (branch
naming-schema-option).While adding the naming schema option in our SONiC setup (Edgecore AS7726-32X, Broadcom SONiC 4.5.2, native
intf_naming_mode) I noticed the schema gets applied twice:getPortsConfigtransforms the ports and keys the map by the transformed name, andGetNicsthen callsgetPortByNamingSchemaagain on the already transformed values. That has three consequences:swapswaps twice inGetNicsand ends up behaving exactly likedefaultswapandaliasthe interface blacklist (spine uplinks etc.) is compared against transformed map keys and no longer matches, so uplinks would get registered as machine nicsGetSwitchPortsreturns the transformed names, andConstantlyPhoneHomeopens one LLDP pcap client per returned name, so underswap/aliasit would try to open netdevs likeEth1/1that do not exist on anEthernet0-named system and machine liveness would silently breakThis change keeps the port map keyed by the real interface names (blacklist matching and pcap handles need the actual netdevs) and applies the schema in one place only, when building the
V1SwitchNiclist for the metal-api.