diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py index 7ce532554f..cd1f77a277 100644 --- a/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py +++ b/device/alphanetworks/x86_64-alphanetworks_snh60a0_320fv2-r0/plugins/led_control.py @@ -187,9 +187,15 @@ class LedControl(LedControlBase): lanes = swss.get( swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + # SonicV2Connector.get() will return None when key does not exist. + if lanes: + lanes_len = len(lanes.split(',')) + else: + lanes_len = 0 + # SONiC port nums are 0-based and increment by 4 # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(','))) + return (((sonic_port_num/4) + 1), sonic_port_num % 4, lanes_len) # Concrete implementation of port_link_state_change() method diff --git a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py index e7c8d3bc1e..67d381d973 100644 --- a/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py +++ b/device/alphanetworks/x86_64-alphanetworks_snh60b0_640f-r0/plugins/led_control.py @@ -154,9 +154,16 @@ class LedControl(LedControlBase): lanes = swss.get( swss.APPL_DB, self.PORT_TABLE_PREFIX + port_name, 'lanes') + # SonicV2Connector.get() will return None when key does not exist. + if lanes: + lanes_len = len(lanes.split(',')) + else: + lanes_len = 0 + + # SONiC port nums are 0-based and increment by 4 # Arista QSFP indices are 1-based and increment by 1 - return (((sonic_port_num/4) + 1), sonic_port_num % 4, len(lanes.split(','))) + return (((sonic_port_num/4) + 1), sonic_port_num % 4, lanes_len) # Concrete implementation of port_link_state_change() method