blob: 89eef3a3961cf966db637dc539d194b2bb139cdf [file] [log] [blame]
Vijaybc331e22020-02-27 04:17:37 -06001*** Settings ***
2
3Documentation Test Lock Management feature of Management Console on BMC.
4
5Resource ../../lib/resource.robot
Vijaybc331e22020-02-27 04:17:37 -06006Resource ../../lib/openbmc_ffdc.robot
George Keishing566daaf2020-07-02 06:18:50 -05007Resource ../../lib/bmc_redfish_utils.robot
Vijaybc331e22020-02-27 04:17:37 -06008
Sushil Singh40ef0eb2020-08-03 02:14:59 -05009Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions
Vijay355daac2020-03-26 12:06:08 -050010Test Setup Test Setup Execution
Vijaybc331e22020-02-27 04:17:37 -060011Test Teardown Test Teardown Execution
Sushil Singh40ef0eb2020-08-03 02:14:59 -050012Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions
Vijaybc331e22020-02-27 04:17:37 -060013
14*** Variables ***
15
16# Data-sets for testing different test cases.
17&{LOCKALL_LEN1} LockFlag=LockAll SegmentLength=${1}
18&{LOCKALL_LEN2} LockFlag=LockAll SegmentLength=${2}
19&{LOCKALL_LEN3} LockFlag=LockAll SegmentLength=${3}
20&{LOCKALL_LEN4} LockFlag=LockAll SegmentLength=${4}
21&{LOCKALL_LEN5} LockFlag=LockAll SegmentLength=${5}
22
23&{LOCKALL_INVALID_LOCKFLAG1} LockFlag=LocAll SegmentLength=${2}
24&{LOCKALL_INVALID_LOCKFLAG2} LockFlag=LOCKALL SegmentLength=${3}
25&{LOCKALL_INVALID_LOCKFLAG3} LOCKFLAG=LockAll SegmentLength=${4}
26&{LOCKSAME_INVALID_LOCKFLAG3} Lock=LockSame SegmentLength=${1}
27&{LOCKSAME_INVALID_LOCKFLAG4} Lock=LockSame SegmentLength=${True}
28
29&{LOCKSAME_LEN1} LockFlag=LockSame SegmentLength=${1}
30&{LOCKSAME_LEN2} LockFlag=LockSame SegmentLength=${2}
31&{LOCKSAME_LEN3} LockFlag=LockSame SegmentLength=${3}
32&{LOCKSAME_LEN4} LockFlag=LockSame SegmentLength=${4}
33&{LOCKSAME_INVALID_LEN1} LockFlag=LockSame SegmentLength=${0}
34&{LOCKSAME_INVALID_LEN2} LockFlag=LockSame SegmentLength=${5}
35&{LOCKSAME_INVALID_LEN_STR} LockFlag=LockSame SegmentLength=2
36&{LOCKSAME_INVALID_LEN_NEG} LockFlag=LockSame SegmentLength=${-3}
37&{LOCKSAME_INVALID_LEN_BOOL} Lock=LockSame SegmentLength=${True}
38
39&{DONTLOCK_LEN1} LockFlag=DontLock SegmentLength=${1}
40&{DONTLOCK_LEN2} LockFlag=DontLock SegmentLength=${2}
41&{DONTLOCK_LEN3} LockFlag=DontLock SegmentLength=${3}
42&{DONTLOCK_LEN4} LockFlag=DontLock SegmentLength=${4}
43&{DONTLOCK_INVALID_LEN} LockFlag=DontLock SegmentLength=${5}
44&{DONTLOCK_INVALID_LEN_BOOL} LockFlag=DONTLOCK SegmentLength=${False}
45&{DONTLOCK_INVALID_LOCKFLAG} LOCKFLAG=LockAll SegmentLength=${4}
46
47@{ONE_SEG_FLAG_ALL} ${LOCKALL_LEN1}
48@{ONE_SEG_FLAG_SAME} ${LOCKSAME_LEN3}
49@{ONE_SEG_FLAG_DONT} ${DONTLOCK_LEN4}
50
51@{TWO_SEG_FLAG_1} ${LOCKALL_LEN1} ${LOCKSAME_LEN2}
52@{TWO_SEG_FLAG_2} ${DONTLOCK_LEN3} ${LOCKALL_LEN1}
53@{TWO_SEG_FLAG_3} ${DONTLOCK_LEN4} ${LOCKSAME_LEN3}
54@{TWO_SEG_FLAG_4} ${DONTLOCK_INVALID_LEN} ${LOCKSAME_LEN3}
55@{TWO_SEG_FLAG_5} ${DONTLOCK_LEN2} ${LOCKSAME_INVALID_LEN1}
56
57@{TWO_SEG_FLAG_INVALID1} ${DONTLOCK_LEN4} ${LOCKSAME_INVALID_LEN1}
58@{TWO_SEG_FLAG_INVALID2} ${LOCKALL_LEN5} ${DONTLOCK_LEN1}
59@{TWO_SEG_FLAG_INVALID3} ${DONTLOCK_LEN1} ${LOCKALL_INVALID_LOCKFLAG1}
60@{TWO_SEG_FLAG_INVALID4} ${DONTLOCK_LEN2} ${LOCKALL_INVALID_LOCKFLAG2}
61@{TWO_SEG_FLAG_INVALID5} ${DONTLOCK_LEN2} ${LOCKALL_INVALID_LOCKFLAG3}
62@{TWO_SEG_FLAG_INVALID6} ${LOCKALL_LEN3} ${LOCKSAME_INVALID_LOCKFLAG3}
63@{TWO_SEG_FLAG_INVALID7} ${DONTLOCK_LEN2} ${LOCKSAME_INVALID_LOCKFLAG4}
64@{TWO_SEG_FLAG_INVALID8} ${DONTLOCK_INVALID_LOCKFLAG} ${LOCKSAME_INVALID_LEN_BOOL}
65@{TWO_SEG_FLAG_INVALID9} ${DONTLOCK_LEN2} ${LOCKSAME_INVALID_LOCKFLAG4}
66
67@{THREE_SEG_FLAG_1} ${LOCKALL_LEN1} @{TWO_SEG_FLAG_3}
68@{THREE_SEG_FLAG_2} ${LOCKSAME_LEN4} @{TWO_SEG_FLAG_2}
69@{THREE_SEG_FLAG_3} ${DONTLOCK_LEN3} @{TWO_SEG_FLAG_1}
70
71@{FOUR_SEG_FLAG_1} ${LOCKALL_LEN1} @{THREE_SEG_FLAG_2}
72@{FOUR_SEG_FLAG_2} ${LOCKSAME_LEN4} @{THREE_SEG_FLAG_3}
73@{FOUR_SEG_FLAG_3} ${DONTLOCK_LEN3} @{THREE_SEG_FLAG_1}
74
75@{FIVE_SEG_FLAG_1} ${LOCKALL_LEN1} @{FOUR_SEG_FLAG_2}
76@{FIVE_SEG_FLAG_2} ${LOCKSAME_LEN4} @{FOUR_SEG_FLAG_3}
77@{FIVE_SEG_FLAG_3} ${DONTLOCK_LEN3} @{FOUR_SEG_FLAG_1}
78
79@{SIX_SEG_FLAG_1} ${LOCKALL_LEN1} @{FIVE_SEG_FLAG_2}
80@{SIX_SEG_FLAG_2} ${LOCKSAME_LEN4} @{FIVE_SEG_FLAG_3}
81@{SIX_SEG_FLAG_3} ${DONTLOCK_LEN3} @{FIVE_SEG_FLAG_1}
82
83@{SEVEN_SEG_FLAG_1} ${LOCKALL_LEN1} @{SIX_SEG_FLAG_2}
84@{SEVEN_SEG_FLAG_2} ${LOCKSAME_LEN4} @{SIX_SEG_FLAG_3}
85@{SEVEN_SEG_FLAG_3} ${DONTLOCK_LEN3} @{SIX_SEG_FLAG_1}
86
87# Different messages to be verified.
88${PROP_REQ_ERR} is a required property and must be included in the request.
89${PROP_ERR} is not in the list of valid properties for the resource.
90${PROP_TYPE_ERR} is of a different type than the property can accept.
91
92# Build error patterns list.
Vijay355daac2020-03-26 12:06:08 -050093@{EMPTY_LIST}
Vijaybc331e22020-02-27 04:17:37 -060094@{ERR_PATTERN1} ${PROP_REQ_ERR} ${PROP_ERR}
95@{ERR_PATTERN2} ${PROP_TYPE_ERR}
96@{ERR_PATTERN3} ${PROP_REQ_ERR} ${PROP_ERR} ${PROP_TYPE_ERR}
97
98# Dictionary of Locks with Transaction ID as key and Session ID as a value.
99&{LOCKS}
100
101
102*** Test Cases ***
103
104Acquire And Release Different Read Locks
105 [Documentation] Acquire and release different read locks.
106 [Tags] Acquire_And_Release_Different_Read_Locks
107 [Template] Acquire And Release Lock
108
109 # lock seg_flags resource_id hmc_id exp_status_code err_msgs new_sess
110 # type req
Vijay355daac2020-03-26 12:06:08 -0500111 Read ${ONE_SEG_FLAG_ALL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
112 Read ${ONE_SEG_FLAG_SAME} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
113 Read ${ONE_SEG_FLAG_DONT} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay149ba762020-04-08 03:38:04 -0500114 Read ${TWO_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay355daac2020-03-26 12:06:08 -0500115 Read ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_OK} ${EMPTY_LIST} ${True}
116 Read ${TWO_SEG_FLAG_3} ${234} hmc-id ${HTTP_OK} ${EMPTY_LIST} ${True}
117 Read ${TWO_SEG_FLAG_4} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
118 Read ${TWO_SEG_FLAG_5} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay149ba762020-04-08 03:38:04 -0500119 Read ${THREE_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
120 Read ${THREE_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
121 Read ${THREE_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
122 Read ${FOUR_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
123 Read ${FOUR_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
124 Read ${FOUR_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
125 Read ${FIVE_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
126 Read ${FIVE_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
127 Read ${FIVE_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
128 Read ${SIX_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
129 Read ${SIX_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
130 Read ${SIX_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay355daac2020-03-26 12:06:08 -0500131 Read ${SEVEN_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
132 Read ${SEVEN_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
133 Read ${SEVEN_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
134 Read ${LOCKSAME_INVALID_LEN1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijaybc331e22020-02-27 04:17:37 -0600135 Read ${LOCKSAME_INVALID_LEN_STR} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
136 Read ${LOCKSAME_INVALID_LEN_NEG} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
137 Read ${LOCKSAME_INVALID_LEN_BOOL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
138 Read ${DONTLOCK_INVALID_LEN_BOOL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
Vijay355daac2020-03-26 12:06:08 -0500139 Read ${TWO_SEG_FLAG_INVALID1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
140 Read ${TWO_SEG_FLAG_INVALID2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
141 Read ${TWO_SEG_FLAG_INVALID3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
142 Read ${TWO_SEG_FLAG_INVALID4} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijaybc331e22020-02-27 04:17:37 -0600143 Read ${TWO_SEG_FLAG_INVALID5} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN1} ${True}
144 Read ${TWO_SEG_FLAG_INVALID6} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN1} ${True}
145 Read ${TWO_SEG_FLAG_INVALID7} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN3} ${True}
146 Read ${TWO_SEG_FLAG_INVALID8} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN1} ${True}
147 Read ${TWO_SEG_FLAG_INVALID9} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
148 Read ${TWO_SEG_FLAG_3} 234 hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
149
150
151Acquire And Release Different Write Locks
152 [Documentation] Acquire and release different write locks.
153 [Tags] Acquire_And_Release_Different_Write_Locks
154 [Template] Acquire And Release Lock
155
156 # lock seg_flags resource_id hmc_id exp_status_code err_msgs new_sess
157 # type req
Vijay355daac2020-03-26 12:06:08 -0500158 Write ${ONE_SEG_FLAG_ALL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
159 Write ${ONE_SEG_FLAG_SAME} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
160 Write ${ONE_SEG_FLAG_DONT} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay60f01e42020-04-09 00:50:42 -0500161 Write ${TWO_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay355daac2020-03-26 12:06:08 -0500162 Write ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_OK} ${EMPTY_LIST} ${True}
163 Write ${TWO_SEG_FLAG_3} ${234} hmc-id ${HTTP_OK} ${EMPTY_LIST} ${True}
164 Write ${TWO_SEG_FLAG_INVALID4} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay60f01e42020-04-09 00:50:42 -0500165 Write ${THREE_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
166 Write ${THREE_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
167 Write ${THREE_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
168 Write ${FOUR_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
169 Write ${FOUR_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
170 Write ${FOUR_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
171 Write ${FIVE_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
172 Write ${FIVE_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
173 Write ${FIVE_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
174 Write ${SIX_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
175 Write ${SIX_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
176 Write ${SIX_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijay355daac2020-03-26 12:06:08 -0500177 Write ${SEVEN_SEG_FLAG_1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
178 Write ${SEVEN_SEG_FLAG_2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
179 Write ${SEVEN_SEG_FLAG_3} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
180 Write ${LOCKSAME_INVALID_LEN1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
181 Write ${LOCKSAME_INVALID_LEN_STR} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
182 Write ${LOCKSAME_INVALID_LEN_NEG} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
183 Write ${LOCKSAME_INVALID_LEN_BOOL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
184 Write ${DONTLOCK_INVALID_LEN_BOOL} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
185 Write ${TWO_SEG_FLAG_INVALID1} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
186 Write ${TWO_SEG_FLAG_INVALID2} ${234} hmc-id ${HTTP_BAD_REQUEST} ${EMPTY_LIST} ${True}
Vijaybc331e22020-02-27 04:17:37 -0600187 Write ${TWO_SEG_FLAG_INVALID8} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN1} ${True}
188 Write ${TWO_SEG_FLAG_INVALID5} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN1} ${True}
189 Write ${TWO_SEG_FLAG_INVALID9} ${234} hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
190 Write ${TWO_SEG_FLAG_3} 234 hmc-id ${HTTP_BAD_REQUEST} ${ERR_PATTERN2} ${True}
191
192
193Verify GetLockList Returns An Empty Record For An Invalid Session Id
194 [Documentation] Verify GetLockList returns an empty record for an invalid session id.
195 [Tags] Verify_GetLockList_Returns_An_Empty_Record_For_An_Invalid_Session_Id
196
George Keishing566daaf2020-07-02 06:18:50 -0500197 ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id}"}}
Vijaybc331e22020-02-27 04:17:37 -0600198
George Keishing566daaf2020-07-02 06:18:50 -0500199 ${records}= Get Locks List ${resp['Id']}
200 ${records}= Get Locks List ZZzZZz9zzZ
Vijaybc331e22020-02-27 04:17:37 -0600201 ${length}= Get Length ${records}
202 Should Be Equal ${length} ${0}
203
204
Vijay355daac2020-03-26 12:06:08 -0500205Verify Lock Conflicts
206 [Documentation] Verify lock conflicts.
207 [Tags] Verify_Lock_Conflicts
208 [Template] Acquire And Release Lock
209
210 Write ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_OK} ['NA'] ${True}
211 Read ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_CONFLICT} ['NA'] ${False}
212 Read ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_OK} ['NA'] ${True}
213 Write ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_CONFLICT} ['NA'] ${False}
214 Write ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_OK} ['NA'] ${True}
215 Write ${TWO_SEG_FLAG_2} ${234} hmc-id ${HTTP_CONFLICT} ['NA'] ${False}
216
217
George Keishing566daaf2020-07-02 06:18:50 -0500218Verify Persistency Of Read Locks After BMC Reboot
Vijay85610ee2020-04-03 05:30:28 -0500219 [Documentation] Verify persistency of locks after BMC reboot.
George Keishing566daaf2020-07-02 06:18:50 -0500220 [Tags] Verify_Persistency_Of_Read_Locks_After_BMC_Reboot
Vijay85610ee2020-04-03 05:30:28 -0500221 [Template] Locks Persistency Check After BMC Reboot
222
223 # lock_type seg_flags resource_id
224 Read ${TWO_SEG_FLAG_2} ${234}
George Keishing566daaf2020-07-02 06:18:50 -0500225
226
227Verify Persistency Of Write Locks After BMC Reboot
228 [Documentation] Verify persistency of locks after BMC reboot.
229 [Tags] Verify_Persistency_Of_Write_Locks_After_BMC_Reboot
230 [Template] Locks Persistency Check After BMC Reboot
231
232 # lock_type seg_flags resource_id
Vijay85610ee2020-04-03 05:30:28 -0500233 Write ${TWO_SEG_FLAG_2} ${234}
234
235
Vijayafdd2a12020-04-09 02:03:20 -0500236Verify Valid Lock Transactions Release
237 [Documentation] Verify valid lock transactions release.
238 [Tags] Verify_Valid_Lock_Transactions_Release
239
George Keishing566daaf2020-07-02 06:18:50 -0500240 ${transaction_id1}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2} ${234}
Vijayafdd2a12020-04-09 02:03:20 -0500241 ${locks_before}= Get Locks List ${SESSION_ID}
242
George Keishing566daaf2020-07-02 06:18:50 -0500243 ${transaction_id2}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3} ${234}
244 ${transaction_id3}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2} ${234}
245 ${transaction_id4}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3} ${234}
Vijayafdd2a12020-04-09 02:03:20 -0500246
247 ${transaction_ids}= Create List ${transaction_id2} ${transaction_id3} ${transaction_id4}
248 Release Locks ${transaction_ids}
249 ${locks_after}= Get Locks List ${SESSION_ID}
250 Should Be Equal ${locks_before} ${locks_after}
251
252
253Verify Invalid Lock Transactions Release
254 [Documentation] Verify invalid lock transactions release.
255 [Tags] Verify_Invalid_Lock_Transactions_Release
256
George Keishing566daaf2020-07-02 06:18:50 -0500257 ${transaction_id1}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2} ${234}
Vijayafdd2a12020-04-09 02:03:20 -0500258 ${locks_before}= Get Locks List ${SESSION_ID}
259
260 ${transaction_id2}= Evaluate ${transaction_id1} + 1
261 ${transaction_id3}= Evaluate ${transaction_id1} - 1
262 ${transaction_ids}= Create List ${transaction_id2} ${transaction_id1} ${transaction_id3}
263
264 # If any transaction/s in the list does not belong to current session then it will be a bad request.
265 Release Locks ${transaction_ids} exp_status_code=${HTTP_BAD_REQUEST}
266 ${locks_after}= Get Locks List ${SESSION_ID}
267 Should Be Equal ${locks_before} ${locks_after}
268
269
270Verify Locks Release By Session
271 [Documentation] Verify locks release by session.
272 [Tags] Verify_Locks_Release_By_Session
273
274 ${locks_before}= Get Locks List ${SESSION_ID}
George Keishing566daaf2020-07-02 06:18:50 -0500275 ${transaction_id1}= Acquire Lock On A Given Resource Write ${TWO_SEG_FLAG_2} ${234}
Vijayafdd2a12020-04-09 02:03:20 -0500276
277 # Release Lock by Session without mentioning transaction_ids.
278 Release Locks release_type=Session
279 ${locks_after}= Get Locks List ${SESSION_ID}
280 Should Be Equal ${locks_before} ${locks_after}
281
George Keishing566daaf2020-07-02 06:18:50 -0500282 ${transaction_id1}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2} ${234}
283 ${transaction_id2}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3} ${234}
Vijayafdd2a12020-04-09 02:03:20 -0500284 ${transaction_ids}= Create List ${transaction_id1} ${transaction_id2}
285
286 # Release Lock by Session by mentioning transaction_ids also in the request.
287 Release Locks ${transaction_ids} release_type=Session
288
289
290Verify Locks Created By One Session Cannot Be Deleted By Another Session
291 [Documentation] Verify locks created by one session cannot be deleted by another session.
292 [Tags] Verify_Locks_Created_By_One_Session_Cannot_Be_Deleted_By_Another_Session
George Keishing566daaf2020-07-02 06:18:50 -0500293 [Setup] No Operation
Vijayafdd2a12020-04-09 02:03:20 -0500294
George Keishing566daaf2020-07-02 06:18:50 -0500295 ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
296 Set Test Variable ${SESSION_ID} ${resp['Id']}
297 ${transaction_id1}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_2} ${234}
298 ${locks_tran1}= Get Locks List ${resp['Id']}
Vijayafdd2a12020-04-09 02:03:20 -0500299
George Keishing566daaf2020-07-02 06:18:50 -0500300 ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
301 Set Test Variable ${SESSION_ID} ${resp['Id']}
Vijayafdd2a12020-04-09 02:03:20 -0500302
George Keishing566daaf2020-07-02 06:18:50 -0500303 ${transaction_id2}= Acquire Lock On A Given Resource Read ${TWO_SEG_FLAG_3} ${234}
304 ${locks_before}= Get Locks List ${resp['Id']}
Vijayafdd2a12020-04-09 02:03:20 -0500305
306 ${transaction_ids}= Create List ${transaction_id1} ${transaction_id2}
307 Release Locks ${transaction_ids} exp_status_code=${HTTP_UNAUTHORIZED} conflict_record=${locks_tran1}
308 ${locks_after}= Get Locks List ${SESSION_ID}
309 Should Be Equal ${locks_before} ${locks_after}
310
311 # When release_type=Session, transaction_ids should be ignored.
312 Release Locks ${transaction_ids} release_type=Session
313 ${locks_after}= Get Locks List ${SESSION_ID}
314 Should Be Equal ${EMPTY_LIST} ${locks_after}
315
316
Vijaybc331e22020-02-27 04:17:37 -0600317*** Keywords ***
318
Vijay85610ee2020-04-03 05:30:28 -0500319Locks Persistency Check After BMC Reboot
320 [Documentation] Locks persistency check after BMC reboot.
321 [Arguments] ${lock_type} ${seg_flags} ${resource_id}
322
323 # Description of argument(s):
324 # lock_type Type of lock (Read/Write).
325 # seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
326 # resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
327
George Keishing566daaf2020-07-02 06:18:50 -0500328 ${transaction_id}= Acquire Lock On A Given Resource ${lock_type} ${seg_flags} ${resource_id}
Vijay85610ee2020-04-03 05:30:28 -0500329
George Keishing566daaf2020-07-02 06:18:50 -0500330 ${locks_prev}= Get Locks List ${SESSION_ID}
Vijay85610ee2020-04-03 05:30:28 -0500331
George Keishing566daaf2020-07-02 06:18:50 -0500332 Redfish OBMC Reboot (off)
333 Redfish Login
Vijay85610ee2020-04-03 05:30:28 -0500334
George Keishing566daaf2020-07-02 06:18:50 -0500335 ${locks_curr}= Get Locks List ${SESSION_ID}
Vijay85610ee2020-04-03 05:30:28 -0500336 Should Be Equal ${locks_prev} ${locks_curr}
George Keishing566daaf2020-07-02 06:18:50 -0500337
Vijayafdd2a12020-04-09 02:03:20 -0500338 ${transaction_ids}= Create List ${transaction_id}
339 Release Locks ${transaction_ids}
Vijay85610ee2020-04-03 05:30:28 -0500340
341
Vijaybc331e22020-02-27 04:17:37 -0600342Return Data Dictionary For Single Request
343 [Documentation] Return data dictionary for single request.
344 [Arguments] ${lock_type} ${seg_flags} ${resource_id}
345
346 # Description of argument(s):
347 # lock_type Type of lock (Read/Write).
348 # seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
349 # resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
350
George Keishing566daaf2020-07-02 06:18:50 -0500351 ${SEG_FLAGS_LOCK}= Create Dictionary
352 ... LockType=${lock_type}
353 ... SegmentFlags=@{seg_flags}
Vijaybc331e22020-02-27 04:17:37 -0600354 ... ResourceID=${resource_id}
George Keishing566daaf2020-07-02 06:18:50 -0500355
Vijaybc331e22020-02-27 04:17:37 -0600356 ${SEG_FLAGS_ENTRIES}= Create List ${SEG_FLAGS_LOCK}
357 ${LOCK_REQUEST}= Create Dictionary Request=${SEG_FLAGS_ENTRIES}
shrsuman1234d44a0d2020-08-05 02:07:16 -0500358 Log To Console \n${SPACE}${LOCK_REQUEST}
Vijaybc331e22020-02-27 04:17:37 -0600359
360 [Return] ${LOCK_REQUEST}
361
362
363Acquire Lock On A Given Resource
364 [Documentation] Acquire lock on a given resource.
365 [Arguments] ${lock_type} ${seg_flags} ${resource_id} ${exp_status_code}=${HTTP_OK}
Vijay355daac2020-03-26 12:06:08 -0500366 ... ${err_msgs}=${EMPTY_LIST}
Vijaybc331e22020-02-27 04:17:37 -0600367
368 # Description of argument(s):
369 # lock_type Type of lock (Read/Write).
370 # seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
371 # Ex: [{'LockFlag': 'LockAll', 'SegmentLength': 1},
Vijay355daac2020-03-26 12:06:08 -0500372 # {'LockFlag': 'LockSame', 'SegmentLength': 2}]
Vijaybc331e22020-02-27 04:17:37 -0600373 # resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
Vijay355daac2020-03-26 12:06:08 -0500374 # exp_status_code Expected status code from the AcquireLock request for given inputs.
375 # err_msgs List of expected error messages.
Vijaybc331e22020-02-27 04:17:37 -0600376
377 ${data}= Return Data Dictionary For Single Request ${lock_type} ${seg_flags} ${resource_id}
George Keishing566daaf2020-07-02 06:18:50 -0500378 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${data}
Vijaybc331e22020-02-27 04:17:37 -0600379
Vijaybc331e22020-02-27 04:17:37 -0600380 ${transaction_id}= Run Keyword If ${exp_status_code} != ${HTTP_OK}
George Keishing566daaf2020-07-02 06:18:50 -0500381 ... Set Variable ${0}
382 ... ELSE
383 ... Load Lock Record And Build Transaction To Session Map ${resp.text}
Vijaybc331e22020-02-27 04:17:37 -0600384
Vijay355daac2020-03-26 12:06:08 -0500385 Run Keyword If ${exp_status_code} == ${HTTP_CONFLICT} and ${err_msgs} == ['NA']
George Keishing566daaf2020-07-02 06:18:50 -0500386 ... Load Response And Verify Conflict ${resp.text} ${SESSION_ID}
Vijay355daac2020-03-26 12:06:08 -0500387 ... ELSE Run Keyword If ${exp_status_code} != ${HTTP_OK} and ${err_msgs} != ${EMPTY_LIST}
George Keishing566daaf2020-07-02 06:18:50 -0500388 ... Load Response And Verify Error ${resp.text} err_msgs=${err_msgs}
Vijay355daac2020-03-26 12:06:08 -0500389
Vijaybc331e22020-02-27 04:17:37 -0600390 Append Transaction Id And Session Id To Locks Dictionary ${transaction_id}
391
392 [Return] ${transaction_id}
393
394
395Load Lock Record And Build Transaction To Session Map
396 [Documentation] Load lock record and build transaction to session map.
397 [Arguments] ${resp_text}
398
399 # Description of argument(s):
400 # resp_text Response test from a REST request.
401
402 ${acquire_lock}= Evaluate json.loads('''${resp_text}''') json
403 Append Transaction Id And Session Id To Locks Dictionary ${acquire_lock["TransactionID"]}
404
405 [Return] ${acquire_lock["TransactionID"]}
406
407
408Load Response And Verify Error
409 [Documentation] Load response and verify error.
Vijay355daac2020-03-26 12:06:08 -0500410 [Arguments] ${error_resp} ${err_msgs}=${EMPTY_LIST}
Vijaybc331e22020-02-27 04:17:37 -0600411
412 # Description of argument(s):
413 # error_resp Error response from a REST request.
414 # err_msgs List of error msg patterns.
415
416 ${error_resp}= Replace String ${error_resp} \" \\"
417 ${error_response}= Evaluate json.loads('''${error_resp}''') json
418
419 ${errors}= Get Dictionary Values ${error_response}
420 ${extended_errors}= Create List
421
422 FOR ${error} IN @{errors}
423 Append To List ${extended_errors} ${error[0]["Message"]}
424 END
425
George Keishing566daaf2020-07-02 06:18:50 -0500426 Log To Console \n ${extended_errors}
Vijaybc331e22020-02-27 04:17:37 -0600427
428 FOR ${exp_error} IN @{err_msgs}
429 Run Keyword Expect List Of Errors In An Extended Errors ${exp_error} ${extended_errors}
430 END
431
432
433Expect List Of Errors In An Extended Errors
434 [Documentation] Expect list of errors in an extended errors.
Vijay355daac2020-03-26 12:06:08 -0500435 [Arguments] ${exp_error} ${extended_errors}=${EMPTY_LIST}
Vijaybc331e22020-02-27 04:17:37 -0600436
437 ${found}= Set Variable ${False}
438
439 FOR ${error_record} IN @{extended_errors}
440 ${found}= Evaluate '${exp_error}' in '${error_record}'
441 Exit For Loop If ${found} == ${True}
442 END
443
444 Should Be True ${found}
445
446
447Append Transaction Id And Session Id To Locks Dictionary
448 [Documentation] Append transaction id and session id to locks dictionary.
449 [Arguments] ${transaction_id}
450
451 # Description of argument(s):
452 # transaction_id Transaction ID created from acquire lock request. Ex: 8, 9 etc.
453
Vijaybc331e22020-02-27 04:17:37 -0600454 Set To Dictionary ${LOCKS} ${${transaction_id}} ${session_id}
Vijaybc331e22020-02-27 04:17:37 -0600455
456
457Get Locks List
458 [Documentation] Get locks list.
459 [Arguments] @{sessions} ${exp_status_code}=${HTTP_OK}
460
461 # Description of argument(s):
462 # sessions List of comma separated strings. Ex: ["euHoAQpvNe", "ecTjANqwFr"]
463 # exp_status_code expected status code from the GetLockList request for given inputs.
464
465 ${sessions}= Evaluate json.dumps(${sessions}) json
466 ${data}= Set Variable {"SessionIDs": ${sessions}}
George Keishing566daaf2020-07-02 06:18:50 -0500467 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
468 ... data=${data}
Vijaybc331e22020-02-27 04:17:37 -0600469 ${locks}= Evaluate json.loads('''${resp.text}''') json
470
471 [Return] ${locks["Records"]}
472
473
Vijayafdd2a12020-04-09 02:03:20 -0500474Release Locks
475 [Documentation] Release locks.
476 [Arguments] ${transaction_ids}=${EMPTY_LIST} ${release_type}=Transaction ${exp_status_code}=${HTTP_OK}
477 ... ${conflict_record}=${EMPTY_LIST}
Vijaybc331e22020-02-27 04:17:37 -0600478
479 # Description of argument(s):
Vijayafdd2a12020-04-09 02:03:20 -0500480 # transaction_ids List of transaction ids or session ids. Ex: [15, 18] or ["euHoAQpvNe", "ecTjANqwFr"]
Vijaybc331e22020-02-27 04:17:37 -0600481 # release_type Release all locks acquired using current session or only given transaction numbers.
482 # Ex: Session, Transaction. Default will be Transaction.
483 # exp_status_code expected status code from the ReleaseLock request for given inputs.
Vijayafdd2a12020-04-09 02:03:20 -0500484 # conflict_record Expected conflict record.
Vijaybc331e22020-02-27 04:17:37 -0600485
Vijayafdd2a12020-04-09 02:03:20 -0500486 # When release_type=Session then TransactionIDs list will be ignored.
Vijaybc331e22020-02-27 04:17:37 -0600487 ${data}= Set Variable {"Type": "${release_type}", "TransactionIDs": ${transaction_ids}}
488 ${data}= Evaluate json.dumps(${data}) json
George Keishing566daaf2020-07-02 06:18:50 -0500489 ${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock data=${data}
490 Should Be True ${resp.status_code} ${exp_status_code}
Vijayafdd2a12020-04-09 02:03:20 -0500491 Return From Keyword If ${conflict_record} == ${EMPTY_LIST}
492
493 ${conflict}= Evaluate json.loads('''${resp.text}''') json
494
495 # Example of conflict
496 # {
497 # "Record":{
498 # "HMCID":"hmc-id",
499 # "LockType":"Read",
500 # "ResourceID":234,
501 # "SegmentFlags":[
502 # {
503 # "LockFlag":"DontLock",
504 # "SegmentLength":3
505 # },
506 # {
507 # "LockFlag":"LockAll",
508 # "SegmentLength":1
509 # }
510 # ],
511 # "SessionID":"OorUVwrXuT",
512 # "TransactionID":47
513 # }
514 # }
515
516 Should Be Equal ${conflict_record[0]} ${conflict["Record"]}
Vijaybc331e22020-02-27 04:17:37 -0600517
518
519Verify Lock Record
520 [Documentation] Verify lock record.
521 [Arguments] ${lock_found} &{lock_records}
522
523 # Description of argument(s):
524 # lock_found True if lock record is expected to be present, else False.
525 # lock_records A dictionary containing key value pairs of a lock record.
526
527 ${session}= Get From Dictionary ${LOCKS} ${lock_records["TransactionID"]}
George Keishing566daaf2020-07-02 06:18:50 -0500528 ${locks}= Get Locks List ${session}
Vijaybc331e22020-02-27 04:17:37 -0600529
530 ${lock_record_found}= Set Variable ${False}
531
532 FOR ${record} IN @{locks}
533 ${record}= Evaluate json.dumps(${record}) json
534 ${record}= Evaluate json.loads('''${record}''') json
535 ${lock_record_found}= Set Variable If ${record["TransactionID"]} == ${lock_records["TransactionID"]}
536 ... ${True} ${False}
537
538 Continue For Loop If ${lock_record_found} == ${False}
539 Dictionaries Should Be Equal ${record} ${lock_records}
540 Exit For Loop
541 END
542
543 Should Be Equal ${lock_record_found} ${lock_found}
544
545
Vijay355daac2020-03-26 12:06:08 -0500546Load Response And Verify Conflict
547 [Documentation] Load response and verify conflict.
548 [Arguments] ${conflict_resp} ${sessions}
549
550 # Description of argument(s):
551 # conflict_resp Conflict response from a REST request.
552 # Example : { "Record": { "HMCID": "hmc-id", "LockType": "Write", "ResourceID": 234,
553 # "SegmentFlags": [ { "LockFlag": "DontLock", "SegmentLength": 3},
554 # { "LockFlag": "LockAll", "SegmentLength": 1}],
555 # "SessionID": "B6geYEdo6T", "TransactionID": 104 } }
556 # sessions Comma separated list of sessions
557
George Keishing566daaf2020-07-02 06:18:50 -0500558 ${curr_locks}= Get Locks List ${sessions}
Vijay355daac2020-03-26 12:06:08 -0500559 ${conflict_resp}= Replace String ${conflict_resp} \" \\"
560 ${conflict_response}= Evaluate json.loads('''${conflict_resp}''') json
561
562 ${conflicts}= Get Dictionary Values ${conflict_response}
563 List Should Contain Value ${conflicts} ${PREV_INPUTS}
564
565
Vijaybc331e22020-02-27 04:17:37 -0600566Acquire And Release Lock
567 [Documentation] Acquire and release lock.
568 [Arguments] ${lock_type} ${seg_flags} ${resource_id} ${hmc_id} ${exp_status_code}=${HTTP_OK}
Vijay355daac2020-03-26 12:06:08 -0500569 ... ${err_msgs}=${EMPTY_LIST} ${new_sess_req}=${True}
Vijaybc331e22020-02-27 04:17:37 -0600570
571 # Description of argument(s):
572 # lock_type Type of lock (Read/Write).
573 # seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
574 # Ex: [{'LockFlag': 'LockAll', 'SegmentLength': 1},
575 # {'LockFlag': 'LockSame', 'SegmentLength': 2}]
576 # resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
577 # hmc_id Hardware management console id.
578 # exp_status_code Expected status code from the AcquireLock request for given inputs.
Vijay355daac2020-03-26 12:06:08 -0500579 # err_msgs List of expected error messages.
580 # new_sess_req Create a new session before acquiring a lock if True.
Vijaybc331e22020-02-27 04:17:37 -0600581
George Keishing566daaf2020-07-02 06:18:50 -0500582 # Delete the session.
George Keishingffe44e82020-08-03 09:34:32 -0500583 Run Keyword If ${new_sess_req} == ${True} Run Keyword And Ignore Error Delete All Redfish Sessions
George Keishing566daaf2020-07-02 06:18:50 -0500584
Vijaybc331e22020-02-27 04:17:37 -0600585 # Get REST session to BMC.
586 Run Keyword If ${new_sess_req} == ${True} Create New Session
587
George Keishing566daaf2020-07-02 06:18:50 -0500588 ${inputs}= Create Dictionary
589 ... LockType=${lock_type}
590 ... ResourceID=${resource_id}
591 ... SegmentFlags=${seg_flags}
592 ... HMCID=${hmc_id}
Vijaybc331e22020-02-27 04:17:37 -0600593
George Keishing566daaf2020-07-02 06:18:50 -0500594 ${transaction_id}= Acquire Lock On A Given Resource ${inputs["LockType"]}
Vijaybc331e22020-02-27 04:17:37 -0600595 ... ${inputs["SegmentFlags"]} ${inputs["ResourceID"]} ${exp_status_code} err_msgs=${err_msgs}
596
Vijay355daac2020-03-26 12:06:08 -0500597 # Each lock request from a new session is saved so that for next lock request using same session
598 # can refer to previous lock data to verify conflict records if any.
599 Run Keyword If ${new_sess_req} == ${True} Set Test Variable Dictionary Of Previous Lock Request
600 ... ${lock_type} ${seg_flags} ${resource_id} ${hmc_id} ${SESSION_ID} ${transaction_id}
Vijaybc331e22020-02-27 04:17:37 -0600601
Vijay355daac2020-03-26 12:06:08 -0500602 ${session}= Get From Dictionary ${LOCKS} ${transaction_id}
Vijaybc331e22020-02-27 04:17:37 -0600603 Set To Dictionary ${inputs} TransactionID=${${transaction_id}} SessionID=${session}
Vijay355daac2020-03-26 12:06:08 -0500604
Vijaybc331e22020-02-27 04:17:37 -0600605 ${lock_found}= Set Variable If ${exp_status_code} == ${HTTP_OK} ${True} ${False}
606 Verify Lock Record ${lock_found} &{inputs}
607
Vijay355daac2020-03-26 12:06:08 -0500608 Return From Keyword If '${exp_status_code}' != '${HTTP_OK}' or ${err_msgs} == ['NA']
Vijayafdd2a12020-04-09 02:03:20 -0500609 ${transaction_ids}= Create List ${transaction_id}
610 Release Locks ${transaction_ids}
Vijaybc331e22020-02-27 04:17:37 -0600611 Verify Lock Record ${False} &{inputs}
612
Vijaybc331e22020-02-27 04:17:37 -0600613
614Create New Session
615 [Documentation] Create new session.
616
George Keishing566daaf2020-07-02 06:18:50 -0500617 ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id}"}}
618 Set Test Variable ${SESSION_ID} ${resp['Id']}
Vijaybc331e22020-02-27 04:17:37 -0600619
620
621Test Teardown Execution
622 [Documentation] Test teardown execution.
623
624 FFDC On Test Case Fail
George Keishingffe44e82020-08-03 09:34:32 -0500625 Run Keyword And Ignore Error Delete All Redfish Sessions
Vijaybc331e22020-02-27 04:17:37 -0600626
Vijay355daac2020-03-26 12:06:08 -0500627
628Return Session Id And Session Key
629 [Documentation] Return session id and sesion key.
630
631 ${session_location}= Redfish.Get Session Location
632 ${session_id}= Evaluate os.path.basename($session_location) modules=os
633 ${session_key}= Redfish.Get Session Key
634
635 [Return] ${session_id} ${session_key}
636
637
638Test Setup Execution
639 [Documentation] Test setup execution.
640
George Keishing566daaf2020-07-02 06:18:50 -0500641 # This is a test constant value.
642 Set Test Variable ${hmc_id} hmc-id
Vijay355daac2020-03-26 12:06:08 -0500643 Create New Session
644
George Keishing566daaf2020-07-02 06:18:50 -0500645 Set Test Variable Dictionary Of Previous Lock Request
646 ... ${EMPTY} ${EMPTY_LIST} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY}
Vijay355daac2020-03-26 12:06:08 -0500647
648
649Set Test Variable Dictionary Of Previous Lock Request
650 [Documentation] Set test variable dictionary of previous lock request.
651 [Arguments] ${lock_type} ${seg_flags} ${resource_id} ${hmc_id} ${session_id} ${transaction_id}
652
653 # Description of argument(s):
654 # lock_type Type of lock (Read/Write).
655 # seg_flags Segmentation Flags to identify lock elements under system level in the hierarchy.
656 # Ex: [{'LockFlag': 'LockAll', 'SegmentLength': 1},
657 # {'LockFlag': 'LockSame', 'SegmentLength': 2}]
658 # resource_id Decimal +ve integer value of maximum 8 hex bytes. Ex: 134, 2048 etc.
659 # hmc_id Hardware management console id.
660 # session_id Session id of the transaction.
661 # transaction_id Transaction_id of the lock request.
662
George Keishing566daaf2020-07-02 06:18:50 -0500663 ${prev_inputs}= Create Dictionary
664 ... LockType=${lock_type}
665 ... ResourceID=${resource_id}
666 ... SegmentFlags=${seg_flags}
667 ... HMCID=${hmc_id}
668 ... SessionID=${session_id}
669 ... TransactionID=${transaction_id}
Vijay355daac2020-03-26 12:06:08 -0500670
671 Set Test Variable ${PREV_INPUTS} ${prev_inputs}