Prashanth Katti | 47da385 | 2017-09-25 11:05:22 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test BMC network interface functionalities. |
| 3 | |
| 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/utils.robot |
| 6 | Resource ../lib/bmc_network_utils.robot |
| 7 | Resource ../lib/boot_utils.robot |
| 8 | |
| 9 | Library String |
| 10 | Library SSHLibrary |
| 11 | |
| 12 | Suite Setup Suite Setup Execution |
| 13 | |
| 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 | |
| 19 | ${valid_mac} AA:E2:84:14:28:79 |
| 20 | ${broadcast_mac} FF:FF:FF:FF:FF:FF |
| 21 | ${zero_mac} 00:00:00:00:00:00 |
| 22 | ${out_of_range_mac} AA:FF:FF:FF:FF:100 |
| 23 | ${special_char_mac} &$:AA:AA:AA:AA:^^ |
| 24 | |
| 25 | # There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx) |
| 26 | # but trying to configure xx.xx.xx.xx.xx |
| 27 | |
| 28 | ${less_byte_mac} AA:AA:AA:AA:BB |
| 29 | |
| 30 | # There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx) |
| 31 | # but trying to configure xx.xx.xx.xx.xx.xx.xx |
| 32 | |
| 33 | ${more_byte_mac} AA:AA:AA:AA:AA:AA:BB |
| 34 | |
| 35 | *** Test Cases *** |
| 36 | |
| 37 | Configure Valid MAC And Verify |
| 38 | [Documentation] Configure valid MAC and verify. |
| 39 | [Tags] Configure_Valid_MAC_And_Verify |
| 40 | |
| 41 | Configure MAC Settings ${valid_mac} valid |
| 42 | |
| 43 | # Verify whether new MAC is configured on BMC. |
| 44 | Validate MAC On BMC ${valid_mac} |
| 45 | |
| 46 | Configure Invalid MAC And Verify |
| 47 | [Documentation] Configure invalid MAC address which is a string. |
| 48 | [Tags] Configure_Invalid_MAC_And_Verify |
| 49 | |
| 50 | [Template] Configure MAC Settings |
| 51 | # MAC Address Expected_Result |
| 52 | ${special_char_mac} error |
| 53 | |
| 54 | |
| 55 | Configure Out Of Range MAC And Verify |
| 56 | [Documentation] Configure out-of-range MAC address. |
| 57 | [Tags] Configure_Out_Of_Range_MAC_And_Verify |
| 58 | |
| 59 | [Template] Configure MAC Settings |
| 60 | # MAC Address Expected_Result |
| 61 | ${out_of_range_mac} error |
| 62 | |
| 63 | Configure Broadcast MAC And Verify |
| 64 | [Documentation] Configure broadcast MAC address. |
| 65 | [Tags] Configure_Broadcast_MAC_And_Verify |
| 66 | |
| 67 | [Template] Configure MAC Settings |
| 68 | # MAC Address Expected_Result |
| 69 | ${broadcast_mac} error |
| 70 | |
| 71 | Configure Zero MAC And Verify |
| 72 | [Documentation] Configure zero MAC address. |
| 73 | [Tags] Configure_Zero_MAC_And_Verify |
| 74 | |
| 75 | [Template] Configure MAC Settings |
| 76 | # MAC Address Expected_Result |
| 77 | ${zero_mac} error |
| 78 | |
| 79 | Configure More Byte MAC And Verify |
| 80 | [Documentation] Configure more byte MAC address. |
| 81 | [Tags] Configure_More_Byte_MAC_And_Verify |
| 82 | |
| 83 | [Template] Configure MAC Settings |
| 84 | # MAC Address Expected_Result |
| 85 | ${more_byte_mac} error |
| 86 | |
| 87 | Configure Less Byte MAC And Verify |
| 88 | [Documentation] Configure less byte MAC address. |
| 89 | [Tags] Configure_Less_Byte_MAC_And_Verify |
| 90 | |
| 91 | [Template] Configure MAC Settings |
| 92 | # MAC Address Expected_Result |
| 93 | ${less_byte_mac} error |
| 94 | |
| 95 | Configure Valid MAC And Check Persistency |
| 96 | [Documentation] Configure valid MAC and check persistency. |
| 97 | [Tags] Configure_Valid_MAC_And_Check_Persistency |
| 98 | |
| 99 | Configure MAC Settings ${valid_mac} valid |
| 100 | |
| 101 | # Verify whether new MAC is configured on BMC. |
| 102 | Validate MAC On BMC ${valid_mac} |
| 103 | |
| 104 | # Reboot BMC and check whether MAC is persistent. |
| 105 | OBMC Reboot (off) |
| 106 | Validate MAC On BMC ${valid_mac} |
| 107 | |
| 108 | Revert To Initial MAC And Verify |
| 109 | [Documentation] Revert to initial MAC address. |
| 110 | [Tags] Revert_To_Initial_MAC_And_Verify |
| 111 | |
| 112 | Configure MAC Settings ${macaddr} valid |
| 113 | |
| 114 | # Verify whether new MAC is configured on BMC. |
| 115 | Validate MAC On BMC ${macaddr} |
| 116 | |
| 117 | *** Keywords *** |
| 118 | |
| 119 | Suite Setup Execution |
| 120 | [Documentation] Network setup. |
| 121 | Open Connection And Login |
| 122 | |
| 123 | # Get BMC MAC address. |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 124 | ${macaddr}= Read Attribute ${NETWORK_MANAGER}/eth0 MACAddress |
Prashanth Katti | 47da385 | 2017-09-25 11:05:22 -0500 | [diff] [blame] | 125 | Validate MAC On BMC ${macaddr} |
| 126 | Set Suite Variable ${macaddr} |
| 127 | |
Prashanth Katti | 47da385 | 2017-09-25 11:05:22 -0500 | [diff] [blame] | 128 | Configure MAC Settings |
| 129 | [Documentation] Configure MAC settings. |
| 130 | [Arguments] ${mac_addr} ${expected_result} |
| 131 | |
| 132 | # Description of argument(s): |
| 133 | # mac_addr MAC address of BMC. |
| 134 | # expected_result Expected status of MAC configuration. |
| 135 | |
| 136 | ${data}= Create Dictionary data=${mac_addr} |
| 137 | |
| 138 | Run Keyword And Ignore Error OpenBMC Put Request |
manasarm | 104cc6b | 2018-02-07 12:35:05 +0530 | [diff] [blame] | 139 | ... ${NETWORK_MANAGER}/eth0/attr/MACAddress data=${data} |
Prashanth Katti | 47da385 | 2017-09-25 11:05:22 -0500 | [diff] [blame] | 140 | |
| 141 | # After any modification on network interface, BMC restarts network |
| 142 | # module, wait until it is reachable. |
| 143 | |
Rahul Maheshwari | 3505c8d | 2018-09-06 01:46:50 -0500 | [diff] [blame] | 144 | Wait For Host To Ping ${OPENBMC_HOST} |
| 145 | ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} |
Prashanth Katti | 47da385 | 2017-09-25 11:05:22 -0500 | [diff] [blame] | 146 | |
| 147 | # Verify whether new MAC address is populated on BMC system. |
| 148 | # It should not allow to configure invalid settings. |
| 149 | |
| 150 | ${status}= Run Keyword And Return Status |
| 151 | ... Validate MAC On BMC ${mac_addr} |
| 152 | |
| 153 | Run Keyword If '${expected_result}' == 'error' |
| 154 | ... Should Be Equal ${status} ${False} |
| 155 | ... msg=Allowing the configuration of an invalid MAC. |
| 156 | ... ELSE |
| 157 | ... Should Be Equal ${status} ${True} |
| 158 | ... msg=Not allowing the configuration of a valid MAC. |
| 159 | |