Skip to content

Commit d2cfec7

Browse files
dmytroxIntelYour Name
authored and
Your Name
committed
[BFN] Updated PSU platform APIs impl
Signed-off-by: Dmytro Lytvynenko <[email protected]>
1 parent bfbffed commit d2cfec7

File tree

1 file changed

+71
-0
lines changed
  • platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform

1 file changed

+71
-0
lines changed

platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py

+71
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class Psu(PsuBase):
1818
def __init__(self, index):
1919
PsuBase.__init__(self)
2020
self.__index = index
21+
# STUB IMPLEMENTATION
22+
self.color = ""
2123

2224
'''
2325
Units of returned info object values:
@@ -95,16 +97,85 @@ def psu_present_get(client):
9597
status = thrift_try(psu_present_get)
9698
return status
9799

100+
def set_status_led(self, color):
101+
"""
102+
Sets the state of the PSU status LED
103+
104+
Args:
105+
color: A string representing the color with which to set the
106+
PSU status LED
107+
108+
Returns:
109+
bool: True if status LED state is set successfully, False if not
110+
"""
111+
# STUB IMPLEMENTATION
112+
self.color = color
113+
return True
114+
115+
def get_status_led(self):
116+
"""
117+
Gets the state of the PSU status LED
118+
119+
Returns:
120+
A string, one of the predefined STATUS_LED_COLOR_* strings above
121+
"""
122+
# STUB IMPLEMENTATION
123+
return self.color
124+
98125
# DeviceBase iface:
99126
def get_serial(self):
127+
"""
128+
Retrieves the serial number of the device
129+
130+
Returns:
131+
string: Serial number of device
132+
"""
100133
return self.__info_get().serial
101134

102135
def get_model(self):
136+
"""
137+
Retrieves the model number (or part number) of the device
138+
139+
Returns:
140+
string: Model/part number of device
141+
"""
103142
return self.__info_get().model
104143

105144
def is_replaceable(self):
145+
"""
146+
Indicate whether this device is replaceable.
147+
Returns:
148+
bool: True if it is replaceable.
149+
"""
106150
return True
107151

152+
def get_revision(self):
153+
"""
154+
Retrieves the hardware revision of the device
155+
156+
Returns:
157+
string: Revision value of device
158+
"""
159+
return self.__info_get().rev
160+
161+
def get_status(self):
162+
"""
163+
Retrieves the operational status of the device
164+
165+
Returns:
166+
A boolean value, True if device is operating properly, False if not
167+
"""
168+
return self.get_powergood_status()
169+
170+
def get_position_in_parent(self):
171+
"""
172+
Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position
173+
for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned
174+
Returns:
175+
integer: The 1-based relative physical position in parent device or -1 if cannot determine the position
176+
"""
177+
return self.__index
178+
108179
def psu_list_get():
109180
psu_list = []
110181
for i in range(1, Psu.get_num_psus() + 1):

0 commit comments

Comments
 (0)