Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC network interface functionalities. |
| 3 | |
| 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/bmc_network_utils.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Library ../../lib/bmc_network_utils.py |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 10 | Test Teardown Test Teardown Execution |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 11 | |
George Keishing | 9899a90 | 2023-09-07 20:57:53 +0530 | [diff] [blame] | 12 | Force Tags Bmc_Network_Mac |
Prashanth Katti | d218f53 | 2019-06-13 04:22:34 -0500 | [diff] [blame] | 13 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 14 | *** Variables *** |
| 15 | |
| 16 | # AA:AA:AA:AA:AA:AA series is a valid MAC and does not exist in |
| 17 | # our network, so this is chosen to avoid MAC conflict. |
| 18 | ${valid_mac} AA:E2:84:14:28:79 |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 19 | ${zero_mac} 00:00:00:00:00:00 |
| 20 | ${broadcast_mac} FF:FF:FF:FF:FF:FF |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 21 | ${out_of_range_mac} AA:FF:FF:FF:FF:100 |
| 22 | |
| 23 | # There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx). |
| 24 | # Here trying to configure xx.xx.xx.xx.xx |
| 25 | ${less_byte_mac} AA:AA:AA:AA:BB |
| 26 | # Here trying to configure xx.xx.xx.xx.xx.xx.xx |
| 27 | ${more_byte_mac} AA:AA:AA:AA:AA:AA:BB |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 28 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 29 | # MAC address with special characters. |
| 30 | ${special_char_mac} &A:$A:AA:AA:AA:^^ |
| 31 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 32 | *** Test Cases *** |
| 33 | |
| 34 | Configure Valid MAC And Verify |
| 35 | [Documentation] Configure valid MAC via Redfish and verify. |
| 36 | [Tags] Configure_Valid_MAC_And_Verify |
| 37 | |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 38 | Configure MAC Settings ${valid_mac} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 39 | |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 40 | # Verify whether new MAC is configured on BMC and FW_Env. |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 41 | Validate MAC On BMC ${valid_mac} |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 42 | Verify MAC Address Via FW_Env ${valid_mac} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 43 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 44 | Configure Zero MAC And Verify |
| 45 | [Documentation] Configure zero MAC via Redfish and verify. |
| 46 | [Tags] Configure_Zero_MAC_And_Verify |
| 47 | |
| 48 | [Template] Configure MAC Settings |
| 49 | # MAC address scenario |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 50 | ${zero_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 51 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 52 | Configure Broadcast MAC And Verify |
| 53 | [Documentation] Configure broadcast MAC via Redfish and verify. |
| 54 | [Tags] Configure_Broadcast_MAC_And_Verify |
| 55 | |
| 56 | [Template] Configure MAC Settings |
| 57 | # MAC address scenario |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 58 | ${broadcast_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 59 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 60 | Configure Invalid MAC And Verify |
| 61 | [Documentation] Configure invalid MAC address which is a string. |
| 62 | [Tags] Configure_Invalid_MAC_And_Verify |
| 63 | |
| 64 | [Template] Configure MAC Settings |
| 65 | # MAC Address Expected_Result |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 66 | ${special_char_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 67 | |
| 68 | Configure Valid MAC And Check Persistency |
| 69 | [Documentation] Configure valid MAC and check persistency. |
| 70 | [Tags] Configure_Valid_MAC_And_Check_Persistency |
| 71 | |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 72 | Configure MAC Settings ${valid_mac} |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 73 | |
| 74 | # Verify whether new MAC is configured on BMC. |
| 75 | Validate MAC On BMC ${valid_mac} |
| 76 | |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 77 | # Reboot BMC and check whether MAC is persistent on BMC and FW_Env. |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 78 | OBMC Reboot (off) |
| 79 | Validate MAC On BMC ${valid_mac} |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 80 | Verify MAC Address Via FW_Env ${valid_mac} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 81 | |
| 82 | Configure Invalid MAC And Verify On FW_Env |
| 83 | [Documentation] Configure Invalid MAC via Redfish and verify on FW_Env. |
| 84 | [Tags] Configure_Invalid_MAC_And_Verify_On_FW_Env |
| 85 | |
| 86 | [Template] Configure MAC Settings |
| 87 | |
| 88 | # invalid_MAC scenario |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 89 | ${zero_mac} ${HTTP_BAD_REQUEST} |
| 90 | ${broadcast_mac} ${HTTP_BAD_REQUEST} |
| 91 | ${special_char_mac} ${HTTP_BAD_REQUEST} |
| 92 | ${less_byte_mac} ${HTTP_BAD_REQUEST} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 93 | |
George Keishing | eedd71a | 2020-09-17 00:40:36 -0500 | [diff] [blame] | 94 | Configure Invalid MAC And Verify Persistency On FW_Env |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 95 | [Documentation] Configure invalid MAC and verify persistency on FW_Env. |
| 96 | [Tags] Configure_Invalid_MAC_And_Verify_Persistency_On_FW_Env |
| 97 | |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 98 | Configure MAC Settings ${special_char_mac} ${HTTP_BAD_REQUEST} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 99 | |
| 100 | # Reboot BMC and check whether MAC is persistent on FW_Env. |
| 101 | OBMC Reboot (off) |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 102 | Verify MAC Address Via FW_Env ${special_char_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 103 | |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 104 | Configure Out Of Range MAC And Verify |
| 105 | [Documentation] Configure out of range MAC via Redfish and verify. |
| 106 | [Tags] Configure_Out_Of_Range_MAC_And_Verify |
| 107 | |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 108 | Configure MAC Settings ${out_of_range_mac} ${HTTP_BAD_REQUEST} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 109 | |
| 110 | # Verify whether new MAC is configured on FW_Env. |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 111 | Verify MAC Address Via FW_Env ${out_of_range_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 112 | |
| 113 | Configure Less Byte MAC And Verify |
| 114 | [Documentation] Configure less byte MAC via Redfish and verify. |
| 115 | [Tags] Configure_Less_Byte_MAC_And_Verify |
| 116 | |
| 117 | [Template] Configure MAC Settings |
| 118 | # MAC address scenario |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 119 | ${less_byte_mac} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 120 | |
| 121 | Configure More Byte MAC And Verify |
| 122 | [Documentation] Configure more byte MAC via Redfish and verify. |
Tony Lee | 3112f4c | 2020-05-13 20:31:42 +0800 | [diff] [blame] | 123 | [Tags] Configure_More_Byte_MAC_And_Verify |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 124 | |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 125 | Configure MAC Settings ${more_byte_mac} ${HTTP_BAD_REQUEST} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 126 | # Verify whether new MAC is configured on FW_Env. |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 127 | Verify MAC Address Via FW_Env ${more_byte_mac} ${HTTP_BAD_REQUEST} |
Sweta Potthuri | fb00136 | 2022-03-14 02:21:14 -0500 | [diff] [blame] | 128 | |
Prashanth Katti | 6386213 | 2019-03-15 04:45:31 -0500 | [diff] [blame] | 129 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 130 | *** Keywords *** |
| 131 | |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 132 | Test Teardown Execution |
| 133 | [Documentation] Do the post test teardown. |
| 134 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 135 | # Revert to initial MAC address. |
kothais | df078f4 | 2023-11-03 05:48:15 +0000 | [diff] [blame] | 136 | Configure MAC Settings ${initial_mac_address} |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 137 | |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 138 | # Verify whether new MAC is configured on BMC and FW_Env. |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 139 | Validate MAC On BMC ${initial_mac_address} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 140 | Validate MAC On Fw_Env ${initial_mac_address} |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 141 | |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 142 | FFDC On Test Case Fail |
| 143 | Redfish.Logout |
| 144 | |
| 145 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 146 | Suite Setup Execution |
| 147 | [Documentation] Do suite setup tasks. |
| 148 | |
| 149 | Redfish.Login |
Tony Lee | 8094d38 | 2020-04-02 13:14:47 +0800 | [diff] [blame] | 150 | ${active_channel_config}= Get Active Channel Config |
| 151 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 152 | |
| 153 | # Get BMC MAC address. |
Tony Lee | 8094d38 | 2020-04-02 13:14:47 +0800 | [diff] [blame] | 154 | ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 155 | Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} |
| 156 | |
| 157 | Validate MAC On BMC ${initial_mac_address} |
| 158 | |
| 159 | Redfish.Logout |
| 160 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 161 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 162 | Configure MAC Settings |
| 163 | [Documentation] Configure MAC settings via Redfish. |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 164 | [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 165 | |
| 166 | # Description of argument(s): |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 167 | # mac_address MAC address of BMC. |
| 168 | # valid_status_code Expected response code, default is ${HTTP_OK}. |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 169 | |
Tony Lee | 8094d38 | 2020-04-02 13:14:47 +0800 | [diff] [blame] | 170 | ${active_channel_config}= Get Active Channel Config |
| 171 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 172 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 173 | Redfish.Login |
| 174 | ${payload}= Create Dictionary MACAddress=${mac_address} |
| 175 | |
Tony Lee | 8094d38 | 2020-04-02 13:14:47 +0800 | [diff] [blame] | 176 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload} |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 177 | ... valid_status_codes=[${valid_status_code},${HTTP_INTERNAL_SERVER_ERROR}] |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 178 | |
| 179 | # After any modification on network interface, BMC restarts network |
Anves Kumar rayankula | ed0124b | 2021-04-06 23:41:07 -0500 | [diff] [blame] | 180 | # Note: Network restart takes around 15-18s after patch request processing. |
| 181 | Sleep ${NETWORK_TIMEOUT}s |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 182 | |
Anves Kumar rayankula | ed0124b | 2021-04-06 23:41:07 -0500 | [diff] [blame] | 183 | Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 184 | |
| 185 | # Verify whether new MAC address is populated on BMC system. |
| 186 | # It should not allow to configure invalid settings. |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 187 | ${status}= Run Keyword And Return Status |
| 188 | ... Validate MAC On BMC ${mac_address} |
| 189 | |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 190 | Run Keyword If ${valid_status_code} == ${HTTP_BAD_REQUEST} |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 191 | ... Should Be Equal ${status} ${False} |
| 192 | ... msg=Allowing the configuration of an invalid MAC. |
| 193 | ... ELSE |
| 194 | ... Should Be Equal ${status} ${True} |
| 195 | ... msg=Not allowing the configuration of a valid MAC. |
| 196 | |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 197 | Verify MAC Address Via FW_Env ${mac_address} ${valid_status_code} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 198 | |
| 199 | Verify MAC Address Via FW_Env |
| 200 | [Documentation] Verify MAC address on FW_Env. |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 201 | [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 202 | |
| 203 | # Description of argument(s): |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 204 | # mac_address MAC address of BMC. |
| 205 | # valid_status_code Expected response code, default is ${HTTP_OK}. |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 206 | |
| 207 | ${status}= Run Keyword And Return Status |
| 208 | ... Validate MAC On FW_Env ${mac_address} |
| 209 | |
Anvesh-Kumar_Rayankula | 55441c0 | 2024-02-26 08:19:26 -0600 | [diff] [blame] | 210 | Run Keyword If ${valid_status_code} == ${HTTP_BAD_REQUEST} |
shrsuman123 | fdc51d2 | 2020-08-18 06:51:09 -0500 | [diff] [blame] | 211 | ... Should Be Equal ${status} ${False} |
| 212 | ... msg=Allowing the configuration of an invalid MAC. |
| 213 | ... ELSE |
| 214 | ... Should Be Equal ${status} ${True} |
| 215 | ... msg=Not allowing the configuration of a valid MAC. |