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