blob: 4908488a7925b7f28acce5f2192220afd1512f98 [file] [log] [blame]
George Keishing4d9b7e12019-03-26 02:03:47 -05001*** Settings ***
George Keishing6a69d262019-04-03 03:45:27 -05002Documentation Test BMC using https://github.com/DMTF/Redfish-Usecase-Checkers
3... DMTF tool.
George Keishing4d9b7e12019-03-26 02:03:47 -05004
George Keishingfc3d8f12022-03-24 10:57:31 -05005Resource ../../lib/resource.robot
George Keishing6a69d262019-04-03 03:45:27 -05006Resource ../../lib/dmtf_tools_utils.robot
7Resource ../../lib/openbmc_ffdc.robot
George Keishingfc3d8f12022-03-24 10:57:31 -05008Library OperatingSystem
9Library ../../lib/state.py
George Keishing4d9b7e12019-03-26 02:03:47 -050010
George Keishing6a69d262019-04-03 03:45:27 -050011Test Setup Test Setup Execution
12Test Teardown Test Teardown Execution
George Keishing4d9b7e12019-03-26 02:03:47 -050013
14*** Variables ***
15
George Keishing6a69d262019-04-03 03:45:27 -050016${DEFAULT_PYTHON} python3
George Keishing4d9b7e12019-03-26 02:03:47 -050017
George Keishing6a69d262019-04-03 03:45:27 -050018${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git
19${rsv_dir_path} Redfish-Usecase-Checkers
George Keishing4d9b7e12019-03-26 02:03:47 -050020
George Keishing6a69d262019-04-03 03:45:27 -050021${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py
22... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
George Keishingfc3d8f12022-03-24 10:57:31 -050023... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}account-logs${/}
George Keishing6a69d262019-04-03 03:45:27 -050024
25${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py
26... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
George Keishingfc3d8f12022-03-24 10:57:31 -050027... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}power-logs${/}
George Keishing6a69d262019-04-03 03:45:27 -050028
29${power_on_timeout} 15 mins
30${power_off_timeout} 15 mins
31${state_change_timeout} 3 mins
ganesanbbca06d02023-04-15 10:52:51 +000032${branch_name} main
George Keishing4d9b7e12019-03-26 02:03:47 -050033
George Keishing409df052024-01-17 22:36:14 +053034*** Test Cases ***
George Keishing4d9b7e12019-03-26 02:03:47 -050035
36Test BMC Redfish Account Management
37 [Documentation] Check Account Management with a Redfish interface.
38 [Tags] Test_BMC_Redfish_Account_Management
39
manashsarmaa053fb32020-06-08 08:43:32 -050040 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1
George Keishing4d9b7e12019-03-26 02:03:47 -050041
George Keishingfc3d8f12022-03-24 10:57:31 -050042 ${output}= Shell Cmd cat ${EXECDIR}${/}account-logs${/}results.json
George Keishing4d9b7e12019-03-26 02:03:47 -050043 Log ${output}
44
George Keishingfc3d8f12022-03-24 10:57:31 -050045 ${json}= OperatingSystem.Get File ${EXECDIR}${/}account-logs${/}results.json
manashsarmaa053fb32020-06-08 08:43:32 -050046
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}
George Keishing4fc24152025-04-11 21:27:56 +053054 ${rc}= Evaluate 'ErrorMessages'=='${result}'
George Keishingc5dbbdd2025-05-07 13:55:17 +053055 ${num}= Set Variable If ${rc} == False ${result_list["${result}"]["fail"]}
56 IF ${num} != None and ${num} > 0
57 Append To List ${failed_tc_list} ${result}
58 END
manashsarmaa053fb32020-06-08 08:43:32 -050059 END
60
61 Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list}
62
George Keishing6a69d262019-04-03 03:45:27 -050063
Peter D Phan1c5d3252021-12-30 12:53:49 -060064Test BMC Redfish Power Control Usecase
65 [Documentation] Power Control Usecase Test.
George Keishinge23afb52022-03-17 08:25:49 -050066 [Tags] Test_BMC_Redfish_Power_Control_Usecase
George Keishing6a69d262019-04-03 03:45:27 -050067
Peter D Phan1c5d3252021-12-30 12:53:49 -060068 DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050069
70
George Keishing4d9b7e12019-03-26 02:03:47 -050071*** Keywords ***
72
73Test Setup Execution
74 [Documentation] Do test case setup tasks.
75
George Keishing6a69d262019-04-03 03:45:27 -050076 Printn
ganesanbbca06d02023-04-15 10:52:51 +000077 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name}
George Keishing4d9b7e12019-03-26 02:03:47 -050078
George Keishing6a69d262019-04-03 03:45:27 -050079
George Keishing4d9b7e12019-03-26 02:03:47 -050080Test Teardown Execution
81 [Documentation] Do the post-test teardown.
82
George Keishing6a69d262019-04-03 03:45:27 -050083 Printn
George Keishing4d9b7e12019-03-26 02:03:47 -050084 FFDC On Test Case Fail
George Keishing6a69d262019-04-03 03:45:27 -050085
86
Peter D Phan1c5d3252021-12-30 12:53:49 -060087DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050088 [Documentation] Power the BMC machine on via DMTF tools.
89
George Keishingfc3d8f12022-03-24 10:57:31 -050090 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1
91 Log ${output}
George Keishing6a69d262019-04-03 03:45:27 -050092
George Keishingfc3d8f12022-03-24 10:57:31 -050093 ${json}= OperatingSystem.Get File ${EXECDIR}${/}power-logs${/}results.json
94
95 ${object}= Evaluate json.loads('''${json}''') json
96
97 ${result_list}= Set Variable ${object["TestResults"]}
98 Log To Console result: ${result_list}
99
100 @{failed_tc_list}= Create List
101 @{error_messages}= Create List
102
103 FOR ${result} IN @{result_list}
George Keishing4fc24152025-04-11 21:27:56 +0530104 ${rc}= Evaluate 'ErrorMessages'=='${result}'
George Keishingc5dbbdd2025-05-07 13:55:17 +0530105
106 ${num}= Set Variable If ${rc} == False
107 ... ${result_list["${result}"]["fail"]}
108
109 IF ${num} != None and ${num} > 0
110 Append To List ${failed_tc_list} ${result}
111 END
112
113 IF ${rc} == True
114 Append To List ${error_messages} ${result_list["ErrorMessages"]}
115 END
George Keishingfc3d8f12022-03-24 10:57:31 -0500116 END
117
118 Log Many ErrorMessages: @{error_messages}
119 Log To Console ErrorMessages:
120 FOR ${msg} IN @{error_messages}
121 Log To Console ${msg}
122 END
123
124 Should Be Empty ${error_messages} DMTF Power keyword failed.