Michael Walsh | ed5b46e | 2017-05-24 11:49:14 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | r""" |
| 4 | Provide useful ipmi functions. |
| 5 | """ |
| 6 | |
| 7 | import gen_misc as gm |
| 8 | import gen_robot_keyword as grk |
| 9 | import gen_robot_utils as gru |
| 10 | import tempfile |
| 11 | gru.my_import_resource("ipmi_client.robot") |
| 12 | |
| 13 | |
| 14 | ############################################################################### |
| 15 | def get_sol_info(): |
| 16 | |
| 17 | r""" |
| 18 | Get all SOL info and return it as a dictionary. |
| 19 | |
| 20 | Example use: |
| 21 | |
| 22 | Robot code: |
| 23 | ${sol_info}= get_sol_info |
| 24 | Rpvars sol_info |
| 25 | |
| 26 | Output: |
| 27 | sol_info: |
| 28 | sol_info[Info]: SOL parameter 'Payload Channel (7)' not supported - defaulting to 0x0e |
| 29 | sol_info[Character Send Threshold]: 1 |
| 30 | sol_info[Force Authentication]: true |
| 31 | sol_info[Privilege Level]: USER |
| 32 | sol_info[Set in progress]: set-complete |
| 33 | sol_info[Retry Interval (ms)]: 100 |
| 34 | sol_info[Non-Volatile Bit Rate (kbps)]: IPMI-Over-Serial-Setting |
| 35 | sol_info[Character Accumulate Level (ms)]: 100 |
| 36 | sol_info[Enabled]: true |
| 37 | sol_info[Volatile Bit Rate (kbps)]: IPMI-Over-Serial-Setting |
| 38 | sol_info[Payload Channel]: 14 (0x0e) |
| 39 | sol_info[Payload Port]: 623 |
| 40 | sol_info[Force Encryption]: true |
| 41 | sol_info[Retry Count]: 7 |
| 42 | """ |
| 43 | |
| 44 | status, ret_values = grk.run_key_u("Run IPMI Standard Command sol info") |
| 45 | |
| 46 | # Create temp file path. |
| 47 | temp = tempfile.NamedTemporaryFile() |
| 48 | temp_file_path = temp.name |
| 49 | |
| 50 | # Write sol info to temp file path. |
| 51 | text_file = open(temp_file_path, "w") |
| 52 | text_file.write(ret_values) |
| 53 | text_file.close() |
| 54 | |
| 55 | # Use my_parm_file to interpret data. |
| 56 | sol_info = gm.my_parm_file(temp_file_path) |
| 57 | |
| 58 | return sol_info |
| 59 | |
| 60 | ############################################################################### |