xref: /openbmc/openbmc-test-automation/openpower/ext_interfaces/test_client_identifier.robot (revision 0125f0c0da5f760b1200212773e3a1681eebe596)
1*** Settings ***
2
3Documentation     Test client identifier feature on BMC.
4
5Resource          ../../lib/rest_client.robot
6Resource          ../../lib/openbmc_ffdc.robot
7Resource          ../../lib/resource.robot
8Resource          ../../lib/bmc_redfish_utils.robot
9Library           ../../lib/bmc_network_utils.py
10Library           ../../lib/gen_robot_valid.py
11
12Suite Setup       Redfish.Login
13Suite Teardown    Delete All Redfish Sessions
14Test Setup        Printn
15Test Teardown     FFDC On Test Case Fail
16
17
18*** Test Cases ***
19
20Create A Session With ClientID And Verify
21   [Documentation]  Create a session with client id and verify client id is same.
22   [Tags]  Create_A_Session_With_ClientID_And_Verify
23   [Template]  Create A Session With ClientID
24
25   # client_id
26   12345
27   123456
28   EXTERNAL-CLIENT-01
29   EXTERNAL-CLIENT-02
30
31*** Keywords ***
32
33Create A Session With ClientID
34    [Documentation]  Create redifish session with client id.
35    [Arguments]  ${client_id}
36
37    # Description of argument(s):
38    # client_id    This client id can contain string value
39    #              (e.g. 12345, "EXTERNAL-CLIENT").
40
41    ${resp}=  Redfish Login  kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
42    Verify A Session Created With ClientID  ${client_id}  ${resp['Id']}
43
44
45Verify A Session Created With ClientID
46    [Documentation]  Verify session created with client id.
47    [Arguments]  ${client_id}  ${session_id}
48
49    # Description of argument(s):
50    # client_id    External client name.
51    # session_id   This value is a session id.
52
53    ${sessions}=  Redfish.Get Properties  /redfish/v1/SessionService/Sessions/${session_id}
54
55    # {
56    #   "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
57    #   "@odata.type": "#Session.v1_0_2.Session",
58    #   "Description": "Manager User Session",
59    #   "Id": "H8q2ZKucSJ",
60    #   "Name": "User Session",
61    #   "Oem": {
62    #   "OpenBMC": {
63    #  "@odata.type": "#OemSession.v1_0_0.Session",
64    #  "ClientID": "",
65    #  "ClientOriginIP": "::ffff:x.x.x.x"
66    #       }
67    #     },
68    #   "UserName": "root"
69    # }
70
71    Rprint Vars  sessions
72    @{words} =  Split String  ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]}  :
73    ${ipaddr}=  Get Running System IP
74    Set Test Variable  ${temp_ipaddr}  ${words}[-1]
75    Valid Value  client_id  ['${sessions["Oem"]["OpenBMC"]["ClientID"]}']
76    Valid Value  sessions["Id"]  ['${session_id}']
77    Valid Value  temp_ipaddr  ${ipaddr}
78