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