Re-write lock management test suit

Changes:
    - Re-structure lock management test suite.
    - Add new test case "Acquire And Release Lock In Loop".

Change-Id: I1d7021440e564bff5b4d7046e5b52a030d4adee3
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/data/resource_lock_table.json b/data/resource_lock_table.json
new file mode 100644
index 0000000..639a323
--- /dev/null
+++ b/data/resource_lock_table.json
@@ -0,0 +1,308 @@
+{
+    "Valid Case": {
+        "ResourceID": 234,
+        "ReadCase1": {
+            "Read": [{
+                "LockFlag": "LockAll",
+                "SegmentLength": 2
+            }, {
+                "LockFlag": "DontLock",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase2": {
+            "Read": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockAll",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase3": {
+            "Read": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 4
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 3
+            }]
+        },
+        "WriteCase1": {
+            "Write": [{
+                "LockFlag": "LockAll",
+                "SegmentLength": 2
+            }, {
+                 "LockFlag": "DontLock",
+                 "SegmentLength": 1
+            }]
+        },
+        "WriteCase2": {
+            "Write": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockAll",
+                "SegmentLength": 1
+            }]
+        },
+        "WriteCase3": {
+            "Write": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 4
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 3
+            }]
+         }
+
+    },
+    "Invalid Case": {
+        "ReadCase1": {
+            "read": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase2": {
+            "READ": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase3": {
+            "Red": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase4": {
+            "*Read": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 1
+            }]
+        },
+        "ReadCase5": {
+            "ReaD": [{
+                "LockFlag": "DontLock",
+                "SegmentLength": 3
+            }, {
+                "LockFlag": "LockSame",
+                "SegmentLength": 1
+            }]
+         },
+         "ReadCase6": {
+             "Read": [{
+                 "LockFlag": "lockall",
+                 "SegmentLength": 1
+              }]
+          },
+          "ReadCase7": {
+              "Read": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "locksame",
+                  "SegmentLength": 1
+              }]
+          },
+          "ReadCase8": {
+              "Read": [{
+                  "LockFlag": "dontlock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "locksame",
+                  "SegmentLength": 1
+              }]
+          },
+          "ReadCase9": {
+              "Read": [{
+                  "LockFlag": "ontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          },
+          "ReadCase10": {
+              "Read": [{
+                  "LockFlag": "*DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          },
+          "ReadCase11": {
+              "Read": [{
+                  "LockFlag": "dontlock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "lockall",
+                  "SegmentLength": 1
+              }]
+          },
+          "ReadCase12": {
+              "Read": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 7
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 0
+              }]
+          },
+          "ReadCase13": {
+              "Read": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 0
+              }]
+          },
+          "ReadCase14": {
+              "Read": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 7
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase1": {
+              "write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockSame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase2": {
+              "WRITE": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockSame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase3": {
+              "*Write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockSame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase4": {
+              "Wrte": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockSame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase5": {
+              "WritE": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockSame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase6": {
+              "Write": [{
+                  "LockFlag": "lockall",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase7": {
+              "Write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "locksame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase8": {
+              "Write": [{
+                  "LockFlag": "dontlock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "locksame",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase9": {
+              "Write": [{
+                  "LockFlag": "ontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase10": {
+              "Write": [{
+                  "LockFlag": "*DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          },
+          "WriteCase11": {
+              "Write": [{
+                  "LockFlag": "dontlock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "lockall",
+                   "SegmentLength": 1
+              }]
+          },
+          "WriteCase12": {
+              "Write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 7
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 0
+              }]
+          },
+          "WriteCase13": {
+              "Write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 3
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 0
+              }]
+          },
+          "WriteCase14": {
+              "Write": [{
+                  "LockFlag": "DontLock",
+                  "SegmentLength": 7
+              }, {
+                  "LockFlag": "LockAll",
+                  "SegmentLength": 1
+              }]
+          }
+    }
+}
diff --git a/lib/external_intf/management_console_utils.robot b/lib/external_intf/management_console_utils.robot
index 5c01227..0539dad 100644
--- a/lib/external_intf/management_console_utils.robot
+++ b/lib/external_intf/management_console_utils.robot
@@ -38,3 +38,14 @@
     ${service_message}=  Get From Dictionary  ${daemon_message}  ${message}
     ${resp}  ${stderr}  ${rc}=  BMC Execute Command  ${service_command}  print_out=1
     Should Contain  ${resp}  ${service_message}
+
+
+Get Lock Resource Information
+    [Documentation]  Get lock resource information.
+
+    ${code_base_dir_path}=  Get Code Base Dir Path
+    ${resource_lock_json}=  Evaluate
+    ...  json.load(open('${code_base_dir_path}data/resource_lock_table.json'))  modules=json
+    Rprint Vars  resource_lock_json
+
+    [Return]  ${resource_lock_json}
diff --git a/openpower/ext_interfaces/test_lock_management.robot b/openpower/ext_interfaces/test_lock_management.robot
index 89eef3a..e2393ef 100644
--- a/openpower/ext_interfaces/test_lock_management.robot
+++ b/openpower/ext_interfaces/test_lock_management.robot
@@ -1,469 +1,307 @@
 *** Settings ***
 
-Documentation    Test Lock Management feature of Management Console on BMC.
+Documentation        Test lock management feature of management console on BMC.
 
-Resource         ../../lib/resource.robot
-Resource         ../../lib/openbmc_ffdc.robot
-Resource         ../../lib/bmc_redfish_utils.robot
+Resource             ../../lib/resource.robot
+Resource             ../../lib/openbmc_ffdc.robot
+Resource             ../../lib/bmc_redfish_utils.robot
+Resource             ../../lib/external_intf/management_console_utils.robot
 
-Suite Setup      Run Keyword And Ignore Error  Delete All Redfish Sessions
-Test Setup       Test Setup Execution
-Test Teardown    Test Teardown Execution
-Suite Teardown   Run Keyword And Ignore Error  Delete All Redfish Sessions
+Suite Setup          Run Keyword And Ignore Error  Delete All Redfish Sessions
+Suite Teardown       Redfish.Logout
+Test Setup           Printn
+Test Teardown        FFDC On Test Case Fail
 
 *** Variables ***
 
-# Data-sets for testing different test cases.
-&{LOCKALL_LEN1}                   LockFlag=LockAll                SegmentLength=${1}
-&{LOCKALL_LEN2}                   LockFlag=LockAll                SegmentLength=${2}
-&{LOCKALL_LEN3}                   LockFlag=LockAll                SegmentLength=${3}
-&{LOCKALL_LEN4}                   LockFlag=LockAll                SegmentLength=${4}
-&{LOCKALL_LEN5}                   LockFlag=LockAll                SegmentLength=${5}
-
-&{LOCKALL_INVALID_LOCKFLAG1}      LockFlag=LocAll                 SegmentLength=${2}
-&{LOCKALL_INVALID_LOCKFLAG2}      LockFlag=LOCKALL                SegmentLength=${3}
-&{LOCKALL_INVALID_LOCKFLAG3}      LOCKFLAG=LockAll                SegmentLength=${4}
-&{LOCKSAME_INVALID_LOCKFLAG3}     Lock=LockSame                   SegmentLength=${1}
-&{LOCKSAME_INVALID_LOCKFLAG4}     Lock=LockSame                   SegmentLength=${True}
-
-&{LOCKSAME_LEN1}                  LockFlag=LockSame               SegmentLength=${1}
-&{LOCKSAME_LEN2}                  LockFlag=LockSame               SegmentLength=${2}
-&{LOCKSAME_LEN3}                  LockFlag=LockSame               SegmentLength=${3}
-&{LOCKSAME_LEN4}                  LockFlag=LockSame               SegmentLength=${4}
-&{LOCKSAME_INVALID_LEN1}          LockFlag=LockSame               SegmentLength=${0}
-&{LOCKSAME_INVALID_LEN2}          LockFlag=LockSame               SegmentLength=${5}
-&{LOCKSAME_INVALID_LEN_STR}       LockFlag=LockSame               SegmentLength=2
-&{LOCKSAME_INVALID_LEN_NEG}       LockFlag=LockSame               SegmentLength=${-3}
-&{LOCKSAME_INVALID_LEN_BOOL}      Lock=LockSame                   SegmentLength=${True}
-
-&{DONTLOCK_LEN1}                  LockFlag=DontLock               SegmentLength=${1}
-&{DONTLOCK_LEN2}                  LockFlag=DontLock               SegmentLength=${2}
-&{DONTLOCK_LEN3}                  LockFlag=DontLock               SegmentLength=${3}
-&{DONTLOCK_LEN4}                  LockFlag=DontLock               SegmentLength=${4}
-&{DONTLOCK_INVALID_LEN}           LockFlag=DontLock               SegmentLength=${5}
-&{DONTLOCK_INVALID_LEN_BOOL}      LockFlag=DONTLOCK               SegmentLength=${False}
-&{DONTLOCK_INVALID_LOCKFLAG}      LOCKFLAG=LockAll                SegmentLength=${4}
-
-@{ONE_SEG_FLAG_ALL}               ${LOCKALL_LEN1}
-@{ONE_SEG_FLAG_SAME}              ${LOCKSAME_LEN3}
-@{ONE_SEG_FLAG_DONT}              ${DONTLOCK_LEN4}
-
-@{TWO_SEG_FLAG_1}                 ${LOCKALL_LEN1}                 ${LOCKSAME_LEN2}
-@{TWO_SEG_FLAG_2}                 ${DONTLOCK_LEN3}                ${LOCKALL_LEN1}
-@{TWO_SEG_FLAG_3}                 ${DONTLOCK_LEN4}                ${LOCKSAME_LEN3}
-@{TWO_SEG_FLAG_4}                 ${DONTLOCK_INVALID_LEN}         ${LOCKSAME_LEN3}
-@{TWO_SEG_FLAG_5}                 ${DONTLOCK_LEN2}                ${LOCKSAME_INVALID_LEN1}
-
-@{TWO_SEG_FLAG_INVALID1}          ${DONTLOCK_LEN4}                ${LOCKSAME_INVALID_LEN1}
-@{TWO_SEG_FLAG_INVALID2}          ${LOCKALL_LEN5}                 ${DONTLOCK_LEN1}
-@{TWO_SEG_FLAG_INVALID3}          ${DONTLOCK_LEN1}                ${LOCKALL_INVALID_LOCKFLAG1}
-@{TWO_SEG_FLAG_INVALID4}          ${DONTLOCK_LEN2}                ${LOCKALL_INVALID_LOCKFLAG2}
-@{TWO_SEG_FLAG_INVALID5}          ${DONTLOCK_LEN2}                ${LOCKALL_INVALID_LOCKFLAG3}
-@{TWO_SEG_FLAG_INVALID6}          ${LOCKALL_LEN3}                 ${LOCKSAME_INVALID_LOCKFLAG3}
-@{TWO_SEG_FLAG_INVALID7}          ${DONTLOCK_LEN2}                ${LOCKSAME_INVALID_LOCKFLAG4}
-@{TWO_SEG_FLAG_INVALID8}          ${DONTLOCK_INVALID_LOCKFLAG}    ${LOCKSAME_INVALID_LEN_BOOL}
-@{TWO_SEG_FLAG_INVALID9}          ${DONTLOCK_LEN2}                ${LOCKSAME_INVALID_LOCKFLAG4}
-
-@{THREE_SEG_FLAG_1}               ${LOCKALL_LEN1}                 @{TWO_SEG_FLAG_3}
-@{THREE_SEG_FLAG_2}               ${LOCKSAME_LEN4}                @{TWO_SEG_FLAG_2}
-@{THREE_SEG_FLAG_3}               ${DONTLOCK_LEN3}                @{TWO_SEG_FLAG_1}
-
-@{FOUR_SEG_FLAG_1}                ${LOCKALL_LEN1}                 @{THREE_SEG_FLAG_2}
-@{FOUR_SEG_FLAG_2}                ${LOCKSAME_LEN4}                @{THREE_SEG_FLAG_3}
-@{FOUR_SEG_FLAG_3}                ${DONTLOCK_LEN3}                @{THREE_SEG_FLAG_1}
-
-@{FIVE_SEG_FLAG_1}                ${LOCKALL_LEN1}                 @{FOUR_SEG_FLAG_2}
-@{FIVE_SEG_FLAG_2}                ${LOCKSAME_LEN4}                @{FOUR_SEG_FLAG_3}
-@{FIVE_SEG_FLAG_3}                ${DONTLOCK_LEN3}                @{FOUR_SEG_FLAG_1}
-
-@{SIX_SEG_FLAG_1}                 ${LOCKALL_LEN1}                 @{FIVE_SEG_FLAG_2}
-@{SIX_SEG_FLAG_2}                 ${LOCKSAME_LEN4}                @{FIVE_SEG_FLAG_3}
-@{SIX_SEG_FLAG_3}                 ${DONTLOCK_LEN3}                @{FIVE_SEG_FLAG_1}
-
-@{SEVEN_SEG_FLAG_1}               ${LOCKALL_LEN1}                 @{SIX_SEG_FLAG_2}
-@{SEVEN_SEG_FLAG_2}               ${LOCKSAME_LEN4}                @{SIX_SEG_FLAG_3}
-@{SEVEN_SEG_FLAG_3}               ${DONTLOCK_LEN3}                @{SIX_SEG_FLAG_1}
-
-# Different messages to be verified.
-${PROP_REQ_ERR}         is a required property and must be included in the request.
-${PROP_ERR}             is not in the list of valid properties for the resource.
-${PROP_TYPE_ERR}        is of a different type than the property can accept.
-
-# Build error patterns list.
-@{EMPTY_LIST}
-@{ERR_PATTERN1}                   ${PROP_REQ_ERR}                ${PROP_ERR}
-@{ERR_PATTERN2}                   ${PROP_TYPE_ERR}
-@{ERR_PATTERN3}                   ${PROP_REQ_ERR}                ${PROP_ERR}                 ${PROP_TYPE_ERR}
-
-# Dictionary of Locks with Transaction ID as key and Session ID as a value.
-&{LOCKS}
-
+${BAD_REQUEST}       Bad Request
 
 *** Test Cases ***
 
-Acquire And Release Different Read Locks
+Acquire Read Write Lock
     [Documentation]  Acquire and release different read locks.
-    [Tags]  Acquire_And_Release_Different_Read_Locks
-    [Template]  Acquire And Release Lock
+    [Tags]  Acquire_Read_Write_Lock
+    [Template]  Acquire Lock On Resource
 
-    # lock  seg_flags                     resource_id  hmc_id  exp_status_code      err_msgs         new_sess
-    # type                                                                                            req
-    Read    ${ONE_SEG_FLAG_ALL}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${ONE_SEG_FLAG_SAME}          ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${ONE_SEG_FLAG_DONT}          ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_1}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_2}             ${234}       hmc-id  ${HTTP_OK}           ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_3}             ${234}       hmc-id  ${HTTP_OK}           ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_4}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_5}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${THREE_SEG_FLAG_1}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${THREE_SEG_FLAG_2}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${THREE_SEG_FLAG_3}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FOUR_SEG_FLAG_1}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FOUR_SEG_FLAG_2}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FOUR_SEG_FLAG_3}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FIVE_SEG_FLAG_1}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FIVE_SEG_FLAG_2}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${FIVE_SEG_FLAG_3}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SIX_SEG_FLAG_1}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SIX_SEG_FLAG_2}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SIX_SEG_FLAG_3}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SEVEN_SEG_FLAG_1}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SEVEN_SEG_FLAG_2}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${SEVEN_SEG_FLAG_3}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${LOCKSAME_INVALID_LEN1}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${LOCKSAME_INVALID_LEN_STR}   ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
-    Read    ${LOCKSAME_INVALID_LEN_NEG}   ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
-    Read    ${LOCKSAME_INVALID_LEN_BOOL}  ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
-    Read    ${DONTLOCK_INVALID_LEN_BOOL}  ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
-    Read    ${TWO_SEG_FLAG_INVALID1}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_INVALID2}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_INVALID3}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_INVALID4}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${EMPTY_LIST}    ${True}
-    Read    ${TWO_SEG_FLAG_INVALID5}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN1}  ${True}
-    Read    ${TWO_SEG_FLAG_INVALID6}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN1}  ${True}
-    Read    ${TWO_SEG_FLAG_INVALID7}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN3}  ${True}
-    Read    ${TWO_SEG_FLAG_INVALID8}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN1}  ${True}
-    Read    ${TWO_SEG_FLAG_INVALID9}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
-    Read    ${TWO_SEG_FLAG_3}             234          hmc-id  ${HTTP_BAD_REQUEST}  ${ERR_PATTERN2}  ${True}
+    # client_id    lock_type     reboot_flag
+    HMCID-01       ReadCase1     False
+    HMCID-01       ReadCase2     False
+    HMCID-01       ReadCase3     False
+    HMCID-01       WriteCase1    False
+    HMCID-01       WriteCase2    False
+    HMCID-01       WriteCase3    False
 
 
-Acquire And Release Different Write Locks
-    [Documentation]  Acquire and release different write locks.
-    [Tags]  Acquire_And_Release_Different_Write_Locks
-    [Template]  Acquire And Release Lock
+Check Lock Persistency On BMC Reboot
+    [Documentation]  Acquire lock and check after reboot it remain same.
+    [Tags]  Check_Lock_Persistency_On_BMC_Reboot
+    [Template]  Acquire Lock On Resource
 
