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