Skip to content

Commit

Permalink
Unify invalid value string/integer/float; add get_system_airflow API,…
Browse files Browse the repository at this point in the history
… ^Cr 4-way discussion on Oct 28th, 2019.
  • Loading branch information
clarklee-guizhao committed Oct 30, 2019
1 parent 96ed0fe commit 8f09d74
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 67 deletions.
21 changes: 15 additions & 6 deletions hal_bmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,28 @@ def get_info(self):
@return dict of BMC info or None for failure
{
"Version": "1.1.1",
"Flash": "master",
"Next": "master"
"Version": "1.1.1", # "N/A"
"Flash": "master", # "N/A"
"Next": "master" # "N/A"
}
"""

def get_version_all(self):
"""
@return dict of BMCs
{
"MasterVersion": "1.1.1", # "N/A"
"SlaveVersion": "1.1.1" # "N/A"
}
"""
pass

def get_status(self):
"""
Get BMC system status
@return dict of system status or None for failure
# "N/A" for invalid outpouts
{
"CPU": {
"StateOutputs": "output of command 'top -bn 1'"
Expand All @@ -54,7 +65,7 @@ def get_next_boot(self):
"""
Get next booting flash of BMC
@return 'master'/'slave' on success, "Failed" for failure
@return 'master'/'slave' on success, "N/A" for failure
"""
pass

Expand All @@ -71,7 +82,5 @@ def set_next_boot(self):
def reboot(self):
"""
Reboot running BMC
@return 0 for success, -1 for failure
"""
pass
8 changes: 4 additions & 4 deletions hal_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_state(self):
"""
Get CPU current state.
@return 'S0', ..., 'S5', or None for failure
@return 'S0', ..., 'S5', or 'N/A' for failure
"""
pass

Expand All @@ -31,8 +31,8 @@ def get_mca_error(self):
@return List of MCERR and IERR counts, or None for failure
Example:
{
"MCErr": 0,
"IErr": 0
"MCErr": 0, # -99999
"IErr": 0 # -99999
}
"""
pass
Expand All @@ -51,6 +51,6 @@ def get_last_reset(self):
"""
Get last CPU reset type, WARM/COLD.
@return Last CPU reset type, "WARM"/"COLD", None for failure
@return Last CPU reset type, "WARM"/"COLD", "N/A" for failure
"""
pass
42 changes: 21 additions & 21 deletions hal_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_watchdog_status(self):
"""
Get Fan watchdog status.
@return 'Normal'/'Abnormal'/'Failed' for status good/bad/read-failed.
@return 'Normal'/'Abnormal'/'N/A' for status good/bad/read-failed.
"""
pass

Expand Down Expand Up @@ -130,11 +130,11 @@ def get_fru_info(self, fan_name):
# Properties
"Name": "FAN1",
"SN": "serial_number_example", # 'N/A'
"PN": "part_number_exampple",
"Rotors": 2,
"AirFlow": "F2B",
"SpeedMin": 2000,
"SpeedMax": 30000
"PN": "part_number_exampple", # 'N/A'
"Rotors": 2, # -1
"AirFlow": "F2B", # 'N/A'
"SpeedMin": 2000, # -1
"SpeedMax": 30000 # -1
}
"""
pass
Expand All @@ -147,9 +147,9 @@ def get_status(self, fan_name):
Example return value(all keys are mandatory)
{
"Rotor1": {
"Running": "no",
"HwAlarm": "yes",
"speed": 0
"Running": "no", # 'N/A'
"HwAlarm": "yes", # 'N/A'
"speed": 0 # -1
},
"Rotor2": {
"Running": "yes",
Expand All @@ -167,24 +167,24 @@ def get_info_all(self):
@return dict of all system fans' infor for success, None for failure
Example return value(all keys are mandatory)
{
"Number": 2,
"WatchdogStatus": "Normal", # "Abnormal"/"Failed"
"Number": 2, # -1
"WatchdogStatus": "Normal", # "Abnormal"/"N/A"
"FAN1": {
# Properties
"Name": FAN1,
"SN": "serial_number_example",
"PN": "part_number_exampple",
"Present": "yes"
"Rotors": 2,
"AirFlow": "F2B",
"SpeedMin": 2000,
"SpeedMax": 30000,
"SN": "serial_number_example", # 'N/A'
"PN": "part_number_exampple", # 'N/A'
"Present": "yes", # 'N/A'
"Rotors": 2, # -1
"AirFlow": "F2B", # 'N/A'
"SpeedMin": 2000, # -1
"SpeedMax": 30000, # -1
# Status, dynamic data
"Rotor1": {
"Running": "yes",
"HwAlarm": "no"
"Speed": 7000
"Running": "yes", # 'N/A'
"HwAlarm": "no", # 'N/A'
"Speed": 7000 # -1
},
"Rotor2": {
"Running": "yes",
Expand Down
2 changes: 1 addition & 1 deletion hal_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_bios_next_boot(self):
"""
Get next booting flash of BIOS
@return "master"/"slave" on success, "Failed" for failure
@return "master"/"slave" on success, "N/A" for failure
"""
pass

Expand Down
27 changes: 22 additions & 5 deletions hal_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ def get_bios_boot_status(self):
@return Dict of BIOS boot status or None for failure
Example:
{
"Flash": "master",
"Result": "success"
"Flash": "master", # "slave" or 'N/A'
"Result": "success" # "failed" or 'N/A'
}
"""
pass

def get_bmc_boot_status(self):
"""
Get BMC last boot status
Get BMC latest boot status
@return "master"/"slave" for boot successfully from master/slave flash
"N/A" for read failed
"""
pass

Expand All @@ -52,7 +53,7 @@ def set_host_cpu_power(self, power_command):
Control host cpu power
@param power_command Control command of host CPU's power,
should be "on"/"off"/"cycle"
should be "on"/"off"/"cycle"/"reset"
@return 0 for success, -1 for failure
"""
Expand All @@ -63,7 +64,7 @@ def get_host_cpu_power_status(self):
Get host cpu power status
@return Power status of CPU(and affiliates), value should be
"on"/"off", or "failed" for failure
"on"/"off", or "N/A" for failure
"""
pass

Expand All @@ -76,3 +77,19 @@ def set_location_led(self, cmd):
@return 0 for success, -1 for failure
"""
pass

def get_location_led(self):
"""
Get location LED admin status
@return status of location LED, "on"/"off" or "N/A" for failure
"""
pass

def get_system_airflow(self):
"""
Get system air flow.
@return "F2B"/"B2F" on success, "N/A" for failure
"""
pass
46 changes: 23 additions & 23 deletions hal_psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def get_fru_info(self, psu_name):
Example return value(all keys are mandatory)
{
"Name": "PSU1",
"SN": "serial_number_example",
"PN": "part_number_example",
"AirFlow": "B2F",
"SN": "serial_number_example", # 'N/A'
"PN": "part_number_example", # 'N/A'
"AirFlow": "B2F" # 'N/A'
}
"""
pass
Expand All @@ -59,18 +59,18 @@ def get_status(self, psu_name):
Example return value(all keys are mandatory)
{
"Name": "PSU1",
"InputType": "DC",
"InputType": "DC", # "AC" or 'N/A'
"InputStatus": True, # H/W status bit
"OutputStatus": True # H/W status bit
"FanSpeed": {
"Value": 4000,
"Min": 2000,
"Max": 10000,
"Value": 4000, # -99999
"Min": 2000, # -99999
"Max": 10000 # -99999
},
"Temperature": {
"Value": 40.0,
"Min": -30.0,
"Max": 50.0
"Value": 40.0, # -99999.0
"Min": -30.0, # -99999.0
"Max": 50.0 # -99999.0
}
}
"""
Expand All @@ -86,23 +86,23 @@ def get_power_status(self, psu_name):
"Name": "PSU1",
"Inputs": {
"Status": True, # H/W status bit
"Type": "DC", # or "AC"
"Type": "DC", # or "AC" or "N/A"
"Voltage": {
"Value": 220,
"LowAlarm": 200,
"HighAlarm": 240,
"Value": 220, # -1
"LowAlarm": 200, # -1
"HighAlarm": 240, # -1
"Unit": "V"
},
"Current": {
"Value": 6.0,
"LowAlarm": 0.2,
"HighAlarm": 7.0,
"Value": 6.0, # -99999.0
"LowAlarm": 0.2, # -99999.0
"HighAlarm": 7.0, # -99999.0
"Unit": "A"
},
"Power": {
"Value": 1000,
"LowAlarm": -1,
"HighAlarm": 1400,
"Value": 1000, # -99999
"LowAlarm": -1, # -99999
"HighAlarm": 1400, # -99999
"Unit": "W"
}
},
Expand Down Expand Up @@ -149,9 +149,9 @@ def get_info_all(self):
{
"Number": 2,
"PSU1": {
"SN": "serial_number_example",
"PN": "part_number_example",
"AirFlow": "F2B",
"SN": "serial_number_example", # 'N/A'
"PN": "part_number_example", # 'N/A'
"AirFlow": "F2B", # 'N/A'
"FanSpeed": {
"Value": 4000,
Expand Down
22 changes: 18 additions & 4 deletions hal_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class for HAL sensor APIs.
@param sensor_dict: Dict of sensor value
Example:
{
"Value": 30.0,
"Min": -10.0,
"Max": 50.0
"Unit": "C"
"Value": 30.0, # -99999.0
"Min": -10.0, # -99999.0
"Max": 50.0, # -99999.0
"Unit": "C" # "N/A"
}
@param name Name of a specific sensor
"""
Expand Down Expand Up @@ -71,3 +71,17 @@ def get_sensor(self, name):
@return sensor_dict or None for failure
"""
pass

def get_sensor_info(self):
"""
@return dict of sensors' information
{
"SensorName1": {
"Value": 1.0, # -99999.0
"Min": 0.0, # -99999.0
"Max": 2.0, # -99999.0
"Unit": "C" # "N/A"
}
}
"""
pass
6 changes: 3 additions & 3 deletions hal_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class for HAL temperature APIs.
point number.
Example:
{
"Value": 30.0,
"Min": -10.0,
"Max": 50.0
"Value": 30.0, # -99999.0
"Min": -10.0, # -99999.0
"Max": 50.0 # -99999.0
}
"""

Expand Down

0 comments on commit 8f09d74

Please sign in to comment.