blob: 6dd0522e59196b94966bb2726c638131ce55fdaa [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
George Keishing4d9b7e12019-03-26 02:03:47 -050032
33*** Test Case ***
34
35Test BMC Redfish Account Management
36 [Documentation] Check Account Management with a Redfish interface.
37 [Tags] Test_BMC_Redfish_Account_Management
38
manashsarmaa053fb32020-06-08 08:43:32 -050039 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1
George Keishing4d9b7e12019-03-26 02:03:47 -050040
George Keishingfc3d8f12022-03-24 10:57:31 -050041 ${output}= Shell Cmd cat ${EXECDIR}${/}account-logs${/}results.json
George Keishing4d9b7e12019-03-26 02:03:47 -050042 Log ${output}
43
George Keishingfc3d8f12022-03-24 10:57:31 -050044 ${json}= OperatingSystem.Get File ${EXECDIR}${/}account-logs${/}results.json
manashsarmaa053fb32020-06-08 08:43:32 -050045
46 ${object}= Evaluate json.loads('''${json}''') json
47
48 ${result_list}= Set Variable ${object["TestResults"]}
49
50 @{failed_tc_list}= Create List
51
52 FOR ${result} IN @{result_list}
53 ${rc}= evaluate 'ErrorMessages'=='${result}'
54 ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]}
55 Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result}
56 END
57
58 Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list}
59
George Keishing6a69d262019-04-03 03:45:27 -050060
Peter D Phan1c5d3252021-12-30 12:53:49 -060061Test BMC Redfish Power Control Usecase
62 [Documentation] Power Control Usecase Test.
George Keishinge23afb52022-03-17 08:25:49 -050063 [Tags] Test_BMC_Redfish_Power_Control_Usecase
George Keishing6a69d262019-04-03 03:45:27 -050064
Peter D Phan1c5d3252021-12-30 12:53:49 -060065 DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050066
67
George Keishing4d9b7e12019-03-26 02:03:47 -050068*** Keywords ***
69
70Test Setup Execution
71 [Documentation] Do test case setup tasks.
72
George Keishing6a69d262019-04-03 03:45:27 -050073 Printn
George Keishing4d9b7e12019-03-26 02:03:47 -050074 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url}
75
George Keishing6a69d262019-04-03 03:45:27 -050076
George Keishing4d9b7e12019-03-26 02:03:47 -050077Test Teardown Execution
78 [Documentation] Do the post-test teardown.
79
George Keishing6a69d262019-04-03 03:45:27 -050080 Printn
George Keishing4d9b7e12019-03-26 02:03:47 -050081 FFDC On Test Case Fail
George Keishing6a69d262019-04-03 03:45:27 -050082
83
Peter D Phan1c5d3252021-12-30 12:53:49 -060084DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050085 [Documentation] Power the BMC machine on via DMTF tools.
86
George Keishingfc3d8f12022-03-24 10:57:31 -050087 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1
88 Log ${output}
George Keishing6a69d262019-04-03 03:45:27 -050089
George Keishingfc3d8f12022-03-24 10:57:31 -050090 ${json}= OperatingSystem.Get File ${EXECDIR}${/}power-logs${/}results.json
91
92 ${object}= Evaluate json.loads('''${json}''') json
93
94 ${result_list}= Set Variable ${object["TestResults"]}
95 Log To Console result: ${result_list}
96
97 @{failed_tc_list}= Create List
98 @{error_messages}= Create List
99
100 FOR ${result} IN @{result_list}
101 ${rc}= evaluate 'ErrorMessages'=='${result}'
102 ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]}
103 Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result}
104 Run Keyword If ${rc} == True Set Variable
105 ... Append To List ${error_messages} ${result_list["ErrorMessages"]}
106 END
107
108 Log Many ErrorMessages: @{error_messages}
109 Log To Console ErrorMessages:
110 FOR ${msg} IN @{error_messages}
111 Log To Console ${msg}
112 END
113
114 Should Be Empty ${error_messages} DMTF Power keyword failed.