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