blob: df989ac2e2e5896ecc57a82369f877d36ada7bb9 [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
34*** Test Case ***
35
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}
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 Keishing6a69d262019-04-03 03:45:27 -050061
Peter D Phan1c5d3252021-12-30 12:53:49 -060062Test BMC Redfish Power Control Usecase
63 [Documentation] Power Control Usecase Test.
George Keishinge23afb52022-03-17 08:25:49 -050064 [Tags] Test_BMC_Redfish_Power_Control_Usecase
George Keishing6a69d262019-04-03 03:45:27 -050065
Peter D Phan1c5d3252021-12-30 12:53:49 -060066 DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050067
68
George Keishing4d9b7e12019-03-26 02:03:47 -050069*** Keywords ***
70
71Test Setup Execution
72 [Documentation] Do test case setup tasks.
73
George Keishing6a69d262019-04-03 03:45:27 -050074 Printn
ganesanbbca06d02023-04-15 10:52:51 +000075 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name}
George Keishing4d9b7e12019-03-26 02:03:47 -050076
George Keishing6a69d262019-04-03 03:45:27 -050077
George Keishing4d9b7e12019-03-26 02:03:47 -050078Test Teardown Execution
79 [Documentation] Do the post-test teardown.
80
George Keishing6a69d262019-04-03 03:45:27 -050081 Printn
George Keishing4d9b7e12019-03-26 02:03:47 -050082 FFDC On Test Case Fail
George Keishing6a69d262019-04-03 03:45:27 -050083
84
Peter D Phan1c5d3252021-12-30 12:53:49 -060085DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050086 [Documentation] Power the BMC machine on via DMTF tools.
87
George Keishingfc3d8f12022-03-24 10:57:31 -050088 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1
89 Log ${output}
George Keishing6a69d262019-04-03 03:45:27 -050090
George Keishingfc3d8f12022-03-24 10:57:31 -050091 ${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.