-    # lock  seg_flags                    resource_id  hmc_id  exp_status_code       err_msgs         new_sess
-    # type                                                                                            req
-    Write  ${ONE_SEG_FLAG_ALL}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${ONE_SEG_FLAG_SAME}          ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${ONE_SEG_FLAG_DONT}          ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_1}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_2}             ${234}       hmc-id  ${HTTP_OK}            ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_3}             ${234}       hmc-id  ${HTTP_OK}            ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_INVALID4}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${THREE_SEG_FLAG_1}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${THREE_SEG_FLAG_2}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${THREE_SEG_FLAG_3}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FOUR_SEG_FLAG_1}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FOUR_SEG_FLAG_2}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FOUR_SEG_FLAG_3}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FIVE_SEG_FLAG_1}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FIVE_SEG_FLAG_2}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${FIVE_SEG_FLAG_3}            ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SIX_SEG_FLAG_1}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SIX_SEG_FLAG_2}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SIX_SEG_FLAG_3}             ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SEVEN_SEG_FLAG_1}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SEVEN_SEG_FLAG_2}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${SEVEN_SEG_FLAG_3}           ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${LOCKSAME_INVALID_LEN1}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${LOCKSAME_INVALID_LEN_STR}   ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${LOCKSAME_INVALID_LEN_NEG}   ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${LOCKSAME_INVALID_LEN_BOOL}  ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${DONTLOCK_INVALID_LEN_BOOL}  ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_INVALID1}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_INVALID2}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${EMPTY_LIST}    ${True}
-    Write  ${TWO_SEG_FLAG_INVALID8}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${ERR_PATTERN1}  ${True}
-    Write  ${TWO_SEG_FLAG_INVALID5}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${ERR_PATTERN1}  ${True}
-    Write  ${TWO_SEG_FLAG_INVALID9}      ${234}       hmc-id  ${HTTP_BAD_REQUEST}   ${ERR_PATTERN2}  ${True}
-    Write  ${TWO_SEG_FLAG_3}             234          hmc-id  ${HTTP_BAD_REQUEST}   ${ERR_PATTERN2}  ${True}
+    # client_id    lock_type     reboot_flag
+    HMCID-01       ReadCase1     True
+    HMCID-01       ReadCase2     True
+    HMCID-01       ReadCase3     True
+    HMCID-01       WriteCase1    True
+    HMCID-01       WriteCase2    True
+    HMCID-01       WriteCase3    True
 
 
-Verify GetLockList Returns An Empty Record For An Invalid Session Id
-    [Documentation]  Verify GetLockList returns an empty record for an invalid session id.
-    [Tags]  Verify_GetLockList_Returns_An_Empty_Record_For_An_Invalid_Session_Id
+Acquire Read Lock On Read Lock
+    [Documentation]  Acquire read lock on another read lock.
+    [Tags]  Acquire_Read_Lock_On_Read_Lock
+    [Template]  Acquire Lock On Another Lock
 
