Skip to content

Commit cbd21d8

Browse files
authored
[202205][DellEMC] Fixing 'show interface status' break in DellEMC platforms porting changes (sonic-net#13236)
1 parent 3e36d72 commit cbd21d8

File tree

14 files changed

+42
-23
lines changed

14 files changed

+42
-23
lines changed

platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/chassis.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ def __init__(self):
106106
for port_num in range(self.PORT_START, (self.PORT_END + 1)):
107107
# sfp get uses zero-indexing, but port numbers start from 1
108108
presence = self.get_sfp(port_num).get_presence()
109-
if presence:
110-
self._global_port_pres_dict[port_num] = '1'
111-
else:
112-
self._global_port_pres_dict[port_num] = '0'
109+
self._global_port_pres_dict[port_num] = '0'
113110

114111
self._watchdog = Watchdog()
115112

platform/broadcom/sonic-platform-modules-dell/s5212f/sonic_platform/component.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self, component_index = 0):
7676
self.index = component_index
7777
self.name = self.CHASSIS_COMPONENTS[self.index][0]
7878
self.description = self.CHASSIS_COMPONENTS[self.index][1]
79-
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
79+
self.version = None
8080

8181
def get_name(self):
8282
"""
@@ -100,6 +100,8 @@ def get_firmware_version(self):
100100
Returns:
101101
A string containing the firmware version of the component
102102
"""
103+
if self.version == None:
104+
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
103105
return self.version
104106

105107
def install_firmware(self, image_path):

platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/chassis.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ def __init__(self):
110110
for port_num in range(self.PORT_START, (self.PORT_END + 1)):
111111
# sfp get uses zero-indexing, but port numbers start from 1
112112
presence = self.get_sfp(port_num-1).get_presence()
113-
if presence:
114-
self._global_port_pres_dict[port_num] = '1'
115-
else:
116-
self._global_port_pres_dict[port_num] = '0'
113+
self._global_port_pres_dict[port_num] = '0'
117114

118115
# check for this event change for sfp / do we need to handle timeout/sleep
119116

platform/broadcom/sonic-platform-modules-dell/s5224f/sonic_platform/component.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self, component_index = 0):
7676
self.index = component_index
7777
self.name = self.CHASSIS_COMPONENTS[self.index][0]
7878
self.description = self.CHASSIS_COMPONENTS[self.index][1]
79-
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
79+
self.version = None
8080

8181
def get_name(self):
8282
"""
@@ -100,6 +100,8 @@ def get_firmware_version(self):
100100
Returns:
101101
A string containing the firmware version of the component
102102
"""
103+
if self.version == None:
104+
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
103105
return self.version
104106

105107
def install_firmware(self, image_path):

platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/chassis.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ def __init__(self):
9292

9393
for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK):
9494
# sfp get uses zero-indexing, but port numbers start from 1
95-
presence = self.get_sfp(port_num).get_presence()
96-
self._global_port_pres_dict[port_num] = '1' if presence else '0'
95+
self._global_port_pres_dict[port_num] = '0'
9796

9897
def __del__(self):
9998
if self.oir_fd != -1:

platform/broadcom/sonic-platform-modules-dell/s5232f/sonic_platform/component.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, component_index = 0):
8686
self.index = component_index
8787
self.name = self.CHASSIS_COMPONENTS[self.index][0]
8888
self.description = self.CHASSIS_COMPONENTS[self.index][1]
89-
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
89+
self.version = None
9090

9191
def get_name(self):
9292
"""
@@ -110,6 +110,8 @@ def get_firmware_version(self):
110110
Returns:
111111
A string containing the firmware version of the component
112112
"""
113+
if self.version == None:
114+
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
113115
return self.version
114116

115117
def install_firmware(self, image_path):

platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/chassis.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ def __init__(self):
151151
self._component_list = [Component(i) for i in range(MAX_S5248F_COMPONENT)]
152152
for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK):
153153
# sfp get uses zero-indexing, but port numbers start from 1
154-
presence = self.get_sfp(port_num-1).get_presence()
155-
self._global_port_pres_dict[port_num] = '1' if presence else '0'
154+
self._global_port_pres_dict[port_num] = '0'
156155

157156
#self.LOCATOR_LED_ON = self.STATUS_LED_COLOR_BLUE_BLINK
158157
#self.LOCATOR_LED_OFF = self.STATUS_LED_COLOR_OFF

