Skip to content

Commit

Permalink
[BFN] Updated PSU platform APIs impl
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Lytvynenko <[email protected]>
  • Loading branch information
dmytroxIntel authored and Andriy Kokhan committed Dec 7, 2021
1 parent c1fa273 commit c55f750
Showing 1 changed file with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Psu(PsuBase):
def __init__(self, index):
PsuBase.__init__(self)
self.__index = index
# STUB IMPLEMENTATION
self.color = ""

'''
Units of returned info object values:
Expand Down Expand Up @@ -95,16 +97,85 @@ def psu_present_get(client):
status = thrift_try(psu_present_get)
return status

def set_status_led(self, color):
"""
Sets the state of the PSU status LED
Args:
color: A string representing the color with which to set the
PSU status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
# STUB IMPLEMENTATION
self.color = color
return True

def get_status_led(self):
"""
Gets the state of the PSU status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
# STUB IMPLEMENTATION
return self.color

# DeviceBase iface:
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return self.__info_get().serial

def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return self.__info_get().model

def is_replaceable(self):
"""
Indicate whether this device is replaceable.
Returns:
bool: True if it is replaceable.
"""
return True

def get_revision(self):
"""
Retrieves the hardware revision of the device
Returns:
string: Revision value of device
"""
return self.__info_get().rev

def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
return self.get_powergood_status()

def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position
for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned
Returns:
integer: The 1-based relative physical position in parent device or -1 if cannot determine the position
"""
return self.__index

def psu_list_get():
psu_list = []
for i in range(1, Psu.get_num_psus() + 1):
Expand Down

0 comments on commit c55f750

Please sign in to comment.