-    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id}"}}
-
-    ${records}=  Get Locks List  ${resp['Id']}
-    ${records}=  Get Locks List  ZZzZZz9zzZ
-    ${length}=  Get Length  ${records}
-    Should Be Equal  ${length}  ${0}
+    # client_id
+    HMCID-01
 
 
-Verify Lock Conflicts
-    [Documentation]  Verify lock conflicts.
-    [Tags]  Verify_Lock_Conflicts
-    [Template]  Acquire And Release Lock
+Get Lock Records Empty For Invalid Session
+    [Documentation]  Record of lock list is empty for invalid session.
+    [Tags]  Get_Lock_Records_Empty_For_Invalid_Session
+    [Template]  Verify Empty Lock Records For Invalid Session
 
-    Write  ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_OK}        ['NA']  ${True}
-    Read   ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_CONFLICT}  ['NA']  ${False}
-    Read   ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_OK}        ['NA']  ${True}
-    Write  ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_CONFLICT}  ['NA']  ${False}
-    Write  ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_OK}        ['NA']  ${True}
-    Write  ${TWO_SEG_FLAG_2}  ${234}  hmc-id  ${HTTP_CONFLICT}  ['NA']  ${False}
+    # client_id
+    HMCID-01
 
 
-Verify Persistency Of Read Locks After BMC Reboot
-    [Documentation]  Verify persistency of locks after BMC reboot.
-    [Tags]  Verify_Persistency_Of_Read_Locks_After_BMC_Reboot
-    [Template]  Locks Persistency Check After BMC Reboot
+Fail To Acquire Lock On Another Lock
+    [Documentation]  Fail to acquire another lock.
+    [Tags]  Fail_To_Acquire_Lock_On_Another_Lock
+    [Template]  Verify Acquire Lock Fails On Another Lock
 
-    # lock_type  seg_flags          resource_id
-    Read         ${TWO_SEG_FLAG_2}  ${234}
+    # client_id    lock_type
+    HMCID-01       ReadCase2,WriteCase2
+    HMCID-01       WriteCase2,WriteCase2
+    HMCID-01       WriteCase2,ReadCase2
 
 
-Verify Persistency Of Write Locks After BMC Reboot
-    [Documentation]  Verify persistency of locks after BMC reboot.
-    [Tags]  Verify_Persistency_Of_Write_Locks_After_BMC_Reboot
-    [Template]  Locks Persistency Check After BMC Reboot
+Acquire And Release Lock In Loop
+    [Documentation]  Acquire and release read, write locks in loop.
+    [Tags]  Acquire_And_Release_Lock_In_Loop
+    [Template]  Verify Acquire And Release Lock In Loop
 
-    # lock_type  seg_flags          resource_id
-    Write        ${TWO_SEG_FLAG_2}  ${234}
+    # client_id    lock_type
+    HMCID-01       ReadCase1
+    HMCID-01       ReadCase2
+    HMCID-01       ReadCase3
+    HMCID-01       WriteCase1
+    HMCID-01       WriteCase2
+    HMCID-01       WriteCase3
 
 
-Verify Valid Lock Transactions Release
-    [Documentation]  Verify valid lock transactions release.
-    [Tags]  Verify_Valid_Lock_Transactions_Release
+Verify Release Of Valid Locks
+    [Documentation]  Release all valid locks.
+    [Tags]  Verify_Release_Of_Valid_Locks
+    [Template]  Acquire And Release Multiple Locks
 
