1*** Settings *** 2Documentation Test BMC network interface functionalities. 3 4Resource ../../lib/bmc_redfish_resource.robot 5Resource ../../lib/bmc_network_utils.robot 6Resource ../../lib/openbmc_ffdc.robot 7Library ../../lib/bmc_network_utils.py 8 9Suite Setup Suite Setup Execution 10Test Teardown Test Teardown Execution 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 17${zero_mac} 00:00:00:00:00:00 18${broadcast_mac} FF:FF:FF:FF:FF:FF 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 26 27# MAC address with special characters. 28${special_char_mac} &A:$A:AA:AA:AA:^^ 29 30*** Test Cases *** 31 32Configure 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 42Configure 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 51Configure 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 59Configure 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 67Configure 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} 79 80Configure 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 88Configure 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 96Configure 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 104*** Keywords *** 105 106Test Teardown Execution 107 [Documentation] Do the post test teardown. 108 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 115 FFDC On Test Case Fail 116 Redfish.Logout 117 118 119Suite 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 132 133Configure 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 144 Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload} 145 ... valid_status_codes=[200, 400] 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 166