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 |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 9 | |
| 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
| 12 | |
| 13 | *** Test Cases *** |
| 14 | |
| 15 | Get IP Address And Verify |
| 16 | [Documentation] Get IP Address And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 17 | [Tags] Get_IP_Address_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 18 | |
| 19 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 20 | \ Verify IP On BMC ${network_configuration['Address']} |
| 21 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 22 | Get Netmask And Verify |
| 23 | [Documentation] Get Netmask And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 24 | [Tags] Get_Netmask_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 25 | |
| 26 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 27 | \ Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 28 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 29 | Get Gateway And Verify |
| 30 | [Documentation] Get gateway and verify it's existence on the BMC. |
| 31 | [Tags] Get_Gateway_And_Verify |
| 32 | |
| 33 | : FOR ${network_configuration} IN @{network_configurations} |
| 34 | \ Verify Gateway On BMC ${network_configuration['Gateway']} |
| 35 | |
| 36 | Get MAC Address And Verify |
| 37 | [Documentation] Get MAC address and verify it's existence on the BMC. |
| 38 | [Tags] Get_MAC_Address_And_Verify |
| 39 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 40 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 41 | ${macaddr}= Get From Dictionary ${resp.dict} MACAddress |
| 42 | Validate MAC On BMC ${macaddr} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 43 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 44 | Verify All Configured IP And Netmask |
| 45 | [Documentation] Verify all configured IP and netmask on BMC. |
| 46 | [Tags] Verify_All_Configured_IP_And_Netmask |
| 47 | |
| 48 | : FOR ${network_configuration} IN @{network_configurations} |
| 49 | \ Verify IP And Netmask On BMC ${network_configuration['Address']} |
| 50 | ... ${network_configuration['SubnetMask']} |
| 51 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 52 | *** Keywords *** |
| 53 | |
| 54 | Test Setup Execution |
| 55 | [Documentation] Test setup execution. |
| 56 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 57 | Redfish.Login |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 58 | |
| 59 | @{network_configurations}= Get Network Configuration |
| 60 | Set Test Variable @{network_configurations} |
| 61 | |
| 62 | # Get BMC IP address and prefix length. |
| 63 | ${ip_data}= Get BMC IP Info |
| 64 | Set Test Variable ${ip_data} |
| 65 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 66 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 67 | Get Network Configuration |
| 68 | [Documentation] Get network configuration. |
| 69 | |
| 70 | # Sample output: |
| 71 | #{ |
| 72 | # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", |
| 73 | # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", |
| 74 | # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", |
| 75 | # "Description": "Management Network Interface", |
| 76 | # "IPv4Addresses": [ |
| 77 | # { |
| 78 | # "Address": "169.254.xx.xx", |
| 79 | # "AddressOrigin": "IPv4LinkLocal", |
| 80 | # "Gateway": "0.0.0.0", |
| 81 | # "SubnetMask": "255.255.0.0" |
| 82 | # }, |
| 83 | # { |
| 84 | # "Address": "xx.xx.xx.xx", |
| 85 | # "AddressOrigin": "Static", |
| 86 | # "Gateway": "xx.xx.xx.1", |
| 87 | # "SubnetMask": "xx.xx.xx.xx" |
| 88 | # } |
| 89 | # ], |
| 90 | # "Id": "eth0", |
| 91 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 92 | # "Name": "Manager Ethernet Interface", |
| 93 | # "SpeedMbps": 0, |
| 94 | # "VLAN": { |
| 95 | # "VLANEnable": false, |
| 96 | # "VLANId": 0 |
| 97 | # } |
| 98 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 99 | ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 100 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses |
| 101 | [Return] @{network_configurations} |
| 102 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 103 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 104 | Verify IP On BMC |
| 105 | [Documentation] Verify IP on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 106 | [Arguments] ${ip} |
| 107 | |
| 108 | # Description of the argument(s): |
| 109 | # ip IP address to be verified. |
| 110 | |
| 111 | # Get IP address details on BMC using IP command. |
| 112 | @{ip_data}= Get BMC IP Info |
| 113 | Should Contain Match ${ip_data} ${ip}/* |
| 114 | ... msg=IP address does not exist. |
| 115 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 116 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 117 | Verify Netmask On BMC |
| 118 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 119 | [Arguments] ${netmask} |
| 120 | |
| 121 | # Description of the argument(s): |
| 122 | # netmask netmask value to be verified. |
| 123 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 124 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 125 | |
| 126 | Should Contain Match ${ip_data} */${prefix_length} |
| 127 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 128 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 129 | Verify Gateway On BMC |
| 130 | [Documentation] Verify gateway on BMC. |
| 131 | [Arguments] ${gateway_ip}=0.0.0.0 |
| 132 | |
| 133 | # Description of argument(s): |
| 134 | # gateway_ip Gateway IP address. |
| 135 | |
| 136 | ${route_info}= Get BMC Route Info |
| 137 | |
| 138 | # If gateway IP is empty or 0.0.0.0 it will not have route entry. |
| 139 | |
| 140 | Run Keyword If '${gateway_ip}' == '0.0.0.0' |
| 141 | ... Pass Execution Gateway IP is "0.0.0.0". |
| 142 | ... ELSE |
| 143 | ... Should Contain ${route_info} ${gateway_ip} |
| 144 | ... msg=Gateway IP address not matching. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 145 | |
Prashanth Katti | 2c5c3bb | 2019-02-14 04:23:07 -0600 | [diff] [blame] | 146 | Verify IP And Netmask On BMC |
| 147 | [Documentation] Verify IP and netmask on BMC. |
| 148 | [Arguments] ${ip} ${netmask} |
| 149 | |
| 150 | # Description of the argument(s): |
| 151 | # ip IP address to be verified. |
| 152 | # netmask netmask value to be verified. |
| 153 | |
| 154 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 155 | @{ip_data}= Get BMC IP Info |
| 156 | |
| 157 | ${ip_with_netmask}= Catenate ${ip}/${prefix_length} |
| 158 | Should Contain ${ip_data} ${ip_with_netmask} |
| 159 | ... msg=IP and netmask pair does not exist. |
| 160 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 161 | Test Teardown Execution |
| 162 | [Documentation] Test teardown execution. |
| 163 | |
| 164 | FFDC On Test Case Fail |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 165 | Redfish.Logout |