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 Redfish.Logout 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 18*** Test Cases *** 19 20Configure Valid MAC And Verify 21 [Documentation] Configure valid MAC via Redfish and verify. 22 [Tags] Configure_Valid_MAC_And_Verify 23 24 Configure MAC Settings ${valid_mac} valid 25 26 # Verify whether new MAC is configured on BMC. 27 Validate MAC On BMC ${valid_mac} 28 29 30*** Keywords *** 31 32Suite Setup Execution 33 [Documentation] Do suite setup tasks. 34 35 Redfish.Login 36 37 # Get BMC MAC address. 38 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} 39 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} 40 41 Validate MAC On BMC ${initial_mac_address} 42 43 Redfish.Logout 44 45Configure MAC Settings 46 [Documentation] Configure MAC settings via Redfish. 47 [Arguments] ${mac_address} ${expected_result} 48 49 # Description of argument(s): 50 # mac_address MAC address of BMC. 51 # expected_result Expected status of MAC configuration. 52 53 Redfish.Login 54 ${payload}= Create Dictionary MACAddress=${mac_address} 55 56 ${resp}= Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload} 57 58 # After any modification on network interface, BMC restarts network 59 # module, wait until it is reachable. 60 61 Wait For Host To Ping ${OPENBMC_HOST} 62 ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 63 64 # Verify whether new MAC address is populated on BMC system. 65 # It should not allow to configure invalid settings. 66 67 ${status}= Run Keyword And Return Status 68 ... Validate MAC On BMC ${mac_address} 69 70 Run Keyword If '${expected_result}' == 'error' 71 ... Should Be Equal ${status} ${False} 72 ... msg=Allowing the configuration of an invalid MAC. 73 ... ELSE 74 ... Should Be Equal ${status} ${True} 75 ... msg=Not allowing the configuration of a valid MAC. 76 77