blob: 1cbbcb11fe8000e97e0841d3d8290485ca6eb846 [file] [log] [blame]
Sushil Singh45d841e2020-07-30 11:52:11 -05001*** 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
Sushil Singh13843212020-08-18 04:00:51 -050023 [Template] Create And Verify Session ClientID
Sushil Singh45d841e2020-07-30 11:52:11 -050024
Sushil Singh13843212020-08-18 04:00:51 -050025 # client_id # reboot_flag
26 12345 False
27 123456 False
28 EXTERNAL-CLIENT-01 False
29 EXTERNAL-CLIENT-02 False
30
31
32Check ClientID Persistency On BMC Reboot
33 [Documentation] Create a session with client id and verify client id is same after the reboot.
34 [Tags] Check_ClientID_Persistency_On_BMC_Reboot
35 [Template] Create And Verify Session ClientID
36
37 # client_id # reboot_flag
38 12345 True
39 EXTERNAL-CLIENT-01 True
Sushil Singh45d841e2020-07-30 11:52:11 -050040
41*** Keywords ***
42
43Create A Session With ClientID
44 [Documentation] Create redifish session with client id.
45 [Arguments] ${client_id}
46
47 # Description of argument(s):
48 # client_id This client id can contain string value
49 # (e.g. 12345, "EXTERNAL-CLIENT").
50
51 ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client_id}"}}
Sushil Singh45d841e2020-07-30 11:52:11 -050052
Sushil Singh13843212020-08-18 04:00:51 -050053 [Return] ${resp}
Sushil Singh45d841e2020-07-30 11:52:11 -050054
55Verify A Session Created With ClientID
56 [Documentation] Verify session created with client id.
57 [Arguments] ${client_id} ${session_id}
58
59 # Description of argument(s):
60 # client_id External client name.
61 # session_id This value is a session id.
62
63 ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id}
64
65 # {
66 # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ",
67 # "@odata.type": "#Session.v1_0_2.Session",
68 # "Description": "Manager User Session",
69 # "Id": "H8q2ZKucSJ",
70 # "Name": "User Session",
71 # "Oem": {
72 # "OpenBMC": {
73 # "@odata.type": "#OemSession.v1_0_0.Session",
74 # "ClientID": "",
75 # "ClientOriginIP": "::ffff:x.x.x.x"
76 # }
77 # },
78 # "UserName": "root"
79 # }
80
81 Rprint Vars sessions
82 @{words} = Split String ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]} :
83 ${ipaddr}= Get Running System IP
84 Set Test Variable ${temp_ipaddr} ${words}[-1]
85 Valid Value client_id ['${sessions["Oem"]["OpenBMC"]["ClientID"]}']
86 Valid Value sessions["Id"] ['${session_id}']
87 Valid Value temp_ipaddr ${ipaddr}
Sushil Singh13843212020-08-18 04:00:51 -050088
89
90Create And Verify Session ClientID
91 [Documentation] Create redifish session with client id and verify it remain same.
92 [Arguments] ${client_id} ${reboot_flag}=False
93
94 # Description of argument(s):
95 # client_id This client id contain string value
96 # (e.g. 12345, "EXTERNAL-CLIENT").
97 # reboot_flag Flag is used to run reboot the BMC code.
98 # (e.g. True or False).
99
100 ${session_info}= Create A Session With ClientID ${client_id}
101 Verify A Session Created With ClientID ${client_id} ${session_info['Id']}
102 Run Keyword If '${reboot_flag}' == 'True'
103 ... Redfish OBMC Reboot (off)
104 Verify A Session Created With ClientID ${client_id} ${session_info['Id']}