blob: 5d0c314943c225513248c4cbfa5f17742cd16301 [file] [log] [blame]
Vijay53a00552020-01-08 04:24:47 -06001*** Settings ***
2Documentation Test Redfish SessionService.
3
4Resource ../../lib/resource.robot
5Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/openbmc_ffdc.robot
7
8Suite Setup Redfish.Login
9Suite Teardown Redfish.Logout
10Test Setup Printn
11Test Teardown FFDC On Test Case Fail
12
13
14*** Test Cases ***
15
16Verify HTTP_CREATED Response From Session Creation Request
17 [Documentation] Verify HTTP_CREATED response from session creation request.
18 [Tags] Verify_HTTP_CREATED_Response_From_Session_Creation_Request
19
20 Redfish.Post /redfish/v1/SessionService/Sessions
21 ... body={'UserName':'${OPENBMC_USERNAME}', 'Password': '${OPENBMC_PASSWORD}'}
22 ... valid_status_codes=[${HTTP_CREATED}]
23
24
25Verify SessionService Defaults
26 [Documentation] Verify SessionService default property values.
27 [Tags] Verify_SessionService_Defaults
28
29 ${session_service}= Redfish.Get Properties /redfish/v1/SessionService
30 Rprint Vars session_service
31
32 Valid Value session_service['@odata.context'] ['/redfish/v1/$metadata#SessionService.SessionService']
33 Valid Value session_service['@odata.id'] ['/redfish/v1/SessionService/']
34 Valid Value session_service['Description'] ['Session Service']
35 Valid Value session_service['Id'] ['SessionService']
36 Valid Value session_service['Name'] ['Session Service']
37 Valid Value session_service['ServiceEnabled'] [True]
38 Valid Value session_service['SessionTimeout'] [3600]
39 Valid Value session_service['Sessions']['@odata.id'] ['/redfish/v1/SessionService/Sessions']
40
41
42Verify Sessions Defaults
43 [Documentation] Verify Sessions default property values.
44 [Tags] Verify_Sessions_Defaults
45
46 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions
47 Rprint Vars sessions
48 ${sessions_count}= Get length ${sessions['Members']}
49
50 Valid Value sessions['@odata.context'] ['/redfish/v1/$metadata#SessionCollection.SessionCollection']
51 Valid Value sessions['@odata.id'] ['/redfish/v1/SessionService/Sessions/']
52 Valid Value sessions['Description'] ['Session Collection']
53 Valid Value sessions['Name'] ['Session Collection']
54 Valid Value sessions['Members@odata.count'] [${sessions_count}]
55
56
57Verify Current Session Defaults
58 [Documentation] Verify Current session default property values.
59 [Tags] Verify_Current_Session_Defaults
60
61 ${session_location}= Redfish.Get Session Location
62 ${session_id}= Evaluate os.path.basename($session_location) modules=os
63 ${session_properties}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
64 Rprint Vars session_location session_id session_properties
65
66 Valid Value session_properties['@odata.context'] ['/redfish/v1/$metadata#Session.Session']
67 Valid Value session_properties['@odata.id'] ['/redfish/v1/SessionService/Sessions/${session_id}']
68 Valid Value session_properties['Description'] ['Manager User Session']
69 Valid Value session_properties['Name'] ['User Session']
70 Valid Value session_properties['Id'] ['${session_id}']
71 Valid Value session_properties['UserName'] ['${OPENBMC_USERNAME}']
Vijay5b2f7792020-01-14 04:18:32 -060072
73
74Verify Managers Defaults
75 [Documentation] Verify managers defaults.
76 [Tags] Verify_Managers_Defaults
77
78 ${managers}= Redfish.Get Properties /redfish/v1/Managers
79 Rprint Vars managers
80 ${managers_count}= Get Length ${managers['Members']}
81
82 Valid Value managers['@odata.context'] ['/redfish/v1/$metadata#ManagerCollection.ManagerCollection']
83 Valid Value managers['Name'] ['Manager Collection']
84 Valid Value managers['@odata.id'] ['/redfish/v1/Managers']
85 Valid Value managers['Members@odata.count'] [${managers_count}]
86
87 # Members can be one or more, hence checking in the list
88 Valid List managers['Members'] required_values=[{'@odata.id': '/redfish/v1/Managers/bmc'}]
89
90
91Verify Chassis Defaults
92 [Documentation] Verify chassis defaults.
93 [Tags] Verify_Chassis_Defaults
94
95 ${chassis}= Redfish.Get Properties /redfish/v1/Chassis
96 Rprint Vars chassis
97 ${chassis_count}= Get Length ${chassis['Members']}
98
99 Valid Value chassis['@odata.context'] ['/redfish/v1/$metadata#ChassisCollection.ChassisCollection']
100 Valid Value chassis['Name'] ['Chassis Collection']
101 Valid Value chassis['@odata.id'] ['/redfish/v1/Chassis']
102 Valid Value chassis['Members@odata.count'] [${chassis_count}]
103 Valid Value chassis['Members@odata.count'] [${chassis_count}]
104
105 # Members can be one or more, hence checking in the list
106 Log To Console ${chassis['Members']}
107 Valid List chassis['Members']
108 ... required_values=[{'@odata.id': '/redfish/v1/Chassis/chassis'}]
109
110
111Verify Systems Defaults
112 [Documentation] Verify systems defaults.
113 [Tags] Verify_Systems_Defaults
114
115 ${systems}= Redfish.Get Properties /redfish/v1/Systems
116 Rprint Vars systems
117 ${systems_count}= Get Length ${systems['Members']}
118
119 Valid Value systems['@odata.context']
120 ... ['/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection']
121 Valid Value systems['Name'] ['Computer System Collection']
122 Valid Value systems['@odata.id'] ['/redfish/v1/Systems']
123 Valid Value systems['Members@odata.count'] [${systems_count}]
124 Valid Value systems['Members@odata.count'] [${systems_count}]
125 # Members can be one or more, hence checking in the list
126 Valid List systems['Members'] required_values=[{'@odata.id': '/redfish/v1/Systems/system'}]
127
128
129Verify Session Persistency After BMC Reboot
130 [Documentation] Verify session persistency after BMC reboot.
131 [Tags] Verify_Session_Persistency_After_BMC_Reboot
132
133 # Note the current session location
134 ${session_location}= Redfish.Get Session Location
135
136 Redfish OBMC Reboot (off) stack_mode=normal
137 Redfish.Login
138
139 # Check for session persistency after BMC reboot
140 # sessions here will have list of all sessions location
141 ${sessions}= Redfish.Get Attribute /redfish/v1/SessionService/Sessions Members
142 ${payload}= Create Dictionary @odata.id=${session_location}
143
144 List Should Contain Value ${sessions} ${payload}
145
146
147REST Logging Interface Read Should Be A SUCCESS For Authorized Users
148 [Documentation] REST logging interface read should be a success for authorized users.
149 [Tags] REST_Logging_Interface_Read_Should_Be_A_SUCCESS_For_Authorized_Users
150
151 ${resp}= Redfish.Get /xyz/openbmc_project/logging
152
153 ${resp_output}= evaluate json.loads('''${resp.text}''') json
154 ${log_count}= Get Length ${resp_output["data"]}
155
156 # Max 200 error logs are allowed in OpenBmc
157 Run Keyword Unless ${-1} < ${log_count} < ${201} Fail
158