Fix issue: module id got from get_change_event is wrong (#9961)

Signed-off-by: Stephen Sun <stephens@nvidia.com>
This commit is contained in:
Stephen Sun 2022-02-13 11:50:37 +08:00 committed by GitHub
parent b621dafff7
commit 486e9b0c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,16 +360,12 @@ class sfp_event:
logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i) logical_port = sx_port_log_id_t_arr_getitem(logical_port_list, i)
rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p) rc = sx_api_port_device_get(self.handle, 1 , 0, port_attributes_list, port_cnt_p)
port_cnt = uint32_t_p_value(port_cnt_p) port_cnt = uint32_t_p_value(port_cnt_p)
x = 0 # x is the port index within a LC
for i in range(port_cnt): for i in range(port_cnt):
port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i) port_attributes = sx_port_attributes_t_arr_getitem(port_attributes_list,i)
if port_attributes.log_port == logical_port: if port_attributes.log_port == logical_port:
label_port = slot_id * DeviceDataManager.get_linecard_max_port_count() + x + 1 label_port = slot_id * DeviceDataManager.get_linecard_max_port_count() + port_attributes.port_mapping.module_port
break break
if port_attributes.port_mapping.slot == slot_id:
x += 1
if label_port is not None: if label_port is not None:
label_port_list.append(label_port) label_port_list.append(label_port)