blob: fdaa82ce9781ce6705354abfa7ab08515e8d945e [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
Sridevi Rameshcf0c8b02025-09-17 06:22:35 -050014Test Tags Redfish_Usecase_Checkers
15
George Keishing4d9b7e12019-03-26 02:03:47 -050016*** Variables ***
17
George Keishing6a69d262019-04-03 03:45:27 -050018${DEFAULT_PYTHON} python3
George Keishing4d9b7e12019-03-26 02:03:47 -050019
George Keishing6a69d262019-04-03 03:45:27 -050020${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git
21${rsv_dir_path} Redfish-Usecase-Checkers
George Keishing4d9b7e12019-03-26 02:03:47 -050022
George Keishing6a69d262019-04-03 03:45:27 -050023${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py
24... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
George Keishingfc3d8f12022-03-24 10:57:31 -050025... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}account-logs${/}
George Keishing6a69d262019-04-03 03:45:27 -050026
27${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py
28... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME}
George Keishingfc3d8f12022-03-24 10:57:31 -050029... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}power-logs${/}
George Keishing6a69d262019-04-03 03:45:27 -050030
31${power_on_timeout} 15 mins
32${power_off_timeout} 15 mins
33${state_change_timeout} 3 mins
ganesanbbca06d02023-04-15 10:52:51 +000034${branch_name} main
George Keishing4d9b7e12019-03-26 02:03:47 -050035
George Keishing409df052024-01-17 22:36:14 +053036*** Test Cases ***
George Keishing4d9b7e12019-03-26 02:03:47 -050037
38Test BMC Redfish Account Management
39 [Documentation] Check Account Management with a Redfish interface.
40 [Tags] Test_BMC_Redfish_Account_Management
41
manashsarmaa053fb32020-06-08 08:43:32 -050042 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1
George Keishing4d9b7e12019-03-26 02:03:47 -050043
George Keishingfc3d8f12022-03-24 10:57:31 -050044 ${output}= Shell Cmd cat ${EXECDIR}${/}account-logs${/}results.json
George Keishing4d9b7e12019-03-26 02:03:47 -050045 Log ${output}
46
George Keishingfc3d8f12022-03-24 10:57:31 -050047 ${json}= OperatingSystem.Get File ${EXECDIR}${/}account-logs${/}results.json
manashsarmaa053fb32020-06-08 08:43:32 -050048
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 Keishing4fc24152025-04-11 21:27:56 +053056 ${rc}= Evaluate 'ErrorMessages'=='${result}'
George Keishingc5dbbdd2025-05-07 13:55:17 +053057 ${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
manashsarmaa053fb32020-06-08 08:43:32 -050061 END
62
63 Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list}
64
George Keishing6a69d262019-04-03 03:45:27 -050065
Peter D Phan1c5d3252021-12-30 12:53:49 -060066Test BMC Redfish Power Control Usecase
67 [Documentation] Power Control Usecase Test.
George Keishinge23afb52022-03-17 08:25:49 -050068 [Tags] Test_BMC_Redfish_Power_Control_Usecase
George Keishing6a69d262019-04-03 03:45:27 -050069
Peter D Phan1c5d3252021-12-30 12:53:49 -060070 DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050071
72
George Keishing4d9b7e12019-03-26 02:03:47 -050073*** Keywords ***
74
75Test Setup Execution
76 [Documentation] Do test case setup tasks.
77
George Keishing6a69d262019-04-03 03:45:27 -050078 Printn
ganesanbbca06d02023-04-15 10:52:51 +000079 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name}
George Keishing4d9b7e12019-03-26 02:03:47 -050080
George Keishing6a69d262019-04-03 03:45:27 -050081
George Keishing4d9b7e12019-03-26 02:03:47 -050082Test Teardown Execution
83 [Documentation] Do the post-test teardown.
84
George Keishing6a69d262019-04-03 03:45:27 -050085 Printn
George Keishing4d9b7e12019-03-26 02:03:47 -050086 FFDC On Test Case Fail
George Keishing6a69d262019-04-03 03:45:27 -050087
88
Peter D Phan1c5d3252021-12-30 12:53:49 -060089DMTF Power
George Keishing6a69d262019-04-03 03:45:27 -050090 [Documentation] Power the BMC machine on via DMTF tools.
91
George Keishingfc3d8f12022-03-24 10:57:31 -050092 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1
93 Log ${output}
George Keishing6a69d262019-04-03 03:45:27 -050094
George Keishingfc3d8f12022-03-24 10:57:31 -050095 ${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 Keishing4fc24152025-04-11 21:27:56 +0530106 ${rc}= Evaluate 'ErrorMessages'=='${result}'
George Keishingc5dbbdd2025-05-07 13:55:17 +0530107
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 Keishingfc3d8f12022-03-24 10:57:31 -0500118 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.