Automated test case lock at CEC level
changes:
- Added testcase "Acquire Multiple Lock Request At CEC Level"
- Added keyword "Verify Acquire Multiple Lock Request At CEC Level"
Change-Id: I2d7dd72f94ca524a24f0e610e85d4a3abbbc32a6
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/data/resource_lock_table.json b/data/resource_lock_table.json
index 6c10771..771c3fe 100644
--- a/data/resource_lock_table.json
+++ b/data/resource_lock_table.json
@@ -28,6 +28,42 @@
"SegmentLength": 3
}]
},
+ "ReadCase4": {
+ "Read": [{
+ "LockFlag": "DontLock",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "LockSame",
+ "SegmentLength": 1
+ }]
+ },
+ "ReadCase5": {
+ "Read": [{
+ "LockFlag": "DontLock",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "LockAll",
+ "SegmentLength": 1
+ }]
+ },
+ "ReadCase6": {
+ "Read": [{
+ "LockFlag": "LockSame",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "DontLock",
+ "SegmentLength": 1
+ }]
+ },
+ "ReadCase7": {
+ "Read": [{
+ "LockFlag": "LockAll",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "DontLock",
+ "SegmentLength": 1
+ }]
+ },
"WriteCase1": {
"Write": [{
"LockFlag": "LockAll",
@@ -54,8 +90,43 @@
"LockFlag": "LockSame",
"SegmentLength": 3
}]
+ },
+ "WriteCase4": {
+ "Write": [{
+ "LockFlag": "DontLock",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "LockAll",
+ "SegmentLength": 1
+ }]
+ },
+ "WriteCase5": {
+ "Write": [{
+ "LockFlag": "DontLock",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "LockSame",
+ "SegmentLength": 1
+ }]
+ },
+ "WriteCase6": {
+ "Write": [{
+ "LockFlag": "LockAll",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "DontLock",
+ "SegmentLength": 1
+ }]
+ },
+ "WriteCase7": {
+ "Write": [{
+ "LockFlag": "LockSame",
+ "SegmentLength": 2
+ }, {
+ "LockFlag": "DontLock",
+ "SegmentLength": 1
+ }]
}
-
},
"Invalid Case": {
"ResourceIDInvalidDataType": "234",
diff --git a/openpower/ext_interfaces/test_lock_management.robot b/openpower/ext_interfaces/test_lock_management.robot
index 027cd26..ddfaabc 100644
--- a/openpower/ext_interfaces/test_lock_management.robot
+++ b/openpower/ext_interfaces/test_lock_management.robot
@@ -10,7 +10,7 @@
Library ../../lib/bmc_network_utils.py
Suite Setup Run Keyword And Ignore Error Delete All Redfish Sessions
-Suite Teardown Redfish.Logout
+Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions
Test Setup Printn
Test Teardown FFDC On Test Case Fail
@@ -106,6 +106,18 @@
HMCID-01 WriteCase1,ReadCase1
+Acquire Multiple Lock Request At CEC Level
+ [Documentation] Acquire write lock on read lock under CEC level.
+ [Tags] Acquire_Multiple_Lock_Request_At_CEC_Level
+ [Template] Verify Acquire Multiple Lock Request At CEC Level
+
+ # client_id lock_type
+ HMCID-01 ReadCase4,WriteCase4
+ HMCID-01 WriteCase5,ReadCase5
+ HMCID-01 ReadCase6,WriteCase6
+ HMCID-01 WriteCase7,ReadCase7
+
+
Verify Release Of Valid Locks
[Documentation] Release all valid locks.
[Tags] Verify_Release_Of_Valid_Locks
@@ -380,7 +392,11 @@
${lock_dict_param}= Form Data To Acquire Lock ${lock_type}
${resp}= Redfish Post Request /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock data=${lock_dict_param}
Should Be Equal As Strings ${resp.status_code} ${status_code}
- ${resp}= Return Description Of Response ${resp.content}
+
+ Run Keyword If ${status_code} == ${HTTP_BAD_REQUEST}
+ ... Valid Value ${BAD_REQUEST} ['${resp.content}']
+ ... ELSE
+ ... Run Keyword And Return Return Description Of Response ${resp.content}
[Return] ${resp}
@@ -611,6 +627,18 @@
Should Be Equal As Strings ${resp.status_code} ${status_code}
+Release locks And Delete Session
+ [Documentation] Release locks and delete redfish session.
+ [Arguments] ${session_info} ${trans_id_list}
+
+ Release Locks On Resource ${session_info} ${trans_id_list}
+
+ ${trans_id_emptylist}= Create List
+ Verify Lock On Resource ${session_info} ${trans_id_emptylist}
+
+ Redfish Delete Session ${session_info}
+
+
Acquire Lock On Another Lock
[Documentation] Acquire lock on another lock.
[Arguments] ${client_id}
@@ -629,11 +657,8 @@
Append To List ${trans_id_list} ${trans_id}
Verify Lock On Resource ${session_info} ${trans_id_list}
- Release Locks On Resource ${session_info} ${trans_id_list}
- ${trans_id_emptylist}= Create List
- Verify Lock On Resource ${session_info} ${trans_id_emptylist}
- Redfish Delete Session ${session_info}
+ Release locks And Delete Session ${session_info} ${trans_id_list}
Verify Fail To Acquire Read And Write In Single Request
@@ -694,12 +719,8 @@
Verify Lock On Resource ${session_info} ${trans_id_list}
${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
- Release Locks On Resource ${session_info} ${trans_id_list}
- ${trans_id_emptylist}= Create List
- Verify Lock On Resource ${session_info} ${trans_id_emptylist}
-
- Redfish Delete Session ${session_info}
+ Release locks And Delete Session ${session_info} ${trans_id_list}
Verify Acquire Lock After Reboot
@@ -721,11 +742,31 @@
${trans_id}= Redfish Post Acquire Lock ${lock_type}
Append To List ${trans_id_list} ${trans_id}
Verify Lock On Resource ${session_info} ${trans_id_list}
- Release Locks On Resource ${session_info} ${trans_id_list} Transaction ${HTTP_OK}
- ${trans_id_emptylist}= Create List
- Verify Lock On Resource ${session_info} ${trans_id_emptylist}
- Redfish Delete Session ${session_info}
+ Release locks And Delete Session ${session_info} ${trans_id_list}
+
+
+Verify Acquire Multiple Lock Request At CEC Level
+ [Documentation] Acquire lock in loop.
+ [Arguments] ${client_id} ${lock_type}
+
+ # Description of argument(s):
+ # client_id This client id can contain string value
+ # (e.g. 12345, "HMCID").
+ # lock_type Read lock or Write lock.
+
+ ${trans_id_list}= Create List
+ @{lock_type_list}= Split String ${lock_type} ,
+ ${session_info}= Create Redfish Session With ClientID ${client_id}
+
+ ${trans_id}= Redfish Post Acquire Lock ${lock_type_list}[0]
+ Append To List ${trans_id_list} ${trans_id}
+
+ Verify Lock On Resource ${session_info} ${trans_id_list}
+
+ Redfish Post Acquire Lock ${lock_type_list}[1] status_code=${HTTP_CONFLICT}
+
+ Release locks And Delete Session ${session_info} ${trans_id_list}
Verify Acquire And Release Lock In Loop