def get_bmc_df(df_parm_string=""): r""" Get df report from BMC and return as a report "object". A df report object is a list where each entry is a dictionary whose keys are the field names from the first entry in report_list. Example df report object: df_report: df_report[0]: [filesystem]: dev [1k-blocks]: 247120 [used]: 0 [available]: 247120 [use%]: 0% [mounted]: /dev df_report[1]: [filesystem]: dev [1k-blocks]: 247120 [used]: 0 [available]: 247120 [use%]: 0% [mounted]: /dev . Description of argument(s): df_parm_string A string containing valid df command parms (e.g. "-h /var"). """ out_buf, stderr, rc = bsu.bmc_execute_command("df " + df_parm_string) return vf.outbuf_to_report(out_buf)
def get_user_access_ipmi(channel_number=1): r""" Run 'user list [<channel number>]' command and return the result as a list of dictionaries. Example robot code: ${users_access}= user list 1 Rprint Vars users_access Example output: users: [0]: [id]: 1 [name]: root [callin]: false [link]: true [auth]: true [ipmi]: ADMINISTRATOR [1]: [id]: 2 [name]: axzIDwnz [callin]: true [link]: false [auth]: true [ipmi]: ADMINISTRATOR """ cmd_buf = "user list " + str(channel_number) stdout, stderr, rc = execute_ipmi_cmd(cmd_buf, "external", print_output=0) return vf.outbuf_to_report(stdout)
def channel_getciphers_ipmi(): r""" Run 'channel getciphers ipmi' command and return the result as a list of dictionaries. Example robot code: ${ipmi_channel_ciphers}= Channel Getciphers IPMI Rprint Vars ipmi_channel_ciphers Example output: ipmi_channel_ciphers: [0]: [id]: 3 [iana]: N/A [auth_alg]: hmac_sha1 [integrity_alg]: hmac_sha1_96 [confidentiality_alg]: aes_cbc_128 [1]: [id]: 17 [iana]: N/A [auth_alg]: hmac_sha256 [integrity_alg]: sha256_128 [confidentiality_alg]: aes_cbc_128 """ cmd_buf = "channel getciphers ipmi | sed -re 's/ Alg/_Alg/g'" stdout, stderr, rc = execute_ipmi_cmd(cmd_buf, "external", print_output=0) return vf.outbuf_to_report(stdout)
def get_fru_status(): r""" Get the fru status and return as a list of dictionaries. Example robot code: ${fru_status}= Get Fru Status Rprint Vars fru_status fmt=1 Example result (excerpt): fru_status: fru_status[0]: [component]: cpu0 [is_a]: Yes [fru]: Yes [present]: Yes [functional]: No fru_status[1]: [component]: cpu0-core0 [is_a]: No [fru]: Yes [present]: Yes [functional]: No ... """ rc, output = openbmctool_execute_command("fru status", print_output=False, ignore_err=False) # Example value for output (partial): # Component | Is a FRU | Present | Functional | Has Logs # cpu0 | Yes | Yes | Yes | No # cpu0-core0 | No | Yes | Yes | No # ... # Replace spaces with underscores in field names (e.g. "Is a FRU" becomes # "Is_a_FRU"). output = re.sub("([^ \\|])[ ]([^ ])", "\\1_\\2", output) output = re.sub("([^ \\|])[ ]([^ ])", "\\1_\\2", output) return vf.outbuf_to_report(output, field_delim="|")
def get_sensors_list(): r""" Get the output of the sensors list command and return as a list of dictionaries. Example robot code: ${sensors_list}= Get Sensors List Rprint Vars sensors_list fmt=1 Example result (excerpt): sensors_list: sensors_list[0]: [sensor]: OCC0 [type]: Discrete [units]: N/A [value]: Active [target]: Active sensors_list[1]: [sensor]: OCC1 [type]: Discrete [units]: N/A [value]: Active [target]: Active ... """ rc, output = openbmctool_execute_command("sensors list", print_output=False, ignore_err=False) # Example value for output (partial): # sensor | type | units | value | target # OCC0 | Discrete | N/A | Active | Active # OCC1 | Discrete | N/A | Active | Active return vf.outbuf_to_report(output, field_delim="|")