xref: /openbmc/openbmc-test-automation/ipmi/test_ipmi_network_verification.robot (revision 6fb70d98f2f1cb9273ba912deaa2cebe3c23ea86)
11c7408f5SJorge Cisneros*** Settings ***
21c7408f5SJorge Cisneros
31c7408f5SJorge CisnerosDocumentation          Module to test IPMI network functionality.
41c7408f5SJorge CisnerosResource               ../lib/ipmi_client.robot
51c7408f5SJorge CisnerosResource               ../lib/openbmc_ffdc.robot
61c7408f5SJorge CisnerosResource               ../lib/bmc_network_utils.robot
71c7408f5SJorge CisnerosLibrary                ../lib/ipmi_utils.py
81c7408f5SJorge CisnerosLibrary                ../lib/gen_robot_valid.py
91c7408f5SJorge CisnerosLibrary                ../lib/var_funcs.py
101c7408f5SJorge CisnerosLibrary                ../lib/bmc_network_utils.py
111c7408f5SJorge CisnerosVariables              ../data/ipmi_raw_cmd_table.py
121c7408f5SJorge Cisneros
131c7408f5SJorge CisnerosSuite Setup            Redfish.Login
141c7408f5SJorge CisnerosTest Setup             Printn
151c7408f5SJorge CisnerosTest Teardown          FFDC On Test Case Fail
161c7408f5SJorge Cisneros
17*6fb70d98SMatt FischerTest Tags             IPMI_Network_Verification
181c7408f5SJorge Cisneros
191c7408f5SJorge Cisneros*** Variables ***
2087dc442cSGeorge Keishing
211c7408f5SJorge Cisneros${set_mac_address}                      02:f4:43:24:e7:1a
221c7408f5SJorge Cisneros${Invalid_mac_address}                  11:f4:43:24:e7:1a
231c7408f5SJorge Cisneros
241c7408f5SJorge Cisneros
251c7408f5SJorge Cisneros*** Test Cases ***
261c7408f5SJorge Cisneros
271c7408f5SJorge CisnerosRetrieve IP Address Via IPMI And Verify Using Redfish
281c7408f5SJorge Cisneros    [Documentation]  Retrieve IP address using IPMI and verify using Redfish.
291c7408f5SJorge Cisneros    [Tags]  Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redfish
301c7408f5SJorge Cisneros
31e9cecb2eSishwaryamathim    ${all_channels_list}=  Get Channel Number For All Interface
32e9cecb2eSishwaryamathim    ${valid_channels_list}=  Get Valid Channel Number  ${all_channels_list}
33e9cecb2eSishwaryamathim    ${ethernet_channels_list}=  Get Channel Number For Valid Ethernet Interface
34e9cecb2eSishwaryamathim    ...  ${valid_channels_list}
35e9cecb2eSishwaryamathim
36e9cecb2eSishwaryamathim    FOR  ${channel_number}  IN  @{ethernet_channels_list}
37e9cecb2eSishwaryamathim      Verify Channel Info  ${channel_number}  IPv4StaticAddresses  ${valid_channels_list}
381c7408f5SJorge Cisneros    END
391c7408f5SJorge Cisneros
40e9cecb2eSishwaryamathim
411c7408f5SJorge CisnerosRetrieve Default Gateway Via IPMI And Verify
421c7408f5SJorge Cisneros    [Documentation]  Retrieve default gateway via IPMI and verify it's existence on the BMC.
431c7408f5SJorge Cisneros    [Tags]  Retrieve_Default_Gateway_Via_IPMI_And_Verify
441c7408f5SJorge Cisneros
451c7408f5SJorge Cisneros    ${lan_print_ipmi}=  Get LAN Print Dict
461c7408f5SJorge Cisneros
471c7408f5SJorge Cisneros    Verify Gateway On BMC  ${lan_print_ipmi['Default Gateway IP']}
481c7408f5SJorge Cisneros
491c7408f5SJorge Cisneros
501c7408f5SJorge CisnerosRetrieve MAC Address Via IPMI And Verify Using Redfish
511c7408f5SJorge Cisneros    [Documentation]  Retrieve MAC address via IPMI and verify using Redfish.
521c7408f5SJorge Cisneros    [Tags]  Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
531c7408f5SJorge Cisneros
54e9cecb2eSishwaryamathim    ${all_channels_list}=  Get Channel Number For All Interface
55e9cecb2eSishwaryamathim    ${valid_channels_list}=  Get Valid Channel Number  ${all_channels_list}
56e9cecb2eSishwaryamathim    ${ethernet_channels_list}=  Get Channel Number For Valid Ethernet Interface
57e9cecb2eSishwaryamathim    ...  ${valid_channels_list}
58e9cecb2eSishwaryamathim
59e9cecb2eSishwaryamathim    FOR  ${channel_number}  IN  @{ethernet_channels_list}
60e9cecb2eSishwaryamathim      Verify Channel Info  ${channel_number}  MACAddress  ${valid_channels_list}
611c7408f5SJorge Cisneros    END
621c7408f5SJorge Cisneros
631c7408f5SJorge Cisneros
641c7408f5SJorge CisnerosTest Valid IPMI Channels Supported
651c7408f5SJorge Cisneros    [Documentation]  Verify IPMI channels supported on a given system.
661c7408f5SJorge Cisneros    [Tags]  Test_Valid_IPMI_Channels_Supported
671c7408f5SJorge Cisneros
68e9cecb2eSishwaryamathim    @{active_channel_list}=  Get Active Ethernet Channel List
69e9cecb2eSishwaryamathim    Set Suite Variable  @{active_channel_list}
701c7408f5SJorge Cisneros
71e9cecb2eSishwaryamathim    FOR  ${channel_number}  IN  @{active_channel_list}
72e9cecb2eSishwaryamathim    ${stdout}=  Run IPMI Standard Command
73e9cecb2eSishwaryamathim    ...  lan print ${channel_number}
741c7408f5SJorge Cisneros    END
751c7408f5SJorge Cisneros
761c7408f5SJorge Cisneros
771c7408f5SJorge CisnerosTest Invalid IPMI Channel Response
781c7408f5SJorge Cisneros    [Documentation]  Verify invalid IPMI channels supported response.
791c7408f5SJorge Cisneros    [Tags]  Test_Invalid_IPMI_Channel_Response
801c7408f5SJorge Cisneros
811c7408f5SJorge Cisneros    # Example of invalid channel:
821c7408f5SJorge Cisneros    # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
831c7408f5SJorge Cisneros    # Get Channel Info command failed: Parameter out of range
841c7408f5SJorge Cisneros    # Invalid channel: 3
851c7408f5SJorge Cisneros
8627d779d0Sishwaryamathim    @{inactive_channel_list}=  Get Invalid Channel Number List
8727d779d0Sishwaryamathim    FOR  ${channel_number}  IN  @{inactive_channel_list}
8827d779d0Sishwaryamathim        ${stdout}=  Run IPMI Standard Command
891c7408f5SJorge Cisneros        ...  lan print ${channel_number}  fail_on_err=${0}
901c7408f5SJorge Cisneros        Should Contain  ${stdout}  Invalid channel
911c7408f5SJorge Cisneros        ...  msg=IPMI channel ${channel_number} is invalid but seen working.
9227d779d0Sishwaryamathim    END
931c7408f5SJorge Cisneros
941c7408f5SJorge Cisneros
951c7408f5SJorge CisnerosGet IP Address Source And Verify Using Redfish
961c7408f5SJorge Cisneros    [Documentation]  Get IP address source and verify it using Redfish.
971c7408f5SJorge Cisneros    [Tags]  Get_IP_Address_Source_And_Verify_Using_Redfish
981c7408f5SJorge Cisneros
991c7408f5SJorge Cisneros    ${active_channel_config}=  Get Active Channel Config
1001c7408f5SJorge Cisneros    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}
1011c7408f5SJorge Cisneros
1021c7408f5SJorge Cisneros    ${ipv4_addresses}=  Redfish.Get Attribute
1034d430283Sganesanb    ...  /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
1041c7408f5SJorge Cisneros    ...  IPv4Addresses
1051c7408f5SJorge Cisneros
1061c7408f5SJorge Cisneros    FOR  ${ipv4_address}  IN  @{ipv4_addresses}
1071c7408f5SJorge Cisneros      ${ip_address_source}=
1081c7408f5SJorge Cisneros      ...  Set Variable if  '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
1091c7408f5SJorge Cisneros      ...  ${ipv4_address['AddressOrigin']} Address
1101c7408f5SJorge Cisneros      Exit For Loop IF  "${ip_address_source}" != 'None'
1111c7408f5SJorge Cisneros    END
1121c7408f5SJorge Cisneros
1131c7408f5SJorge Cisneros    Valid Value  lan_config['IP Address Source']  ['${ip_address_source}']
1141c7408f5SJorge Cisneros
1151c7408f5SJorge Cisneros
1161c7408f5SJorge CisnerosVerify Get Set In Progress
1171c7408f5SJorge Cisneros    [Documentation]  Verify Get Set In Progress which belongs to LAN Configuration Parameters
1181c7408f5SJorge Cisneros    ...              via IPMI raw Command.
1191c7408f5SJorge Cisneros    [Tags]  Verify_Get_Set_In_Progress
1201c7408f5SJorge Cisneros
1211c7408f5SJorge Cisneros    ${ipmi_output}=  Run IPMI Command
1221c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
1231c7408f5SJorge Cisneros
1241c7408f5SJorge Cisneros    ${ipmi_output}=  Split String  ${ipmi_output}
1251c7408f5SJorge Cisneros    ${set_in_progress_value}=  Set Variable  ${ipmi_output[1]}
1261c7408f5SJorge Cisneros
1271c7408f5SJorge Cisneros    # 00b = set complete.
1281c7408f5SJorge Cisneros    # 01b = set in progress.
1291c7408f5SJorge Cisneros    Should Contain Any  ${set_in_progress_value}  00  01
1301c7408f5SJorge Cisneros
1311c7408f5SJorge Cisneros
1321c7408f5SJorge CisnerosVerify Cipher Suite Entry Count
1331c7408f5SJorge Cisneros    [Documentation]  Verify cipher suite entry count which belongs to LAN Configuration Parameters
1341c7408f5SJorge Cisneros    ...              via IPMI raw Command.
1351c7408f5SJorge Cisneros    [Tags]  Verify_Cipher_Suite_Entry_Count
1361c7408f5SJorge Cisneros
1371c7408f5SJorge Cisneros    ${ipmi_output}=  Run IPMI Command
1381c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
1391c7408f5SJorge Cisneros    ${cipher_suite_entry_count}=  Split String  ${ipmi_output}
1401c7408f5SJorge Cisneros
1411c7408f5SJorge Cisneros    # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
1421c7408f5SJorge Cisneros    ${cipher_suite_entry_count[1]}=  Convert To Integer  ${cipher_suite_entry_count[1]}
1431c7408f5SJorge Cisneros    ${cnt}=  Get length  ${valid_ciphers}
1441c7408f5SJorge Cisneros
1451c7408f5SJorge Cisneros    Should be Equal  ${cipher_suite_entry_count[1]}  ${cnt}
1461c7408f5SJorge Cisneros
1471c7408f5SJorge Cisneros
1481c7408f5SJorge CisnerosVerify Authentication Type Support
1491c7408f5SJorge Cisneros    [Documentation]  Verify authentication type support which belongs to LAN Configuration Parameters
1501c7408f5SJorge Cisneros    ...              via IPMI raw Command.
1511c7408f5SJorge Cisneros    [Tags]  Verify_Authentication_Type_Support
1521c7408f5SJorge Cisneros
1531c7408f5SJorge Cisneros    ${ipmi_output}=  Run IPMI Command
1541c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
1551c7408f5SJorge Cisneros
1561c7408f5SJorge Cisneros    ${authentication_type_support}=  Split String  ${ipmi_output}
1571c7408f5SJorge Cisneros    # All bits:
1581c7408f5SJorge Cisneros    # 1b = supported
1591c7408f5SJorge Cisneros    # 0b = authentication type not available for use
1601c7408f5SJorge Cisneros    # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
1611c7408f5SJorge Cisneros    # [4] - straight password / key
1621c7408f5SJorge Cisneros    # [3] - reserved
1631c7408f5SJorge Cisneros    # [2] - MD5
1641c7408f5SJorge Cisneros    # [1] - MD2
1651c7408f5SJorge Cisneros    # [0] - none
1661c7408f5SJorge Cisneros    Should Contain Any  ${authentication_type_support[1]}  00  01  02  03  04  05
1671c7408f5SJorge Cisneros
1681c7408f5SJorge Cisneros
1691c7408f5SJorge CisnerosVerify Set In Progress
1701c7408f5SJorge Cisneros    [Documentation]  Verify Set In Progress which belongs to LAN Configuration Parameters
1711c7408f5SJorge Cisneros    ...              via IPMI raw Command.
1721c7408f5SJorge Cisneros    [Tags]  Verify_Set_In_Progress
1731c7408f5SJorge Cisneros
1741c7408f5SJorge Cisneros   # Set the Set In Progress
1751c7408f5SJorge Cisneros    ${output_msg}=  Run Inband IPMI Raw Command
1761c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x01
1771c7408f5SJorge Cisneros
1781c7408f5SJorge Cisneros    # Get the Set In Progress
1791c7408f5SJorge Cisneros    ${ipmi_output}=  Run Inband IPMI Raw Command
1801c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
1811c7408f5SJorge Cisneros
1821c7408f5SJorge Cisneros    # Verify the response
1831c7408f5SJorge Cisneros    ${ipmi_output}=  Split String  ${ipmi_output}
1841c7408f5SJorge Cisneros    ${set_in_progress_value}=  Set Variable  ${ipmi_output[1]}
1851c7408f5SJorge Cisneros
1861c7408f5SJorge Cisneros    # 01b = set in progress.
1871c7408f5SJorge Cisneros    Should be Equal  ${set_in_progress_value}  01
1881c7408f5SJorge Cisneros
1891c7408f5SJorge Cisneros    # set back to default.
1901c7408f5SJorge Cisneros    Run IPMI Command  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x00
1911c7408f5SJorge Cisneros
1921c7408f5SJorge Cisneros    # Get the Set In Progress.
1931c7408f5SJorge Cisneros    ${ipmi_output}=  Run Inband IPMI Raw Command
1941c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
1951c7408f5SJorge Cisneros
1961c7408f5SJorge Cisneros    # Verify the response.
1971c7408f5SJorge Cisneros    ${ipmi_output}=  Split String  ${ipmi_output}
1981c7408f5SJorge Cisneros    ${set_in_progress_value}=  Set Variable  ${ipmi_output[1]}
1991c7408f5SJorge Cisneros
2001c7408f5SJorge Cisneros    # 00b = set complete.
2011c7408f5SJorge Cisneros    Should be Equal  ${set_in_progress_value}  00
2021c7408f5SJorge Cisneros
2031c7408f5SJorge Cisneros
2041c7408f5SJorge CisnerosVerify Invalid Set MAC Address Via IPMI
2051c7408f5SJorge Cisneros    [Documentation]  Verify Get and Set MAC address via IPMI.
2061c7408f5SJorge Cisneros    [Tags]  Verify_Invalid_Set_MAC_Address_Via_IPMI
2071c7408f5SJorge Cisneros
2081c7408f5SJorge Cisneros    # MAC to hexa string.
2091c7408f5SJorge Cisneros    ${Invalid_mac_address_hex}=  Mac Address To Hex String  ${Invalid_mac_address}
2101c7408f5SJorge Cisneros
2111c7408f5SJorge Cisneros    # Set MAC Address with invalid data.
2121c7408f5SJorge Cisneros    ${cmd}=  Catenate  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
21327d779d0Sishwaryamathim    ...  0x05 ${Invalid_mac_address_hex}
21427d779d0Sishwaryamathim    ${ipmi_set_output}=  Run Inband IPMI Raw Command  ${cmd}  fail_on_err=0
2151c7408f5SJorge Cisneros
2161c7408f5SJorge Cisneros    Should Contain  ${ipmi_set_output}  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}
2171c7408f5SJorge Cisneros
2181c7408f5SJorge Cisneros
2191c7408f5SJorge CisnerosVerify Get And Set MAC Address Via IPMI
2201c7408f5SJorge Cisneros    [Documentation]  Verify Get and Set MAC address via IPMI.
2211c7408f5SJorge Cisneros    [Tags]  Verify_Get_And_Set_MAC_Address_Via_IPMI
2221c7408f5SJorge Cisneros    [Setup]  Fetch The Default Mac Address
2231c7408f5SJorge Cisneros    [Teardown]  Set Default Mac And Verify  ${ipmi_default_mac_split}
2241c7408f5SJorge Cisneros
2251c7408f5SJorge Cisneros    # MAC to hexa string.
2261c7408f5SJorge Cisneros    ${mac_address_hex}=  Mac Address To Hex String  ${set_mac_address}
2271c7408f5SJorge Cisneros
2281c7408f5SJorge Cisneros    # Set the MAC address.
2291c7408f5SJorge Cisneros    ${cmd}=  Catenate  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
23027d779d0Sishwaryamathim    ...  0x05 ${mac_address_hex}
23127d779d0Sishwaryamathim    ${ipmi_set_output}=  Run Inband IPMI Raw Command  ${cmd}  fail_on_err=0
2321c7408f5SJorge Cisneros
2331c7408f5SJorge Cisneros    # Get the MAC address and verify.
2341c7408f5SJorge Cisneros    ${ipmi_output}=  Run Inband IPMI Raw Command
2351c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
2361c7408f5SJorge Cisneros    ${ipmi_output_split}=  Split String  ${ipmi_output}
2371c7408f5SJorge Cisneros    ${get_mac}=   Evaluate  ":".join(${ipmi_output_split[1:]})
2381c7408f5SJorge Cisneros
2391c7408f5SJorge Cisneros    Should be Equal  ${get_mac}  ${set_mac_address}
2401c7408f5SJorge Cisneros
2411c7408f5SJorge Cisneros
2421c7408f5SJorge CisnerosVerify Cipher Suite Privilege
2431c7408f5SJorge Cisneros    [Documentation]  Verify cipher suite privilege which belongs to LAN Configuration Parameters
2441c7408f5SJorge Cisneros    ...              via IPMI raw Command.
2451c7408f5SJorge Cisneros    [Tags]  Verify_Cipher_Suite_Privilege
2461c7408f5SJorge Cisneros
2471c7408f5SJorge Cisneros    # Get the Cipher Suite privilege and verify the response.
2481c7408f5SJorge Cisneros    ${ipmi_output}=  Run Inband IPMI Raw Command
2491c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x18 0x00 0x00
2501c7408f5SJorge Cisneros    ${cipher_suite_privilege}=  Split String  ${ipmi_output}
2511c7408f5SJorge Cisneros
2521c7408f5SJorge Cisneros    Should be Equal  '${${cipher_suite_privilege}[0]}'  '11'
2531c7408f5SJorge Cisneros    # 00b = reserved.
2541c7408f5SJorge Cisneros    Should Contain Any  '${cipher_suite_privilege[1]}'  '00'  '0'
2551c7408f5SJorge Cisneros
2561c7408f5SJorge Cisneros    ${cipher_suite_privilege_length}=  Get length  ${cipher_suite_privilege}
2571c7408f5SJorge Cisneros    Should be Equal  '${cipher_suite_privilege_length}'  '10'
2581c7408f5SJorge Cisneros
2591c7408f5SJorge Cisneros    #44b = Maximum privilege for cipher suite.
2601c7408f5SJorge Cisneros    FOR  ${channel_number}  IN RANGE  2  ${cipher_suite_privilege_length}
2611c7408f5SJorge Cisneros      Should be Equal  '${cipher_suite_privilege[${channel_number}]}'  '44'
2621c7408f5SJorge Cisneros    END
2631c7408f5SJorge Cisneros
2641c7408f5SJorge Cisneros
2651c7408f5SJorge CisnerosVerify Set On Authentication Type
2661c7408f5SJorge Cisneros    [Documentation]  Verify Set On Authentication Type which belongs to LAN Configuration Parameters
2671c7408f5SJorge Cisneros    ...              via IPMI raw Command.
2681c7408f5SJorge Cisneros    [Tags]  Verify_Set_On_Authentication_Type
2691c7408f5SJorge Cisneros
2701c7408f5SJorge Cisneros    # Set Authentication Type and expect error.
2711c7408f5SJorge Cisneros    ${ipmi_output}=  Run Inband IPMI Raw Command
2721c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x01 0x01  fail_on_err=0
2731c7408f5SJorge Cisneros
2741c7408f5SJorge Cisneros    Should Contain  ${ipmi_output}  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][2]}
2751c7408f5SJorge Cisneros
2761c7408f5SJorge Cisneros
2771c7408f5SJorge CisnerosVerify IP Address Source Set To Address Loaded By BIOS
2781c7408f5SJorge Cisneros    [Documentation]  Verify Set IP Address Source to address loaded by BIOS or system software via IPMI.
2791c7408f5SJorge Cisneros    [Tags]  Verify_IP_Address_Source_Set_To_Address_Loaded_By_BIOS
2801c7408f5SJorge Cisneros
2811c7408f5SJorge Cisneros    # Set IP address source to address loaded by BIOS or system software.
2821c7408f5SJorge Cisneros    ${ipmi_output}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
2831c7408f5SJorge Cisneros    ...  Run Inband IPMI Raw Command
2841c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03
2851c7408f5SJorge Cisneros
2861c7408f5SJorge Cisneros
2871c7408f5SJorge CisnerosVerify IP Address Source Set To Address Obtained By BMC
2881c7408f5SJorge Cisneros    [Documentation]  Verify Set IP Address Source to address obtained by,
2891c7408f5SJorge Cisneros    ...              BMC running other address assignment protocol via IPMI.
2901c7408f5SJorge Cisneros    [Tags]  Verify_IP_Address_Source_Set_To_Address_Obtained_By_BMC
2911c7408f5SJorge Cisneros
2921c7408f5SJorge Cisneros    # Set IP address source to address obtained by BMC running other address assignment protocol
2931c7408f5SJorge Cisneros    ${ipmi_output}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
2941c7408f5SJorge Cisneros    ...  Run Inband IPMI Raw Command
2951c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04
2961c7408f5SJorge Cisneros
2971c7408f5SJorge Cisneros
2981c7408f5SJorge CisnerosVerify IP Address Source Set To Unspecified Address Source
2991c7408f5SJorge Cisneros    [Documentation]  Verify Set IP Address source to unspecified address source via IPMI.
3001c7408f5SJorge Cisneros    [Tags]  Verify_IP_Address_Source_Set_To_Unspecified_Address_Source
3011c7408f5SJorge Cisneros
3021c7408f5SJorge Cisneros    # Set IP address source to unspecified address source.
3031c7408f5SJorge Cisneros    ${ipmi_output}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
3041c7408f5SJorge Cisneros    ...  Run Inband IPMI Raw Command
3051c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00
3061c7408f5SJorge Cisneros
3071c7408f5SJorge Cisneros
3081c7408f5SJorge Cisneros*** Keywords ***
3091c7408f5SJorge Cisneros
3101c7408f5SJorge CisnerosGet Physical Network Interface Count
3111c7408f5SJorge Cisneros    [Documentation]  Return valid physical network interfaces count.
3121c7408f5SJorge Cisneros    # Example:
3131c7408f5SJorge Cisneros    # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
3141c7408f5SJorge Cisneros    # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
3151c7408f5SJorge Cisneros
3161c7408f5SJorge Cisneros    ${mac_entry_list}=  Get BMC MAC Address List
3171c7408f5SJorge Cisneros    ${mac_unique_list}=  Remove Duplicates  ${mac_entry_list}
3181c7408f5SJorge Cisneros    ${physical_interface_count}=  Get Length  ${mac_unique_list}
3191c7408f5SJorge Cisneros
320409df05dSGeorge Keishing    RETURN  ${physical_interface_count}
3211c7408f5SJorge Cisneros
3221c7408f5SJorge Cisneros
3231c7408f5SJorge CisnerosVerify Channel Info
3241c7408f5SJorge Cisneros    [Documentation]  Verify the channel info.
325e9cecb2eSishwaryamathim    [Arguments]  ${channel_number}  ${network_parameter}  ${valid_channels_list}
3261c7408f5SJorge Cisneros
3271c7408f5SJorge Cisneros    Run Keyword If  '${network_parameter}' == 'IPv4StaticAddresses'
328e9cecb2eSishwaryamathim    ...    Verify IPv4 Static Address  ${channel_number}  ${valid_channels_list}
3291c7408f5SJorge Cisneros    ...  ELSE IF  '${network_parameter}' == 'MACAddress'
330e9cecb2eSishwaryamathim    ...    Verify MAC Address  ${channel_number}  ${valid_channels_list}
3311c7408f5SJorge Cisneros
3321c7408f5SJorge Cisneros
3331c7408f5SJorge CisnerosVerify IPv4 Static Address
3341c7408f5SJorge Cisneros    [Documentation]  Verify the IPv4 Static Address.
335e9cecb2eSishwaryamathim    [Arguments]  ${channel_number}  ${valid_channels_list}
3361c7408f5SJorge Cisneros
3371c7408f5SJorge Cisneros    ${lan_print_ipmi}=  Get LAN Print Dict  ${channel_number}
3381c7408f5SJorge Cisneros    ${ipv4_static_addresses}=  Redfish.Get Attribute
339e9cecb2eSishwaryamathim    ...  ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']}  IPv4StaticAddresses
3401c7408f5SJorge Cisneros    ${redfish_ips}=  Nested Get  Address  ${ipv4_static_addresses}
3411c7408f5SJorge Cisneros    Rprint Vars  lan_print_ipmi  ipv4_static_addresses  redfish_ips
3421c7408f5SJorge Cisneros    Valid Value  lan_print_ipmi['IP Address']  ${redfish_ips}
3431c7408f5SJorge Cisneros
3441c7408f5SJorge Cisneros
3451c7408f5SJorge CisnerosVerify MAC Address
3461c7408f5SJorge Cisneros    [Documentation]  Verify the MAC Address.
347e9cecb2eSishwaryamathim    [Arguments]  ${channel_number}  ${valid_channels_list}
3481c7408f5SJorge Cisneros
3491c7408f5SJorge Cisneros    ${lan_print_ipmi}=  Get LAN Print Dict  ${channel_number}
3501c7408f5SJorge Cisneros    ${redfish_mac_address}=  Redfish.Get Attribute
351e9cecb2eSishwaryamathim    ...  ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']}  MACAddress
3521c7408f5SJorge Cisneros    Rprint Vars  lan_print_ipmi  redfish_mac_address
3531c7408f5SJorge Cisneros    Valid Value  lan_print_ipmi['MAC Address']  ['${redfish_mac_address}']
3541c7408f5SJorge Cisneros
3551c7408f5SJorge Cisneros
3561c7408f5SJorge CisnerosFetch The Default Mac Address
3571c7408f5SJorge Cisneros    [Documentation]  Fetch The Default MAC Address.
3581c7408f5SJorge Cisneros
3591c7408f5SJorge Cisneros     # Get Default MAC Address.
3601c7408f5SJorge Cisneros    ${ipmi_get_default_mac}=  Run Inband IPMI Raw Command
3611c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
3621c7408f5SJorge Cisneros    Set Test Variable  ${ipmi_get_default_mac}
3631c7408f5SJorge Cisneros
3641c7408f5SJorge Cisneros    # After splitting, list will have each byte of MAC address.
3651c7408f5SJorge Cisneros    ${ipmi_default_mac_split}=  Split String  ${ipmi_get_default_mac}
3661c7408f5SJorge Cisneros    Set Test Variable  ${ipmi_default_mac_split}
3671c7408f5SJorge Cisneros
3681c7408f5SJorge Cisneros
3691c7408f5SJorge CisnerosSet Default Mac And Verify
3701c7408f5SJorge Cisneros    [Documentation]  Set Default Mac And Verify.
3711c7408f5SJorge Cisneros    [Arguments]  ${default_mac}=${ipmi_default_mac_split}
3721c7408f5SJorge Cisneros
3731c7408f5SJorge Cisneros    ${set_default_mac}=   Evaluate  ":".join(${default_mac[1:]})
3741c7408f5SJorge Cisneros    ${default_mac_address_hex}=  Mac Address To Hex String  ${set_default_mac}
3751c7408f5SJorge Cisneros
3761c7408f5SJorge Cisneros    # Set the Default MAC address.
3771c7408f5SJorge Cisneros    ${cmd}=  Catenate  ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
37827d779d0Sishwaryamathim    ...  0x05 ${default_mac_address_hex}
37927d779d0Sishwaryamathim    ${ipmi_set_output}=  Run Inband IPMI Raw Command  ${cmd}  fail_on_err=0
3801c7408f5SJorge Cisneros
3811c7408f5SJorge Cisneros    # check whether the default MAC is set.
3821c7408f5SJorge Cisneros    ${ipmi_get_mac}=  Run Inband IPMI Raw Command
3831c7408f5SJorge Cisneros    ...  ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
3841c7408f5SJorge Cisneros
3851c7408f5SJorge Cisneros    ${ipmi_out}=  Split String  ${ipmi_get_mac}
3861c7408f5SJorge Cisneros    Should be Equal  ${default_mac}  ${ipmi_out}
387