| 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 | 
|  | 13 |  | 
| Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 14 | *** Variables *** | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 15 | ${test_hostname}           openbmc | 
|  | 16 | ${test_ipv4_addr}          10.7.7.7 | 
|  | 17 | ${test_ipv4_invalid_addr}  0.0.1.a | 
|  | 18 | ${test_subnet_mask}        255.255.0.0 | 
|  | 19 | ${test_gateway}            10.7.7.1 | 
| Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 20 | ${broadcast_ip}            10.7.7.255 | 
|  | 21 | ${loopback_ip}             127.0.0.2 | 
|  | 22 | ${multicast_ip}            224.6.6.6 | 
|  | 23 | ${out_of_range_ip}         10.7.7.256 | 
| Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 24 |  | 
| Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 25 | # Valid netmask is 4 bytes long and has continuos block of 1s. | 
|  | 26 | # Maximum valid value in each octet is 255 and least value is 0. | 
|  | 27 | # 253 is not valid, as binary value is 11111101. | 
|  | 28 | ${invalid_netmask}         255.255.253.0 | 
|  | 29 | ${alpha_netmask}           ff.ff.ff.ff | 
|  | 30 | # Maximum value of octet in netmask is 255. | 
|  | 31 | ${out_of_range_netmask}    255.256.255.0 | 
|  | 32 | ${more_byte_netmask}       255.255.255.0.0 | 
|  | 33 | ${less_byte_netmask}       255.255.255 | 
|  | 34 |  | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 35 | *** Test Cases *** | 
|  | 36 |  | 
|  | 37 | Get IP Address And Verify | 
|  | 38 | [Documentation]  Get IP Address And Verify. | 
| George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 39 | [Tags]  Get_IP_Address_And_Verify | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 40 |  | 
|  | 41 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 42 | \  Verify IP On BMC  ${network_configuration['Address']} | 
|  | 43 |  | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 44 | Get Netmask And Verify | 
|  | 45 | [Documentation]  Get Netmask And Verify. | 
| George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 46 | [Tags]  Get_Netmask_And_Verify | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 47 |  | 
|  | 48 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 49 | \  Verify Netmask On BMC  ${network_configuration['SubnetMask']} | 
|  | 50 |  | 
| Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 51 | Get Gateway And Verify | 
|  | 52 | [Documentation]  Get gateway and verify it's existence on the BMC. | 
|  | 53 | [Tags]  Get_Gateway_And_Verify | 
|  | 54 |  | 
|  | 55 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
|  | 56 | \  Verify Gateway On BMC  ${network_configuration['Gateway']} | 
|  | 57 |  | 
|  | 58 | Get MAC Address And Verify | 
|  | 59 | [Documentation]  Get MAC address and verify it's existence on the BMC. | 
|  | 60 | [Tags]  Get_MAC_Address_And_Verify | 
|  | 61 |  | 
| George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 62 | ${resp}=  Redfish.Get  ${REDFISH_NW_ETH0_URI} | 
| Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 63 | ${macaddr}=  Get From Dictionary  ${resp.dict}  MACAddress | 
|  | 64 | Validate MAC On BMC  ${macaddr} | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 65 |  | 
| Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 66 | Verify All Configured IP And Netmask | 
|  | 67 | [Documentation]  Verify all configured IP and netmask on BMC. | 
|  | 68 | [Tags]  Verify_All_Configured_IP_And_Netmask | 
|  | 69 |  | 
|  | 70 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
|  | 71 | \  Verify IP And Netmask On BMC  ${network_configuration['Address']} | 
|  | 72 | ...  ${network_configuration['SubnetMask']} | 
|  | 73 |  | 
| Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 74 | Get Hostname And Verify | 
|  | 75 | [Documentation]  Get hostname via Redfish and verify. | 
|  | 76 | [Tags]  Get_Hostname_And_Verify | 
|  | 77 |  | 
|  | 78 | ${hostname}=  Redfish_Utils.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName | 
|  | 79 |  | 
|  | 80 | Validate Hostname On BMC  ${hostname} | 
|  | 81 |  | 
|  | 82 | Configure Hostname And Verify | 
|  | 83 | [Documentation]  Configure hostname via Redfish and verify. | 
|  | 84 | [Tags]  Configure_Hostname_And_Verify | 
|  | 85 |  | 
|  | 86 | Configure Hostname  ${test_hostname} | 
|  | 87 |  | 
|  | 88 | Validate Hostname On BMC  ${test_hostname} | 
|  | 89 |  | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 90 | Add Valid IPv4 Address And Verify | 
|  | 91 | [Documentation]  Add IPv4 Address via Redfish and verify. | 
|  | 92 | [Tags]  Add_Valid_IPv4_Addres_And_Verify | 
|  | 93 |  | 
|  | 94 | Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway} | 
|  | 95 | Delete IP Address  ${test_ipv4_addr} | 
|  | 96 |  | 
|  | 97 | Add Invalid IPv4 Address And Verify | 
|  | 98 | [Documentation]  Add Invalid IPv4 Address via Redfish and verify. | 
|  | 99 | [Tags]  Add_Invalid_IPv4_Addres_And_Verify | 
|  | 100 |  | 
|  | 101 | Add IP Address  ${test_ipv4_invalid_addr}  ${test_subnet_mask} | 
|  | 102 | ...  ${test_gateway}  valid_status_codes=${HTTP_BAD_REQUEST} | 
|  | 103 |  | 
| Prashanth Katti | b36a752 | 2019-05-22 05:32:39 -0500 | [diff] [blame] | 104 | Configure Out Of Range IP | 
|  | 105 | [Documentation]  Configure out-of-range IP address. | 
|  | 106 | [Tags]  Configure_Out_Of_Range_IP | 
|  | 107 | [Template]  Add IP Address | 
|  | 108 |  | 
|  | 109 | # ip                subnet_mask          gateway          valid_status_codes | 
|  | 110 | ${out_of_range_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 111 |  | 
|  | 112 | Configure Broadcast IP | 
|  | 113 | [Documentation]  Configure broadcast IP address. | 
|  | 114 | [Tags]  Configure_Broadcast_IP | 
|  | 115 | [Template]  Add IP Address | 
|  | 116 |  | 
|  | 117 | # ip             subnet_mask          gateway          valid_status_codes | 
|  | 118 | ${broadcast_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 119 |  | 
|  | 120 | Configure Multicast IP | 
|  | 121 | [Documentation]  Configure multicast IP address. | 
|  | 122 | [Tags]  Configure_Multicast_IP | 
|  | 123 | [Template]  Add IP Address | 
|  | 124 |  | 
|  | 125 | # ip             subnet_mask          gateway          valid_status_codes | 
|  | 126 | ${multicast_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 127 |  | 
|  | 128 | Configure Loopback IP | 
|  | 129 | [Documentation]  Configure loopback IP address. | 
|  | 130 | [Tags]  Configure_Loopback_IP | 
|  | 131 | [Template]  Add IP Address | 
|  | 132 |  | 
|  | 133 | # ip            subnet_mask          gateway          valid_status_codes | 
|  | 134 | ${loopback_ip}  ${test_subnet_mask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 135 |  | 
|  | 136 | Add Valid IPv4 Address And Check Persistency | 
|  | 137 | [Documentation]  Add IPv4 address and check peristency. | 
|  | 138 | [Tags]  Add_Valid_IPv4_Addres_And_Check_Persistency | 
|  | 139 |  | 
|  | 140 | Add IP Address  ${test_ipv4_addr}  ${test_subnet_mask}  ${test_gateway} | 
|  | 141 |  | 
|  | 142 | # Reboot BMC and verify persistency. | 
|  | 143 | OBMC Reboot (off) | 
|  | 144 | Verify IP On BMC  ${test_ipv4_addr} | 
|  | 145 | Delete IP Address  ${test_ipv4_addr} | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 146 |  | 
| Prashanth Katti | 6cedca2 | 2019-05-30 02:31:11 -0500 | [diff] [blame] | 147 | Add Fourth Octet Threshold IP And Verify | 
|  | 148 | [Documentation]  Add fourth octet threshold IP and verify. | 
|  | 149 | [Tags]  Add_Fourth_Octet_Threshold_IP_And_Verify | 
|  | 150 |  | 
|  | 151 | Add IP Address  10.7.7.254  ${test_subnet_mask}  ${test_gateway} | 
|  | 152 | Delete IP Address  10.7.7.254 | 
|  | 153 |  | 
|  | 154 | Add Fourth Octet Lowest IP And Verify | 
|  | 155 | [Documentation]  Add fourth octet lowest IP and verify. | 
|  | 156 | [Tags]  Add_Fourth_Octet_Lowest_IP_And_Verify | 
|  | 157 |  | 
|  | 158 | Add IP Address  10.7.7.1  ${test_subnet_mask}  ${test_gateway} | 
|  | 159 | Delete IP Address  10.7.7.1 | 
|  | 160 |  | 
|  | 161 | Add Third Octet Threshold IP And Verify | 
|  | 162 | [Documentation]  Add third octet threshold IP and verify. | 
|  | 163 | [Tags]  Add_Third_Octet_Threshold_IP_And_Verify | 
|  | 164 |  | 
|  | 165 | Add IP Address  10.7.255.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 166 | Delete IP Address  10.7.255.7 | 
|  | 167 |  | 
|  | 168 | Add Third Octet Lowest IP And Verify | 
|  | 169 | [Documentation]  Add third octet lowest IP and verify. | 
|  | 170 | [Tags]  Add_Third_Octet_Lowest_IP_And_Verify | 
|  | 171 |  | 
|  | 172 | Add IP Address  10.7.0.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 173 | Delete IP Address  10.7.0.7 | 
|  | 174 |  | 
|  | 175 | Add Second Octet Threshold IP And Verify | 
|  | 176 | [Documentation]  Add second octet threshold IP and verify. | 
|  | 177 | [Tags]  Add_Second_Octet_Threshold_IP_And_Verify | 
|  | 178 |  | 
|  | 179 | Add IP Address  10.255.7.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 180 | Delete IP Address  10.255.7.7 | 
|  | 181 |  | 
|  | 182 | Add Second Octet Lowest IP And Verify | 
|  | 183 | [Documentation]  Add second octet lowest IP and verify. | 
|  | 184 | [Tags]  Add_Second_Octet_Lowest_IP_And_Verify | 
|  | 185 |  | 
|  | 186 | Add IP Address  10.0.7.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 187 | Delete IP Address  10.0.7.7 | 
|  | 188 |  | 
|  | 189 | Add First Octet Threshold IP And Verify | 
|  | 190 | [Documentation]  Add first octet threshold IP and verify. | 
|  | 191 | [Tags]  Add_First_Octet_Threshold_IP_And_Verify | 
|  | 192 |  | 
|  | 193 | Add IP Address  223.7.7.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 194 | Delete IP Address  223.7.7.7 | 
|  | 195 |  | 
|  | 196 | Add First Octet Lowest IP And Verify | 
|  | 197 | [Documentation]  Add first octet lowest IP and verify. | 
|  | 198 | [Tags]  Add_First_Octet_Lowest_IP_And_Verify | 
|  | 199 |  | 
|  | 200 | Add IP Address  1.7.7.7  ${test_subnet_mask}  ${test_gateway} | 
|  | 201 | Delete IP Address  1.7.7.7 | 
|  | 202 |  | 
| Prashanth Katti | 040c8c1 | 2019-05-31 04:42:05 -0500 | [diff] [blame] | 203 | Configure Invalid Netmask | 
|  | 204 | [Documentation]  Verify error while setting invalid netmask. | 
|  | 205 | [Tags]  Configure_Invalid_Netmask | 
|  | 206 | [Template]  Add IP Address | 
|  | 207 |  | 
|  | 208 | # ip               subnet_mask         gateway          valid_status_codes | 
|  | 209 | ${test_ipv4_addr}  ${invalid_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 210 |  | 
|  | 211 | Configure Out Of Range Netmask | 
|  | 212 | [Documentation]  Verify error while setting out of range netmask. | 
|  | 213 | [Tags]  Configure_Out_Of_Range_Netmask | 
|  | 214 | [Template]  Add IP Address | 
|  | 215 |  | 
|  | 216 | # ip               subnet_mask              gateway          valid_status_codes | 
|  | 217 | ${test_ipv4_addr}  ${out_of_range_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 218 |  | 
|  | 219 | Configure Alpha Netmask | 
|  | 220 | [Documentation]  Verify error while setting alpha netmask. | 
|  | 221 | [Tags]  Configure_Alpha_Netmask | 
|  | 222 | [Template]  Add IP Address | 
|  | 223 |  | 
|  | 224 | # ip               subnet_mask       gateway          valid_status_codes | 
|  | 225 | ${test_ipv4_addr}  ${alpha_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 226 |  | 
|  | 227 | Configure More Byte Netmask | 
|  | 228 | [Documentation]  Verify error while setting more byte netmask. | 
|  | 229 | [Tags]  Configure_More_Byte_Netmask | 
|  | 230 | [Template]  Add IP Address | 
|  | 231 |  | 
|  | 232 | # ip               subnet_mask           gateway          valid_status_codes | 
|  | 233 | ${test_ipv4_addr}  ${more_byte_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 234 |  | 
|  | 235 | Configure Less Byte Netmask | 
|  | 236 | [Documentation]  Verify error while setting less byte netmask. | 
|  | 237 | [Tags]  Configure_Less_Byte_Netmask | 
|  | 238 | [Template]  Add IP Address | 
|  | 239 |  | 
|  | 240 | # ip               subnet_mask           gateway          valid_status_codes | 
|  | 241 | ${test_ipv4_addr}  ${less_byte_netmask}  ${test_gateway}  ${HTTP_BAD_REQUEST} | 
|  | 242 |  | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 243 | *** Keywords *** | 
|  | 244 |  | 
|  | 245 | Test Setup Execution | 
|  | 246 | [Documentation]  Test setup execution. | 
|  | 247 |  | 
| George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 248 | Redfish.Login | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 249 |  | 
|  | 250 | @{network_configurations}=  Get Network Configuration | 
|  | 251 | Set Test Variable  @{network_configurations} | 
|  | 252 |  | 
|  | 253 | # Get BMC IP address and prefix length. | 
|  | 254 | ${ip_data}=  Get BMC IP Info | 
|  | 255 | Set Test Variable  ${ip_data} | 
|  | 256 |  | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 257 |  | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 258 | Get Network Configuration | 
|  | 259 | [Documentation]  Get network configuration. | 
|  | 260 |  | 
|  | 261 | # Sample output: | 
|  | 262 | #{ | 
|  | 263 | #  "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", | 
|  | 264 | #  "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", | 
|  | 265 | #  "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", | 
|  | 266 | #  "Description": "Management Network Interface", | 
|  | 267 | #  "IPv4Addresses": [ | 
|  | 268 | #    { | 
|  | 269 | #      "Address": "169.254.xx.xx", | 
|  | 270 | #      "AddressOrigin": "IPv4LinkLocal", | 
|  | 271 | #      "Gateway": "0.0.0.0", | 
|  | 272 | #      "SubnetMask": "255.255.0.0" | 
|  | 273 | #    }, | 
|  | 274 | #    { | 
|  | 275 | #      "Address": "xx.xx.xx.xx", | 
|  | 276 | #      "AddressOrigin": "Static", | 
|  | 277 | #      "Gateway": "xx.xx.xx.1", | 
|  | 278 | #      "SubnetMask": "xx.xx.xx.xx" | 
|  | 279 | #    } | 
|  | 280 | #  ], | 
|  | 281 | #  "Id": "eth0", | 
|  | 282 | #  "MACAddress": "xx:xx:xx:xx:xx:xx", | 
|  | 283 | #  "Name": "Manager Ethernet Interface", | 
|  | 284 | #  "SpeedMbps": 0, | 
|  | 285 | #  "VLAN": { | 
|  | 286 | #    "VLANEnable": false, | 
|  | 287 | #    "VLANId": 0 | 
|  | 288 | #  } | 
|  | 289 |  | 
| George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 290 | ${resp}=  Redfish.Get  ${REDFISH_NW_ETH0_URI} | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 291 | @{network_configurations}=  Get From Dictionary  ${resp.dict}  IPv4Addresses | 
|  | 292 | [Return]  @{network_configurations} | 
|  | 293 |  | 
| George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 294 |  | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 295 | Verify IP On BMC | 
|  | 296 | [Documentation]  Verify IP on BMC. | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 297 | [Arguments]  ${ip} | 
|  | 298 |  | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 299 | # Description of argument(s): | 
|  | 300 | # ip  IP address to be verified (e.g. "10.7.7.7"). | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 301 |  | 
|  | 302 | # Get IP address details on BMC using IP command. | 
|  | 303 | @{ip_data}=  Get BMC IP Info | 
|  | 304 | Should Contain Match  ${ip_data}  ${ip}/* | 
|  | 305 | ...  msg=IP address does not exist. | 
|  | 306 |  | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 307 | Add IP Address | 
|  | 308 | [Documentation]  Add IP Address To BMC. | 
|  | 309 | [Arguments]  ${ip}  ${subnet_mask}  ${gateway} | 
|  | 310 | ...  ${valid_status_codes}=${HTTP_OK} | 
|  | 311 |  | 
|  | 312 | # Description of argument(s): | 
|  | 313 | # ip                  IP address to be added (e.g. "10.7.7.7"). | 
|  | 314 | # subnet_mask         Subnet mask for the IP to be added | 
|  | 315 | #                     (e.g. "255.255.0.0"). | 
|  | 316 | # gateway             Gateway for the IP to be added (e.g. "10.7.7.1"). | 
|  | 317 | # valid_status_codes  Expected return code from patch operation | 
|  | 318 | #                     (e.g. "200").  See prolog of rest_request | 
|  | 319 | #                     method in redfish_plut.py for details. | 
|  | 320 |  | 
|  | 321 | ${empty_dict}=  Create Dictionary | 
|  | 322 | ${ip_data}=  Create Dictionary  Address=${ip} | 
|  | 323 | ...  AddressOrigin=Static  SubnetMask=${subnet_mask} | 
|  | 324 | ...  Gateway=${gateway} | 
|  | 325 |  | 
|  | 326 | ${patch_list}=  Create List | 
|  | 327 | ${network_configurations}=  Get Network Configuration | 
|  | 328 | ${num_entries}=  Get Length  ${network_configurations} | 
|  | 329 |  | 
|  | 330 | : FOR  ${INDEX}  IN RANGE  0  ${num_entries} | 
|  | 331 | \  Append To List  ${patch_list}  ${empty_dict} | 
|  | 332 |  | 
| George Keishing | 98ffa86 | 2019-05-23 10:07:45 -0500 | [diff] [blame] | 333 | # We need not check for existence of IP on BMC while adding. | 
| Vijay | de3bf7b | 2019-04-16 04:56:09 -0500 | [diff] [blame] | 334 | Append To List  ${patch_list}  ${ip_data} | 
|  | 335 | ${data}=  Create Dictionary  IPv4Addresses=${patch_list} | 
|  | 336 |  | 
|  | 337 | Redfish.patch  ${REDFISH_NW_ETH0_URI}  body=&{data} | 
|  | 338 | ...  valid_status_codes=[${valid_status_codes}] | 
|  | 339 |  | 
|  | 340 | Return From Keyword If  '${valid_status_codes}' != '${HTTP_OK}' | 
|  | 341 |  | 
|  | 342 | # Note: Network restart takes around 15-18s after patch request processing. | 
|  | 343 | Sleep  ${NETWORK_TIMEOUT}s | 
|  | 344 | Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT} | 
|  | 345 |  | 
|  | 346 | Verify IP On BMC  ${ip} | 
|  | 347 | Validate Network Config On BMC | 
|  | 348 |  | 
|  | 349 |  | 
|  | 350 | Delete IP Address | 
|  | 351 | [Documentation]  Delete IP Address Of BMC. | 
|  | 352 | [Arguments]  ${ip}  ${valid_status_codes}=${HTTP_OK} | 
|  | 353 |  | 
|  | 354 | # Description of argument(s): | 
|  | 355 | # ip                  IP address to be deleted (e.g. "10.7.7.7"). | 
|  | 356 | # valid_status_codes  Expected return code from patch operation | 
|  | 357 | #                     (e.g. "200").  See prolog of rest_request | 
|  | 358 | #                     method in redfish_plut.py for details. | 
|  | 359 |  | 
|  | 360 | ${empty_dict}=  Create Dictionary | 
|  | 361 | ${patch_list}=  Create List | 
|  | 362 |  | 
|  | 363 | @{network_configurations}=  Get Network Configuration | 
|  | 364 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
|  | 365 | \  Run Keyword If  '${network_configuration['Address']}' == '${ip}' | 
|  | 366 | ...  Append To List  ${patch_list}  ${null} | 
|  | 367 | ...  ELSE  Append To List  ${patch_list}  ${empty_dict} | 
|  | 368 |  | 
|  | 369 | ${ip_found}=  Run Keyword And Return Status  List Should Contain Value | 
|  | 370 | ...  ${patch_list}  ${null}  msg=${ip} does not exist on BMC | 
|  | 371 | Pass Execution If  ${ip_found} == ${False}  ${ip} does not exist on BMC | 
|  | 372 |  | 
|  | 373 | # Run patch command only if given IP is found on BMC | 
|  | 374 | ${data}=  Create Dictionary  IPv4Addresses=${patch_list} | 
|  | 375 |  | 
|  | 376 | Redfish.patch  ${REDFISH_NW_ETH0_URI}  body=&{data} | 
|  | 377 | ...  valid_status_codes=[${valid_status_codes}] | 
|  | 378 |  | 
|  | 379 | # Note: Network restart takes around 15-18s after patch request processing | 
|  | 380 | Sleep  ${NETWORK_TIMEOUT}s | 
|  | 381 | Wait For Host To Ping  ${OPENBMC_HOST}  ${NETWORK_TIMEOUT} | 
|  | 382 |  | 
|  | 383 | ${delete_status}=  Run Keyword And Return Status  Verify IP On BMC  ${ip} | 
|  | 384 | Run Keyword If  '${valid_status_codes}' == '${HTTP_OK}' | 
|  | 385 | ...  Should Be True  ${delete_status} == ${False} | 
|  | 386 | ...  ELSE  Should Be True  ${delete_status} == ${True} | 
|  | 387 |  | 
|  | 388 | Validate Network Config On BMC | 
|  | 389 |  | 
|  | 390 |  | 
|  | 391 | Validate Network Config On BMC | 
|  | 392 | [Documentation]  Check that network info obtained via redfish matches info | 
|  | 393 | ...              obtained via CLI. | 
|  | 394 |  | 
|  | 395 | @{network_configurations}=  Get Network Configuration | 
|  | 396 | ${ip_data}=  Get BMC IP Info | 
|  | 397 | : FOR  ${network_configuration}  IN  @{network_configurations} | 
|  | 398 | \  Should Contain Match  ${ip_data}  ${network_configuration['Address']}/* | 
|  | 399 | ...  msg=IP address does not exist. | 
|  | 400 |  | 
| George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 401 |  | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 402 | Verify Netmask On BMC | 
|  | 403 | [Documentation]  Verify netmask on BMC. | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 404 | [Arguments]  ${netmask} | 
|  | 405 |  | 
|  | 406 | # Description of the argument(s): | 
|  | 407 | # netmask  netmask value to be verified. | 
|  | 408 |  | 
| Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 409 | ${prefix_length}=  Netmask Prefix Length  ${netmask} | 
|  | 410 |  | 
|  | 411 | Should Contain Match  ${ip_data}  */${prefix_length} | 
|  | 412 | ...  msg=Prefix length does not exist. | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 413 |  | 
| Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 414 | Verify Gateway On BMC | 
|  | 415 | [Documentation]  Verify gateway on BMC. | 
|  | 416 | [Arguments]  ${gateway_ip}=0.0.0.0 | 
|  | 417 |  | 
|  | 418 | # Description of argument(s): | 
|  | 419 | # gateway_ip  Gateway IP address. | 
|  | 420 |  | 
|  | 421 | ${route_info}=  Get BMC Route Info | 
|  | 422 |  | 
|  | 423 | # If gateway IP is empty or 0.0.0.0 it will not have route entry. | 
|  | 424 |  | 
|  | 425 | Run Keyword If  '${gateway_ip}' == '0.0.0.0' | 
|  | 426 | ...      Pass Execution  Gateway IP is "0.0.0.0". | 
|  | 427 | ...  ELSE | 
|  | 428 | ...      Should Contain  ${route_info}  ${gateway_ip} | 
|  | 429 | ...      msg=Gateway IP address not matching. | 
| George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 430 |  | 
| Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 431 | Verify IP And Netmask On BMC | 
|  | 432 | [Documentation]  Verify IP and netmask on BMC. | 
|  | 433 | [Arguments]  ${ip}  ${netmask} | 
|  | 434 |  | 
|  | 435 | # Description of the argument(s): | 
|  | 436 | # ip       IP address to be verified. | 
|  | 437 | # netmask  netmask value to be verified. | 
|  | 438 |  | 
|  | 439 | ${prefix_length}=  Netmask Prefix Length  ${netmask} | 
|  | 440 | @{ip_data}=  Get BMC IP Info | 
|  | 441 |  | 
|  | 442 | ${ip_with_netmask}=  Catenate  ${ip}/${prefix_length} | 
|  | 443 | Should Contain  ${ip_data}  ${ip_with_netmask} | 
|  | 444 | ...  msg=IP and netmask pair does not exist. | 
|  | 445 |  | 
| Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 446 | Validate Hostname On BMC | 
|  | 447 | [Documentation]  Verify that the hostname read via Redfish is the same as the | 
|  | 448 | ...  hostname configured on system. | 
|  | 449 | [Arguments]  ${hostname} | 
|  | 450 |  | 
|  | 451 | # Description of argument(s): | 
|  | 452 | # hostname  A hostname value which is to be compared to the hostname | 
|  | 453 | #           configured on system. | 
|  | 454 |  | 
|  | 455 | ${sys_hostname}=  Get BMC Hostname | 
| Prashanth Katti | 466d834 | 2019-03-21 08:58:50 -0500 | [diff] [blame] | 456 | Should Be Equal  ${sys_hostname}  ${hostname} | 
| Prashanth Katti | 23efc6e | 2019-03-13 06:07:15 -0500 | [diff] [blame] | 457 | ...  ignore_case=True  msg=Hostname does not exist. | 
|  | 458 |  | 
| Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 459 | Test Teardown Execution | 
|  | 460 | [Documentation]  Test teardown execution. | 
|  | 461 |  | 
|  | 462 | FFDC On Test Case Fail | 
| George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 463 | Redfish.Logout |