Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sort the system port ID generation (#20075)
#### Why I did it The system_port_id generation was based on the loop below for interface in **interface_metadata.findall**(str(QName(ns1, "DeviceInterfaceMetadata"))): "DeviceInterfaceMetadata" defined in the minigraph in DeviceInfo section, which is per interface and in this loop we increment the system_port_id++ so that each interface will have a unique ID. The for loop was based on interface_metadata list extracted by findall() API matching tag **"DeviceInterfaceMetadata"** [lxml.etree._Element](https://lxml.de/api/lxml.etree._Element-class.html). findall() doesn't guarantee document order. Hence the interface list and the corresponding system_port ids generated - has a possibility of not matching across config_db's in different linecards of a chassis. When SYSTEM_PORT table entries hve mismatch across linecards, a few line cards behaving erratically, resulting in continuous pkt error interrupts getting fired and the IBGP sessions not getting established with other peer ASIC's in other line cards. ### How I did it Add logic to do a sort of the system_ports dictionary based on the key (eg: "str-sonic-lc03|ASIC0|Ethernet120") and assign the system_port_id in an incremental way. This makes sure the system_port_ids in SYSTEM_PORT table in config_db matches in all linecards/asic Thanks to @abdosi and @vmittal-msft in triaging and coming to this solution. #### How to verify it Verified by manually patching this logic in the minigraph parser in the sonic T2 chassis and make sure the dockers, interfaces, IBGP, EBGP comes up in all linecards across the chassis.
- Loading branch information