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