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