-    ${transaction_id1}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_2}  ${234}
-    ${locks_before}=  Get Locks List  ${SESSION_ID}
-
-    ${transaction_id2}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_3}  ${234}
-    ${transaction_id3}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_2}  ${234}
-    ${transaction_id4}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_3}  ${234}
-
-    ${transaction_ids}=  Create List  ${transaction_id2}  ${transaction_id3}  ${transaction_id4}
-    Release Locks  ${transaction_ids}
-    ${locks_after}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${locks_before}  ${locks_after}
+    # client_id    lock_type                        release_lock_type
+    HMCID-01       ReadCase1,ReadCase1,ReadCase1    Transaction
+    HMCID-02       ReadCase1,ReadCase1,ReadCase1    Session
 
 
-Verify Invalid Lock Transactions Release
-    [Documentation]  Verify invalid lock transactions release.
-    [Tags]  Verify_Invalid_Lock_Transactions_Release
+Invalid Locks Fail To Release
+    [Documentation]  Release in-valid lock result in fail.
+    [Tags]  Invalid_Locks_Fail_To_Release
+    [Template]  Verify Invalid Locks Fail To Release
 
-    ${transaction_id1}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_2}  ${234}
-    ${locks_before}=  Get Locks List  ${SESSION_ID}
-
-    ${transaction_id2}=  Evaluate  ${transaction_id1} + 1
-    ${transaction_id3}=  Evaluate  ${transaction_id1} - 1
-    ${transaction_ids}=  Create List  ${transaction_id2}  ${transaction_id1}  ${transaction_id3}
-
-    # If any transaction/s in the list does not belong to current session then it will be a bad request.
-    Release Locks  ${transaction_ids}  exp_status_code=${HTTP_BAD_REQUEST}
-    ${locks_after}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${locks_before}  ${locks_after}
+    # client_id    lock_type                        release_lock_type
+    HMCID-01       ReadCase1,ReadCase1,ReadCase1    Transaction
+    12345          ReadCase2,ReadCase2,ReadCase2    Transaction
+    HMCID          ReadCase3,ReadCase3,ReadCase3    Transaction
 
 
-Verify Locks Release By Session
-    [Documentation]  Verify locks release by session.
-    [Tags]  Verify_Locks_Release_By_Session
+Fail To Release Lock For Another Session
+    [Documentation]  Failed to release locks from another session.
+    [Tags]  Fail_To_Release_Lock_For_Another_Session
+    [Template]  Verify Fail To Release Lock For Another Session
 
-    ${locks_before}=  Get Locks List  ${SESSION_ID}
-    ${transaction_id1}=  Acquire Lock On A Given Resource  Write  ${TWO_SEG_FLAG_2}  ${234}
-
-    # Release Lock by Session without mentioning transaction_ids.
-    Release Locks  release_type=Session
-    ${locks_after}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${locks_before}  ${locks_after}
-
-    ${transaction_id1}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_2}  ${234}
-    ${transaction_id2}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_3}  ${234}
-    ${transaction_ids}=  Create List  ${transaction_id1}  ${transaction_id2}
-
-    # Release Lock by Session by mentioning transaction_ids also in the request.
-    Release Locks  ${transaction_ids}  release_type=Session
+    # client_id          lock_type
+    HMCID-01,HMCID-02    ReadCase1,ReadCase1
 
 
-Verify Locks Created By One Session Cannot Be Deleted By Another Session
-    [Documentation]  Verify locks created by one session cannot be deleted by another session.
-    [Tags]  Verify_Locks_Created_By_One_Session_Cannot_Be_Deleted_By_Another_Session
-    [Setup]  No Operation
+Fail To Acquire Lock For Invalid Lock Type
+    [Documentation]  Failed to acquire read, write lock for invalid lock data passed.
+    [Tags]  Fail_To_Acquire_Lock_For_Invalid_Lock_Type
+    [Template]  Verify Fail To Acquire Lock For Invalid Lock Data
 
-    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
-    Set Test Variable  ${SESSION_ID}  ${resp['Id']}
-    ${transaction_id1}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_2}  ${234}
-    ${locks_tran1}=  Get Locks List  ${resp['Id']}
+    # client_id    lock_type      message
+    HMCID-01       ReadCase1      ${BAD_REQUEST}
+    HMCID-01       ReadCase2      ${BAD_REQUEST}
+    HMCID-01       ReadCase3      ${BAD_REQUEST}
+    HMCID-01       ReadCase4      ${BAD_REQUEST}
+    HMCID-01       ReadCase5      ${BAD_REQUEST}
+    HMCID-01       WriteCase1     ${BAD_REQUEST}
+    HMCID-01       WriteCase2     ${BAD_REQUEST}
+    HMCID-01       WriteCase3     ${BAD_REQUEST}
+    HMCID-01       WriteCase4     ${BAD_REQUEST}
+    HMCID-01       WriteCase5     ${BAD_REQUEST}
 
-    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"hmc-id"}}
-    Set Test Variable  ${SESSION_ID}  ${resp['Id']}
 
-    ${transaction_id2}=  Acquire Lock On A Given Resource  Read  ${TWO_SEG_FLAG_3}  ${234}
-    ${locks_before}=  Get Locks List  ${resp['Id']}
+Fail To Acquire Lock For Invalid Lock Flag
+    [Documentation]  Failed to acquire read write lock for invalid lock flag passed.
+    [Tags]  Fail_To_Acquire_Lock_For_Invalid_Lock_Flag
+    [Template]  Verify Fail To Acquire Lock For Invalid Lock Data
 
-    ${transaction_ids}=  Create List  ${transaction_id1}  ${transaction_id2}
-    Release Locks  ${transaction_ids}  exp_status_code=${HTTP_UNAUTHORIZED}  conflict_record=${locks_tran1}
-    ${locks_after}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${locks_before}  ${locks_after}
+    # client_id    lock_type       message
+    HMCID-01       ReadCase6       ${BAD_REQUEST}
+    HMCID-01       ReadCase7       ${BAD_REQUEST}
+    HMCID-01       ReadCase8       ${BAD_REQUEST}
+    HMCID-01       ReadCase9       ${BAD_REQUEST}
+    HMCID-01       ReadCase10      ${BAD_REQUEST}
+    HMCID-01       ReadCase11      ${BAD_REQUEST}
+    HMCID-01       WriteCase6      ${BAD_REQUEST}
+    HMCID-01       WriteCase7      ${BAD_REQUEST}
+    HMCID-01       WriteCase8      ${BAD_REQUEST}
+    HMCID-01       WriteCase9      ${BAD_REQUEST}
+    HMCID-01       WriteCase10     ${BAD_REQUEST}
+    HMCID-01       WriteCase11     ${BAD_REQUEST}
 
-    # When release_type=Session, transaction_ids should be ignored.
-    Release Locks  ${transaction_ids}  release_type=Session
-    ${locks_after}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${EMPTY_LIST}  ${locks_after}
 
+Fail To Acquire Lock For Invalid Segment Flag
+    [Documentation]  Failed to acquire read write lock for invalid segment flag passed.
+    [Tags]  Fail_To_Acquire_Lock_For_Invalid_Segment_Flag
+    [Template]  Verify Fail To Acquire Lock For Invalid Lock Data
+
+    # client_id    lock_type       message
+    HMCID-01       ReadCase12      ${BAD_REQUEST}
+    HMCID-01       ReadCase13      ${BAD_REQUEST}
+    HMCID-01       ReadCase14      ${BAD_REQUEST}
+    HMCID-01       WriteCase12     ${BAD_REQUEST}
+    HMCID-01       WriteCase13     ${BAD_REQUEST}
+    HMCID-01       WriteCase14     ${BAD_REQUEST}
 
 *** Keywords ***
 
