1*** Settings *** 2 3Documentation Module to test IPMI network functionality. 4Resource ../lib/ipmi_client.robot 5Resource ../lib/openbmc_ffdc.robot 6Resource ../lib/bmc_network_utils.robot 7Resource ../lib/boot_utils.robot 8Library ../lib/ipmi_utils.py 9Library ../lib/gen_robot_valid.py 10Library ../lib/var_funcs.py 11Library ../lib/bmc_network_utils.py 12Variables ../data/ipmi_raw_cmd_table.py 13 14Suite Setup Suite Setup Execution 15Suite Teardown Redfish.Logout 16Test Setup Printn 17Test Teardown Test Teardown Execution 18 19Test Tags IPMI_Network_Configuration 20 21*** Variables *** 22 23${vlan_id_for_ipmi} ${10} 24@{vlan_ids} ${20} ${30} 25${interface} eth0 26${initial_lan_config} &{EMPTY} 27${vlan_resource} ${NETWORK_MANAGER}action/VLAN 28${subnet_mask} ${24} 29${gateway_ip} 0.0.0.0 30${vlan_id_for_rest} ${30} 31 32 33*** Test Cases *** 34 35Verify 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 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]} 41 42 Redfish Power On 43 44 Set IPMI Inband Network Configuration ${STATIC_IP} ${NETMASK} ${GATEWAY} 45 Sleep 10 46 47 ${lan_print_output}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 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}"] 51 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 74 75Disable VLAN Via IPMI When Multiple VLAN Exist On BMC 76 [Documentation] Disable VLAN Via IPMI When Multiple VLAN Exist On BMC. 77 [Tags] Disable_VLAN_Via_IPMI_When_Multiple_VLAN_Exist_On_BMC 78 79 FOR ${vlan_id} IN @{vlan_ids} 80 Create VLAN ${vlan_id} 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 89Configure IP On VLAN Via IPMI 90 [Documentation] Configure IP On VLAN Via IPMI. 91 [Tags] Configure_IP_On_VLAN_Via_IPMI 92 93 Create VLAN Via IPMI ${vlan_id_for_ipmi} 94 95 Run Inband IPMI Standard Command 96 ... lan set ${CHANNEL_NUMBER} ipaddr ${STATIC_IP} login_host=${0} 97 98 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 99 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] 100 Valid Value lan_config['IP Address'] ["${STATIC_IP}"] 101 102 103Create 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 106 [Setup] Create VLAN ${vlan_id_for_rest} 107 108 Create VLAN Via IPMI ${vlan_id_for_ipmi} 109 110 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 111 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] 112 113 114Create VLAN Via IPMI And Verify 115 [Documentation] Create and verify VLAN via IPMI. 116 [Tags] Create_VLAN_Via_IPMI_And_Verify 117 118 Create VLAN Via IPMI ${vlan_id_for_ipmi} 119 120 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 121 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}'] 122 Valid Value lan_config['IP Address'] ['${ip_address}'] 123 Valid Value lan_config['Subnet Mask'] ['${subnet_mask}'] 124 125Test Disabling Of VLAN Via IPMI 126 [Documentation] Disable VLAN and verify via IPMI. 127 [Tags] Test_Disabling_Of_VLAN_Via_IPMI 128 129 Create VLAN Via IPMI ${vlan_id_for_ipmi} 130 Create VLAN Via IPMI off 131 132 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 133 Valid Value lan_config['802.1q VLAN ID'] ['Disabled'] 134 135 136Create 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 139 [Setup] Run Keywords Create VLAN ${vlan_id_for_rest} interface=${interface} 140 ... AND Configure Network Settings On VLAN ${vlan_id_for_rest} ${STATIC_IP} 141 ... ${netmask} ${gateway} interface=${interface} 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}'] 147 Valid Value lan_config['IP Address'] ['${STATIC_IP}'] 148 149 150Create 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 171*** Keywords *** 172 173Create 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 184Set 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 204Restore Configuration 205 [Documentation] Restore the configuration to its pre-test state. 206 207 ${length}= Get Length ${initial_lan_config} 208 Return From Keyword If ${length} == ${0} 209 210 Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask} 211 ... ${initial_lan_config['Default Gateway IP']} login=${0} 212 213 214Suite Setup Execution 215 [Documentation] Suite Setup Execution. 216 217 Redfish.Login 218 219 ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband 220 Set Suite Variable ${initial_lan_config} 221 222 Run Inband IPMI Standard Command 223 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1} 224 225 ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST} 226 Set Suite Variable ${ip_address} 227 228 @{network_configurations}= Get Network Configuration 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 234 235Test Teardown Execution 236 [Documentation] Test Teardown Execution. 237 238 FFDC On Test Case Fail 239 Create VLAN Via IPMI off 240 Restore Configuration 241