145d841e3SSushil Singh*** Settings *** 245d841e3SSushil Singh 345d841e3SSushil SinghDocumentation Test client identifier feature on BMC. 445d841e3SSushil Singh 545d841e3SSushil SinghResource ../../lib/rest_client.robot 645d841e3SSushil SinghResource ../../lib/openbmc_ffdc.robot 745d841e3SSushil SinghResource ../../lib/resource.robot 845d841e3SSushil SinghResource ../../lib/bmc_redfish_utils.robot 945d841e3SSushil SinghLibrary ../../lib/bmc_network_utils.py 1045d841e3SSushil SinghLibrary ../../lib/gen_robot_valid.py 1145d841e3SSushil Singh 1245d841e3SSushil SinghSuite Setup Redfish.Login 1345d841e3SSushil SinghSuite Teardown Delete All Redfish Sessions 1445d841e3SSushil SinghTest Setup Printn 1545d841e3SSushil SinghTest Teardown FFDC On Test Case Fail 1645d841e3SSushil Singh 1745d841e3SSushil Singh 1845d841e3SSushil Singh*** Test Cases *** 1945d841e3SSushil Singh 2045d841e3SSushil SinghCreate A Session With ClientID And Verify 2145d841e3SSushil Singh [Documentation] Create a session with client id and verify client id is same. 2245d841e3SSushil Singh [Tags] Create_A_Session_With_ClientID_And_Verify 23*1384321bSSushil Singh [Template] Create And Verify Session ClientID 2445d841e3SSushil Singh 25*1384321bSSushil Singh # client_id # reboot_flag 26*1384321bSSushil Singh 12345 False 27*1384321bSSushil Singh 123456 False 28*1384321bSSushil Singh EXTERNAL-CLIENT-01 False 29*1384321bSSushil Singh EXTERNAL-CLIENT-02 False 30*1384321bSSushil Singh 31*1384321bSSushil Singh 32*1384321bSSushil SinghCheck ClientID Persistency On BMC Reboot 33*1384321bSSushil Singh [Documentation] Create a session with client id and verify client id is same after the reboot. 34*1384321bSSushil Singh [Tags] Check_ClientID_Persistency_On_BMC_Reboot 35*1384321bSSushil Singh [Template] Create And Verify Session ClientID 36*1384321bSSushil Singh 37*1384321bSSushil Singh # client_id # reboot_flag 38*1384321bSSushil Singh 12345 True 39*1384321bSSushil Singh EXTERNAL-CLIENT-01 True 4045d841e3SSushil Singh 4145d841e3SSushil Singh*** Keywords *** 4245d841e3SSushil Singh 4345d841e3SSushil SinghCreate A Session With ClientID 4445d841e3SSushil Singh [Documentation] Create redifish session with client id. 4545d841e3SSushil Singh [Arguments] ${client_id} 4645d841e3SSushil Singh 4745d841e3SSushil Singh # Description of argument(s): 4845d841e3SSushil Singh # client_id This client id can contain string value 4945d841e3SSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 5045d841e3SSushil Singh 5145d841e3SSushil Singh ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}} 5245d841e3SSushil Singh 53*1384321bSSushil Singh [Return] ${resp} 5445d841e3SSushil Singh 5545d841e3SSushil SinghVerify A Session Created With ClientID 5645d841e3SSushil Singh [Documentation] Verify session created with client id. 5745d841e3SSushil Singh [Arguments] ${client_id} ${session_id} 5845d841e3SSushil Singh 5945d841e3SSushil Singh # Description of argument(s): 6045d841e3SSushil Singh # client_id External client name. 6145d841e3SSushil Singh # session_id This value is a session id. 6245d841e3SSushil Singh 6345d841e3SSushil Singh ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id} 6445d841e3SSushil Singh 6545d841e3SSushil Singh # { 6645d841e3SSushil Singh # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ", 6745d841e3SSushil Singh # "@odata.type": "#Session.v1_0_2.Session", 6845d841e3SSushil Singh # "Description": "Manager User Session", 6945d841e3SSushil Singh # "Id": "H8q2ZKucSJ", 7045d841e3SSushil Singh # "Name": "User Session", 7145d841e3SSushil Singh # "Oem": { 7245d841e3SSushil Singh # "OpenBMC": { 7345d841e3SSushil Singh # "@odata.type": "#OemSession.v1_0_0.Session", 7445d841e3SSushil Singh # "ClientID": "", 7545d841e3SSushil Singh # "ClientOriginIP": "::ffff:x.x.x.x" 7645d841e3SSushil Singh # } 7745d841e3SSushil Singh # }, 7845d841e3SSushil Singh # "UserName": "root" 7945d841e3SSushil Singh # } 8045d841e3SSushil Singh 8145d841e3SSushil Singh Rprint Vars sessions 8245d841e3SSushil Singh @{words} = Split String ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]} : 8345d841e3SSushil Singh ${ipaddr}= Get Running System IP 8445d841e3SSushil Singh Set Test Variable ${temp_ipaddr} ${words}[-1] 8545d841e3SSushil Singh Valid Value client_id ['${sessions["Oem"]["OpenBMC"]["ClientID"]}'] 8645d841e3SSushil Singh Valid Value sessions["Id"] ['${session_id}'] 8745d841e3SSushil Singh Valid Value temp_ipaddr ${ipaddr} 88*1384321bSSushil Singh 89*1384321bSSushil Singh 90*1384321bSSushil SinghCreate And Verify Session ClientID 91*1384321bSSushil Singh [Documentation] Create redifish session with client id and verify it remain same. 92*1384321bSSushil Singh [Arguments] ${client_id} ${reboot_flag}=False 93*1384321bSSushil Singh 94*1384321bSSushil Singh # Description of argument(s): 95*1384321bSSushil Singh # client_id This client id contain string value 96*1384321bSSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 97*1384321bSSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 98*1384321bSSushil Singh # (e.g. True or False). 99*1384321bSSushil Singh 100*1384321bSSushil Singh ${session_info}= Create A Session With ClientID ${client_id} 101*1384321bSSushil Singh Verify A Session Created With ClientID ${client_id} ${session_info['Id']} 102*1384321bSSushil Singh Run Keyword If '${reboot_flag}' == 'True' 103*1384321bSSushil Singh ... Redfish OBMC Reboot (off) 104*1384321bSSushil Singh Verify A Session Created With ClientID ${client_id} ${session_info['Id']} 105