platform/broadcom/sonic-platform-modules-dell/s5248f/sonic_platform/component.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, component_index = 0):
8686
self.index = component_index
8787
self.name = self.CHASSIS_COMPONENTS[self.index][0]
8888
self.description = self.CHASSIS_COMPONENTS[self.index][1]
89-
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
89+
self.version = None
9090

9191
def get_name(self):
9292
"""
@@ -110,6 +110,8 @@ def get_firmware_version(self):
110110
Returns:
111111
A string containing the firmware version of the component
112112
"""
113+
if self.version == None:
114+
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
113115
return self.version
114116

115117
def install_firmware(self, image_path):

platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class Chassis(ChassisBase):
5656
_is_fan_control_enabled = False
5757
_fan_control_initialised = False
5858

59+
_global_port_pres_dict = {}
60+
61+
5962
def __init__(self):
6063
ChassisBase.__init__(self)
6164
self.status_led_reg = "system_led"
@@ -107,6 +110,9 @@ def __init__(self):
107110
component = Component(i)
108111
self._component_list.append(component)
109112

113+
for port_num in range(self.PORT_START, (self.PORT_END + 1)):
114+
self._global_port_pres_dict[port_num] = '0'
115+
110116
def _get_cpld_register(self, reg_name):
111117
rv = 'ERR'
112118
mb_reg_file = self.CPLD_DIR+'/'+reg_name

platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py

+10
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class Chassis(ChassisBase):
6565
'amber': 0x02, 'blinking amber': 0x08
6666
}
6767

68+
_global_port_pres_dict = {}
69+
70+
6871
def __init__(self):
6972

7073
ChassisBase.__init__(self)
@@ -103,6 +106,13 @@ def __init__(self):
103106
component = Component(i)
104107
self._component_list.append(component)
105108

109+
for i in self._sfp_list:
110+
presence = i.get_presence()
111+
if presence:
112+
self._global_port_pres_dict[i.index] = '1'
113+
else:
114+
self._global_port_pres_dict[i.index] = '0'
115+
106116
bios_ver = self.get_component(0).get_firmware_version()
107117
bios_minor_ver = bios_ver.split("-")[-1]
108118
if bios_minor_ver.isdigit() and (int(bios_minor_ver) >= 9):

platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
try:
1313
from sonic_eeprom import eeprom_tlvinfo
14+
import os
1415
except ImportError as e:
1516
raise ImportError(str(e) + "- required module not found")
1617

@@ -27,6 +28,10 @@ def __init__(self, i2c_line=0, iom_eeprom=False):
2728
super(Eeprom, self).__init__(self.eeprom_path, 0, '', True)
2829
self.eeprom_tlv_dict = dict()
2930

31+
if os.geteuid() != 0:
32+
self.eeprom_data = "N/A"
33+
return
34+
3035
try:
3136
if self.is_module:
3237
self.write_eeprom(b"\x00\x00")

platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/chassis.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ def __init__(self):
8484

8585
for port_num in range(self.PORT_START, (self.PORT_END + 1)):
8686
presence = self.get_sfp(port_num).get_presence()
87-
if presence:
88-
self._global_port_pres_dict[port_num] = '1'
89-
else:
90-
self._global_port_pres_dict[port_num] = '0'
87+
self._global_port_pres_dict[port_num] = '0'
9188

9289
def __del__(self):
9390
if self.oir_fd != -1:

platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/chassis.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ def __init__(self):
147147
self._component_list = [Component(i) for i in range(MAX_Z9332F_COMPONENT)]
148148
for port_num in range(self.PORT_START, self.PORTS_IN_BLOCK):
149149
# sfp get uses zero-indexing, but port numbers start from 1
150-
presence = self.get_sfp(port_num).get_presence()
151-
self._global_port_pres_dict[port_num] = '1' if presence else '0'
150+
self._global_port_pres_dict[port_num] = '0'
152151

153152
self._watchdog = Watchdog()
154153
def __del__(self):

platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def __init__(self, component_index=0):
153153
self.index = component_index
154154
self.name = self.CHASSIS_COMPONENTS[self.index][0]
155155
self.description = self.CHASSIS_COMPONENTS[self.index][1]
156-
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
156+
self.version = None
157157

158158
@staticmethod
159159
def _get_available_firmware_version(image_path):
@@ -242,6 +242,8 @@ def get_firmware_version(self):
242242
Returns:
243243
A string containing the firmware version of the component
244244
"""
245+
if self.version == None:
246+
self.version = self.CHASSIS_COMPONENTS[self.index][2]()
245247
return self.version
246248

247249
def get_presence(self):

0 commit comments

Comments
 (0)