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