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