Added test case related to multiple session

Changes:
   - Added testcase "Create A Multiple Session With ClientID And Verify"
   - Added testcase "Check Multiple ClientID Persistency On BMC Reboot"
   - Added keyword "Get Session Information By ClientID"

Change-Id: Icba45921f8aaa27f324185f6598536a481f909f4
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/openpower/ext_interfaces/test_client_identifier.robot b/openpower/ext_interfaces/test_client_identifier.robot
index 1cbbcb1..0bfea48 100644
--- a/openpower/ext_interfaces/test_client_identifier.robot
+++ b/openpower/ext_interfaces/test_client_identifier.robot
@@ -10,7 +10,7 @@
 Library           ../../lib/gen_robot_valid.py
 
 Suite Setup       Redfish.Login
-Suite Teardown    Delete All Redfish Sessions
+Suite Teardown    Run Keyword And Ignore Error  Delete All Redfish Sessions
 Test Setup        Printn
 Test Teardown     FFDC On Test Case Fail
 
@@ -18,25 +18,46 @@
 *** Test Cases ***
 
 Create A Session With ClientID And Verify
-   [Documentation]  Create a session with client id and verify client id is same.
-   [Tags]  Create_A_Session_With_ClientID_And_Verify
-   [Template]  Create And Verify Session ClientID
+    [Documentation]  Create a session with client id and verify client id is same.
+    [Tags]  Create_A_Session_With_ClientID_And_Verify
+    [Template]  Create And Verify Session ClientID
 
-   # client_id           # reboot_flag
-   12345                 False
-   123456                False
-   EXTERNAL-CLIENT-01    False
-   EXTERNAL-CLIENT-02    False
+    # client_id           reboot_flag
+    12345                 False
+    123456                False
+    EXTERNAL-CLIENT-01    False
+    EXTERNAL-CLIENT-02    False
 
 
 Check ClientID Persistency On BMC Reboot
-   [Documentation]  Create a session with client id and verify client id is same after the reboot.
-   [Tags]  Check_ClientID_Persistency_On_BMC_Reboot
-   [Template]  Create And Verify Session ClientID
+    [Documentation]  Create a session with client id and verify client id is same after the reboot.
+    [Tags]  Check_ClientID_Persistency_On_BMC_Reboot
+    [Template]  Create And Verify Session ClientID
 
-   # client_id           # reboot_flag
-   12345                 True
-   EXTERNAL-CLIENT-01    True
+    # client_id           reboot_flag
+    12345                 True
+    EXTERNAL-CLIENT-01    True
+
+
+Create A Multiple Session With ClientID And Verify
+    [Documentation]  Create a multiple session with client id and verify client id is same.
+    [Tags]  Create_A_Multiple_Session_With_ClientID_And_Verify
+    [Template]  Create And Verify Session ClientID
+
+    # client_id                              reboot_flag
+    12345,123456                             False
+    EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02    False
+
+
+Check Multiple ClientID Persistency On BMC Reboot
+    [Documentation]  Create a multiple session with client id and verify client id is same after the reboot.
+    [Tags]  Check_Multiple_ClientID_Persistency_On_BMC_Reboot
+    [Template]  Create And Verify Session ClientID
+
+    # client_id                              reboot_flag
+    12345,123456                             True
+    EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02    True
+
 
 *** Keywords ***
 
@@ -48,20 +69,36 @@
     # client_id    This client id can contain string value
     #              (e.g. 12345, "EXTERNAL-CLIENT").
 
-    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
+    @{session_list}=  Create List
+    &{tmp_dict}=  Create Dictionary
 
-    [Return]  ${resp}
+    FOR  ${client}  IN  @{client_id}
+      ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client}"}}
+      Append To List  ${session_list}  ${resp}
+    END
+
+    [Return]  ${session_list}
+
+
+Get Session Information By ClientID
+    [Documentation]  Get session information by client id.
+    [Arguments]  ${client_id}  ${session_ids}
+
+    FOR  ${session}  IN  @{session_ids}
+       Return From Keyword If  '${client_id}' == '${session["Oem"]["OpenBMC"]["ClientID"]}'  ${session["Id"]}
+    END
+
+    [Return]  ${EMPTY}
+
 
 Verify A Session Created With ClientID
     [Documentation]  Verify session created with client id.
-    [Arguments]  ${client_id}  ${session_id}
+    [Arguments]  ${client_ids}  ${session_ids}
 
     # Description of argument(s):
     # client_id    External client name.
     # session_id   This value is a session id.
 
-    ${sessions}=  Redfish.Get Properties  /redfish/v1/SessionService/Sessions/${session_id}
-
     # {
     #   "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
     #   "@odata.type": "#Session.v1_0_2.Session",
@@ -78,13 +115,17 @@
     #   "UserName": "root"
     # }
 
-    Rprint Vars  sessions
-    @{words} =  Split String  ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]}  :
-    ${ipaddr}=  Get Running System IP
-    Set Test Variable  ${temp_ipaddr}  ${words}[-1]
-    Valid Value  client_id  ['${sessions["Oem"]["OpenBMC"]["ClientID"]}']
-    Valid Value  sessions["Id"]  ['${session_id}']
-    Valid Value  temp_ipaddr  ${ipaddr}
+    FOR  ${client}  IN  @{client_ids}
+      ${session_id}=  Get Session Information By ClientID  ${client}  ${session_ids}
+      ${sessions}=  Redfish.Get Properties  /redfish/v1/SessionService/Sessions/${session_id}
+      Rprint Vars  sessions
+      @{words} =  Split String  ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]}  :
+      ${ipaddr}=  Get Running System IP
+      Set Test Variable  ${temp_ipaddr}  ${words}[-1]
+      Valid Value  client  ['${sessions["Oem"]["OpenBMC"]["ClientID"]}']
+      Valid Value  sessions["Id"]  ['${session_id}']
+      Valid Value  temp_ipaddr  ${ipaddr}
+    END
 
 
 Create And Verify Session ClientID
@@ -97,8 +138,9 @@
     # reboot_flag  Flag is used to run reboot the BMC code.
     #               (e.g. True or False).
 
-    ${session_info}=  Create A Session With ClientID  ${client_id}
-    Verify A Session Created With ClientID  ${client_id}  ${session_info['Id']}
+    ${client_ids}=  Split String  ${client_id}  ,
+    ${session_info}=  Create A Session With ClientID  ${client_ids}
+    Verify A Session Created With ClientID  ${client_ids}  ${session_info}
     Run Keyword If  '${reboot_flag}' == 'True'
-    ...  Redfish OBMC Reboot (off)
-    Verify A Session Created With ClientID  ${client_id}  ${session_info['Id']}
+    ...  Run Keywords  Redfish OBMC Reboot (off)  AND
+    ...  Verify A Session Created With ClientID  ${client_ids}  ${session_info}