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 | |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 28 | # Valid netmask is 4 bytes long and has continuous block of 1s. |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 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 |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 50 | @{static_name_servers} 10.5.5.5 |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 51 | @{null_value} null |
Prashanth Katti | afe16b7 | 2019-08-02 00:29:45 -0500 | [diff] [blame] | 52 | @{empty_dictionary} {} |
| 53 | @{string_value} aa.bb.cc.dd |
| 54 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 55 | *** Test Cases *** |
| 56 | |
| 57 | Get IP Address And Verify |
| 58 | [Documentation] Get IP Address And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 59 | [Tags] Get_IP_Address_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 60 | |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 61 | FOR ${network_configuration} IN @{network_configurations} |
| 62 | Verify IP On BMC ${network_configuration['Address']} |
| 63 | END |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 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 | |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 69 | FOR ${network_configuration} IN @{network_configurations} |
| 70 | Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 71 | END |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 72 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 73 | Get Gateway And Verify |
| 74 | [Documentation] Get gateway and verify it's existence on the BMC. |
| 75 | [Tags] Get_Gateway_And_Verify |
| 76 | |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 77 | FOR ${network_configuration} IN @{network_configurations} |
| 78 | Verify Gateway On BMC ${network_configuration['Gateway']} |
| 79 | END |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 80 | |
| 81 | Get MAC Address And Verify |
| 82 | [Documentation] Get MAC address and verify it's existence on the BMC. |
| 83 | [Tags] Get_MAC_Address_And_Verify |
| 84 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 85 | ${active_channel_config}= Get Active Channel Config |
| 86 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 87 | |
| 88 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 89 | ${macaddr}= Get From Dictionary ${resp.dict} MACAddress |
| 90 | Validate MAC On BMC ${macaddr} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 91 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 92 | Verify All Configured IP And Netmask |
| 93 | [Documentation] Verify all configured IP and netmask on BMC. |
| 94 | [Tags] Verify_All_Configured_IP_And_Netmask |
| 95 | |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 96 | FOR ${network_configuration} IN @{network_configurations} |
| 97 | Verify IP And Netmask On BMC ${network_configuration['Address']} |
| 98 | ... ${network_configuration['SubnetMask']} |
| 99 | END |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 100 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 101 | Get Hostname And Verify |
| 102 | [Documentation] Get hostname via Redfish and verify. |
| 103 | [Tags] Get_Hostname_And_Verify |
| 104 | |
| 105 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 106 | |
| 107 | Validate Hostname On BMC ${hostname} |
| 108 | |
| 109 | Configure Hostname And Verify |
| 110 | [Documentation] Configure hostname via Redfish and verify. |
| 111 | [Tags] Configure_Hostname_And_Verify |
shrsuman123 | 578276c | 2020-08-04 04:28:58 -0500 | [diff] [blame] | 112 | [Teardown] Run Keywords |
| 113 | ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 114 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 115 | ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 116 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 117 | Configure Hostname ${test_hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 118 | Validate Hostname On BMC ${test_hostname} |
| 119 | |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 120 | |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 121 | Add Valid IPv4 Address And Verify |
| 122 | [Documentation] Add IPv4 Address via Redfish and verify. |
| 123 | [Tags] Add_Valid_IPv4_Addres_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 124 | [Teardown] Run Keywords |
| 125 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 126 | |
| 127 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 128 | |
| 129 | Add Invalid IPv4 Address And Verify |
| 130 | [Documentation] Add Invalid IPv4 Address via Redfish and verify. |
| 131 | [Tags] Add_Invalid_IPv4_Addres_And_Verify |
| 132 | |
| 133 | Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} |
| 134 | ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} |
| 135 | |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 136 | Configure Out Of Range IP |
| 137 | [Documentation] Configure out-of-range IP address. |
| 138 | [Tags] Configure_Out_Of_Range_IP |
| 139 | [Template] Add IP Address |
| 140 | |
| 141 | # ip subnet_mask gateway valid_status_codes |
| 142 | ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 143 | |
| 144 | Configure Broadcast IP |
| 145 | [Documentation] Configure broadcast IP address. |
| 146 | [Tags] Configure_Broadcast_IP |
| 147 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 148 | [Teardown] Clear IP Settings On Fail ${broadcast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 149 | |
| 150 | # ip subnet_mask gateway valid_status_codes |
| 151 | ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 152 | |
| 153 | Configure Multicast IP |
| 154 | [Documentation] Configure multicast IP address. |
| 155 | [Tags] Configure_Multicast_IP |
| 156 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 157 | [Teardown] Clear IP Settings On Fail ${multicast_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 158 | |
| 159 | # ip subnet_mask gateway valid_status_codes |
| 160 | ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 161 | |
| 162 | Configure Loopback IP |
| 163 | [Documentation] Configure loopback IP address. |
| 164 | [Tags] Configure_Loopback_IP |
| 165 | [Template] Add IP Address |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 166 | [Teardown] Clear IP Settings On Fail ${loopback_ip} |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 167 | |
| 168 | # ip subnet_mask gateway valid_status_codes |
| 169 | ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 170 | |
| 171 | Add Valid IPv4 Address And Check Persistency |
| 172 | [Documentation] Add IPv4 address and check peristency. |
| 173 | [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 174 | [Teardown] Run Keywords |
| 175 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 176 | |
| 177 | Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} |
| 178 | |
| 179 | # Reboot BMC and verify persistency. |
| 180 | OBMC Reboot (off) |
George Keishing | 5c49874 | 2019-08-09 02:14:44 -0500 | [diff] [blame] | 181 | Redfish.Login |
Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 182 | Verify IP On BMC ${test_ipv4_addr} |
Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 183 | |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 184 | Add Fourth Octet Threshold IP And Verify |
| 185 | [Documentation] Add fourth octet threshold IP and verify. |
| 186 | [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 187 | [Teardown] Run Keywords |
| 188 | ... Delete IP Address 10.7.7.254 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 189 | |
| 190 | Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 191 | |
| 192 | Add Fourth Octet Lowest IP And Verify |
| 193 | [Documentation] Add fourth octet lowest IP and verify. |
| 194 | [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 195 | [Teardown] Run Keywords |
| 196 | ... Delete IP Address 10.7.7.1 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 197 | |
| 198 | Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 199 | |
| 200 | Add Third Octet Threshold IP And Verify |
| 201 | [Documentation] Add third octet threshold IP and verify. |
| 202 | [Tags] Add_Third_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 203 | [Teardown] Run Keywords |
| 204 | ... Delete IP Address 10.7.255.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 205 | |
| 206 | Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 207 | |
| 208 | Add Third Octet Lowest IP And Verify |
| 209 | [Documentation] Add third octet lowest IP and verify. |
| 210 | [Tags] Add_Third_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 211 | [Teardown] Run Keywords |
| 212 | ... Delete IP Address 10.7.0.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 213 | |
| 214 | Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 215 | |
| 216 | Add Second Octet Threshold IP And Verify |
| 217 | [Documentation] Add second octet threshold IP and verify. |
| 218 | [Tags] Add_Second_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 219 | [Teardown] Run Keywords |
| 220 | ... Delete IP Address 10.255.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 221 | |
| 222 | Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 223 | |
| 224 | Add Second Octet Lowest IP And Verify |
| 225 | [Documentation] Add second octet lowest IP and verify. |
| 226 | [Tags] Add_Second_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 227 | [Teardown] Run Keywords |
| 228 | ... Delete IP Address 10.0.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 229 | |
| 230 | Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 231 | |
| 232 | Add First Octet Threshold IP And Verify |
| 233 | [Documentation] Add first octet threshold IP and verify. |
| 234 | [Tags] Add_First_Octet_Threshold_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 235 | [Teardown] Run Keywords |
Anves Kumar rayankula | f757b10 | 2020-07-27 20:41:36 -0500 | [diff] [blame] | 236 | ... Delete IP Address 223.7.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 237 | |
| 238 | Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 239 | |
| 240 | Add First Octet Lowest IP And Verify |
| 241 | [Documentation] Add first octet lowest IP and verify. |
| 242 | [Tags] Add_First_Octet_Lowest_IP_And_Verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 243 | [Teardown] Run Keywords |
| 244 | ... Delete IP Address 1.7.7.7 AND Test Teardown Execution |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 245 | |
| 246 | Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} |
Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 247 | |
Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 248 | Configure Invalid Netmask |
| 249 | [Documentation] Verify error while setting invalid netmask. |
| 250 | [Tags] Configure_Invalid_Netmask |
| 251 | [Template] Add IP Address |
| 252 | |
| 253 | # ip subnet_mask gateway valid_status_codes |
| 254 | ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 255 | |
| 256 | Configure Out Of Range Netmask |
| 257 | [Documentation] Verify error while setting out of range netmask. |
| 258 | [Tags] Configure_Out_Of_Range_Netmask |
| 259 | [Template] Add IP Address |
| 260 | |
| 261 | # ip subnet_mask gateway valid_status_codes |
| 262 | ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 263 | |
| 264 | Configure Alpha Netmask |
| 265 | [Documentation] Verify error while setting alpha netmask. |
| 266 | [Tags] Configure_Alpha_Netmask |
| 267 | [Template] Add IP Address |
| 268 | |
| 269 | # ip subnet_mask gateway valid_status_codes |
| 270 | ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 271 | |
| 272 | Configure More Byte Netmask |
| 273 | [Documentation] Verify error while setting more byte netmask. |
| 274 | [Tags] Configure_More_Byte_Netmask |
| 275 | [Template] Add IP Address |
| 276 | |
| 277 | # ip subnet_mask gateway valid_status_codes |
| 278 | ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 279 | |
| 280 | Configure Less Byte Netmask |
| 281 | [Documentation] Verify error while setting less byte netmask. |
| 282 | [Tags] Configure_Less_Byte_Netmask |
| 283 | [Template] Add IP Address |
| 284 | |
| 285 | # ip subnet_mask gateway valid_status_codes |
| 286 | ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 287 | |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 288 | Configure Threshold Netmask And Verify |
| 289 | [Documentation] Configure threshold netmask and verify. |
| 290 | [Tags] Configure_Threshold_Netmask_And_verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 291 | [Teardown] Run Keywords |
| 292 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 293 | |
| 294 | Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway} |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 295 | |
| 296 | Configure Lowest Netmask And Verify |
| 297 | [Documentation] Configure lowest netmask and verify. |
| 298 | [Tags] Configure_Lowest_Netmask_And_verify |
Anvesh Kumar | 9c7238d | 2020-04-21 03:56:21 -0500 | [diff] [blame] | 299 | [Teardown] Run Keywords |
| 300 | ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 301 | |
| 302 | Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} |
Prashanth Katti | c6ad647 | 2019-06-14 03:33:39 -0500 | [diff] [blame] | 303 | |
| 304 | Configure Network ID |
| 305 | [Documentation] Verify error while configuring network ID. |
| 306 | [Tags] Configure_Network_ID |
| 307 | [Template] Add IP Address |
| 308 | [Teardown] Clear IP Settings On Fail ${network_id} |
| 309 | |
| 310 | # ip subnet_mask gateway valid_status_codes |
| 311 | ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 312 | |
| 313 | Configure Less Octet IP |
| 314 | [Documentation] Verify error while Configuring less octet IP address. |
| 315 | [Tags] Configure_Less_Octet_IP |
| 316 | [Template] Add IP Address |
| 317 | |
| 318 | # ip subnet_mask gateway valid_status_codes |
| 319 | ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 320 | |
| 321 | Configure Empty IP |
| 322 | [Documentation] Verify error while Configuring empty IP address. |
| 323 | [Tags] Configure_Empty_IP |
| 324 | [Template] Add IP Address |
| 325 | |
| 326 | # ip subnet_mask gateway valid_status_codes |
| 327 | ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 328 | |
| 329 | Configure Special Char IP |
| 330 | [Documentation] Configure invalid IP address containing special chars. |
| 331 | [Tags] Configure_Special_Char_IP |
| 332 | [Template] Add IP Address |
| 333 | |
| 334 | # ip subnet_mask gateway valid_status_codes |
| 335 | @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 336 | |
| 337 | Configure Hexadecimal IP |
| 338 | [Documentation] Configure invalid IP address containing hex value. |
| 339 | [Tags] Configure_Hexadecimal_IP |
| 340 | [Template] Add IP Address |
| 341 | |
| 342 | # ip subnet_mask gateway valid_status_codes |
| 343 | ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 344 | |
| 345 | Configure Negative Octet IP |
| 346 | [Documentation] Configure invalid IP address containing negative octet. |
| 347 | [Tags] Configure_Negative_Octet_IP |
| 348 | [Template] Add IP Address |
| 349 | |
| 350 | # ip subnet_mask gateway valid_status_codes |
| 351 | ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} |
| 352 | |
Prashanth Katti | 5cad5a0 | 2019-06-20 07:27:10 -0500 | [diff] [blame] | 353 | Configure Incomplete IP For Gateway |
| 354 | [Documentation] Configure incomplete IP for gateway and expect an error. |
| 355 | [Tags] Configure_Incomplete_IP_For_Gateway |
| 356 | [Template] Add IP Address |
| 357 | |
| 358 | # ip subnet_mask gateway valid_status_codes |
| 359 | ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST} |
| 360 | |
| 361 | Configure Special Char IP For Gateway |
| 362 | [Documentation] Configure special char IP for gateway and expect an error. |
| 363 | [Tags] Configure_Special_Char_IP_For_Gateway |
| 364 | [Template] Add IP Address |
| 365 | |
| 366 | # ip subnet_mask gateway valid_status_codes |
| 367 | ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST} |
| 368 | |
| 369 | Configure Hexadecimal IP For Gateway |
| 370 | [Documentation] Configure hexadecimal IP for gateway and expect an error. |
| 371 | [Tags] Configure_Hexadecimal_IP_For_Gateway |
| 372 | [Template] Add IP Address |
| 373 | |
| 374 | # ip subnet_mask gateway valid_status_codes |
| 375 | ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST} |
| 376 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 377 | Get DNS Server And Verify |
| 378 | [Documentation] Get DNS server via Redfish and verify. |
| 379 | [Tags] Get_DNS_Server_And_Verify |
| 380 | |
| 381 | Verify CLI and Redfish Nameservers |
| 382 | |
| 383 | Configure DNS Server And Verify |
| 384 | [Documentation] Configure DNS server and verify. |
| 385 | [Tags] Configure_DNS_Server_And_Verify |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 386 | [Setup] DNS Test Setup Execution |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 387 | [Teardown] Run Keywords |
| 388 | ... Configure Static Name Servers AND Test Teardown Execution |
| 389 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 390 | Configure Static Name Servers ${static_name_servers} |
| 391 | Verify CLI and Redfish Nameservers |
| 392 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 393 | Delete DNS Server And Verify |
| 394 | [Documentation] Delete DNS server and verify. |
| 395 | [Tags] Delete_DNS_Server_And_Verify |
| 396 | [Setup] DNS Test Setup Execution |
| 397 | [Teardown] Run Keywords |
| 398 | ... Configure Static Name Servers AND Test Teardown Execution |
| 399 | |
| 400 | Delete Static Name Servers |
| 401 | Verify CLI and Redfish Nameservers |
| 402 | |
| 403 | Configure DNS Server And Check Persistency |
| 404 | [Documentation] Configure DNS server and check persistency on reboot. |
| 405 | [Tags] Configure_DNS_Server_And_Check_Persistency |
| 406 | [Setup] DNS Test Setup Execution |
| 407 | [Teardown] Run Keywords |
| 408 | ... Configure Static Name Servers AND Test Teardown Execution |
| 409 | |
| 410 | Configure Static Name Servers ${static_name_servers} |
| 411 | # Reboot BMC and verify persistency. |
| 412 | OBMC Reboot (off) |
Anves Kumar rayankula | 8c628b7 | 2021-02-05 05:03:45 -0600 | [diff] [blame] | 413 | Redfish.Login |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 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 | |
Anves Kumar rayankula | 6b9fcd1 | 2020-12-18 01:03:19 -0600 | [diff] [blame] | 490 | Configure Invalid Values For DNS Server |
| 491 | [Documentation] Configure invalid values for DNS server and expect an error. |
| 492 | [Tags] Configure_Invalid_Value_For_DNS_Server |
| 493 | [Setup] DNS Test Setup Execution |
| 494 | [Template] Configure Static Name Servers |
| 495 | [Teardown] Run Keywords |
| 496 | ... Configure Static Name Servers AND Test Teardown Execution |
| 497 | |
| 498 | # static_name_servers valid_status_codes |
| 499 | 0xa.0xb.0xc.0xd ${HTTP_BAD_REQUEST} |
| 500 | 10.-7.-7.-7 ${HTTP_BAD_REQUEST} |
| 501 | 10.3.36 ${HTTP_BAD_REQUEST} |
| 502 | @@@.%%.44.11 ${HTTP_BAD_REQUEST} |
| 503 | |
| 504 | |
| 505 | Config Multiple DNS Servers And Verify |
| 506 | [Documentation] Config multiple DNS servers and verify. |
| 507 | [Tags] Config_Multiple_DNS_Servers_And_Verify |
| 508 | [Setup] DNS Test Setup Execution |
| 509 | [Teardown] Run Keywords |
| 510 | ... Configure Static Name Servers AND Test Teardown Execution |
| 511 | |
| 512 | @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7 |
| 513 | Configure Static Name Servers ${list_name_servers} |
| 514 | Verify CLI and Redfish Nameservers |
| 515 | |
| 516 | |
Anves Kumar rayankula | d4cdd8c | 2021-01-11 04:10:05 -0600 | [diff] [blame] | 517 | Configure And Verify Multiple Static IPv4 Addresses |
| 518 | [Documentation] Configure multiple static ipv4 address via Redfish and verify. |
| 519 | [Tags] Configure_And_Verify_Multiple_Static_IPv4_Addresses |
| 520 | [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses} |
| 521 | ... AND Test Teardown Execution |
| 522 | |
| 523 | ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2} |
| 524 | Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway} |
| 525 | |
| 526 | |
| 527 | Configure Multiple Static IPv4 Addresses And Check Persistency |
| 528 | [Documentation] Configure multiple static ipv4 address via Redfish and check persistency. |
| 529 | [Tags] Configure_Multiple_Static_IPv4_Addresses_And_Check_Persistency |
| 530 | [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses} |
| 531 | ... AND Test Teardown Execution |
| 532 | |
| 533 | ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2} |
| 534 | Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway} |
| 535 | |
| 536 | # Reboot BMC and verify persistency. |
| 537 | OBMC Reboot (off) |
Anves Kumar rayankula | 8c628b7 | 2021-02-05 05:03:45 -0600 | [diff] [blame] | 538 | Redfish.Login |
Anves Kumar rayankula | d4cdd8c | 2021-01-11 04:10:05 -0600 | [diff] [blame] | 539 | FOR ${ip} IN @{test_ipv4_addresses} |
| 540 | Verify IP And Netmask On BMC ${ip} ${test_subnet_mask} |
| 541 | END |
| 542 | |
| 543 | |
Anves Kumar rayankula | 43e93e1 | 2021-01-27 03:52:37 -0600 | [diff] [blame] | 544 | Configure And Verify Multiple IPv4 Addresses |
| 545 | [Documentation] Configure multiple IPv4 addresses and verify. |
| 546 | [Tags] Configure_And_Verify_Multiple_IPv4_Addresse |
| 547 | [Teardown] Run Keywords |
| 548 | ... Delete IP Address ${test_ipv4_addr} AND Delete IP Address ${test_ipv4_addr2} |
| 549 | ... AND Test Teardown Execution |
| 550 | |
| 551 | ${ip1}= Create dictionary Address=${test_ipv4_addr} |
| 552 | ... SubnetMask=255.255.0.0 Gateway=${test_gateway} |
| 553 | ${ip2}= Create dictionary Address=${test_ipv4_addr2} |
| 554 | ... SubnetMask=255.255.252.0 Gateway=${test_gateway} |
| 555 | |
| 556 | ${empty_dict}= Create Dictionary |
| 557 | ${patch_list}= Create List |
| 558 | ${network_configurations}= Get Network Configuration |
| 559 | ${num_entries}= Get Length ${network_configurations} |
| 560 | |
| 561 | FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 562 | Append To List ${patch_list} ${empty_dict} |
| 563 | END |
| 564 | |
| 565 | # We need not check for existence of IP on BMC while adding. |
| 566 | Append To List ${patch_list} ${ip1} ${ip2} |
| 567 | ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list} |
| 568 | ${active_channel_config}= Get Active Channel Config |
| 569 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 570 | Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload} |
Anves Kumar rayankula | 53b8030 | 2021-05-21 01:50:03 -0500 | [diff] [blame] | 571 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Anves Kumar rayankula | 43e93e1 | 2021-01-27 03:52:37 -0600 | [diff] [blame] | 572 | |
| 573 | # Note: Network restart takes around 15-18s after patch request processing. |
| 574 | Sleep ${NETWORK_TIMEOUT}s |
| 575 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 576 | Verify IP On BMC ${test_ipv4_addr} |
| 577 | Verify IP On BMC ${test_ipv4_addr2} |
| 578 | |
| 579 | |
Anves Kumar rayankula | eefdb56 | 2021-02-08 07:54:11 -0600 | [diff] [blame] | 580 | Config Multiple DNS Servers And Check Persistency |
| 581 | [Documentation] Config multiple DNS and check persistency. |
| 582 | [Tags] Config_Multiple_DNS_Servers_And_Check_Persistency |
| 583 | [Setup] DNS Test Setup Execution |
| 584 | [Teardown] Run Keywords |
| 585 | ... Configure Static Name Servers AND Test Teardown Execution |
| 586 | |
| 587 | @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7 |
| 588 | Configure Static Name Servers ${list_name_servers} |
| 589 | |
| 590 | # Reboot BMC and verify persistency. |
| 591 | OBMC Reboot (off) |
| 592 | Redfish.Login |
| 593 | Verify CLI and Redfish Nameservers |
| 594 | |
Anves Kumar rayankula | 2f137eb | 2021-03-29 01:12:01 -0500 | [diff] [blame] | 595 | |
| 596 | Configure Static IP Without Using Gateway And Verify |
| 597 | [Documentation] Configure static IP without using gateway and verify error. |
| 598 | [Tags] Configure_Static_IP_Without_Using_Gateway_And_Verify |
| 599 | |
| 600 | ${ip}= Create dictionary Address=${test_ipv4_addr} |
| 601 | ... SubnetMask=${test_subnet_mask} |
| 602 | ${empty_dict}= Create Dictionary |
| 603 | ${patch_list}= Create List |
| 604 | ${network_configurations}= Get Network Configuration |
| 605 | |
| 606 | ${num_entries}= Get Length ${network_configurations} |
| 607 | FOR ${INDEX} IN RANGE 0 ${num_entries} |
| 608 | Append To List ${patch_list} ${empty_dict} |
| 609 | END |
| 610 | |
| 611 | # We need not check for existence of IP on BMC while adding. |
| 612 | Append To List ${patch_list} ${ip} |
| 613 | ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list} |
| 614 | ${active_channel_config}= Get Active Channel Config |
| 615 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 616 | Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 617 | ... body=&{payload} valid_status_codes=[${HTTP_BAD_REQUEST}] |
| 618 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 619 | *** Keywords *** |
| 620 | |
| 621 | Test Setup Execution |
| 622 | [Documentation] Test setup execution. |
| 623 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 624 | Redfish.Login |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 625 | |
| 626 | @{network_configurations}= Get Network Configuration |
| 627 | Set Test Variable @{network_configurations} |
| 628 | |
| 629 | # Get BMC IP address and prefix length. |
| 630 | ${ip_data}= Get BMC IP Info |
| 631 | Set Test Variable ${ip_data} |
| 632 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 633 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 634 | Verify Netmask On BMC |
| 635 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 636 | [Arguments] ${netmask} |
| 637 | |
| 638 | # Description of the argument(s): |
| 639 | # netmask netmask value to be verified. |
| 640 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 641 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 642 | |
| 643 | Should Contain Match ${ip_data} */${prefix_length} |
| 644 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 645 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 646 | Verify IP And Netmask On BMC |
| 647 | [Documentation] Verify IP and netmask on BMC. |
| 648 | [Arguments] ${ip} ${netmask} |
| 649 | |
| 650 | # Description of the argument(s): |
| 651 | # ip IP address to be verified. |
| 652 | # netmask netmask value to be verified. |
| 653 | |
| 654 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 655 | @{ip_data}= Get BMC IP Info |
| 656 | |
| 657 | ${ip_with_netmask}= Catenate ${ip}/${prefix_length} |
| 658 | Should Contain ${ip_data} ${ip_with_netmask} |
| 659 | ... msg=IP and netmask pair does not exist. |
| 660 | |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 661 | Validate Hostname On BMC |
| 662 | [Documentation] Verify that the hostname read via Redfish is the same as the |
| 663 | ... hostname configured on system. |
| 664 | [Arguments] ${hostname} |
| 665 | |
| 666 | # Description of argument(s): |
| 667 | # hostname A hostname value which is to be compared to the hostname |
| 668 | # configured on system. |
| 669 | |
| 670 | ${sys_hostname}= Get BMC Hostname |
Prashanth Katti | 466d834 | 2019-03-21 08:58:50 -0500 | [diff] [blame] | 671 | Should Be Equal ${sys_hostname} ${hostname} |
Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 672 | ... ignore_case=True msg=Hostname does not exist. |
| 673 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 674 | Test Teardown Execution |
| 675 | [Documentation] Test teardown execution. |
| 676 | |
| 677 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 678 | Redfish.Logout |
Prashanth Katti | a844251 | 2019-06-07 06:47:09 -0500 | [diff] [blame] | 679 | |
| 680 | Clear IP Settings On Fail |
| 681 | [Documentation] Clear IP settings on fail. |
| 682 | [Arguments] ${ip} |
| 683 | |
| 684 | # Description of argument(s): |
| 685 | # ip IP address to be deleted. |
| 686 | |
| 687 | Run Keyword If '${TEST STATUS}' == 'FAIL' |
| 688 | ... Delete IP Address ${ip} |
| 689 | |
| 690 | Test Teardown Execution |
Prashanth Katti | adf0b4e | 2019-06-10 04:20:30 -0500 | [diff] [blame] | 691 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 692 | Verify CLI and Redfish Nameservers |
| 693 | [Documentation] Verify that nameservers obtained via Redfish do not |
| 694 | ... match those found in /etc/resolv.conf. |
| 695 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 696 | ${active_channel_config}= Get Active Channel Config |
| 697 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 698 | |
Anves Kumar rayankula | 91548ea | 2020-06-18 00:28:13 -0500 | [diff] [blame] | 699 | ${redfish_nameservers}= Redfish.Get Attribute |
| 700 | ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 701 | ${resolve_conf_nameservers}= CLI Get Nameservers |
Michael Walsh | 39c0051 | 2019-07-17 10:54:06 -0500 | [diff] [blame] | 702 | Rqprint Vars redfish_nameservers resolve_conf_nameservers |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 703 | |
| 704 | # Check that the 2 lists are equivalent. |
| 705 | ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers) |
| 706 | Should Be True ${match} |
| 707 | ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf. |
| 708 | |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 709 | |
| 710 | Configure Static Name Servers |
| 711 | [Documentation] Configure DNS server on BMC. |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 712 | [Arguments] ${static_name_servers}=${original_nameservers} |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 713 | ... ${valid_status_codes}=${HTTP_OK} |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 714 | |
George Keishing | 9cb2e59 | 2019-07-12 09:37:33 -0500 | [diff] [blame] | 715 | # Description of the argument(s): |
Prashanth Katti | 7098c97 | 2019-07-03 06:56:42 -0500 | [diff] [blame] | 716 | # static_name_servers A list of static name server IPs to be |
| 717 | # configured on the BMC. |
| 718 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 719 | ${active_channel_config}= Get Active Channel Config |
| 720 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 721 | |
Anves Kumar rayankula | 6b9fcd1 | 2020-12-18 01:03:19 -0600 | [diff] [blame] | 722 | ${type} = Evaluate type($static_name_servers).__name__ |
| 723 | ${static_name_servers}= Set Variable If '${type}'=='str' |
| 724 | ... '${static_name_servers}' ${static_name_servers} |
| 725 | |
Prashanth Katti | 9d995fc | 2019-09-24 01:29:06 -0500 | [diff] [blame] | 726 | # 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] | 727 | Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 728 | ... body={'StaticNameServers': ${static_name_servers}} |
Prashanth Katti | 9d995fc | 2019-09-24 01:29:06 -0500 | [diff] [blame] | 729 | ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}] |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 730 | |
Prashanth Katti | f247be3 | 2019-10-07 04:40:43 -0500 | [diff] [blame] | 731 | # Patch operation takes 1 to 3 seconds to set new value. |
| 732 | Sleep 3s |
| 733 | |
Prashanth Katti | 7f9e60f | 2019-07-26 01:18:41 -0500 | [diff] [blame] | 734 | # Check if newly added DNS server is configured on BMC. |
| 735 | ${cli_nameservers}= CLI Get Nameservers |
Prashanth Katti | 3c7b643 | 2019-07-26 06:53:37 -0500 | [diff] [blame] | 736 | ${cmd_status}= Run Keyword And Return Status |
| 737 | ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers} |
| 738 | |
| 739 | Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' |
| 740 | ... Should Be True ${cmd_status} == ${True} |
| 741 | ... ELSE Should Be True ${cmd_status} == ${False} |
Prashanth Katti | 7f9e60f | 2019-07-26 01:18:41 -0500 | [diff] [blame] | 742 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 743 | Delete Static Name Servers |
| 744 | [Documentation] Delete static name servers. |
| 745 | |
Anves Kumar rayankula | 045814b | 2020-10-09 09:17:05 -0500 | [diff] [blame] | 746 | Configure Static Name Servers static_name_servers=@{EMPTY} |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 747 | |
| 748 | # Check if all name servers deleted on BMC. |
| 749 | ${nameservers}= CLI Get Nameservers |
| 750 | Should Be Empty ${nameservers} |
| 751 | |
| 752 | DNS Test Setup Execution |
| 753 | [Documentation] Do DNS test setup execution. |
| 754 | |
| 755 | Redfish.Login |
| 756 | |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 757 | ${active_channel_config}= Get Active Channel Config |
| 758 | ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 759 | |
Anves Kumar rayankula | 91548ea | 2020-06-18 00:28:13 -0500 | [diff] [blame] | 760 | ${original_nameservers}= Redfish.Get Attribute |
| 761 | ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers |
Tony Lee | 412c668 | 2020-04-01 17:34:30 +0800 | [diff] [blame] | 762 | |
Prashanth Katti | c85957c | 2019-07-09 02:01:20 -0500 | [diff] [blame] | 763 | Rprint Vars original_nameservers |
| 764 | # Set suite variables to trigger restoration during teardown. |
| 765 | Set Suite Variable ${original_nameservers} |
Prashanth Katti | b478d90 | 2020-05-08 10:05:32 -0500 | [diff] [blame] | 766 | |
| 767 | Suite Setup Execution |
| 768 | [Documentation] Do suite setup execution. |
| 769 | |
| 770 | ${test_gateway}= Get BMC Default Gateway |
| 771 | Set Suite Variable ${test_gateway} |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 772 | |
| 773 | Update IP Address |
| 774 | [Documentation] Update IP address of BMC. |
Anves Kumar rayankula | 53b8030 | 2021-05-21 01:50:03 -0500 | [diff] [blame] | 775 | [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} |
| 776 | ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 777 | |
| 778 | # Description of argument(s): |
| 779 | # ip IP address to be replaced (e.g. "10.7.7.7"). |
| 780 | # new_ip New IP address to be configured. |
| 781 | # netmask Netmask value. |
| 782 | # gw_ip Gateway IP address. |
| 783 | # valid_status_codes Expected return code from patch operation |
| 784 | # (e.g. "200"). See prolog of rest_request |
| 785 | # method in redfish_plus.py for details. |
| 786 | |
| 787 | ${empty_dict}= Create Dictionary |
| 788 | ${patch_list}= Create List |
| 789 | ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip} |
| 790 | |
| 791 | # Find the position of IP address to be modified. |
| 792 | @{network_configurations}= Get Network Configuration |
| 793 | FOR ${network_configuration} IN @{network_configurations} |
| 794 | Run Keyword If '${network_configuration['Address']}' == '${ip}' |
| 795 | ... Append To List ${patch_list} ${ip_data} |
| 796 | ... ELSE Append To List ${patch_list} ${empty_dict} |
| 797 | END |
| 798 | |
| 799 | ${ip_found}= Run Keyword And Return Status List Should Contain Value |
| 800 | ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC |
| 801 | Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC |
| 802 | |
| 803 | # Run patch command only if given IP is found on BMC |
| 804 | ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} |
| 805 | |
Anves Kumar rayankula | 53b8030 | 2021-05-21 01:50:03 -0500 | [diff] [blame] | 806 | Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} valid_status_codes=${valid_status_codes} |
Prashanth Katti | 568df5f | 2020-05-15 06:00:37 -0500 | [diff] [blame] | 807 | |
| 808 | # Note: Network restart takes around 15-18s after patch request processing. |
| 809 | Sleep ${NETWORK_TIMEOUT}s |
| 810 | Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} |
| 811 | |
| 812 | Verify IP On BMC ${new_ip} |
| 813 | Validate Network Config On BMC |
Anves Kumar rayankula | d4cdd8c | 2021-01-11 04:10:05 -0600 | [diff] [blame] | 814 | |
| 815 | Configure Multiple Static IPv4 Addresses |
| 816 | [Documentation] Configure multiple static ipv4 address via Redfish and verify. |
| 817 | [Arguments] ${ip_addreses} ${subnet_mask} ${gateway} |
| 818 | |
| 819 | # Description of argument(s): |
| 820 | # ip_addreses A list of IP addresses to be added (e.g.["10.7.7.7"]). |
| 821 | # subnet_mask Subnet mask for the IP to be added (e.g. "255.255.0.0"). |
| 822 | # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). |
| 823 | |
| 824 | FOR ${ip} IN @{ip_addreses} |
| 825 | Add IP Address ${ip} ${subnet_mask} ${gateway} |
| 826 | END |
| 827 | Validate Network Config On BMC |
| 828 | |
| 829 | |
| 830 | Delete Multiple Static IPv4 Addresses |
| 831 | [Documentation] Delete multiple static ipv4 address via Redfish. |
| 832 | [Arguments] ${ip_addreses} |
| 833 | |
| 834 | # Description of argument(s): |
| 835 | # ip_addreses A list of IP addresses to be deleted (e.g.["10.7.7.7"]). |
| 836 | |
| 837 | FOR ${ip} IN @{ip_addreses} |
| 838 | Delete IP Address ${ip} |
| 839 | END |
| 840 | Validate Network Config On BMC |