-Locks Persistency Check After BMC Reboot
-    [Documentation]  Locks persistency check after BMC reboot.
-    [Arguments]  ${lock_type}  ${seg_flags}  ${resource_id}
+Create Redfish Session With ClientID
+    [Documentation]  Create redifish session with client id.
+    [Arguments]  ${client_id}
 
     # Description of argument(s):
-    # lock_type    Type of lock (Read/Write).
-    # seg_flags    Segmentation Flags to identify lock elements under system level in the hierarchy.
-    # resource_id  Decimal +ve integer value of maximum 8 hex bytes.  Ex: 134, 2048 etc.
+    # client_id    This client id can contain string value
+    #              (e.g. 12345, "HMCID").
 
-    ${transaction_id}=  Acquire Lock On A Given Resource  ${lock_type}  ${seg_flags}  ${resource_id}
+    ${session_info}=  Create Dictionary
+    ${session}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
 
-    ${locks_prev}=  Get Locks List  ${SESSION_ID}
+    Set To Dictionary  ${session_info}  SessionIDs  ${session['Id']}
+    Set To Dictionary  ${session_info}  ClientID  ${session["Oem"]["OpenBMC"]["ClientID"]}
 
-    Redfish OBMC Reboot (off)
-    Redfish Login
-
-    ${locks_curr}=  Get Locks List  ${SESSION_ID}
-    Should Be Equal  ${locks_prev}  ${locks_curr}
-
-    ${transaction_ids}=  Create List  ${transaction_id}
-    Release Locks  ${transaction_ids}
+    [Return]  ${session_info}
 
 
-Return Data Dictionary For Single Request
-    [Documentation]  Return data dictionary for single request.
-    [Arguments]  ${lock_type}  ${seg_flags}  ${resource_id}
+RW General Dictionary
+    [Documentation]  Create dictionay of lock request.
+    [Arguments]  ${read_case}  ${res_id}
 
     # Description of argument(s):
-    # lock_type    Type of lock (Read/Write).
-    # seg_flags    Segmentation Flags to identify lock elements under system level in the hierarchy.
-    # resource_id  Decimal +ve integer value of maximum 8 hex bytes.  Ex: 134, 2048 etc.
+    # read_case    Read or Write lock type.
+    # res_id       Resource id.
 
-    ${SEG_FLAGS_LOCK}=  Create Dictionary
-    ...  LockType=${lock_type}
-    ...  SegmentFlags=@{seg_flags}
-    ...  ResourceID=${resource_id}
+    ${request_dict}=  Create Dictionary
 
-    ${SEG_FLAGS_ENTRIES}=  Create List  ${SEG_FLAGS_LOCK}
-    ${LOCK_REQUEST}=  Create Dictionary  Request=${SEG_FLAGS_ENTRIES}
-    Log To Console  \n${SPACE}${LOCK_REQUEST}
+    FOR  ${key}  IN  @{read_case.keys()}
+      Set To Dictionary  ${request_dict}  LockType  ${key}
+      Set To Dictionary  ${request_dict}  SegmentFlags  ${read_case["${key}"]}
+    END
 
-    [Return]  ${LOCK_REQUEST}
+    Set To Dictionary  ${request_dict}  ResourceID  ${res_id}
+
+    [Return]  ${request_dict}
 
 
-Acquire Lock On A Given Resource
-    [Documentation]  Acquire lock on a given resource.
-    [Arguments]  ${lock_type}  ${seg_flags}  ${resource_id}  ${exp_status_code}=${HTTP_OK}
-    ...  ${err_msgs}=${EMPTY_LIST}
-
-    # Description of argument(s):
-    # lock_type        Type of lock (Read/Write).
-    # seg_flags        Segmentation Flags to identify lock elements under system level in the hierarchy.
-    #                  Ex:  [{'LockFlag': 'LockAll', 'SegmentLength': 1},
-    #                        {'LockFlag': 'LockSame', 'SegmentLength': 2}]
-    # resource_id      Decimal +ve integer value of maximum 8 hex bytes.  Ex: 134, 2048 etc.
-    # exp_status_code  Expected status code from the AcquireLock request for given inputs.
-    # err_msgs         List of expected error messages.
-
-    ${data}=  Return Data Dictionary For Single Request  ${lock_type}  ${seg_flags}  ${resource_id}
-    ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock  data=${data}
-
-    ${transaction_id}=  Run Keyword If  ${exp_status_code} != ${HTTP_OK}
-    ...      Set Variable  ${0}
-    ...  ELSE
-    ...     Load Lock Record And Build Transaction To Session Map  ${resp.text}
-
-    Run Keyword If  ${exp_status_code} == ${HTTP_CONFLICT} and ${err_msgs} == ['NA']
-    ...      Load Response And Verify Conflict  ${resp.text}  ${SESSION_ID}
-    ...  ELSE  Run Keyword If  ${exp_status_code} != ${HTTP_OK} and ${err_msgs} != ${EMPTY_LIST}
-    ...     Load Response And Verify Error  ${resp.text}  err_msgs=${err_msgs}
-
-    Append Transaction Id And Session Id To Locks Dictionary  ${transaction_id}
-
-    [Return]  ${transaction_id}
-
-
-Load Lock Record And Build Transaction To Session Map
-    [Documentation]  Load lock record and build transaction to session map.
+Return Description Of Response
+    [Documentation]  Return description of REST response.
     [Arguments]  ${resp_text}
 
     # Description of argument(s):
-    # resp_text  Response test from a REST request.
+    # resp_text    REST response body.
 
-    ${acquire_lock}=  Evaluate  json.loads('''${resp_text}''')  json
-    Append Transaction Id And Session Id To Locks Dictionary  ${acquire_lock["TransactionID"]}
+    # resp_text after successful partition file upload looks like:
+    # {
+    #    "Description": "File Created"
+    # }
 
-    [Return]  ${acquire_lock["TransactionID"]}
+    ${message}=  Evaluate  json.loads('''${resp_text}''')  json
+
+    [Return]  ${message}
 
 
-Load Response And Verify Error
-    [Documentation]  Load response and verify error.
-    [Arguments]  ${error_resp}  ${err_msgs}=${EMPTY_LIST}
+Redfish Post Acquire Lock
+    [Documentation]  Acquire and release lock.
+    [Arguments]  ${lock_type}  ${status_code}=${HTTP_OK}
 
     # Description of argument(s):
-    # error_resp  Error response from a REST request.
-    # err_msgs    List of error msg patterns.
+    # lock_type      Read lock or Write lock.
+    # status_code    HTTP status code.
 
-    ${error_resp}=  Replace String  ${error_resp}  \"  \\"
-    ${error_response}=  Evaluate  json.loads('''${error_resp}''')  json
+    ${resp}=  Form Data To Acquire Lock  ${lock_type}
+    ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock  data=${resp}
+    Should Be Equal As Strings  ${resp.status_code}  ${status_code}
+    ${resp}=  Return Description Of Response  ${resp.content}
 
-    ${errors}=  Get Dictionary Values  ${error_response}
-    ${extended_errors}=  Create List
-
-    FOR  ${error}  IN  @{errors}
-      Append To List  ${extended_errors}  ${error[0]["Message"]}
-    END
-
-    Log To Console  \n ${extended_errors}
-
-    FOR  ${exp_error}  IN  @{err_msgs}
-        Run Keyword  Expect List Of Errors In An Extended Errors  ${exp_error}  ${extended_errors}
-    END
+    [Return]  ${resp}
 
 
-Expect List Of Errors In An Extended Errors
-    [Documentation]  Expect list of errors in an extended errors.
-    [Arguments]  ${exp_error}  ${extended_errors}=${EMPTY_LIST}
-
-    ${found}=  Set Variable  ${False}
-
-    FOR  ${error_record}  IN  @{extended_errors}
-      ${found}=  Evaluate  '${exp_error}' in '${error_record}'
-      Exit For Loop If  ${found} == ${True}
-    END
-
-    Should Be True  ${found}
-
-
-Append Transaction Id And Session Id To Locks Dictionary
-    [Documentation]  Append transaction id and session id to locks dictionary.
-    [Arguments]  ${transaction_id}
+Redfish Post Acquire Invalid Lock
+    [Documentation]  Redfish to post request to acquire in-valid lock.
+    [Arguments]  ${lock_type}  ${message}  ${status_code}=${HTTP_OK}
 
     # Description of argument(s):
