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 |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 13 | Suite Teardown Run Keyword And Ignore Error Delete All Redfish Sessions |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 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 |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 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 And Verify Session ClientID |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 24 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 25 | # client_id reboot_flag |
| 26 | 12345 False |
| 27 | 123456 False |
| 28 | EXTERNAL-CLIENT-01 False |
| 29 | EXTERNAL-CLIENT-02 False |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame] | 30 | |
| 31 | |
| 32 | Check ClientID Persistency On BMC Reboot |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 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 |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame] | 36 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 37 | # client_id reboot_flag |
| 38 | 12345 True |
| 39 | EXTERNAL-CLIENT-01 True |
| 40 | |
| 41 | |
| 42 | Create A Multiple Session With ClientID And Verify |
| 43 | [Documentation] Create a multiple session with client id and verify client id is same. |
| 44 | [Tags] Create_A_Multiple_Session_With_ClientID_And_Verify |
| 45 | [Template] Create And Verify Session ClientID |
| 46 | |
| 47 | # client_id reboot_flag |
| 48 | 12345,123456 False |
| 49 | EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02 False |
| 50 | |
| 51 | |
| 52 | Check Multiple ClientID Persistency On BMC Reboot |
| 53 | [Documentation] Create a multiple session with client id and verify client id is same after the reboot. |
| 54 | [Tags] Check_Multiple_ClientID_Persistency_On_BMC_Reboot |
| 55 | [Template] Create And Verify Session ClientID |
| 56 | |
| 57 | # client_id reboot_flag |
| 58 | 12345,123456 True |
| 59 | EXTERNAL-CLIENT-01,EXTERNAL-CLIENT-02 True |
| 60 | |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 61 | |
| 62 | *** Keywords *** |
| 63 | |
| 64 | Create A Session With ClientID |
| 65 | [Documentation] Create redifish session with client id. |
| 66 | [Arguments] ${client_id} |
| 67 | |
| 68 | # Description of argument(s): |
| 69 | # client_id This client id can contain string value |
| 70 | # (e.g. 12345, "EXTERNAL-CLIENT"). |
| 71 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 72 | @{session_list}= Create List |
| 73 | &{tmp_dict}= Create Dictionary |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 74 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 75 | FOR ${client} IN @{client_id} |
| 76 | ${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"${client}"}} |
| 77 | Append To List ${session_list} ${resp} |
| 78 | END |
| 79 | |
| 80 | [Return] ${session_list} |
| 81 | |
| 82 | |
| 83 | Get Session Information By ClientID |
| 84 | [Documentation] Get session information by client id. |
| 85 | [Arguments] ${client_id} ${session_ids} |
| 86 | |
| 87 | FOR ${session} IN @{session_ids} |
| 88 | Return From Keyword If '${client_id}' == '${session["Oem"]["OpenBMC"]["ClientID"]}' ${session["Id"]} |
| 89 | END |
| 90 | |
| 91 | [Return] ${EMPTY} |
| 92 | |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 93 | |
| 94 | Verify A Session Created With ClientID |
| 95 | [Documentation] Verify session created with client id. |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 96 | [Arguments] ${client_ids} ${session_ids} |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 97 | |
| 98 | # Description of argument(s): |
| 99 | # client_id External client name. |
| 100 | # session_id This value is a session id. |
| 101 | |
Sushil Singh | 45d841e | 2020-07-30 11:52:11 -0500 | [diff] [blame] | 102 | # { |
| 103 | # "@odata.id": "/redfish/v1/SessionService/Sessions/H8q2ZKucSJ", |
| 104 | # "@odata.type": "#Session.v1_0_2.Session", |
| 105 | # "Description": "Manager User Session", |
| 106 | # "Id": "H8q2ZKucSJ", |
| 107 | # "Name": "User Session", |
| 108 | # "Oem": { |
| 109 | # "OpenBMC": { |
| 110 | # "@odata.type": "#OemSession.v1_0_0.Session", |
| 111 | # "ClientID": "", |
| 112 | # "ClientOriginIP": "::ffff:x.x.x.x" |
| 113 | # } |
| 114 | # }, |
| 115 | # "UserName": "root" |
| 116 | # } |
| 117 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 118 | FOR ${client} IN @{client_ids} |
| 119 | ${session_id}= Get Session Information By ClientID ${client} ${session_ids} |
| 120 | ${sessions}= Redfish.Get Properties /redfish/v1/SessionService/Sessions/${session_id} |
| 121 | Rprint Vars sessions |
| 122 | @{words} = Split String ${sessions["Oem"]["OpenBMC"]["ClientOriginIP"]} : |
| 123 | ${ipaddr}= Get Running System IP |
| 124 | Set Test Variable ${temp_ipaddr} ${words}[-1] |
| 125 | Valid Value client ['${sessions["Oem"]["OpenBMC"]["ClientID"]}'] |
| 126 | Valid Value sessions["Id"] ['${session_id}'] |
| 127 | Valid Value temp_ipaddr ${ipaddr} |
| 128 | END |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame] | 129 | |
| 130 | |
| 131 | Create And Verify Session ClientID |
| 132 | [Documentation] Create redifish session with client id and verify it remain same. |
| 133 | [Arguments] ${client_id} ${reboot_flag}=False |
| 134 | |
| 135 | # Description of argument(s): |
| 136 | # client_id This client id contain string value |
| 137 | # (e.g. 12345, "EXTERNAL-CLIENT"). |
| 138 | # reboot_flag Flag is used to run reboot the BMC code. |
| 139 | # (e.g. True or False). |
| 140 | |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 141 | ${client_ids}= Split String ${client_id} , |
| 142 | ${session_info}= Create A Session With ClientID ${client_ids} |
| 143 | Verify A Session Created With ClientID ${client_ids} ${session_info} |
Sushil Singh | 1384321 | 2020-08-18 04:00:51 -0500 | [diff] [blame] | 144 | Run Keyword If '${reboot_flag}' == 'True' |
Sushil Singh | 889a75e | 2020-08-19 08:50:15 -0500 | [diff] [blame^] | 145 | ... Run Keywords Redfish OBMC Reboot (off) AND |
| 146 | ... Verify A Session Created With ClientID ${client_ids} ${session_info} |