George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test IPMI network functionality. |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | Resource ../lib/bmc_network_utils.robot |
| 7 | Library ../lib/ipmi_utils.py |
| 8 | Library ../lib/gen_robot_valid.py |
| 9 | Library ../lib/var_funcs.py |
| 10 | Library ../lib/bmc_network_utils.py |
Tony Lee | c03c8e2 | 2020-03-25 13:41:07 +0800 | [diff] [blame] | 11 | Variables ../data/ipmi_raw_cmd_table.py |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 12 | |
| 13 | Suite Setup Redfish.Login |
| 14 | Test Setup Printn |
| 15 | Test Teardown FFDC On Test Case Fail |
| 16 | |
| 17 | Force Tags IPMI_Network_Verify |
| 18 | |
| 19 | *** Test Cases *** |
| 20 | |
| 21 | Retrieve IP Address Via IPMI And Verify Using Redfish |
| 22 | [Documentation] Retrieve IP address using IPMI and verify using Redfish. |
| 23 | [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redish |
| 24 | |
| 25 | ${active_channel_config}= Get Active Channel Config |
| 26 | FOR ${channel_number} IN @{active_channel_config.keys()} |
| 27 | Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config} |
| 28 | END |
| 29 | |
| 30 | Retrieve Default Gateway Via IPMI And Verify |
| 31 | [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC. |
| 32 | [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify |
| 33 | |
| 34 | ${lan_print_ipmi}= Get LAN Print Dict |
| 35 | |
| 36 | Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']} |
| 37 | |
| 38 | |
| 39 | Retrieve MAC Address Via IPMI And Verify Using Redfish |
| 40 | [Documentation] Retrieve MAC address via IPMI and verify using Redfish. |
| 41 | [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish |
| 42 | |
| 43 | ${active_channel_config}= Get Active Channel Config |
| 44 | FOR ${channel_number} IN @{active_channel_config.keys()} |
| 45 | Verify Channel Info ${channel_number} MACAddress ${active_channel_config} |
| 46 | END |
| 47 | |
| 48 | |
| 49 | Test Valid IPMI Channels Supported |
| 50 | [Documentation] Verify IPMI channels supported on a given system. |
| 51 | [Tags] Test_Valid_IPMI_Channels_Supported |
| 52 | |
| 53 | ${channel_count}= Get Physical Network Interface Count |
| 54 | |
| 55 | # Note: IPMI network channel logically starts from 1. |
| 56 | FOR ${channel_number} IN RANGE 1 ${channel_count} |
| 57 | Run IPMI Standard Command lan print ${channel_number} |
| 58 | END |
| 59 | |
| 60 | |
| 61 | Test Invalid IPMI Channel Response |
| 62 | [Documentation] Verify invalid IPMI channels supported response. |
| 63 | [Tags] Test_Invalid_IPMI_Channel_Response |
| 64 | |
| 65 | ${channel_count}= Get Physical Network Interface Count |
| 66 | |
| 67 | # To target invalid channel, increment count. |
| 68 | ${channel_number}= Evaluate ${channel_count} + 1 |
| 69 | |
| 70 | # Example of invalid channel: |
| 71 | # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3 |
| 72 | # Get Channel Info command failed: Parameter out of range |
| 73 | # Invalid channel: 3 |
| 74 | |
| 75 | ${stdout}= Run External IPMI Standard Command |
| 76 | ... lan print ${channel_number} fail_on_err=${0} |
| 77 | Should Contain ${stdout} Invalid channel |
| 78 | ... msg=IPMI channel ${channel_number} is invalid but seen working. |
| 79 | |
| 80 | |
| 81 | Get IP Address Source And Verify Using Redfish |
| 82 | [Documentation] Get IP address source and verify it using Redfish. |
| 83 | [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish |
| 84 | |
| 85 | ${active_channel_config}= Get Active Channel Config |
| 86 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} |
| 87 | |
| 88 | ${ipv4_addresses}= Redfish.Get Attribute |
| 89 | ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} |
| 90 | ... IPv4Addresses |
| 91 | |
| 92 | FOR ${ipv4_address} IN @{ipv4_addresses} |
| 93 | ${ip_address_source}= |
| 94 | ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}' |
| 95 | ... ${ipv4_address['AddressOrigin']} Address |
| 96 | Exit For Loop IF "${ip_address_source}" != 'None' |
| 97 | END |
| 98 | |
| 99 | Valid Value lan_config['IP Address Source'] ['${ip_address_source}'] |
| 100 | |
| 101 | |
Tony Lee | c03c8e2 | 2020-03-25 13:41:07 +0800 | [diff] [blame] | 102 | Verify Get Set In Progress |
| 103 | [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters |
| 104 | ... via IPMI raw Command. |
Tony Lee | 5e73552 | 2020-05-13 20:23:38 +0800 | [diff] [blame] | 105 | [Tags] Verify_Get_Set_In_Progress |
Tony Lee | c03c8e2 | 2020-03-25 13:41:07 +0800 | [diff] [blame] | 106 | |
| 107 | ${ipmi_output}= Run IPMI Command |
| 108 | ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00 |
| 109 | |
| 110 | ${ipmi_output}= Split String ${ipmi_output} |
| 111 | ${set_in_progress_value}= Set Variable ${ipmi_output[1]} |
| 112 | |
| 113 | # 00b = set complete. |
| 114 | # 01b = set in progress. |
| 115 | Should Contain Any ${set_in_progress_value} 00 01 |
| 116 | |
| 117 | |
| 118 | Verify Cipher Suite Entry Count |
| 119 | [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters |
| 120 | ... via IPMI raw Command. |
Tony Lee | 5e73552 | 2020-05-13 20:23:38 +0800 | [diff] [blame] | 121 | [Tags] Verify_Cipher_Suite_Entry_Count |
Tony Lee | c03c8e2 | 2020-03-25 13:41:07 +0800 | [diff] [blame] | 122 | |
| 123 | ${ipmi_output}= Run IPMI Command |
| 124 | ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00 |
| 125 | ${cipher_suite_entry_count}= Split String ${ipmi_output} |
| 126 | |
| 127 | # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1. |
| 128 | ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]} |
| 129 | ${cnt}= Get length ${valid_ciphers} |
| 130 | |
| 131 | Should be Equal ${cipher_suite_entry_count[1]} ${cnt} |
| 132 | |
| 133 | |
| 134 | Verify Authentication Type Support |
| 135 | [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters |
| 136 | ... via IPMI raw Command. |
Tony Lee | 5e73552 | 2020-05-13 20:23:38 +0800 | [diff] [blame] | 137 | [Tags] Verify_Authentication_Type_Support |
Tony Lee | c03c8e2 | 2020-03-25 13:41:07 +0800 | [diff] [blame] | 138 | |
| 139 | ${ipmi_output}= Run IPMI Command |
| 140 | ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00 |
| 141 | |
| 142 | ${authentication_type_support}= Split String ${ipmi_output} |
| 143 | # All bits: |
| 144 | # 1b = supported |
| 145 | # 0b = authentication type not available for use |
| 146 | # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response) |
| 147 | # [4] - straight password / key |
| 148 | # [3] - reserved |
| 149 | # [2] - MD5 |
| 150 | # [1] - MD2 |
| 151 | # [0] - none |
| 152 | Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05 |
| 153 | |
| 154 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 155 | *** Keywords *** |
| 156 | |
| 157 | Get Physical Network Interface Count |
| 158 | [Documentation] Return valid physical network interfaces count. |
| 159 | # Example: |
| 160 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff |
| 161 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff |
| 162 | |
| 163 | ${mac_entry_list}= Get BMC MAC Address List |
| 164 | ${mac_unique_list}= Remove Duplicates ${mac_entry_list} |
| 165 | ${physical_interface_count}= Get Length ${mac_unique_list} |
| 166 | |
| 167 | [Return] ${physical_interface_count} |
| 168 | |
| 169 | |
| 170 | Verify Channel Info |
| 171 | [Documentation] Verify the channel info. |
| 172 | [Arguments] ${channel_number} ${network_parameter} ${active_channel_config} |
| 173 | |
| 174 | Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses' |
| 175 | ... Verify IPv4 Static Address ${channel_number} ${active_channel_config} |
| 176 | ... ELSE IF '${network_parameter}' == 'MACAddress' |
| 177 | ... Verify MAC Address ${channel_number} ${active_channel_config} |
| 178 | |
| 179 | |
| 180 | Verify IPv4 Static Address |
| 181 | [Documentation] Verify the IPv4 Static Address. |
| 182 | [Arguments] ${channel_number} ${active_channel_config} |
| 183 | |
| 184 | ${lan_print_ipmi}= Get LAN Print Dict ${channel_number} |
| 185 | ${ipv4_static_addresses}= Redfish.Get Attribute |
| 186 | ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses |
| 187 | ${redfish_ips}= Nested Get Address ${ipv4_static_addresses} |
| 188 | Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips |
| 189 | Valid Value lan_print_ipmi['IP Address'] ${redfish_ips} |
| 190 | |
| 191 | |
| 192 | Verify MAC Address |
| 193 | [Documentation] Verify the MAC Address. |
| 194 | [Arguments] ${channel_number} ${active_channel_config} |
| 195 | |
| 196 | ${lan_print_ipmi}= Get LAN Print Dict ${channel_number} |
| 197 | ${redfish_mac_address}= Redfish.Get Attribute |
| 198 | ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress |
| 199 | Rprint Vars lan_print_ipmi redfish_mac_address |
| 200 | Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}'] |