Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC network interface functionalities. |
| 3 | |
| 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/bmc_network_utils.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Library ../../lib/bmc_network_utils.py |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 10 | Test Teardown Test Teardown Execution |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 11 | |
| 12 | *** Variables *** |
| 13 | |
| 14 | # AA:AA:AA:AA:AA:AA series is a valid MAC and does not exist in |
| 15 | # our network, so this is chosen to avoid MAC conflict. |
| 16 | ${valid_mac} AA:E2:84:14:28:79 |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 17 | ${zero_mac} 00:00:00:00:00:00 |
| 18 | ${broadcast_mac} FF:FF:FF:FF:FF:FF |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 19 | |
| 20 | *** Test Cases *** |
| 21 | |
| 22 | Configure Valid MAC And Verify |
| 23 | [Documentation] Configure valid MAC via Redfish and verify. |
| 24 | [Tags] Configure_Valid_MAC_And_Verify |
| 25 | |
| 26 | Configure MAC Settings ${valid_mac} valid |
| 27 | |
| 28 | # Verify whether new MAC is configured on BMC. |
| 29 | Validate MAC On BMC ${valid_mac} |
| 30 | |
| 31 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 32 | Configure Zero MAC And Verify |
| 33 | [Documentation] Configure zero MAC via Redfish and verify. |
| 34 | [Tags] Configure_Zero_MAC_And_Verify |
| 35 | |
| 36 | [Template] Configure MAC Settings |
| 37 | # MAC address scenario |
| 38 | ${zero_mac} error |
| 39 | |
| 40 | |
| 41 | Configure Broadcast MAC And Verify |
| 42 | [Documentation] Configure broadcast MAC via Redfish and verify. |
| 43 | [Tags] Configure_Broadcast_MAC_And_Verify |
| 44 | |
| 45 | [Template] Configure MAC Settings |
| 46 | # MAC address scenario |
| 47 | ${broadcast_mac} error |
| 48 | |
| 49 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 50 | *** Keywords *** |
| 51 | |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 52 | Test Teardown Execution |
| 53 | [Documentation] Do the post test teardown. |
| 54 | |
| 55 | FFDC On Test Case Fail |
| 56 | Redfish.Logout |
| 57 | |
| 58 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 59 | Suite Setup Execution |
| 60 | [Documentation] Do suite setup tasks. |
| 61 | |
| 62 | Redfish.Login |
| 63 | |
| 64 | # Get BMC MAC address. |
| 65 | ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} |
| 66 | Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} |
| 67 | |
| 68 | Validate MAC On BMC ${initial_mac_address} |
| 69 | |
| 70 | Redfish.Logout |
| 71 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 72 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 73 | Configure MAC Settings |
| 74 | [Documentation] Configure MAC settings via Redfish. |
| 75 | [Arguments] ${mac_address} ${expected_result} |
| 76 | |
| 77 | # Description of argument(s): |
| 78 | # mac_address MAC address of BMC. |
| 79 | # expected_result Expected status of MAC configuration. |
| 80 | |
| 81 | Redfish.Login |
| 82 | ${payload}= Create Dictionary MACAddress=${mac_address} |
| 83 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 84 | Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload} |
| 85 | ... valid_status_codes=[200, 400] |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 86 | |
| 87 | # After any modification on network interface, BMC restarts network |
| 88 | # module, wait until it is reachable. |
| 89 | |
| 90 | Wait For Host To Ping ${OPENBMC_HOST} |
| 91 | ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} |
| 92 | |
| 93 | # Verify whether new MAC address is populated on BMC system. |
| 94 | # It should not allow to configure invalid settings. |
| 95 | |
| 96 | ${status}= Run Keyword And Return Status |
| 97 | ... Validate MAC On BMC ${mac_address} |
| 98 | |
| 99 | Run Keyword If '${expected_result}' == 'error' |
| 100 | ... Should Be Equal ${status} ${False} |
| 101 | ... msg=Allowing the configuration of an invalid MAC. |
| 102 | ... ELSE |
| 103 | ... Should Be Equal ${status} ${True} |
| 104 | ... msg=Not allowing the configuration of a valid MAC. |
| 105 | |