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 |
George Keishing | 6f395fd | 2021-08-18 02:18:53 -0500 | [diff] [blame] | 7 | Resource ../lib/boot_utils.robot |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 8 | Library ../lib/ipmi_utils.py |
| 9 | Library ../lib/gen_robot_valid.py |
| 10 | Library ../lib/var_funcs.py |
| 11 | Library ../lib/bmc_network_utils.py |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 12 | Variables ../data/ipmi_raw_cmd_table.py |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 13 | |
| 14 | Suite Setup Suite Setup Execution |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 15 | Suite Teardown Redfish.Logout |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 16 | Test Setup Printn |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 17 | Test Teardown Test Teardown Execution |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 18 | |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 19 | Force Tags IPMI_Network_Configuration |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 20 | |
| 21 | *** Variables *** |
George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 22 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 23 | ${vlan_id_for_ipmi} ${10} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 24 | @{vlan_ids} ${20} ${30} |
| 25 | ${interface} eth0 |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 26 | ${initial_lan_config} &{EMPTY} |
| 27 | ${vlan_resource} ${NETWORK_MANAGER}action/VLAN |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 28 | ${subnet_mask} ${24} |
| 29 | ${gateway_ip} 0.0.0.0 |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 30 | ${vlan_id_for_rest} ${30} |
| 31 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 32 | |
| 33 | *** Test Cases *** |
| 34 | |
| 35 | Verify IPMI Inband Network Configuration |
| 36 | [Documentation] Verify BMC network configuration via inband IPMI. |
| 37 | [Tags] Verify_IPMI_Inband_Network_Configuration |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 38 | [Teardown] Run Keywords Restore Configuration AND set_base_url https://${OPENBMC_HOST}:${HTTPS_PORT} |
| 39 | ... AND FFDC On Test Case Fail AND |
| 40 | ... Redfish.Login AND Run IPMI Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 41 | |
| 42 | Redfish Power On |
| 43 | |
Tony Lee | 374a538 | 2021-08-09 19:22:44 +0800 | [diff] [blame] | 44 | Set IPMI Inband Network Configuration ${STATIC_IP} ${NETMASK} ${GATEWAY} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 45 | Sleep 10 |
| 46 | |
| 47 | ${lan_print_output}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
Tony Lee | 374a538 | 2021-08-09 19:22:44 +0800 | [diff] [blame] | 48 | Valid Value lan_print_output['IP Address'] ["${STATIC_IP}"] |
| 49 | Valid Value lan_print_output['Subnet Mask'] ["${NETMASK}"] |
| 50 | Valid Value lan_print_output['Default Gateway IP'] ["${GATEWAY}"] |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 51 | |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 52 | # To verify changed static ip is communicable through external IPMI cmd. |
| 53 | Run External IPMI Raw Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} H=${STATIC_IP} |
| 54 | |
| 55 | set_base_url https://${STATIC_IP}:${HTTPS_PORT} |
| 56 | Redfish.Login |
| 57 | |
| 58 | |
| 59 | ${ipv4_addresses}= Redfish.Get Attribute |
| 60 | ... ${REDFISH_NW_ETH_IFACE}${interface} IPv4Addresses |
| 61 | |
| 62 | FOR ${ipv4_address} IN @{ipv4_addresses} |
| 63 | ${ip_address}= Set Variable if '${ipv4_address['Address']}' == '${STATIC_IP}' |
| 64 | ... ${ipv4_address} |
| 65 | Exit For Loop If ${ip_address} != None |
| 66 | END |
| 67 | |
| 68 | Should Be Equal ${ip_address['AddressOrigin']} Static |
| 69 | Should Be Equal ${ip_address['SubnetMask']} ${NETMASK} |
| 70 | Should Be Equal ${ip_address['Gateway']} ${GATEWAY} |
| 71 | |
| 72 | Redfish.Logout |
| 73 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 74 | |
| 75 | Disable VLAN Via IPMI When Multiple VLAN Exist On BMC |
| 76 | [Documentation] Disable VLAN Via IPMI When Multiple VLAN Exist On BMC. |
George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 77 | [Tags] Disable_VLAN_Via_IPMI_When_Multiple_VLAN_Exist_On_BMC |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 78 | |
Anves Kumar rayankula | 1ee5332 | 2020-07-06 23:46:44 -0500 | [diff] [blame] | 79 | FOR ${vlan_id} IN @{vlan_ids} |
| 80 | Create VLAN ${vlan_id} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 81 | END |
| 82 | |
| 83 | Create VLAN Via IPMI off |
| 84 | |
| 85 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 86 | Valid Value lan_config['802.1q VLAN ID'] ['Disabled'] |
| 87 | |
| 88 | |
| 89 | Configure IP On VLAN Via IPMI |
| 90 | [Documentation] Configure IP On VLAN Via IPMI. |
| 91 | [Tags] Configure_IP_On_VLAN_Via_IPMI |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 92 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 93 | Create VLAN Via IPMI ${vlan_id_for_ipmi} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 94 | |
| 95 | Run Inband IPMI Standard Command |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 96 | ... lan set ${CHANNEL_NUMBER} ipaddr ${STATIC_IP} login_host=${0} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 97 | |
| 98 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 99 | Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 100 | Valid Value lan_config['IP Address'] ["${STATIC_IP}"] |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 101 | |
| 102 | |
| 103 | Create VLAN Via IPMI When LAN And VLAN Exist On BMC |
| 104 | [Documentation] Create VLAN Via IPMI When LAN And VLAN Exist On BMC. |
| 105 | [Tags] Create_VLAN_Via_IPMI_When_LAN_And_VLAN_Exist_On_BMC |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 106 | [Setup] Create VLAN ${vlan_id_for_rest} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 107 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 108 | Create VLAN Via IPMI ${vlan_id_for_ipmi} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 109 | |
| 110 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 111 | Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 112 | |
| 113 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 114 | Create VLAN Via IPMI And Verify |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 115 | [Documentation] Create and verify VLAN via IPMI. |
| 116 | [Tags] Create_VLAN_Via_IPMI_And_Verify |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 117 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 118 | Create VLAN Via IPMI ${vlan_id_for_ipmi} |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 119 | |
| 120 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 121 | Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 122 | Valid Value lan_config['IP Address'] ['${ip_address}'] |
| 123 | Valid Value lan_config['Subnet Mask'] ['${subnet_mask}'] |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 124 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 125 | Test Disabling Of VLAN Via IPMI |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 126 | [Documentation] Disable VLAN and verify via IPMI. |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 127 | [Tags] Test_Disabling_Of_VLAN_Via_IPMI |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 128 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 129 | Create VLAN Via IPMI ${vlan_id_for_ipmi} |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 130 | Create VLAN Via IPMI off |
| 131 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 132 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
Anvesh Kumar Rayankula | 74ed739 | 2020-02-10 01:00:11 -0600 | [diff] [blame] | 133 | Valid Value lan_config['802.1q VLAN ID'] ['Disabled'] |
| 134 | |
| 135 | |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 136 | Create VLAN When LAN And VLAN Exist With IP Address Configured |
| 137 | [Documentation] Create VLAN when LAN and VLAN exist with IP address configured. |
| 138 | [Tags] Create_VLAN_When_LAN_And_VLAN_Exist_With_IP_Address_Configured |
Brian Ma | c658f1d | 2022-03-11 16:35:41 +0800 | [diff] [blame] | 139 | [Setup] Run Keywords Create VLAN ${vlan_id_for_rest} interface=${interface} |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 140 | ... AND Configure Network Settings On VLAN ${vlan_id_for_rest} ${STATIC_IP} |
Brian Ma | c658f1d | 2022-03-11 16:35:41 +0800 | [diff] [blame] | 141 | ... ${netmask} ${gateway} interface=${interface} |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 142 | |
| 143 | Create VLAN Via IPMI ${vlan_id_for_ipmi} |
| 144 | |
| 145 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 146 | Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] |
ishwaryamathim | 64a7bb0 | 2023-11-10 08:57:20 +0000 | [diff] [blame] | 147 | Valid Value lan_config['IP Address'] ['${STATIC_IP}'] |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 148 | |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 149 | |
| 150 | Create Multiple VLANs Via IPMI And Verify |
| 151 | [Documentation] Create multiple VLANs through IPMI. |
| 152 | [Tags] Create_Multiple_VLANs_Via_IPMI_And_Verify |
| 153 | |
| 154 | FOR ${vlan_id} IN @{vlan_ids} |
| 155 | |
| 156 | Create VLAN Via IPMI ${vlan_id} |
| 157 | |
| 158 | ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 159 | |
| 160 | # Validate VLAN creation. |
| 161 | Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id}'] |
| 162 | |
| 163 | # Validate existing IP address. |
| 164 | Valid Value lan_config['IP Address'] ['${ip_address}'] |
| 165 | |
| 166 | # Validate existing subnet mask. |
| 167 | Valid Value lan_config['Subnet Mask'] ['${subnet_mask}'] |
| 168 | END |
| 169 | |
| 170 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 171 | *** Keywords *** |
| 172 | |
| 173 | Create VLAN Via IPMI |
| 174 | [Documentation] Create VLAN via inband IPMI command. |
| 175 | [Arguments] ${vlan_id} ${channel_number}=${CHANNEL_NUMBER} |
| 176 | |
| 177 | # Description of argument(s): |
| 178 | # vlan_id The VLAN ID (e.g. '10'). |
| 179 | |
| 180 | Run Inband IPMI Standard Command |
| 181 | ... lan set ${channel_number} vlan id ${vlan_id} login_host=${0} |
| 182 | |
| 183 | |
| 184 | Set IPMI Inband Network Configuration |
| 185 | [Documentation] Run sequence of standard IPMI command in-band and set |
| 186 | ... the IP configuration. |
| 187 | [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1} |
| 188 | |
| 189 | # Description of argument(s): |
| 190 | # ip The IP address to be set using ipmitool-inband. |
| 191 | # netmask The Netmask to be set using ipmitool-inband. |
| 192 | # gateway The Gateway address to be set using ipmitool-inband. |
| 193 | |
| 194 | Run Inband IPMI Standard Command |
| 195 | ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${login} |
| 196 | Run Inband IPMI Standard Command |
| 197 | ... lan set ${CHANNEL_NUMBER} ipaddr ${ip} login_host=${0} |
| 198 | Run Inband IPMI Standard Command |
| 199 | ... lan set ${CHANNEL_NUMBER} netmask ${netmask} login_host=${0} |
| 200 | Run Inband IPMI Standard Command |
| 201 | ... lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway} login_host=${0} |
| 202 | |
| 203 | |
| 204 | Restore Configuration |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 205 | [Documentation] Restore the configuration to its pre-test state. |
| 206 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 207 | ${length}= Get Length ${initial_lan_config} |
| 208 | Return From Keyword If ${length} == ${0} |
| 209 | |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 210 | Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask} |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 211 | ... ${initial_lan_config['Default Gateway IP']} login=${0} |
| 212 | |
| 213 | |
| 214 | Suite Setup Execution |
| 215 | [Documentation] Suite Setup Execution. |
| 216 | |
| 217 | Redfish.Login |
Anves Kumar rayankula | 1ee5332 | 2020-07-06 23:46:44 -0500 | [diff] [blame] | 218 | |
| 219 | ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband |
| 220 | Set Suite Variable ${initial_lan_config} |
| 221 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 222 | Run Inband IPMI Standard Command |
| 223 | ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1} |
| 224 | |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 225 | ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST} |
| 226 | Set Suite Variable ${ip_address} |
| 227 | |
George Keishing | 364e93d | 2020-03-05 04:31:49 -0600 | [diff] [blame] | 228 | @{network_configurations}= Get Network Configuration |
Anvesh Kumar Rayankula | 8e25b8f | 2020-04-06 01:18:37 -0500 | [diff] [blame] | 229 | FOR ${network_configuration} IN @{network_configurations} |
| 230 | Run Keyword If '${network_configuration['Address']}' == '${ip_address}' |
| 231 | ... Run Keywords Set Suite Variable ${subnet_mask} ${network_configuration['SubnetMask']} AND |
| 232 | ... Exit For Loop |
| 233 | END |
Anvesh Kumar Rayankula | e354c1c | 2020-03-09 06:01:13 -0500 | [diff] [blame] | 234 | |
| 235 | Test Teardown Execution |
| 236 | [Documentation] Test Teardown Execution. |
| 237 | |
| 238 | FFDC On Test Case Fail |
| 239 | Create VLAN Via IPMI off |
| 240 | Restore Configuration |