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 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 20 | # MAC address with special characters. |
| 21 | ${special_char_mac} &A:$A:AA:AA:AA:^^ |
| 22 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 23 | *** Test Cases *** |
| 24 | |
| 25 | Configure Valid MAC And Verify |
| 26 | [Documentation] Configure valid MAC via Redfish and verify. |
| 27 | [Tags] Configure_Valid_MAC_And_Verify |
| 28 | |
| 29 | Configure MAC Settings ${valid_mac} valid |
| 30 | |
| 31 | # Verify whether new MAC is configured on BMC. |
| 32 | Validate MAC On BMC ${valid_mac} |
| 33 | |
| 34 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 35 | Configure Zero MAC And Verify |
| 36 | [Documentation] Configure zero MAC via Redfish and verify. |
| 37 | [Tags] Configure_Zero_MAC_And_Verify |
| 38 | |
| 39 | [Template] Configure MAC Settings |
| 40 | # MAC address scenario |
| 41 | ${zero_mac} error |
| 42 | |
| 43 | |
| 44 | Configure Broadcast MAC And Verify |
| 45 | [Documentation] Configure broadcast MAC via Redfish and verify. |
| 46 | [Tags] Configure_Broadcast_MAC_And_Verify |
| 47 | |
| 48 | [Template] Configure MAC Settings |
| 49 | # MAC address scenario |
| 50 | ${broadcast_mac} error |
| 51 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 52 | Configure Invalid MAC And Verify |
| 53 | [Documentation] Configure invalid MAC address which is a string. |
| 54 | [Tags] Configure_Invalid_MAC_And_Verify |
| 55 | |
| 56 | [Template] Configure MAC Settings |
| 57 | # MAC Address Expected_Result |
| 58 | ${special_char_mac} error |
| 59 | |
| 60 | Configure Valid MAC And Check Persistency |
| 61 | [Documentation] Configure valid MAC and check persistency. |
| 62 | [Tags] Configure_Valid_MAC_And_Check_Persistency |
| 63 | |
| 64 | Configure MAC Settings ${valid_mac} valid |
| 65 | |
| 66 | # Verify whether new MAC is configured on BMC. |
| 67 | Validate MAC On BMC ${valid_mac} |
| 68 | |
| 69 | # Reboot BMC and check whether MAC is persistent. |
| 70 | OBMC Reboot (off) |
| 71 | Validate MAC On BMC ${valid_mac} |
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 | *** Keywords *** |
| 74 | |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 75 | Test Teardown Execution |
| 76 | [Documentation] Do the post test teardown. |
| 77 | |
Prashanth Katti | e8c8735 | 2019-03-21 06:23:41 -0500 | [diff] [blame] | 78 | # Revert to initial MAC address. |
| 79 | Configure MAC Settings ${initial_mac_address} valid |
| 80 | |
| 81 | # Verify whether new MAC is configured on BMC. |
| 82 | Validate MAC On BMC ${initial_mac_address} |
| 83 | |
George Keishing | a8cc1ad | 2019-03-13 02:58:34 -0500 | [diff] [blame] | 84 | FFDC On Test Case Fail |
| 85 | Redfish.Logout |
| 86 | |
| 87 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 88 | Suite Setup Execution |
| 89 | [Documentation] Do suite setup tasks. |
| 90 | |
| 91 | Redfish.Login |
| 92 | |
| 93 | # Get BMC MAC address. |
| 94 | ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} |
| 95 | Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} |
| 96 | |
| 97 | Validate MAC On BMC ${initial_mac_address} |
| 98 | |
| 99 | Redfish.Logout |
| 100 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 101 | |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 102 | Configure MAC Settings |
| 103 | [Documentation] Configure MAC settings via Redfish. |
| 104 | [Arguments] ${mac_address} ${expected_result} |
| 105 | |
| 106 | # Description of argument(s): |
| 107 | # mac_address MAC address of BMC. |
| 108 | # expected_result Expected status of MAC configuration. |
| 109 | |
| 110 | Redfish.Login |
| 111 | ${payload}= Create Dictionary MACAddress=${mac_address} |
| 112 | |
Prashanth Katti | 46ca7ae | 2019-03-14 02:41:11 -0500 | [diff] [blame] | 113 | Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload} |
| 114 | ... valid_status_codes=[200, 400] |
Prashanth Katti | ed0bedd | 2019-02-20 07:34:14 -0600 | [diff] [blame] | 115 | |
| 116 | # After any modification on network interface, BMC restarts network |
| 117 | # module, wait until it is reachable. |
| 118 | |
| 119 | Wait For Host To Ping ${OPENBMC_HOST} |
| 120 | ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} |
| 121 | |
| 122 | # Verify whether new MAC address is populated on BMC system. |
| 123 | # It should not allow to configure invalid settings. |
| 124 | |
| 125 | ${status}= Run Keyword And Return Status |
| 126 | ... Validate MAC On BMC ${mac_address} |
| 127 | |
| 128 | Run Keyword If '${expected_result}' == 'error' |
| 129 | ... Should Be Equal ${status} ${False} |
| 130 | ... msg=Allowing the configuration of an invalid MAC. |
| 131 | ... ELSE |
| 132 | ... Should Be Equal ${status} ${True} |
| 133 | ... msg=Not allowing the configuration of a valid MAC. |
| 134 | |