Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Network interface configuration and verification |
| 3 | ... tests. |
| 4 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/bmc_network_utils.robot |
| 7 | Resource ../../lib/openbmc_ffdc.robot |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 8 | Library ../../lib/bmc_network_utils.py |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 9 | Library Collections |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 10 | |
| 11 | Test Setup Test Setup Execution |
| 12 | Test Teardown Test Teardown Execution |
Prashanth Katti | b478d90 | 2020-05-08 10:05:32 -0500 | [diff] [blame] | 13 | Suite Setup Suite Setup Execution |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 14 | |
Prashanth Katti | f34fafa | 2019-06-20 05:04:40 -0500 | [diff] [blame] | 15 | Force Tags Network_Conf_Test |
| 16 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 17 | *** Variables *** |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 18 | ${test_hostname} openbmc |
| 19 | ${test_ipv4_addr} 10.7.7.7 |
| 20 | ${test_ipv4_invalid_addr} 0.0.1.a |
| 21 | ${test_subnet_mask} 255.255.0.0 |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 22 | ${broadcast_ip} 10.7.7.255 |
| 23 | ${loopback_ip} 127.0.0.2 |
| 24 | ${multicast_ip} 224.6.6.6 |
| 25 | ${out_of_range_ip} 10.7.7.256 |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 26 | ${test_ipv4_addr2} 10.7.7.8 |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 27 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 28 | # Valid netmask is 4 bytes long and has continuos block of 1s. |
| 29 | # Maximum valid value in each octet is 255 and least value is 0. |
| 30 | # 253 is not valid, as binary value is 11111101. |
| 31 | ${invalid_netmask} 255.255.253.0 |
| 32 | ${alpha_netmask} ff.ff.ff.ff |
| 33 | # Maximum value of octet in netmask is 255. |
| 34 | ${out_of_range_netmask} 255.256.255.0 |
| 35 | ${more_byte_netmask} 255.255.255.0.0 |
| 36 | ${less_byte_netmask} 255.255.255 |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 37 | ${threshold_netmask} 255.255.255.255 |
| 38 | ${lowest_netmask} 128.0.0.0 |
| 39 | |
| 40 | # There will be 4 octets in IP address (e.g. xx.xx.xx.xx) |
| 41 | # but trying to configure xx.xx.xx |
| 42 | ${less_octet_ip} 10.3.36 |
| 43 | |
| 44 | # For the address 10.6.6.6, the 10.6.6.0 portion describes the |
| 45 | # network ID and the 6 describe the host. |
| 46 | |
| 47 | ${network_id} 10.7.7.0 |
| 48 | ${hex_ip} 0xa.0xb.0xc.0xd |
| 49 | ${negative_ip} 10.-7.-7.7 |
| 50 | ${hex_ip} 0xa.0xb.0xc.0xd |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 51 | @{static_name_servers} 10.5.5.5 |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 52 | @{null_value} null |
Prashanth Katti | afe16b7 | 2019-08-02 00:29:45 -0500 | [diff] [blame] | 53 | @{empty_dictionary} {} |
| 54 | @{string_value} aa.bb.cc.dd |
| 55 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 56 | *** Test Cases *** |
| 57 | |
| 58 | Get IP Address And Verify |
| 59 | [Documentation] Get IP Address And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 60 | [Tags] Get_IP_Address_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 61 | |
| 62 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 63 | \ Verify IP On BMC ${network_configuration['Address']} |
| 64 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 65 | Get Netmask And Verify |
| 66 | [Documentation] Get Netmask And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 67 | [Tags] Get_Netmask_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 68 | |
| 69 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 70 | \ Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 71 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 72 | Get Gateway And Verify |
| 73 | [Documentation] Get gateway and verify it's existence on the BMC. |
| 74 | [Tags] Get_Gateway_And_Verify |
| 75 | |
| 76 | : FOR ${network_configuration} IN @{network_configurations} |
| 77 | \ Verify Gateway On BMC ${network_configuration['Gateway']} |
| 78 | |
| 79 | Get MAC Address And Verify |
| 80 | [Documentation] Get MAC address and verify it's existence on the BMC. |
| 81 | [Tags] Get_MAC_Address_And_Verify |
| 82 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 83 | ${active_channel_config}= Get Active Channel Config |
| 84 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 85 | |
| 86 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 87 | ${macaddr}= Get From Dictionary ${resp.dict} MACAddress |
| 88 | Validate MAC On BMC ${macaddr} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 89 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 90 | Verify All Configured IP And Netmask |
| 91 | [Documentation] Verify all configured IP and netmask on BMC. |
| 92 | [Tags] Verify_All_Configured_IP_And_Netmask |
| 93 | |
| 94 | : FOR ${network_configuration} IN @{network_configurations} |
| 95 | \ Verify IP And Netmask On BMC ${network_configuration['Address']} |
| 96 | ... ${network_configuration['SubnetMask']} |
| 97 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 98 | Get Hostname And Verify |
| 99 | [Documentation] Get hostname via Redfish and verify. |
| 100 | [Tags] Get_Hostname_And_Verify |
| 101 | |
| 102 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 103 | |
| 104 | Validate Hostname On BMC ${hostname} |
| 105 | |
| 106 | Configure Hostname And Verify |
| 107 | [Documentation] Configure hostname via Redfish and verify. |
| 108 | [Tags] Configure_Hostname_And_Verify |
| 109 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 110 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 111 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 112 | Configure Hostname ${test_hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 113 | Validate Hostname On BMC ${test_hostname} |
| 114 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 115 | # Revert back to initial hostname. |
| 116 | Configure Hostname ${hostname} |
| 117 | Validate Hostname On BMC ${hostname} |
| 118 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 119 | Add Valid IPv4 Address And Verify |
| 120 | [Documentation] Add IPv4 Address via Redfish and verify. |
| 121 | [Tags] Add_Valid_IPv4_Addres_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 122 | [Teardown] Run Keywords |
| 123 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 124 | |
| 125 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 126 | |
| 127 | Add Invalid IPv4 Address And Verify |
| 128 | [Documentation] Add Invalid IPv4 Address via Redfish and verify. |
| 129 | [Tags] Add_Invalid_IPv4_Addres_And_Verify |
| 130 | |
| 131 | Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} |
| 132 | ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} |
| 133 | |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 134 | Configure Out Of Range IP |
| 135 | [Documentation] Configure out-of-range IP address. |
| 136 | [Tags] Configure_Out_Of_Range_IP |
| 137 | [Template] Add IP Address |
| 138 | |
| 139 | # ip subnet_mask gateway valid_status_codes |
| 140 | ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 141 | |
| 142 | Configure Broadcast IP |
| 143 | [Documentation] Configure broadcast IP address. |
| 144 | [Tags] Configure_Broadcast_IP |
| 145 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 146 | [Teardown] Clear IP Settings On Fail ${broadcast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 147 | |
| 148 | # ip subnet_mask gateway valid_status_codes |
| 149 | ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 150 | |
| 151 | Configure Multicast IP |
| 152 | [Documentation] Configure multicast IP address. |
| 153 | [Tags] Configure_Multicast_IP |
| 154 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 155 | [Teardown] Clear IP Settings On Fail ${multicast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 156 | |
| 157 | # ip subnet_mask gateway valid_status_codes |
| 158 | ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 159 | |
| 160 | Configure Loopback IP |
| 161 | [Documentation] Configure loopback IP address. |
| 162 | [Tags] Configure_Loopback_IP |
| 163 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 164 | [Teardown] Clear IP Settings On Fail ${loopback_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 165 | |
| 166 | # ip subnet_mask gateway valid_status_codes |
| 167 | ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 168 | |
| 169 | Add Valid IPv4 Address And Check Persistency |
| 170 | [Documentation] Add IPv4 address and check peristency. |
| 171 | [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 172 | [Teardown] Run Keywords |
| 173 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 174 | |
| 175 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 176 | |
| 177 | # Reboot BMC and verify persistency. |
| 178 | OBMC Reboot (off) |
George Keishing | 5c49874 | 2019-08-09 02:14:44 -0500 | [diff] [blame] | 179 | Redfish.Login |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 180 | Verify IP On BMC ${test_ipv4_addr} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 181 | |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 182 | Add Fourth Octet Threshold IP And Verify |
| 183 | [Documentation] Add fourth octet threshold IP and verify. |
| 184 | [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 185 | [Teardown] Run Keywords |
| 186 | ... Delete IP Address 10.7.7.254 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 187 | |
| 188 | Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 189 | |
| 190 | Add Fourth Octet Lowest IP And Verify |
| 191 | [Documentation] Add fourth octet lowest IP and verify. |
| 192 | [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 193 | [Teardown] Run Keywords |
| 194 | ... Delete IP Address 10.7.7.1 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 195 | |
| 196 | Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 197 | |
| 198 | Add Third Octet Threshold IP And Verify |
| 199 | [Documentation] Add third octet threshold IP and verify. |
| 200 | [Tags] Add_Third_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 201 | [Teardown] Run Keywords |
| 202 | ... Delete IP Address 10.7.255.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 203 | |
| 204 | Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 205 | |
| 206 | Add Third Octet Lowest IP And Verify |
| 207 | [Documentation] Add third octet lowest IP and verify. |
| 208 | [Tags] Add_Third_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 209 | [Teardown] Run Keywords |
| 210 | ... Delete IP Address 10.7.0.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 211 | |
| 212 | Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 213 | |
| 214 | Add Second Octet Threshold IP And Verify |
| 215 | [Documentation] Add second octet threshold IP and verify. |
| 216 | [Tags] Add_Second_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 217 | [Teardown] Run Keywords |
| 218 | ... Delete IP Address 10.255.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 219 | |
| 220 | Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 221 | |
| 222 | Add Second Octet Lowest IP And Verify |
| 223 | [Documentation] Add second octet lowest IP and verify. |
| 224 | [Tags] Add_Second_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 225 | [Teardown] Run Keywords |
| 226 | ... Delete IP Address 10.0.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 227 | |
| 228 | Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 229 | |
| 230 | Add First Octet Threshold IP And Verify |
| 231 | [Documentation] Add first octet threshold IP and verify. |
| 232 | [Tags] Add_First_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 233 | [Teardown] Run Keywords |
| 234 | ... Delete IP Address 233.7.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 235 | |
| 236 | Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 237 | |
| 238 | Add First Octet Lowest IP And Verify |
| 239 | [Documentation] Add first octet lowest IP and verify. |
| 240 | [Tags] Add_First_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 241 | [Teardown] Run Keywords |
| 242 | ... Delete IP Address 1.7.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 243 | |
| 244 | Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 245 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 246 | Configure Invalid Netmask |
| 247 | [Documentation] Verify error while setting invalid netmask. |
| 248 | [Tags] Configure_Invalid_Netmask |
| 249 | [Template] Add IP Address |
| 250 | |
| 251 | # ip subnet_mask gateway valid_status_codes |
| 252 | ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 253 | |
| 254 | Configure Out Of Range Netmask |
| 255 | [Documentation] Verify error while setting out of range netmask. |
| 256 | [Tags] Configure_Out_Of_Range_Netmask |
| 257 | [Template] Add IP Address |
| 258 | |
| 259 | # ip subnet_mask gateway valid_status_codes |
| 260 | ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 261 | |
| 262 | Configure Alpha Netmask |
| 263 | [Documentation] Verify error while setting alpha netmask. |
| 264 | [Tags] Configure_Alpha_Netmask |
| 265 | [Template] Add IP Address |
| 266 | |
| 267 | # ip subnet_mask gateway valid_status_codes |
| 268 | ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 269 | |
| 270 | Configure More Byte Netmask |
| 271 | [Documentation] Verify error while setting more byte netmask. |
| 272 | [Tags] Configure_More_Byte_Netmask |
| 273 | [Template] Add IP Address |
| 274 | |
| 275 | # ip subnet_mask gateway valid_status_codes |
| 276 | ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 277 | |
| 278 | Configure Less Byte Netmask |
| 279 | [Documentation] Verify error while setting less byte netmask. |
| 280 | [Tags] Configure_Less_Byte_Netmask |
| 281 | [Template] Add IP Address |
| 282 | |
| 283 | # ip subnet_mask gateway valid_status_codes |
| 284 | ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 285 | |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 286 | Configure Threshold Netmask And Verify |
| 287 | [Documentation] Configure threshold netmask and verify. |
| 288 | [Tags] Configure_Threshold_Netmask_And_verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 289 | [Teardown] Run Keywords |
| 290 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 291 | |
| 292 | Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway} |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 293 | |
| 294 | Configure Lowest Netmask And Verify |
| 295 | [Documentation] Configure lowest netmask and verify. |
| 296 | [Tags] Configure_Lowest_Netmask_And_verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 297 | [Teardown] Run Keywords |
| 298 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 299 | |
| 300 | Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 301 | |
| 302 | Configure Network ID |
| 303 | [Documentation] Verify error while configuring network ID. |
| 304 | [Tags] Configure_Network_ID |
| 305 | [Template] Add IP Address |
| 306 | [Teardown] Clear IP Settings On Fail ${network_id} |
| 307 | |
| 308 | # ip subnet_mask gateway valid_status_codes |
| 309 | ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 310 | |
| 311 | Configure Less Octet IP |
| 312 | [Documentation] Verify error while Configuring less octet IP address. |
| 313 | [Tags] Configure_Less_Octet_IP |
| 314 | [Template] Add IP Address |
| 315 | |
| 316 | # ip subnet_mask gateway valid_status_codes |
| 317 | ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 318 | |
| 319 | Configure Empty IP |
| 320 | [Documentation] Verify error while Configuring empty IP address. |
| 321 | [Tags] Configure_Empty_IP |
| 322 | [Template] Add IP Address |
| 323 | |
| 324 | # ip subnet_mask gateway valid_status_codes |
| 325 | ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 326 | |
| 327 | Configure Special Char IP |
| 328 | [Documentation] Configure invalid IP address containing special chars. |
| 329 | [Tags] Configure_Special_Char_IP |
| 330 | [Template] Add IP Address |
| 331 | |
| 332 | # ip subnet_mask gateway valid_status_codes |
| 333 | @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 334 | |
| 335 | Configure Hexadecimal IP |
| 336 | [Documentation] Configure invalid IP address containing hex value. |
| 337 | [Tags] Configure_Hexadecimal_IP |
| 338 | [Template] Add IP Address |
| 339 | |
| 340 | # ip subnet_mask gateway valid_status_codes |
| 341 | ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 342 | |
| 343 | Configure Negative Octet IP |
| 344 | [Documentation] Configure invalid IP address containing negative octet. |
| 345 | [Tags] Configure_Negative_Octet_IP |
| 346 | [Template] Add IP Address |
| 347 | |
| 348 | # ip subnet_mask gateway valid_status_codes |
| 349 | ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 350 | |
Prashanth Katti | 5cad5a0 | 2019-06-20 07:27:10 -0500 | [diff] [blame] | 351 | Configure Incomplete IP For Gateway |
| 352 | [Documentation] Configure incomplete IP for gateway and expect an error. |
| 353 | [Tags] Configure_Incomplete_IP_For_Gateway |
| 354 | [Template] Add IP Address |
| 355 | |
| 356 | # ip subnet_mask gateway valid_status_codes |
| 357 | ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST} |
| 358 | |
| 359 | Configure Special Char IP For Gateway |
| 360 | [Documentation] Configure special char IP for gateway and expect an error. |
| 361 | [Tags] Configure_Special_Char_IP_For_Gateway |
| 362 | [Template] Add IP Address |
| 363 | |
| 364 | # ip subnet_mask gateway valid_status_codes |
| 365 | ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST} |
| 366 | |
| 367 | Configure Hexadecimal IP For Gateway |
| 368 | [Documentation] Configure hexadecimal IP for gateway and expect an error. |
| 369 | [Tags] Configure_Hexadecimal_IP_For_Gateway |
| 370 | [Template] Add IP Address |
| 371 | |
| 372 | # ip subnet_mask gateway valid_status_codes |
| 373 | ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST} |
| 374 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 375 | Get DNS Server And Verify |
| 376 | [Documentation] Get DNS server via Redfish and verify. |
| 377 | [Tags] Get_DNS_Server_And_Verify |
| 378 | |
| 379 | Verify CLI and Redfish Nameservers |
| 380 | |
| 381 | Configure DNS Server And Verify |
| 382 | [Documentation] Configure DNS server and verify. |
| 383 | [Tags] Configure_DNS_Server_And_Verify |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 384 | [Setup] DNS Test Setup Execution |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 385 | [Teardown] Run Keywords |
| 386 | ... Configure Static Name Servers AND Test Teardown Execution |
| 387 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 388 | Configure Static Name Servers ${static_name_servers} |
| 389 | Verify CLI and Redfish Nameservers |
| 390 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 391 | Delete DNS Server And Verify |
| 392 | [Documentation] Delete DNS server and verify. |
| 393 | [Tags] Delete_DNS_Server_And_Verify |
| 394 | [Setup] DNS Test Setup Execution |
| 395 | [Teardown] Run Keywords |
| 396 | ... Configure Static Name Servers AND Test Teardown Execution |
| 397 | |
| 398 | Delete Static Name Servers |
| 399 | Verify CLI and Redfish Nameservers |
| 400 | |
| 401 | Configure DNS Server And Check Persistency |
| 402 | [Documentation] Configure DNS server and check persistency on reboot. |
| 403 | [Tags] Configure_DNS_Server_And_Check_Persistency |
| 404 | [Setup] DNS Test Setup Execution |
| 405 | [Teardown] Run Keywords |
| 406 | ... Configure Static Name Servers AND Test Teardown Execution |
| 407 | |
| 408 | Configure Static Name Servers ${static_name_servers} |
| 409 | # Reboot BMC and verify persistency. |
| 410 | OBMC Reboot (off) |
| 411 | Verify CLI and Redfish Nameservers |
| 412 | |
Prashanth Katti | 3063ffe | 2019-07-25 04:35:25 -0500 | [diff] [blame] | 413 | Configure Loopback IP For Gateway |
| 414 | [Documentation] Configure loopback IP for gateway and expect an error. |
| 415 | [Tags] Configure_Loopback_IP_For_Gateway |
| 416 | [Template] Add IP Address |
| 417 | [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} |
| 418 | |
| 419 | # ip subnet_mask gateway valid_status_codes |
| 420 | ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST} |
| 421 | |
| 422 | Configure Network ID For Gateway |
| 423 | [Documentation] Configure network ID for gateway and expect an error. |
| 424 | [Tags] Configure_Network_ID_For_Gateway |
| 425 | [Template] Add IP Address |
| 426 | [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} |
| 427 | |
| 428 | # ip subnet_mask gateway valid_status_codes |
| 429 | ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST} |
| 430 | |
| 431 | Configure Multicast IP For Gateway |
| 432 | [Documentation] Configure multicast IP for gateway and expect an error. |
| 433 | [Tags] Configure_Multicast_IP_For_Gateway |
| 434 | [Template] Add IP Address |
| 435 | [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} |
| 436 | |
| 437 | # ip subnet_mask gateway valid_status_codes |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 438 | ${test_ipv4_addr} ${test_subnet_mask} ${multicast_ip} ${HTTP_BAD_REQUEST} |
Prashanth Katti | 3063ffe | 2019-07-25 04:35:25 -0500 | [diff] [blame] | 439 | |
| 440 | Configure Broadcast IP For Gateway |
| 441 | [Documentation] Configure broadcast IP for gateway and expect an error. |
| 442 | [Tags] Configure_Broadcast_IP_For_Gateway |
| 443 | [Template] Add IP Address |
| 444 | [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} |
| 445 | |
| 446 | # ip subnet_mask gateway valid_status_codes |
| 447 | ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST} |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 448 | |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 449 | Configure Null Value For DNS Server |
| 450 | [Documentation] Configure null value for DNS server and expect an error. |
| 451 | [Tags] Configure_Null_Value_For_DNS_Server |
| 452 | [Setup] DNS Test Setup Execution |
| 453 | [Teardown] Run Keywords |
| 454 | ... Configure Static Name Servers AND Test Teardown Execution |
| 455 | |
| 456 | Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST} |
| 457 | |
Prashanth Katti | afe16b7 | 2019-08-02 00:29:45 -0500 | [diff] [blame] | 458 | Configure Empty Value For DNS Server |
| 459 | [Documentation] Configure empty value for DNS server and expect an error. |
| 460 | [Tags] Configure_Empty_Value_For_DNS_Server |
| 461 | [Setup] DNS Test Setup Execution |
| 462 | [Teardown] Run Keywords |
| 463 | ... Configure Static Name Servers AND Test Teardown Execution |
| 464 | |
| 465 | Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST} |
| 466 | |
| 467 | Configure String Value For DNS Server |
| 468 | [Documentation] Configure string value for DNS server and expect an error. |
| 469 | [Tags] Configure_String_Value_For_DNS_Server |
| 470 | [Setup] DNS Test Setup Execution |
| 471 | [Teardown] Run Keywords |
| 472 | ... Configure Static Name Servers AND Test Teardown Execution |
| 473 | |
| 474 | Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST} |
| 475 | |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 476 | Modify IPv4 Address And Verify |
| 477 | [Documentation] Modify IP address via Redfish and verify. |
| 478 | [Tags] Modify_IPv4_Addres_And_Verify |
| 479 | [Teardown] Run Keywords |
| 480 | ... Delete IP Address ${test_ipv4_addr2} AND Delete IP Address ${test_ipv4_addr} |
| 481 | ... AND Test Teardown Execution |
| 482 | |
| 483 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 484 | |
| 485 | Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} |
| 486 | |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 487 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 488 | *** Keywords *** |
| 489 | |
| 490 | Test Setup Execution |
| 491 | [Documentation] Test setup execution. |
| 492 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 493 | Redfish.Login |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 494 | |
| 495 | @{network_configurations}= Get Network Configuration |
| 496 | Set Test Variable @{network_configurations} |
| 497 | |
| 498 | # Get BMC IP address and prefix length. |
| 499 | ${ip_data}= Get BMC IP Info |
| 500 | Set Test Variable ${ip_data} |
| 501 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 502 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 503 | Verify Netmask On BMC |
| 504 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 505 | [Arguments] ${netmask} |
| 506 | |
| 507 | # Description of the argument(s): |
| 508 | # netmask netmask value to be verified. |
| 509 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 510 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 511 | |
| 512 | Should Contain Match ${ip_data} */${prefix_length} |
| 513 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 514 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 515 | Verify IP And Netmask On BMC |
| 516 | [Documentation] Verify IP and netmask on BMC. |
| 517 | [Arguments] ${ip} ${netmask} |
| 518 | |
| 519 | # Description of the argument(s): |
| 520 | # ip IP address to be verified. |
| 521 | # netmask netmask value to be verified. |
| 522 | |
| 523 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 524 | @{ip_data}= Get BMC IP Info |
| 525 | |
| 526 | ${ip_with_netmask}= Catenate ${ip}/${prefix_length} |
| 527 | Should Contain ${ip_data} ${ip_with_netmask} |
| 528 | ... msg=IP and netmask pair does not exist. |
| 529 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 530 | Validate Hostname On BMC |
| 531 | [Documentation] Verify that the hostname read via Redfish is the same as the |
| 532 | ... hostname configured on system. |
| 533 | [Arguments] ${hostname} |
| 534 | |
| 535 | # Description of argument(s): |
| 536 | # hostname A hostname value which is to be compared to the hostname |
| 537 | # configured on system. |
| 538 | |
| 539 | ${sys_hostname}= Get BMC Hostname |
Prashanth Katti | 466d834 | 2019-03-21 08:58:50 -0500 | [diff] [blame] | 540 | Should Be Equal ${sys_hostname} ${hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 541 | ... ignore_case=True msg=Hostname does not exist. |
| 542 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 543 | Test Teardown Execution |
| 544 | [Documentation] Test teardown execution. |
| 545 | |
| 546 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 547 | Redfish.Logout |
Prashanth Katti | a844251 | 2019-06-07 06:47:09 -0500 | [diff] [blame] | 548 | |
| 549 | Clear IP Settings On Fail |
| 550 | [Documentation] Clear IP settings on fail. |
| 551 | [Arguments] ${ip} |
| 552 | |
| 553 | # Description of argument(s): |
| 554 | # ip IP address to be deleted. |
| 555 | |
| 556 | Run Keyword If '${TEST STATUS}' == 'FAIL' |
| 557 | ... Delete IP Address ${ip} |
| 558 | |
| 559 | Test Teardown Execution |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 560 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 561 | Verify CLI and Redfish Nameservers |
| 562 | [Documentation] Verify that nameservers obtained via Redfish do not |
| 563 | ... match those found in /etc/resolv.conf. |
| 564 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 565 | ${active_channel_config}= Get Active Channel Config |
| 566 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 567 | |
| 568 | ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 569 | ${resolve_conf_nameservers}= CLI Get Nameservers |
Michael Walsh | 39c0051 | 2019-07-17 10:54:06 -0500 | [diff] [blame] | 570 | Rqprint Vars redfish_nameservers resolve_conf_nameservers |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 571 | |
| 572 | # Check that the 2 lists are equivalent. |
| 573 | ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers) |
| 574 | Should Be True ${match} |
| 575 | ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf. |
| 576 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 577 | |
| 578 | Configure Static Name Servers |
| 579 | [Documentation] Configure DNS server on BMC. |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 580 | [Arguments] ${static_name_servers}=${original_nameservers} |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 581 | ... ${valid_status_codes}=${HTTP_OK} |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 582 | |
George Keishing | 9cb2e59 | 2019-07-12 09:37:33 -0500 | [diff] [blame] | 583 | # Description of the argument(s): |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 584 | # static_name_servers A list of static name server IPs to be |
| 585 | # configured on the BMC. |
| 586 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 587 | ${active_channel_config}= Get Active Channel Config |
| 588 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 589 | |
Prashanth Katti | 9d995fc | 2019-09-24 01:29:06 -0500 | [diff] [blame] | 590 | # Currently BMC is sending 500 response code instead of 400 for invalid scenarios. |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 591 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body={'StaticNameServers': ${static_name_servers}} |
Prashanth Katti | 9d995fc | 2019-09-24 01:29:06 -0500 | [diff] [blame] | 592 | ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}] |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 593 | |
Prashanth Katti | f247be3 | 2019-10-07 04:40:43 -0500 | [diff] [blame] | 594 | # Patch operation takes 1 to 3 seconds to set new value. |
| 595 | Sleep 3s |
| 596 | |
Prashanth Katti | 7f9e60f | 2019-07-26 01:18:41 -0500 | [diff] [blame] | 597 | # Check if newly added DNS server is configured on BMC. |
| 598 | ${cli_nameservers}= CLI Get Nameservers |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 599 | ${cmd_status}= Run Keyword And Return Status |
| 600 | ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers} |
| 601 | |
| 602 | Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' |
| 603 | ... Should Be True ${cmd_status} == ${True} |
| 604 | ... ELSE Should Be True ${cmd_status} == ${False} |
Prashanth Katti | 7f9e60f | 2019-07-26 01:18:41 -0500 | [diff] [blame] | 605 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 606 | Delete Static Name Servers |
| 607 | [Documentation] Delete static name servers. |
| 608 | |
| 609 | Configure Static Name Servers @{EMPTY} |
| 610 | |
| 611 | # Check if all name servers deleted on BMC. |
| 612 | ${nameservers}= CLI Get Nameservers |
| 613 | Should Be Empty ${nameservers} |
| 614 | |
| 615 | DNS Test Setup Execution |
| 616 | [Documentation] Do DNS test setup execution. |
| 617 | |
| 618 | Redfish.Login |
| 619 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 620 | ${active_channel_config}= Get Active Channel Config |
| 621 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 622 | |
| 623 | ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers |
| 624 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 625 | Rprint Vars original_nameservers |
| 626 | # Set suite variables to trigger restoration during teardown. |
| 627 | Set Suite Variable ${original_nameservers} |
Prashanth Katti | b478d90 | 2020-05-08 10:05:32 -0500 | [diff] [blame] | 628 | |
| 629 | Suite Setup Execution |
| 630 | [Documentation] Do suite setup execution. |
| 631 | |
| 632 | ${test_gateway}= Get BMC Default Gateway |
| 633 | Set Suite Variable ${test_gateway} |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 634 | |
| 635 | Update IP Address |
| 636 | [Documentation] Update IP address of BMC. |
| 637 | [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} ${valid_status_codes}=${HTTP_OK} |
| 638 | |
| 639 | # Description of argument(s): |
| 640 | # ip IP address to be replaced (e.g. "10.7.7.7"). |
| 641 | # new_ip New IP address to be configured. |
| 642 | # netmask Netmask value. |
| 643 | # gw_ip Gateway IP address. |
| 644 | # valid_status_codes Expected return code from patch operation |
| 645 | # (e.g. "200"). See prolog of rest_request |
| 646 | # method in redfish_plus.py for details. |
| 647 | |
| 648 | ${empty_dict}= Create Dictionary |
| 649 | ${patch_list}= Create List |
| 650 | ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip} |
| 651 | |
| 652 | # Find the position of IP address to be modified. |
| 653 | @{network_configurations}= Get Network Configuration |
| 654 | FOR ${network_configuration} IN @{network_configurations} |
| 655 | Run Keyword If '${network_configuration['Address']}' == '${ip}' |
| 656 | ... Append To List ${patch_list} ${ip_data} |
| 657 | ... ELSE Append To List ${patch_list} ${empty_dict} |
| 658 | END |
| 659 | |
| 660 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 661 | ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC |
| 662 | Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC |
| 663 | |
| 664 | # Run patch command only if given IP is found on BMC |
| 665 | ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} |
| 666 | |
| 667 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} valid_status_codes=[${valid_status_codes}] |
| 668 | |
| 669 | # Note: Network restart takes around 15-18s after patch request processing. |
| 670 | Sleep ${NETWORK_TIMEOUT}s |
| 671 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 672 | |
| 673 | Verify IP On BMC ${new_ip} |
| 674 | Validate Network Config On BMC |