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 20*** Test Cases *** 21 22Configure Valid MAC And Verify 23 [Documentation] Configure valid MAC via Redfish and verify. 24 [Tags] Configure_Valid_MAC_And_Verify 25 26 Configure MAC Settings ${valid_mac} valid 27 28 # Verify whether new MAC is configured on BMC. 29 Validate MAC On BMC ${valid_mac} 30 31 32Configure Zero MAC And Verify 33 [Documentation] Configure zero MAC via Redfish and verify. 34 [Tags] Configure_Zero_MAC_And_Verify 35 36 [Template] Configure MAC Settings 37 # MAC address scenario 38 ${zero_mac} error 39 40 41Configure Broadcast MAC And Verify 42 [Documentation] Configure broadcast MAC via Redfish and verify. 43 [Tags] Configure_Broadcast_MAC_And_Verify 44 45 [Template] Configure MAC Settings 46 # MAC address scenario 47 ${broadcast_mac} error 48 49 50*** Keywords *** 51 52Test Teardown Execution 53 [Documentation] Do the post test teardown. 54 55 FFDC On Test Case Fail 56 Redfish.Logout 57 58 59Suite Setup Execution 60 [Documentation] Do suite setup tasks. 61 62 Redfish.Login 63 64 # Get BMC MAC address. 65 ${resp}= redfish.Get ${REDFISH_NW_ETH0_URI} 66 Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} 67 68 Validate MAC On BMC ${initial_mac_address} 69 70 Redfish.Logout 71 72 73Configure MAC Settings 74 [Documentation] Configure MAC settings via Redfish. 75 [Arguments] ${mac_address} ${expected_result} 76 77 # Description of argument(s): 78 # mac_address MAC address of BMC. 79 # expected_result Expected status of MAC configuration. 80 81 Redfish.Login 82 ${payload}= Create Dictionary MACAddress=${mac_address} 83 84 Redfish.Patch ${REDFISH_NW_ETH0_URI} body=&{payload} 85 ... valid_status_codes=[200, 400] 86 87 # After any modification on network interface, BMC restarts network 88 # module, wait until it is reachable. 89 90 Wait For Host To Ping ${OPENBMC_HOST} 91 ... ${NETWORK_TIMEOUT} ${NETWORK_RETRY_TIME} 92 93 # Verify whether new MAC address is populated on BMC system. 94 # It should not allow to configure invalid settings. 95 96 ${status}= Run Keyword And Return Status 97 ... Validate MAC On BMC ${mac_address} 98 99 Run Keyword If '${expected_result}' == 'error' 100 ... Should Be Equal ${status} ${False} 101 ... msg=Allowing the configuration of an invalid MAC. 102 ... ELSE 103 ... Should Be Equal ${status} ${True} 104 ... msg=Not allowing the configuration of a valid MAC. 105 106