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 9ca49ced3SSushil SinghResource ../../lib/external_intf/management_console_utils.robot 10f90fd656SSushil SinghResource ../../lib/utils.robot 1145d841e3SSushil SinghLibrary ../../lib/bmc_network_utils.py 1245d841e3SSushil SinghLibrary ../../lib/gen_robot_valid.py 1345d841e3SSushil Singh 14f90fd656SSushil Singh 1545d841e3SSushil SinghSuite Setup Redfish.Login 16889a75e4SSushil SinghSuite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions 1745d841e3SSushil SinghTest Setup Printn 1845d841e3SSushil SinghTest Teardown FFDC On Test Case Fail 1945d841e3SSushil Singh 2045d841e3SSushil Singh 2145d841e3SSushil Singh*** Test Cases *** 2245d841e3SSushil Singh 2345d841e3SSushil SinghCreate A Session With ClientID And Verify 2445d841e3SSushil Singh [Documentation] Create a session with client id and verify client id is same. 2545d841e3SSushil Singh [Tags] Create_A_Session_With_ClientID_And_Verify 261384321bSSushil Singh [Template] Create And Verify Session ClientID 2745d841e3SSushil Singh 28889a75e4SSushil Singh # client_id reboot_flag 291384321bSSushil Singh 12345 False 301384321bSSushil Singh 123456 False 311384321bSSushil Singh EXTERNAL-CLIENT-01 False 321384321bSSushil Singh EXTERNAL-CLIENT-02 False 331384321bSSushil Singh 341384321bSSushil Singh 351384321bSSushil SinghCheck ClientID Persistency On BMC Reboot 361384321bSSushil Singh [Documentation] Create a session with client id and verify client id is same after the reboot. 371384321bSSushil Singh [Tags] Check_ClientID_Persistency_On_BMC_Reboot 381384321bSSushil Singh [Template] Create And Verify Session ClientID 391384321bSSushil Singh 40889a75e4SSushil Singh # client_id reboot_flag 411384321bSSushil Singh 12345 True 421384321bSSushil Singh EXTERNAL-CLIENT-01 True 4345d841e3SSushil Singh 44889a75e4SSushil Singh 45889a75e4SSushil SinghCreate A Multiple Session With ClientID And Verify 46889a75e4SSushil Singh [Documentation] Create a multiple session with client id and verify client id is same. 47889a75e4SSushil Singh [Tags] Create_A_Multiple_Session_With_ClientID_And_Verify 48889a75e4SSushil Singh [Template] Create And Verify Session ClientID 49889a75e4SSushil Singh 50889a75e4SSushil Singh # client_id reboot_flag 51889a75e4SSushil Singh 12345,123456 False 52889a75e4SSushil Singh EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02 False 53889a75e4SSushil Singh 54889a75e4SSushil Singh 55889a75e4SSushil SinghCheck Multiple ClientID Persistency On BMC Reboot 56889a75e4SSushil Singh [Documentation] Create a multiple session with client id and verify client id is same after the reboot. 57889a75e4SSushil Singh [Tags] Check_Multiple_ClientID_Persistency_On_BMC_Reboot 58889a75e4SSushil Singh [Template] Create And Verify Session ClientID 59889a75e4SSushil Singh 60889a75e4SSushil Singh # client_id reboot_flag 61889a75e4SSushil Singh 12345,123456 True 62889a75e4SSushil Singh EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02 True 63889a75e4SSushil Singh 64889a75e4SSushil Singh 65c957f57fSSushil SinghFail To Set Client Origin IP 66c957f57fSSushil Singh [Documentation] Fail to set the client origin IP. 67c957f57fSSushil Singh [Tags] Fail_To_Set_Client_Origin_IP 68c957f57fSSushil Singh [Template] Create Session And Fail To Set Client Origin IP 69c957f57fSSushil Singh 70c957f57fSSushil Singh # client_id 71c957f57fSSushil Singh 12345 72c957f57fSSushil Singh EXTERNAL-CLIENT-01 73c957f57fSSushil Singh 744ec68ba8SSushil Singh 754ec68ba8SSushil SinghCreate Session For Non Admin User 764ec68ba8SSushil Singh [Documentation] Create Session for non-admin user. 774ec68ba8SSushil Singh [Tags] Create_Session_For_Non_Admin_User 784ec68ba8SSushil Singh [Template] Non Admin User To Create Session 794ec68ba8SSushil Singh 804ec68ba8SSushil Singh # client_id username password role_id 814ec68ba8SSushil Singh 12345 operator_user TestPwd123 Operator 824ec68ba8SSushil Singh 834ec68ba8SSushil Singh 8445d841e3SSushil Singh*** Keywords *** 8545d841e3SSushil Singh 861384321bSSushil SinghCreate And Verify Session ClientID 871384321bSSushil Singh [Documentation] Create redifish session with client id and verify it remain same. 881384321bSSushil Singh [Arguments] ${client_id} ${reboot_flag}=False 891384321bSSushil Singh 901384321bSSushil Singh # Description of argument(s): 911384321bSSushil Singh # client_id This client id contain string value 921384321bSSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 931384321bSSushil Singh # reboot_flag Flag is used to run reboot the BMC code. 941384321bSSushil Singh # (e.g. True or False). 951384321bSSushil Singh 96889a75e4SSushil Singh ${client_ids}= Split String ${client_id} , 9787e984c8SSushil Singh ${session_info}= Create Session With List Of ClientID ${client_ids} 98889a75e4SSushil Singh Verify A Session Created With ClientID ${client_ids} ${session_info} 99f90fd656SSushil Singh 100f90fd656SSushil Singh ${before_reboot_xauth_token}= Set Variable ${XAUTH_TOKEN} 101f90fd656SSushil Singh 1021384321bSSushil Singh Run Keyword If '${reboot_flag}' == 'True' 103f90fd656SSushil Singh ... Run Keywords Redfish BMC Reset Operation AND 104f90fd656SSushil Singh ... Set Global Variable ${XAUTH_TOKEN} ${before_reboot_xauth_token} AND 105f90fd656SSushil Singh ... Is BMC Standby AND 106889a75e4SSushil Singh ... Verify A Session Created With ClientID ${client_ids} ${session_info} 107f90fd656SSushil Singh 10887e984c8SSushil Singh Redfish Delete List Of Session ${session_info} 109c957f57fSSushil Singh 110c957f57fSSushil Singh 111c957f57fSSushil SinghSet Client Origin IP 112c957f57fSSushil Singh [Documentation] Set client origin IP. 113c957f57fSSushil Singh [Arguments] ${client_id} ${client_ip} ${status} 114c957f57fSSushil Singh 115c957f57fSSushil Singh # Description of argument(s): 116c957f57fSSushil Singh # client_id This client id contain string value 117c957f57fSSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 118c957f57fSSushil Singh # client_ip Valid IP address 119c957f57fSSushil Singh # status HTTP status code 120c957f57fSSushil Singh 121c957f57fSSushil Singh ${session}= Run Keyword And Return Status 122c957f57fSSushil Singh ... Redfish Login 123c957f57fSSushil Singh ... kwargs= "Oem":{"OpenBMC": {"ClientID":"${client_id}", "ClientOriginIP":"${client_ip}"}} 124c957f57fSSushil Singh Valid Value session [${status}] 125c957f57fSSushil Singh 126c957f57fSSushil Singh 127c957f57fSSushil SinghCreate Session And Fail To Set Client Origin IP 128c957f57fSSushil Singh [Documentation] Create redifish session with client id and fail to set client origin IP. 129c957f57fSSushil Singh [Arguments] ${client_id} 130c957f57fSSushil Singh 131c957f57fSSushil Singh # Description of argument(s): 132c957f57fSSushil Singh # client_id This client id contain string value 133c957f57fSSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 134c957f57fSSushil Singh 135c957f57fSSushil Singh Set Test Variable ${client_ip} 10.6.7.8 136c957f57fSSushil Singh ${resp}= Set Client Origin IP ${client_id} ${client_ip} status=False 1374ec68ba8SSushil Singh 1384ec68ba8SSushil Singh 1394ec68ba8SSushil SinghCreate A Non Admin Session With ClientID 1404ec68ba8SSushil Singh [Documentation] Create redifish session with client id. 1414ec68ba8SSushil Singh [Arguments] ${client_id} ${username} ${password} 1424ec68ba8SSushil Singh 1434ec68ba8SSushil Singh # Description of argument(s): 1444ec68ba8SSushil Singh # client_id This client id can contain string value 1454ec68ba8SSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 1464ec68ba8SSushil Singh 1474ec68ba8SSushil Singh @{session_list}= Create List 1484ec68ba8SSushil Singh &{tmp_dict}= Create Dictionary 1494ec68ba8SSushil Singh 1504ec68ba8SSushil Singh FOR ${client} IN @{client_id} 151b78bca24SGeorge Keishing ${resp}= Redfish Login rest_username=${username} rest_password=${password} 152b78bca24SGeorge Keishing ... kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client}"}} 1534ec68ba8SSushil Singh Append To List ${session_list} ${resp} 1544ec68ba8SSushil Singh END 1554ec68ba8SSushil Singh 1564ec68ba8SSushil Singh [Return] ${session_list} 1574ec68ba8SSushil Singh 1584ec68ba8SSushil Singh 1594ec68ba8SSushil SinghVerify A Non Admin Session Created With ClientID 1604ec68ba8SSushil Singh [Documentation] Verify session created with client id. 1614ec68ba8SSushil Singh [Arguments] ${client_ids} ${session_ids} 1624ec68ba8SSushil Singh 1634ec68ba8SSushil Singh # Description of argument(s): 16487e984c8SSushil Singh # client_ids External client name. 16587e984c8SSushil Singh # session_ids This value is a session id. 1664ec68ba8SSushil Singh 1674ec68ba8SSushil Singh # { 1684ec68ba8SSushil Singh # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ", 1694ec68ba8SSushil Singh # "@odata.type": "#Session.v1_0_2.Session", 1704ec68ba8SSushil Singh # "Description": "Manager User Session", 1714ec68ba8SSushil Singh # "Id": "H8q2ZKucSJ", 1724ec68ba8SSushil Singh # "Name": "User Session", 1734ec68ba8SSushil Singh # "Oem": { 1744ec68ba8SSushil Singh # "OpenBMC": { 1754ec68ba8SSushil Singh # "@odata.type": "#OemSession.v1_0_0.Session", 1764ec68ba8SSushil Singh # "ClientID": "", 1774ec68ba8SSushil Singh # "ClientOriginIP": "::ffff:x.x.x.x" 1784ec68ba8SSushil Singh # } 1794ec68ba8SSushil Singh # }, 1804ec68ba8SSushil Singh # "UserName": "root" 1814ec68ba8SSushil Singh # } 1824ec68ba8SSushil Singh 18387e984c8SSushil Singh FOR ${client} ${session} IN ZIP ${client_ids} ${session_ids} 18487e984c8SSushil Singh ${resp}= Redfish Get Request /redfish/v1/SessionService/Sessions/${session["Id"]} 185*fbd67007SGeorge Keishing Rprint Vars resp.json() 186*fbd67007SGeorge Keishing @{words} = Split String ${resp.json()["ClientOriginIPAddress"]} : 1874ec68ba8SSushil Singh ${ip_address}= Get Running System IP 1884ec68ba8SSushil Singh Set Test Variable ${temp_ipaddr} ${words}[-1] 189*fbd67007SGeorge Keishing Valid Value client ['${resp.json()["Oem"]["OpenBMC"]["ClientID"]}'] 190*fbd67007SGeorge Keishing Valid Value session["Id"] ['${resp.json()["Id"]}'] 1914ec68ba8SSushil Singh Valid Value temp_ipaddr ${ip_address} 1924ec68ba8SSushil Singh END 1934ec68ba8SSushil Singh 1944ec68ba8SSushil Singh 1954ec68ba8SSushil SinghNon Admin User To Create Session 1964ec68ba8SSushil Singh [Documentation] Non Admin user create a session and verify the session is created. 1974ec68ba8SSushil Singh [Arguments] ${client_id} ${username} ${password} ${role} ${enabled}=${True} 1984ec68ba8SSushil Singh 1994ec68ba8SSushil Singh # Description of argument(s): 2004ec68ba8SSushil Singh # client_id This client id contain string value 2014ec68ba8SSushil Singh # (e.g. 12345, "EXTERNAL-CLIENT"). 2024ec68ba8SSushil Singh # username Username. 2034ec68ba8SSushil Singh # password Password. 2044ec68ba8SSushil Singh # role Role of user. 2054ec68ba8SSushil Singh # enabled Value can be True or False. 2064ec68ba8SSushil Singh 2074ec68ba8SSushil Singh Redfish.Login 2084ec68ba8SSushil Singh Redfish Create User ${username} ${password} ${role} ${enabled} 2094ec68ba8SSushil Singh Delete All Sessions 2104ec68ba8SSushil Singh Redfish.Logout 2114ec68ba8SSushil Singh Initialize OpenBMC rest_username=${username} rest_password=${password} 2124ec68ba8SSushil Singh ${client_ids}= Split String ${client_id} , 2134ec68ba8SSushil Singh ${session_info}= Create A Non Admin Session With ClientID ${client_ids} ${username} ${password} 2144ec68ba8SSushil Singh Verify A Non Admin Session Created With ClientID ${client_ids} ${session_info} 215