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 | |
| 40 | ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} |
| 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 | |
| 44 | *** Keywords *** |
| 45 | |
| 46 | Test Setup Execution |
| 47 | [Documentation] Test setup execution. |
| 48 | |
| 49 | redfish.Login |
| 50 | |
| 51 | @{network_configurations}= Get Network Configuration |
| 52 | Set Test Variable @{network_configurations} |
| 53 | |
| 54 | # Get BMC IP address and prefix length. |
| 55 | ${ip_data}= Get BMC IP Info |
| 56 | Set Test Variable ${ip_data} |
| 57 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 58 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 59 | Get Network Configuration |
| 60 | [Documentation] Get network configuration. |
| 61 | |
| 62 | # Sample output: |
| 63 | #{ |
| 64 | # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", |
| 65 | # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", |
| 66 | # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", |
| 67 | # "Description": "Management Network Interface", |
| 68 | # "IPv4Addresses": [ |
| 69 | # { |
| 70 | # "Address": "169.254.xx.xx", |
| 71 | # "AddressOrigin": "IPv4LinkLocal", |
| 72 | # "Gateway": "0.0.0.0", |
| 73 | # "SubnetMask": "255.255.0.0" |
| 74 | # }, |
| 75 | # { |
| 76 | # "Address": "xx.xx.xx.xx", |
| 77 | # "AddressOrigin": "Static", |
| 78 | # "Gateway": "xx.xx.xx.1", |
| 79 | # "SubnetMask": "xx.xx.xx.xx" |
| 80 | # } |
| 81 | # ], |
| 82 | # "Id": "eth0", |
| 83 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 84 | # "Name": "Manager Ethernet Interface", |
| 85 | # "SpeedMbps": 0, |
| 86 | # "VLAN": { |
| 87 | # "VLANEnable": false, |
| 88 | # "VLANId": 0 |
| 89 | # } |
| 90 | |
| 91 | ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} |
| 92 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses |
| 93 | [Return] @{network_configurations} |
| 94 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 95 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 96 | Verify IP On BMC |
| 97 | [Documentation] Verify IP on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 98 | [Arguments] ${ip} |
| 99 | |
| 100 | # Description of the argument(s): |
| 101 | # ip IP address to be verified. |
| 102 | |
| 103 | # Get IP address details on BMC using IP command. |
| 104 | @{ip_data}= Get BMC IP Info |
| 105 | Should Contain Match ${ip_data} ${ip}/* |
| 106 | ... msg=IP address does not exist. |
| 107 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 108 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 109 | Verify Netmask On BMC |
| 110 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 111 | [Arguments] ${netmask} |
| 112 | |
| 113 | # Description of the argument(s): |
| 114 | # netmask netmask value to be verified. |
| 115 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame] | 116 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 117 | |
| 118 | Should Contain Match ${ip_data} */${prefix_length} |
| 119 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 120 | |
Prashanth Katti | 2ec9d8b | 2019-02-12 05:20:19 -0600 | [diff] [blame] | 121 | Verify Gateway On BMC |
| 122 | [Documentation] Verify gateway on BMC. |
| 123 | [Arguments] ${gateway_ip}=0.0.0.0 |
| 124 | |
| 125 | # Description of argument(s): |
| 126 | # gateway_ip Gateway IP address. |
| 127 | |
| 128 | ${route_info}= Get BMC Route Info |
| 129 | |
| 130 | # If gateway IP is empty or 0.0.0.0 it will not have route entry. |
| 131 | |
| 132 | Run Keyword If '${gateway_ip}' == '0.0.0.0' |
| 133 | ... Pass Execution Gateway IP is "0.0.0.0". |
| 134 | ... ELSE |
| 135 | ... Should Contain ${route_info} ${gateway_ip} |
| 136 | ... msg=Gateway IP address not matching. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 137 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 138 | Test Teardown Execution |
| 139 | [Documentation] Test teardown execution. |
| 140 | |
| 141 | FFDC On Test Case Fail |
| 142 | redfish.Logout |