-    # transaction_id  Transaction ID created from acquire lock request. Ex: 8, 9 etc.
+    # lock_type      Read lock or Write lock.
+    # message        Return message from URI.
+    # status_code    HTTP status code.
 
-    Set To Dictionary  ${LOCKS}  ${${transaction_id}}  ${session_id}
+    ${resp}=  Form Data To Acquire Invalid Lock  ${lock_type}
+    ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.AcquireLock  data=${resp}
+    Should Be Equal As Strings  ${resp.status_code}  ${status_code}
+    Valid Value  message  ['${resp.content}']
+
+    [Return]  ${resp}
 
 
-Get Locks List
+Form Data To Acquire Lock
+    [Documentation]  Create a dictionay for lock request.
+    [Arguments]  ${lock_type}
+
+    # Description of argument(s):
+    # lock_type      Read lock or Write lock.
+
+    ${lock_res_info}=  Get Lock Resource Information
+    ${resp}=  RW General Dictionary
+    ...    ${lock_res_info["Valid Case"]["${lock_type}"]}
+    ...    ${lock_res_info["Valid Case"]["ResourceID"]}
+    ${temp_list}=  Create List  ${resp}
+    ${lock_request}=  Create Dictionary  Request=${temp_list}
+
+    [Return]  ${lock_request}
+
+
+Form Data To Acquire Invalid Lock
+    [Documentation]  Create a dictionay for in-valid lock request.
+    [Arguments]  ${lock_type}
+
+    # Description of argument(s):
+    # lock_type      Read lock or Write lock.
+
+    ${lock_res_info}=  Get Lock Resource Information
+    ${resp}=  RW General Dictionary
+    ...    ${lock_res_info["Invalid Case"]["${lock_type}"]}
+    ...    ${lock_res_info["Valid Case"]["ResourceID"]}
+    ${temp_list}=  Create List  ${resp}
+    ${lock_request}=  Create Dictionary  Request=${temp_list}
+
+    [Return]  ${lock_request}
+
+
+Get Locks List On Resource
     [Documentation]  Get locks list.
-    [Arguments]  @{sessions}  ${exp_status_code}=${HTTP_OK}
+    [Arguments]  ${session_info}  ${exp_status_code}=${HTTP_OK}
 
     # Description of argument(s):
-    # sessions         List of comma separated strings. Ex: ["euHoAQpvNe", "ecTjANqwFr"]
-    # exp_status_code  expected status code from the GetLockList request for given inputs.
+    # session_info       Session information in dict.
+    # exp_status_code    Expected HTTP status code.
 
-    ${sessions}=  Evaluate  json.dumps(${sessions})  json
-    ${data}=  Set Variable  {"SessionIDs": ${sessions}}
+    ${data}=  Set Variable  {"SessionIDs": ["${session_info['SessionIDs']}"]}
     ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.GetLockList
     ...  data=${data}
     ${locks}=  Evaluate  json.loads('''${resp.text}''')  json
@@ -471,201 +309,321 @@
     [Return]  ${locks["Records"]}
 
 
-Release Locks
-    [Documentation]  Release locks.
-    [Arguments]  ${transaction_ids}=${EMPTY_LIST}  ${release_type}=Transaction  ${exp_status_code}=${HTTP_OK}
-    ...  ${conflict_record}=${EMPTY_LIST}
+Verify Lock On Resource
+    [Documentation]  Verify lock on resource.
+    [Arguments]  ${session_info}  ${transaction_id}
 
     # Description of argument(s):
-    # transaction_ids  List of transaction ids or session ids. Ex: [15, 18]  or ["euHoAQpvNe", "ecTjANqwFr"]
-    # release_type     Release all locks acquired using current session or only given transaction numbers.
-    #                  Ex:  Session,  Transaction.  Default will be Transaction.
-    # exp_status_code  expected status code from the ReleaseLock request for given inputs.
-    # conflict_record  Expected conflict record.
+    # session_info      Session information in dict.
+    # transaction_id    Transaction id in list stored in dict.
 
-    # When release_type=Session then TransactionIDs list will be ignored.
-    ${data}=  Set Variable  {"Type": "${release_type}", "TransactionIDs": ${transaction_ids}}
-    ${data}=  Evaluate  json.dumps(${data})  json
-    ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock  data=${data}
-    Should Be True  ${resp.status_code}  ${exp_status_code}
-    Return From Keyword If  ${conflict_record} == ${EMPTY_LIST}
+    ${sessions}=  Redfish.Get Properties  /redfish/v1/SessionService/Sessions/${session_info['SessionIDs']}
+    Rprint Vars  sessions
+    ${lock_list}=  Get Locks List On Resource  ${session_info}
+    ${lock_length}=  Get Length  ${lock_list}
+    ${tran_id_length}=  Get Length  ${transaction_id}
+    Should Be Equal As Integers  ${tran_id_length}  ${lock_length}
 
-    ${conflict}=  Evaluate  json.loads('''${resp.text}''')  json
-
-    # Example of conflict
-    # {
-    #    "Record":{
-    #       "HMCID":"hmc-id",
-    #       "LockType":"Read",
-    #       "ResourceID":234,
-    #       "SegmentFlags":[
-    #          {
-    #             "LockFlag":"DontLock",
-    #             "SegmentLength":3
-    #          },
-    #          {
-    #             "LockFlag":"LockAll",
-    #             "SegmentLength":1
-    #          }
-    #       ],
-    #       "SessionID":"OorUVwrXuT",
-    #       "TransactionID":47
-    #    }
-    # }
-
-    Should Be Equal  ${conflict_record[0]}  ${conflict["Record"]}
-
-
-Verify Lock Record
-    [Documentation]  Verify lock record.
-    [Arguments]  ${lock_found}  &{lock_records}
-
-    # Description of argument(s):
-    # lock_found    True if lock record is expected to be present, else False.
-    # lock_records  A dictionary containing key value pairs of a lock record.
-
-    ${session}=  Get From Dictionary  ${LOCKS}  ${lock_records["TransactionID"]}
-    ${locks}=  Get Locks List  ${session}
-
-    ${lock_record_found}=  Set Variable  ${False}
-
-    FOR  ${record}  IN  @{locks}
-      ${record}=  Evaluate  json.dumps(${record})  json
-      ${record}=  Evaluate  json.loads('''${record}''')  json
-      ${lock_record_found}=  Set Variable If  ${record["TransactionID"]} == ${lock_records["TransactionID"]}
-      ...  ${True}  ${False}
-
-      Continue For Loop If  ${lock_record_found} == ${False}
-      Dictionaries Should Be Equal  ${record}  ${lock_records}
-      Exit For Loop
+    FOR  ${tran_id}  ${lock}  IN ZIP  ${transaction_id}  ${lock_list}
+      Valid Value  session_info['ClientID']  ['${lock['HMCID']}']
+      Valid Value  session_info['SessionIDs']  ['${lock['SessionID']}']
+      Should Be Equal As Integers  ${tran_id['TransactionID']}  ${lock['TransactionID']}
     END
 
-    Should Be Equal  ${lock_record_found}  ${lock_found}
 
-
-Load Response And Verify Conflict
-    [Documentation]  Load response and verify conflict.
-    [Arguments]  ${conflict_resp}  ${sessions}
+Redfish Delete Session
+    [Documentation]  Redfish delete session.
+    [Arguments]  ${session_info}
 
     # Description of argument(s):
