Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test client identifier feature on BMC. |
| 4 | |
| 5 | Resource ../../lib/rest_client.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/resource.robot |
| 8 | Resource ../../lib/bmc_redfish_utils.robot |
| 9 | Library ../../lib/bmc_network_utils.py |
| 10 | Library ../../lib/gen_robot_valid.py |
| 11 | |
| 12 | Suite Setup Redfish.Login |
| 13 | Suite Teardown Delete All Redfish Sessions |
| 14 | Test Setup Printn |
| 15 | Test Teardown FFDC On Test Case Fail |
| 16 | |
| 17 | |
| 18 | *** Test Cases *** |
| 19 | |
| 20 | Create 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 Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame^] | 23 | [Template] Create And Verify Session ClientID |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 24 | |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame^] | 25 | # client_id # reboot_flag |
| 26 | 12345 False |
| 27 | 123456 False |
| 28 | EXTERNAL-CLIENT-01 False |
| 29 | EXTERNAL-CLIENT-02 False |
| 30 | |
| 31 | |
| 32 | Check 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 Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 40 | |
| 41 | *** Keywords *** |
| 42 | |
| 43 | Create 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 Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 52 | |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame^] | 53 | [Return] ${resp} |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 54 | |
| 55 | Verify 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 Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame^] | 88 | |
| 89 | |
| 90 | Create 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']} |