1ed0beddeSPrashanth Katti*** Settings *** 2ed0beddeSPrashanth KattiDocumentation Test BMC network interface functionalities. 3ed0beddeSPrashanth Katti 4ed0beddeSPrashanth KattiResource ../../lib/bmc_redfish_resource.robot 5ed0beddeSPrashanth KattiResource ../../lib/bmc_network_utils.robot 6ed0beddeSPrashanth KattiResource ../../lib/openbmc_ffdc.robot 7ed0beddeSPrashanth KattiLibrary ../../lib/bmc_network_utils.py 8ed0beddeSPrashanth Katti 9ed0beddeSPrashanth KattiSuite Setup Suite Setup Execution 10a8cc1ad4SGeorge KeishingTest Teardown Test Teardown Execution 11ed0beddeSPrashanth Katti 126fb70d98SMatt FischerTest Tags Bmc_Network_Mac 13d218f539SPrashanth Katti 14ed0beddeSPrashanth Katti*** Variables *** 15ed0beddeSPrashanth Katti 16ed0beddeSPrashanth Katti# AA:AA:AA:AA:AA:AA series is a valid MAC and does not exist in 17ed0beddeSPrashanth Katti# our network, so this is chosen to avoid MAC conflict. 18ed0beddeSPrashanth Katti${valid_mac} AA:E2:84:14:28:79 1946ca7ae4SPrashanth Katti${zero_mac} 00:00:00:00:00:00 2046ca7ae4SPrashanth Katti${broadcast_mac} FF:FF:FF:FF:FF:FF 2163862139SPrashanth Katti${out_of_range_mac} AA:FF:FF:FF:FF:100 2263862139SPrashanth Katti 2363862139SPrashanth Katti# There will be 6 bytes in MAC address (e.g. xx.xx.xx.xx.xx.xx). 2463862139SPrashanth Katti# Here trying to configure xx.xx.xx.xx.xx 2563862139SPrashanth Katti${less_byte_mac} AA:AA:AA:AA:BB 2663862139SPrashanth Katti# Here trying to configure xx.xx.xx.xx.xx.xx.xx 2763862139SPrashanth Katti${more_byte_mac} AA:AA:AA:AA:AA:AA:BB 28ed0beddeSPrashanth Katti 29e8c87350SPrashanth Katti# MAC address with special characters. 30e8c87350SPrashanth Katti${special_char_mac} &A:$A:AA:AA:AA:^^ 31e8c87350SPrashanth Katti 32ed0beddeSPrashanth Katti*** Test Cases *** 33ed0beddeSPrashanth Katti 34ed0beddeSPrashanth KattiConfigure Valid MAC And Verify 35ed0beddeSPrashanth Katti [Documentation] Configure valid MAC via Redfish and verify. 36ed0beddeSPrashanth Katti [Tags] Configure_Valid_MAC_And_Verify 37ed0beddeSPrashanth Katti 38df078f46Skothais Configure MAC Settings ${valid_mac} 39ed0beddeSPrashanth Katti 40fdc51d23Sshrsuman123 # Verify whether new MAC is configured on BMC and FW_Env. 41ed0beddeSPrashanth Katti Validate MAC On BMC ${valid_mac} 42df078f46Skothais Verify MAC Address Via FW_Env ${valid_mac} 43ed0beddeSPrashanth Katti 4446ca7ae4SPrashanth KattiConfigure Zero MAC And Verify 4546ca7ae4SPrashanth Katti [Documentation] Configure zero MAC via Redfish and verify. 4646ca7ae4SPrashanth Katti [Tags] Configure_Zero_MAC_And_Verify 4746ca7ae4SPrashanth Katti 4846ca7ae4SPrashanth Katti [Template] Configure MAC Settings 4946ca7ae4SPrashanth Katti # MAC address scenario 50df078f46Skothais ${zero_mac} ${HTTP_BAD_REQUEST} 5146ca7ae4SPrashanth Katti 5246ca7ae4SPrashanth KattiConfigure Broadcast MAC And Verify 5346ca7ae4SPrashanth Katti [Documentation] Configure broadcast MAC via Redfish and verify. 5446ca7ae4SPrashanth Katti [Tags] Configure_Broadcast_MAC_And_Verify 5546ca7ae4SPrashanth Katti 5646ca7ae4SPrashanth Katti [Template] Configure MAC Settings 5746ca7ae4SPrashanth Katti # MAC address scenario 58df078f46Skothais ${broadcast_mac} ${HTTP_BAD_REQUEST} 5946ca7ae4SPrashanth Katti 60e8c87350SPrashanth KattiConfigure Invalid MAC And Verify 61e8c87350SPrashanth Katti [Documentation] Configure invalid MAC address which is a string. 62e8c87350SPrashanth Katti [Tags] Configure_Invalid_MAC_And_Verify 63e8c87350SPrashanth Katti 64e8c87350SPrashanth Katti [Template] Configure MAC Settings 65e8c87350SPrashanth Katti # MAC Address Expected_Result 66df078f46Skothais ${special_char_mac} ${HTTP_BAD_REQUEST} 67e8c87350SPrashanth Katti 68e8c87350SPrashanth KattiConfigure Valid MAC And Check Persistency 69e8c87350SPrashanth Katti [Documentation] Configure valid MAC and check persistency. 70e8c87350SPrashanth Katti [Tags] Configure_Valid_MAC_And_Check_Persistency 71e8c87350SPrashanth Katti 72df078f46Skothais Configure MAC Settings ${valid_mac} 73e8c87350SPrashanth Katti 74e8c87350SPrashanth Katti # Verify whether new MAC is configured on BMC. 75e8c87350SPrashanth Katti Validate MAC On BMC ${valid_mac} 76e8c87350SPrashanth Katti 77fdc51d23Sshrsuman123 # Reboot BMC and check whether MAC is persistent on BMC and FW_Env. 78e8c87350SPrashanth Katti OBMC Reboot (off) 79e8c87350SPrashanth Katti Validate MAC On BMC ${valid_mac} 80df078f46Skothais Verify MAC Address Via FW_Env ${valid_mac} 81fdc51d23Sshrsuman123 82fdc51d23Sshrsuman123Configure Invalid MAC And Verify On FW_Env 83fdc51d23Sshrsuman123 [Documentation] Configure Invalid MAC via Redfish and verify on FW_Env. 84fdc51d23Sshrsuman123 [Tags] Configure_Invalid_MAC_And_Verify_On_FW_Env 85fdc51d23Sshrsuman123 86fdc51d23Sshrsuman123 [Template] Configure MAC Settings 87fdc51d23Sshrsuman123 88fdc51d23Sshrsuman123 # invalid_MAC scenario 89df078f46Skothais ${zero_mac} ${HTTP_BAD_REQUEST} 90df078f46Skothais ${broadcast_mac} ${HTTP_BAD_REQUEST} 91df078f46Skothais ${special_char_mac} ${HTTP_BAD_REQUEST} 92df078f46Skothais ${less_byte_mac} ${HTTP_BAD_REQUEST} 93fdc51d23Sshrsuman123 94fdc51d23Sshrsuman123Configure Invalid MAC And Verify Persistency On FW_Env 95fdc51d23Sshrsuman123 [Documentation] Configure invalid MAC and verify persistency on FW_Env. 96fdc51d23Sshrsuman123 [Tags] Configure_Invalid_MAC_And_Verify_Persistency_On_FW_Env 97fdc51d23Sshrsuman123 98df078f46Skothais Configure MAC Settings ${special_char_mac} ${HTTP_BAD_REQUEST} 99fdc51d23Sshrsuman123 100fdc51d23Sshrsuman123 # Reboot BMC and check whether MAC is persistent on FW_Env. 101fdc51d23Sshrsuman123 OBMC Reboot (off) 102df078f46Skothais Verify MAC Address Via FW_Env ${special_char_mac} ${HTTP_BAD_REQUEST} 10346ca7ae4SPrashanth Katti 10463862139SPrashanth KattiConfigure Out Of Range MAC And Verify 10563862139SPrashanth Katti [Documentation] Configure out of range MAC via Redfish and verify. 10663862139SPrashanth Katti [Tags] Configure_Out_Of_Range_MAC_And_Verify 10763862139SPrashanth Katti 108df078f46Skothais Configure MAC Settings ${out_of_range_mac} ${HTTP_BAD_REQUEST} 109fdc51d23Sshrsuman123 110fdc51d23Sshrsuman123 # Verify whether new MAC is configured on FW_Env. 111df078f46Skothais Verify MAC Address Via FW_Env ${out_of_range_mac} ${HTTP_BAD_REQUEST} 11263862139SPrashanth Katti 11363862139SPrashanth KattiConfigure Less Byte MAC And Verify 11463862139SPrashanth Katti [Documentation] Configure less byte MAC via Redfish and verify. 11563862139SPrashanth Katti [Tags] Configure_Less_Byte_MAC_And_Verify 11663862139SPrashanth Katti 11763862139SPrashanth Katti [Template] Configure MAC Settings 11863862139SPrashanth Katti # MAC address scenario 119df078f46Skothais ${less_byte_mac} ${HTTP_BAD_REQUEST} 12063862139SPrashanth Katti 12163862139SPrashanth KattiConfigure More Byte MAC And Verify 12263862139SPrashanth Katti [Documentation] Configure more byte MAC via Redfish and verify. 1233112f4c6STony Lee [Tags] Configure_More_Byte_MAC_And_Verify 12463862139SPrashanth Katti 125df078f46Skothais Configure MAC Settings ${more_byte_mac} ${HTTP_BAD_REQUEST} 126fdc51d23Sshrsuman123 # Verify whether new MAC is configured on FW_Env. 127df078f46Skothais Verify MAC Address Via FW_Env ${more_byte_mac} ${HTTP_BAD_REQUEST} 128fb001363SSweta Potthuri 12963862139SPrashanth Katti 130ed0beddeSPrashanth Katti*** Keywords *** 131ed0beddeSPrashanth Katti 132a8cc1ad4SGeorge KeishingTest Teardown Execution 133a8cc1ad4SGeorge Keishing [Documentation] Do the post test teardown. 134a8cc1ad4SGeorge Keishing 135e8c87350SPrashanth Katti # Revert to initial MAC address. 136df078f46Skothais Configure MAC Settings ${initial_mac_address} 137e8c87350SPrashanth Katti 138fdc51d23Sshrsuman123 # Verify whether new MAC is configured on BMC and FW_Env. 139e8c87350SPrashanth Katti Validate MAC On BMC ${initial_mac_address} 140fdc51d23Sshrsuman123 Validate MAC On Fw_Env ${initial_mac_address} 141e8c87350SPrashanth Katti 142a8cc1ad4SGeorge Keishing FFDC On Test Case Fail 143a8cc1ad4SGeorge Keishing Redfish.Logout 144a8cc1ad4SGeorge Keishing 145a8cc1ad4SGeorge Keishing 146ed0beddeSPrashanth KattiSuite Setup Execution 147ed0beddeSPrashanth Katti [Documentation] Do suite setup tasks. 148ed0beddeSPrashanth Katti 149ed0beddeSPrashanth Katti Redfish.Login 1508094d386STony Lee ${active_channel_config}= Get Active Channel Config 1518094d386STony Lee ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 152ed0beddeSPrashanth Katti 153ed0beddeSPrashanth Katti # Get BMC MAC address. 1548094d386STony Lee ${resp}= redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 155ed0beddeSPrashanth Katti Set Suite Variable ${initial_mac_address} ${resp.dict['MACAddress']} 156ed0beddeSPrashanth Katti 157ed0beddeSPrashanth Katti Validate MAC On BMC ${initial_mac_address} 158ed0beddeSPrashanth Katti 159ed0beddeSPrashanth Katti Redfish.Logout 160ed0beddeSPrashanth Katti 16146ca7ae4SPrashanth Katti 162ed0beddeSPrashanth KattiConfigure MAC Settings 163ed0beddeSPrashanth Katti [Documentation] Configure MAC settings via Redfish. 16455441c09SAnvesh-Kumar_Rayankula [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK} 165ed0beddeSPrashanth Katti 166ed0beddeSPrashanth Katti # Description of argument(s): 167ed0beddeSPrashanth Katti # mac_address MAC address of BMC. 16855441c09SAnvesh-Kumar_Rayankula # valid_status_code Expected response code, default is ${HTTP_OK}. 169ed0beddeSPrashanth Katti 1708094d386STony Lee ${active_channel_config}= Get Active Channel Config 1718094d386STony Lee ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 1728094d386STony Lee 173ed0beddeSPrashanth Katti Redfish.Login 174ed0beddeSPrashanth Katti ${payload}= Create Dictionary MACAddress=${mac_address} 175ed0beddeSPrashanth Katti 1768094d386STony Lee Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload} 177*52f8198aSAnvesh-Kumar_Rayankula ... valid_status_codes=[${valid_status_code},${HTTP_NO_CONTENT},${HTTP_INTERNAL_SERVER_ERROR}] 178ed0beddeSPrashanth Katti 179ed0beddeSPrashanth Katti # After any modification on network interface, BMC restarts network 180ed0124beSAnves Kumar rayankula # Note: Network restart takes around 15-18s after patch request processing. 181ed0124beSAnves Kumar rayankula Sleep ${NETWORK_TIMEOUT}s 182ed0beddeSPrashanth Katti 183ed0124beSAnves Kumar rayankula Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 184ed0beddeSPrashanth Katti 185ed0beddeSPrashanth Katti # Verify whether new MAC address is populated on BMC system. 186ed0beddeSPrashanth Katti # It should not allow to configure invalid settings. 187ed0beddeSPrashanth Katti ${status}= Run Keyword And Return Status 188ed0beddeSPrashanth Katti ... Validate MAC On BMC ${mac_address} 189ed0beddeSPrashanth Katti 19055441c09SAnvesh-Kumar_Rayankula Run Keyword If ${valid_status_code} == ${HTTP_BAD_REQUEST} 191ed0beddeSPrashanth Katti ... Should Be Equal ${status} ${False} 192ed0beddeSPrashanth Katti ... msg=Allowing the configuration of an invalid MAC. 193ed0beddeSPrashanth Katti ... ELSE 194ed0beddeSPrashanth Katti ... Should Be Equal ${status} ${True} 195ed0beddeSPrashanth Katti ... msg=Not allowing the configuration of a valid MAC. 196ed0beddeSPrashanth Katti 19755441c09SAnvesh-Kumar_Rayankula Verify MAC Address Via FW_Env ${mac_address} ${valid_status_code} 198fdc51d23Sshrsuman123 199fdc51d23Sshrsuman123Verify MAC Address Via FW_Env 200fdc51d23Sshrsuman123 [Documentation] Verify MAC address on FW_Env. 20155441c09SAnvesh-Kumar_Rayankula [Arguments] ${mac_address} ${valid_status_code}=${HTTP_OK} 202fdc51d23Sshrsuman123 203fdc51d23Sshrsuman123 # Description of argument(s): 204fdc51d23Sshrsuman123 # mac_address MAC address of BMC. 20555441c09SAnvesh-Kumar_Rayankula # valid_status_code Expected response code, default is ${HTTP_OK}. 206fdc51d23Sshrsuman123 207fdc51d23Sshrsuman123 ${status}= Run Keyword And Return Status 208fdc51d23Sshrsuman123 ... Validate MAC On FW_Env ${mac_address} 209fdc51d23Sshrsuman123 21055441c09SAnvesh-Kumar_Rayankula Run Keyword If ${valid_status_code} == ${HTTP_BAD_REQUEST} 211fdc51d23Sshrsuman123 ... Should Be Equal ${status} ${False} 212fdc51d23Sshrsuman123 ... msg=Allowing the configuration of an invalid MAC. 213fdc51d23Sshrsuman123 ... ELSE 214fdc51d23Sshrsuman123 ... Should Be Equal ${status} ${True} 215fdc51d23Sshrsuman123 ... msg=Not allowing the configuration of a valid MAC. 216