-    # conflict_resp  Conflict response from a REST request.
-    #                Example : { "Record": { "HMCID": "hmc-id", "LockType": "Write", "ResourceID": 234,
-    #                            "SegmentFlags": [ { "LockFlag": "DontLock", "SegmentLength": 3},
-    #                                              { "LockFlag": "LockAll",  "SegmentLength": 1}],
-    #                            "SessionID": "B6geYEdo6T", "TransactionID": 104 } }
-    # sessions       Comma separated list of sessions
+    # session_info      Session information in dict.
 
-    ${curr_locks}=  Get Locks List  ${sessions}
-    ${conflict_resp}=  Replace String  ${conflict_resp}  \"  \\"
-    ${conflict_response}=  Evaluate  json.loads('''${conflict_resp}''')  json
-
-    ${conflicts}=  Get Dictionary Values  ${conflict_response}
-    List Should Contain Value  ${conflicts}  ${PREV_INPUTS}
+    Redfish.Delete  /redfish/v1/SessionService/Sessions/${session_info["SessionIDs"]}
 
 
-Acquire And Release Lock
-    [Documentation]  Acquire and release lock.
-    [Arguments]  ${lock_type}  ${seg_flags}  ${resource_id}  ${hmc_id}  ${exp_status_code}=${HTTP_OK}
-    ...  ${err_msgs}=${EMPTY_LIST}  ${new_sess_req}=${True}
+Acquire Lock On Resource
+    [Documentation]  Acquire lock on resource.
+    [Arguments]  ${client_id}  ${lock_type}  ${reboot_flag}=False
 
     # Description of argument(s):
-    # lock_type        Type of lock (Read/Write).
-    # seg_flags        Segmentation Flags to identify lock elements under system level in the hierarchy.
-    #                  Ex:  [{'LockFlag': 'LockAll', 'SegmentLength': 1},
-    #                        {'LockFlag': 'LockSame', 'SegmentLength': 2}]
-    # resource_id      Decimal +ve integer value of maximum 8 hex bytes.  Ex: 134, 2048 etc.
-    # hmc_id           Hardware management console id.
-    # exp_status_code  Expected status code from the AcquireLock request for given inputs.
-    # err_msgs         List of expected error messages.
-    # new_sess_req     Create a new session before acquiring a lock if True.
+    # client_id    This client id can contain string value
+    #              (e.g. 12345, "HMCID").
+    # lock_type    Read lock or Write lock.
+    # reboot_flag  Flag is used to run reboot the BMC code.
+    #               (e.g. True or False).
 
-    # Delete the session.
-    Run Keyword If  ${new_sess_req} == ${True}  Run Keyword And Ignore Error  Delete All Redfish Sessions
+    ${trans_id_list}=  Create List
+    ${session_info}=  Create Redfish Session With ClientID  ${client_id}
+    ${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}
 
-    # Get REST session to BMC.
-    Run Keyword If  ${new_sess_req} == ${True}  Create New Session
+    ${BEROFE_REBOOT_XAUTH_TOKEN}=  Set Variable  ${XAUTH_TOKEN}
 
-    ${inputs}=  Create Dictionary
-    ...  LockType=${lock_type}
-    ...  ResourceID=${resource_id}
-    ...  SegmentFlags=${seg_flags}
-    ...  HMCID=${hmc_id}
+    Run Keyword If  '${reboot_flag}' == 'True'
+    ...  Run Keywords  Redfish OBMC Reboot (off)  AND
+    ...  Redfish Login  AND
+    ...  Set Global Variable  ${XAUTH_TOKEN}  ${BEROFE_REBOOT_XAUTH_TOKEN}  AND
+    ...  Verify Lock On Resource  ${session_info}  ${trans_id_list}  AND
+    ...  Release Locks On Resource  ${session_info}  ${trans_id_list}  Transaction  ${HTTP_OK}
 
-    ${transaction_id}=  Acquire Lock On A Given Resource  ${inputs["LockType"]}
-    ...  ${inputs["SegmentFlags"]}  ${inputs["ResourceID"]}  ${exp_status_code}  err_msgs=${err_msgs}
+    Run Keyword If  '${reboot_flag}' == 'False'
+    ...  Release Locks On Resource  ${session_info}  ${trans_id_list}  Transaction  ${HTTP_OK}
 
-    # Each lock request from a new session is saved so that for next lock request using same session
-    # can refer to previous lock data to verify conflict records if any.
-    Run Keyword If  ${new_sess_req} == ${True}  Set Test Variable Dictionary Of Previous Lock Request
-    ...  ${lock_type}  ${seg_flags}  ${resource_id}  ${hmc_id}  ${SESSION_ID}  ${transaction_id}
-
-    ${session}=  Get From Dictionary  ${LOCKS}  ${transaction_id}
-    Set To Dictionary  ${inputs}  TransactionID=${${transaction_id}}  SessionID=${session}
-
-    ${lock_found}=  Set Variable If  ${exp_status_code} == ${HTTP_OK}  ${True}  ${False}
-    Verify Lock Record  ${lock_found}  &{inputs}
-
-    Return From Keyword If  '${exp_status_code}' != '${HTTP_OK}' or ${err_msgs} == ['NA']
-    ${transaction_ids}=  Create List  ${transaction_id}
-    Release Locks  ${transaction_ids}
-    Verify Lock Record  ${False}  &{inputs}
+    ${trans_id_emptylist}=  Create List
+    Verify Lock On Resource  ${session_info}  ${trans_id_emptylist}
+    Redfish Delete Session  ${session_info}
 
 
-Create New Session
-    [Documentation]  Create new session.
-
-    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${hmc_id}"}}
-    Set Test Variable  ${SESSION_ID}  ${resp['Id']}
-
-
-Test Teardown Execution
-    [Documentation]  Test teardown execution.
-
-    FFDC On Test Case Fail
-    Run Keyword And Ignore Error  Delete All Redfish Sessions
-
-
-Return Session Id And Session Key
-    [Documentation]  Return session id and sesion key.
-
-    ${session_location}=  Redfish.Get Session Location
-    ${session_id}=  Evaluate  os.path.basename($session_location)  modules=os
-    ${session_key}=  Redfish.Get Session Key
-
-    [Return]  ${session_id}  ${session_key}
-
-
-Test Setup Execution
-    [Documentation]  Test setup execution.
-
-    # This is a test constant value.
-    Set Test Variable  ${hmc_id}  hmc-id
-    Create New Session
-
-    Set Test Variable Dictionary Of Previous Lock Request
-    ...  ${EMPTY}  ${EMPTY_LIST}  ${EMPTY}  ${EMPTY}  ${EMPTY}  ${EMPTY}
-
-
-Set Test Variable Dictionary Of Previous Lock Request
-    [Documentation]  Set test variable dictionary of previous lock request.
-    [Arguments]  ${lock_type}  ${seg_flags}  ${resource_id}  ${hmc_id}  ${session_id}  ${transaction_id}
+Form Data To Release Lock
+    [Documentation]  Create a dictonay to release lock.
+    [Arguments]  ${trans_id_list}
 
     # Description of argument(s):
-    # lock_type            Type of lock (Read/Write).
-    # seg_flags            Segmentation Flags to identify lock elements under system level in the hierarchy.
-    #                      Ex:  [{'LockFlag': 'LockAll', 'SegmentLength': 1},
-    #                           {'LockFlag': 'LockSame', 'SegmentLength': 2}]
-    # resource_id          Decimal +ve integer value of maximum 8 hex bytes.  Ex: 134, 2048 etc.
-    # hmc_id               Hardware management console id.
-    # session_id           Session id of the transaction.
-    # transaction_id       Transaction_id of the lock request.
+    # trans_id_list
 
-    ${prev_inputs}=  Create Dictionary
-    ...  LockType=${lock_type}
-    ...  ResourceID=${resource_id}
-    ...  SegmentFlags=${seg_flags}
-    ...  HMCID=${hmc_id}
-    ...  SessionID=${session_id}
-    ...  TransactionID=${transaction_id}
+    @{tran_ids}=  Create List
 
