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 | |
| 23 | Get Netmask And Verify |
| 24 | [Documentation] Get Netmask And Verify. |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 25 | [Tags] Get_Netmask_And_Verify |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 26 | |
| 27 | : FOR ${network_configuration} IN @{network_configurations} |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame^] | 28 | \ Verify Netmask On BMC ${network_configuration['SubnetMask']} |
| 29 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 30 | |
| 31 | *** Keywords *** |
| 32 | |
| 33 | Test Setup Execution |
| 34 | [Documentation] Test setup execution. |
| 35 | |
| 36 | redfish.Login |
| 37 | |
| 38 | @{network_configurations}= Get Network Configuration |
| 39 | Set Test Variable @{network_configurations} |
| 40 | |
| 41 | # Get BMC IP address and prefix length. |
| 42 | ${ip_data}= Get BMC IP Info |
| 43 | Set Test Variable ${ip_data} |
| 44 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame^] | 45 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 46 | Get Network Configuration |
| 47 | [Documentation] Get network configuration. |
| 48 | |
| 49 | # Sample output: |
| 50 | #{ |
| 51 | # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface", |
| 52 | # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", |
| 53 | # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface", |
| 54 | # "Description": "Management Network Interface", |
| 55 | # "IPv4Addresses": [ |
| 56 | # { |
| 57 | # "Address": "169.254.xx.xx", |
| 58 | # "AddressOrigin": "IPv4LinkLocal", |
| 59 | # "Gateway": "0.0.0.0", |
| 60 | # "SubnetMask": "255.255.0.0" |
| 61 | # }, |
| 62 | # { |
| 63 | # "Address": "xx.xx.xx.xx", |
| 64 | # "AddressOrigin": "Static", |
| 65 | # "Gateway": "xx.xx.xx.1", |
| 66 | # "SubnetMask": "xx.xx.xx.xx" |
| 67 | # } |
| 68 | # ], |
| 69 | # "Id": "eth0", |
| 70 | # "MACAddress": "xx:xx:xx:xx:xx:xx", |
| 71 | # "Name": "Manager Ethernet Interface", |
| 72 | # "SpeedMbps": 0, |
| 73 | # "VLAN": { |
| 74 | # "VLANEnable": false, |
| 75 | # "VLANId": 0 |
| 76 | # } |
| 77 | |
| 78 | ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} |
| 79 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses |
| 80 | [Return] @{network_configurations} |
| 81 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 82 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame^] | 83 | Verify IP On BMC |
| 84 | [Documentation] Verify IP on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 85 | [Arguments] ${ip} |
| 86 | |
| 87 | # Description of the argument(s): |
| 88 | # ip IP address to be verified. |
| 89 | |
| 90 | # Get IP address details on BMC using IP command. |
| 91 | @{ip_data}= Get BMC IP Info |
| 92 | Should Contain Match ${ip_data} ${ip}/* |
| 93 | ... msg=IP address does not exist. |
| 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 Netmask On BMC |
| 97 | [Documentation] Verify netmask on BMC. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 98 | [Arguments] ${netmask} |
| 99 | |
| 100 | # Description of the argument(s): |
| 101 | # netmask netmask value to be verified. |
| 102 | |
Prashanth Katti | 747ce9d | 2019-02-07 07:23:48 -0600 | [diff] [blame^] | 103 | ${prefix_length}= Netmask Prefix Length ${netmask} |
| 104 | |
| 105 | Should Contain Match ${ip_data} */${prefix_length} |
| 106 | ... msg=Prefix length does not exist. |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 107 | |
George Keishing | 5d46755 | 2019-02-08 23:30:48 -0600 | [diff] [blame] | 108 | |
Prashanth Katti | f58cce0 | 2019-02-06 03:05:14 -0600 | [diff] [blame] | 109 | Test Teardown Execution |
| 110 | [Documentation] Test teardown execution. |
| 111 | |
| 112 | FFDC On Test Case Fail |
| 113 | redfish.Logout |