George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 2 | Documentation Test BMC using https://github.com/DMTF/Redfish-Usecase-Checkers |
| 3 | ... DMTF tool. |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 4 | |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 5 | Resource ../../lib/resource.robot |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 6 | Resource ../../lib/dmtf_tools_utils.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 8 | Library OperatingSystem |
| 9 | Library ../../lib/state.py |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 10 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 11 | Test Setup Test Setup Execution |
| 12 | Test Teardown Test Teardown Execution |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
| 15 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 16 | ${DEFAULT_PYTHON} python3 |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 17 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 18 | ${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git |
| 19 | ${rsv_dir_path} Redfish-Usecase-Checkers |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 20 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 21 | ${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py |
| 22 | ... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 23 | ... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}account-logs${/} |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 24 | |
| 25 | ${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py |
| 26 | ... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 27 | ... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}power-logs${/} |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 28 | |
| 29 | ${power_on_timeout} 15 mins |
| 30 | ${power_off_timeout} 15 mins |
| 31 | ${state_change_timeout} 3 mins |
ganesanb | bca06d0 | 2023-04-15 10:52:51 +0000 | [diff] [blame] | 32 | ${branch_name} main |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 33 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 34 | *** Test Cases *** |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 35 | |
| 36 | Test BMC Redfish Account Management |
| 37 | [Documentation] Check Account Management with a Redfish interface. |
| 38 | [Tags] Test_BMC_Redfish_Account_Management |
| 39 | |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 40 | ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1 |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 41 | |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 42 | ${output}= Shell Cmd cat ${EXECDIR}${/}account-logs${/}results.json |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 43 | Log ${output} |
| 44 | |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 45 | ${json}= OperatingSystem.Get File ${EXECDIR}${/}account-logs${/}results.json |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 46 | |
| 47 | ${object}= Evaluate json.loads('''${json}''') json |
| 48 | |
| 49 | ${result_list}= Set Variable ${object["TestResults"]} |
| 50 | |
| 51 | @{failed_tc_list}= Create List |
| 52 | |
| 53 | FOR ${result} IN @{result_list} |
| 54 | ${rc}= evaluate 'ErrorMessages'=='${result}' |
| 55 | ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]} |
| 56 | Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result} |
| 57 | END |
| 58 | |
| 59 | Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list} |
| 60 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 61 | |
Peter D Phan | 1c5d325 | 2021-12-30 12:53:49 -0600 | [diff] [blame] | 62 | Test BMC Redfish Power Control Usecase |
| 63 | [Documentation] Power Control Usecase Test. |
George Keishing | e23afb5 | 2022-03-17 08:25:49 -0500 | [diff] [blame] | 64 | [Tags] Test_BMC_Redfish_Power_Control_Usecase |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 65 | |
Peter D Phan | 1c5d325 | 2021-12-30 12:53:49 -0600 | [diff] [blame] | 66 | DMTF Power |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 67 | |
| 68 | |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 69 | *** Keywords *** |
| 70 | |
| 71 | Test Setup Execution |
| 72 | [Documentation] Do test case setup tasks. |
| 73 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 74 | Printn |
ganesanb | bca06d0 | 2023-04-15 10:52:51 +0000 | [diff] [blame] | 75 | Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name} |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 76 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 77 | |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 78 | Test Teardown Execution |
| 79 | [Documentation] Do the post-test teardown. |
| 80 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 81 | Printn |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 82 | FFDC On Test Case Fail |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 83 | |
| 84 | |
Peter D Phan | 1c5d325 | 2021-12-30 12:53:49 -0600 | [diff] [blame] | 85 | DMTF Power |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 86 | [Documentation] Power the BMC machine on via DMTF tools. |
| 87 | |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 88 | ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1 |
| 89 | Log ${output} |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 90 | |
George Keishing | fc3d8f1 | 2022-03-24 10:57:31 -0500 | [diff] [blame] | 91 | ${json}= OperatingSystem.Get File ${EXECDIR}${/}power-logs${/}results.json |
| 92 | |
| 93 | ${object}= Evaluate json.loads('''${json}''') json |
| 94 | |
| 95 | ${result_list}= Set Variable ${object["TestResults"]} |
| 96 | Log To Console result: ${result_list} |
| 97 | |
| 98 | @{failed_tc_list}= Create List |
| 99 | @{error_messages}= Create List |
| 100 | |
| 101 | FOR ${result} IN @{result_list} |
| 102 | ${rc}= evaluate 'ErrorMessages'=='${result}' |
| 103 | ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]} |
| 104 | Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result} |
| 105 | Run Keyword If ${rc} == True Set Variable |
| 106 | ... Append To List ${error_messages} ${result_list["ErrorMessages"]} |
| 107 | END |
| 108 | |
| 109 | Log Many ErrorMessages: @{error_messages} |
| 110 | Log To Console ErrorMessages: |
| 111 | FOR ${msg} IN @{error_messages} |
| 112 | Log To Console ${msg} |
| 113 | END |
| 114 | |
| 115 | Should Be Empty ${error_messages} DMTF Power keyword failed. |