-    Set Test Variable  ${PREV_INPUTS}  ${prev_inputs}
+    FOR  ${item}  IN  @{trans_id_list}
+      Append To List  ${tran_ids}  ${item['TransactionID']}
+    END
+
+    [Return]  ${tran_ids}
+
+
+Release Locks On Resource
+    [Documentation]  Redfish request to release a lock.
+    [Arguments]  ${session_info}  ${trans_id_list}  ${release_lock_type}=Transaction  ${status_code}=${HTTP_OK}
+
+    # Description of argument(s):
+    # session_info        Session information in dict.
+    # trans_id_list       Transaction id list.
+    # release_lock_type   Release lock by Transaction, Session.
+    # status_code         HTTP status code.
+
+    ${tran_ids}=  Form Data To Release Lock  ${trans_id_list}
+    ${data}=  Set Variable  {"Type": "${release_lock_type}", "TransactionIDs":${tran_ids}}
+    ${data}=  Evaluate  json.dumps(${data})  json
+    ${resp}=  Redfish Post Request  /ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock  data=${data}
+    Should Be Equal As Strings  ${resp.status_code}  ${status_code}
+
+
+Acquire Lock On Another Lock
+    [Documentation]  Acquire lock on another lock.
+    [Arguments]  ${client_id}
+
+    # Description of argument(s):
+    # client_id    This client id can contain string value
+    #              (e.g. 12345, "HMCID").
+
+    ${trans_id_list}=  Create List
+    ${session_info}=  Create Redfish Session With ClientID  ${client_id}
+
+    ${trans_id}=  Redfish Post Acquire Lock  ReadCase1
+    Append To List  ${trans_id_list}  ${trans_id}
+
+    ${trans_id}=  Redfish Post Acquire Lock  ReadCase1
+    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}
+
+
+Verify Empty Lock Records For Invalid Session
+    [Documentation]  Verify no lock record found for invalid session.
+    [Arguments]  ${client_id}
+
+    # Description of argument(s):
+    # client_id    This client id can contain string value
+    #              (e.g. 12345, "HMCID").
+
+    ${session_info1}=  Create Redfish Session With ClientID  ${client_id}
+
+    ${lock_list1}=  Get Locks List On Resource  ${session_info1}
+    ${lock_length1}=  Get Length  ${lock_list1}
+
+    ${session_info2}=  Copy Dictionary  ${session_info1}  deepcopy=True
+    set to dictionary  ${session_info2}  SessionIDs  xxyXyyYZZz
+
+    ${lock_list2}=  Get Locks List On Resource  ${session_info2}
+    ${lock_length2}=  Get Length  ${lock_list1}
+
+    Valid Value  lock_length1  ${lock_list2}
+
+    Redfish Delete Session  ${session_info1}
+
+
+Verify Acquire Lock Fails On Another Lock
+    [Documentation]  Verify acquire lock on another lock fails.
+    [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.
+
+    @{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]
+
+    ${trans_id_list}=  Create List
+    Append To List  ${trans_id_list}  ${trans_id}
+
+    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}
+
+
+Verify Acquire And Release Lock In Loop
+    [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.
+
+    FOR  ${count}  IN RANGE  1  11
+      ${trans_id_list}=  Create List
+      ${session_info}=  Create Redfish Session With ClientID  ${client_id}
+      ${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}
+    END
+
+    Redfish Delete Session  ${session_info}
+
+
+Acquire And Release Multiple Locks
+    [Documentation]  Acquire mutilple locks on resource.
+    [Arguments]  ${client_id}  ${lock_type}  ${release_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.
+    # release_lock_type  The value can be Transaction or Session.
+
+    @{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]
+
+    ${trans_id_list}=  Create List
+
+    Append To List  ${trans_id_list}  ${trans_id}
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[1]
+
+    Append To List  ${trans_id_list}  ${trans_id}
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[2]
+
+    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}  release_lock_type=${release_lock_type}
+
+    ${trans_id_emptylist}=  Create List
+    Verify Lock On Resource  ${session_info}  ${trans_id_emptylist}
+    Redfish Delete Session  ${session_info}
+
+
+Verify Invalid Locks Fail To Release
+    [Documentation]  Verify invalid locks fails to be released.
+    [Arguments]  ${client_id}  ${lock_type}  ${release_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.
+    # release_lock_type  The value can be Transaction or Session.
+
+    ${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]
+    ${value}=  Get From Dictionary  ${trans_id}  TransactionID
+    ${value}=  Evaluate  ${value} + 10
+    Set To Dictionary  ${trans_id}  TransactionID  ${value}
+    Append To List  ${trans_id_list}  ${trans_id}
+
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[1]
+    ${value}=  Get From Dictionary  ${trans_id}  TransactionID
+    ${value}=  Evaluate  ${value} + 10
+    Set To Dictionary  ${trans_id}  TransactionID  ${value}
+    Append To List  ${trans_id_list}  ${trans_id}
+
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[2]
+    ${value}=  Get From Dictionary  ${trans_id}  TransactionID
+    ${value}=  Evaluate  ${value} + 10
+    Set To Dictionary  ${trans_id}  TransactionID  ${value}
+    Append To List  ${trans_id_list}  ${trans_id}
+
+    Release Locks On Resource
+    ...  ${session_info}  ${trans_id_list}
+    ...  release_lock_type=${release_lock_type}  status_code=${HTTP_BAD_REQUEST}
+    Release Locks On Resource  ${session_info}  ${trans_id_list}  release_lock_type=Session
+
+    ${trans_id_emptylist}=  Create List
+    Verify Lock On Resource  ${session_info}  ${trans_id_emptylist}
+    Redfish Delete Session  ${session_info}
+
+
+Verify Fail To Release Lock For Another Session
+    [Documentation]  Verify failed to release the lock form another session.
+    [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.
+
+    ${client_ids}=  Split String  ${client_id}  ,
+    ${lock_type_list}=  Split String  ${lock_type}  ,
+    ${trans_id_list1}=  Create List
+    ${trans_id_list2}=  Create List
+
+    ${session_info1}=  Create Redfish Session With ClientID  ${client_ids}[0]
+
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[0]
+    Append To List  ${trans_id_list1}  ${trans_id}
+    Verify Lock On Resource  ${session_info1}  ${trans_id_list1}
+
+    ${session_info2}=  Create Redfish Session With ClientID  ${client_ids}[1]
+    ${trans_id}=  Redfish Post Acquire Lock  ${lock_type_list}[1]
+    Append To List  ${trans_id_list2}  ${trans_id}
+    Verify Lock On Resource  ${session_info2}  ${trans_id_list2}
+
+    Release Locks On Resource
+    ...  ${session_info1}  ${trans_id_list1}  Transaction  status_code=${HTTP_UNAUTHORIZED}
+    Verify Lock On Resource  ${session_info1}  ${trans_id_list1}
+    Release Locks On Resource  ${session_info1}  ${trans_id_list1}  release_lock_type=Session
+    Release Locks On Resource  ${session_info2}  ${trans_id_list2}  release_lock_type=Session
+    Redfish Delete Session  ${session_info1}
+    Redfish Delete Session  ${session_info2}
+
+
+Verify Fail To Acquire Lock For Invalid Lock Data
+    [Documentation]  Verify fail to quired lock with invalid lock types, lock flags, segement flags.
+    [Arguments]  ${client_id}  ${lock_type}  ${message}
+
+    # Description of argument(s):
+    # client_id    This client id can contain string value
+    #              (e.g. 12345, "HMCID").
+    # lock_type    Read lock or Write lock.
+    # message      Return message from URI.
+
+    ${session_info}=  Create Redfish Session With ClientID  ${client_id}
+    ${trans_id}=  Redfish Post Acquire Invalid Lock  ${lock_type}  message=${message}  status_code=${HTTP_BAD_REQUEST}
+    Redfish Delete Session  ${session_info}