blob: 573e5ebf9d7f677f2eab22439b8f183679463fb1 [file] [log] [blame]
George Keishing364e93d2020-03-05 04:31:49 -06001*** 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
George Keishing6f395fd2021-08-18 02:18:53 -05007Resource ../lib/boot_utils.robot
George Keishing364e93d2020-03-05 04:31:49 -06008Library ../lib/ipmi_utils.py
9Library ../lib/gen_robot_valid.py
10Library ../lib/var_funcs.py
11Library ../lib/bmc_network_utils.py
ishwaryamathim64a7bb02023-11-10 08:57:20 +000012Variables ../data/ipmi_raw_cmd_table.py
George Keishing364e93d2020-03-05 04:31:49 -060013
14Suite Setup Suite Setup Execution
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050015Suite Teardown Redfish.Logout
George Keishing364e93d2020-03-05 04:31:49 -060016Test Setup Printn
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050017Test Teardown Test Teardown Execution
George Keishing364e93d2020-03-05 04:31:49 -060018
George Keishing87dc4422023-10-20 12:56:30 +053019Force Tags IPMI_Network_Configuration
George Keishing364e93d2020-03-05 04:31:49 -060020
21*** Variables ***
George Keishing87dc4422023-10-20 12:56:30 +053022
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050023${vlan_id_for_ipmi} ${10}
George Keishing364e93d2020-03-05 04:31:49 -060024@{vlan_ids} ${20} ${30}
25${interface} eth0
George Keishing364e93d2020-03-05 04:31:49 -060026${initial_lan_config} &{EMPTY}
27${vlan_resource} ${NETWORK_MANAGER}action/VLAN
ishwaryamathim64a7bb02023-11-10 08:57:20 +000028${subnet_mask} ${24}
29${gateway_ip} 0.0.0.0
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050030${vlan_id_for_rest} ${30}
31
George Keishing364e93d2020-03-05 04:31:49 -060032
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
ishwaryamathim64a7bb02023-11-10 08:57:20 +000038 [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 Keishing364e93d2020-03-05 04:31:49 -060041
42 Redfish Power On
43
Tony Lee374a5382021-08-09 19:22:44 +080044 Set IPMI Inband Network Configuration ${STATIC_IP} ${NETMASK} ${GATEWAY}
George Keishing364e93d2020-03-05 04:31:49 -060045 Sleep 10
46
47 ${lan_print_output}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Tony Lee374a5382021-08-09 19:22:44 +080048 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 Keishing364e93d2020-03-05 04:31:49 -060051
ishwaryamathim64a7bb02023-11-10 08:57:20 +000052 # 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 Keishing364e93d2020-03-05 04:31:49 -060074
75Disable VLAN Via IPMI When Multiple VLAN Exist On BMC
76 [Documentation] Disable VLAN Via IPMI When Multiple VLAN Exist On BMC.
George Keishingb98036a2022-01-31 12:39:47 -060077 [Tags] Disable_VLAN_Via_IPMI_When_Multiple_VLAN_Exist_On_BMC
George Keishing364e93d2020-03-05 04:31:49 -060078
Anves Kumar rayankula1ee53322020-07-06 23:46:44 -050079 FOR ${vlan_id} IN @{vlan_ids}
80 Create VLAN ${vlan_id}
George Keishing364e93d2020-03-05 04:31:49 -060081 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
George Keishing364e93d2020-03-05 04:31:49 -060092
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050093 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -060094
95 Run Inband IPMI Standard Command
ishwaryamathim64a7bb02023-11-10 08:57:20 +000096 ... lan set ${CHANNEL_NUMBER} ipaddr ${STATIC_IP} login_host=${0}
George Keishing364e93d2020-03-05 04:31:49 -060097
98 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050099 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
ishwaryamathim64a7bb02023-11-10 08:57:20 +0000100 Valid Value lan_config['IP Address'] ["${STATIC_IP}"]
George Keishing364e93d2020-03-05 04:31:49 -0600101
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
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500106 [Setup] Create VLAN ${vlan_id_for_rest}
George Keishing364e93d2020-03-05 04:31:49 -0600107
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500108 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -0600109
110 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500111 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
George Keishing364e93d2020-03-05 04:31:49 -0600112
113
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500114Create VLAN Via IPMI And Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600115 [Documentation] Create and verify VLAN via IPMI.
116 [Tags] Create_VLAN_Via_IPMI_And_Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600117
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500118 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600119
120 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500121 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500122 Valid Value lan_config['IP Address'] ['${ip_address}']
123 Valid Value lan_config['Subnet Mask'] ['${subnet_mask}']
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600124
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500125Test Disabling Of VLAN Via IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600126 [Documentation] Disable VLAN and verify via IPMI.
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500127 [Tags] Test_Disabling_Of_VLAN_Via_IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600128
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500129 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600130 Create VLAN Via IPMI off
131
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500132 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600133 Valid Value lan_config['802.1q VLAN ID'] ['Disabled']
134
135
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500136Create 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 Mac658f1d2022-03-11 16:35:41 +0800139 [Setup] Run Keywords Create VLAN ${vlan_id_for_rest} interface=${interface}
ishwaryamathim64a7bb02023-11-10 08:57:20 +0000140 ... AND Configure Network Settings On VLAN ${vlan_id_for_rest} ${STATIC_IP}
Brian Mac658f1d2022-03-11 16:35:41 +0800141 ... ${netmask} ${gateway} interface=${interface}
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500142
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}']
ishwaryamathim64a7bb02023-11-10 08:57:20 +0000147 Valid Value lan_config['IP Address'] ['${STATIC_IP}']
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500148
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500149
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
George Keishing364e93d2020-03-05 04:31:49 -0600171*** 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
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500205 [Documentation] Restore the configuration to its pre-test state.
206
George Keishing364e93d2020-03-05 04:31:49 -0600207 ${length}= Get Length ${initial_lan_config}
208 Return From Keyword If ${length} == ${0}
209
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500210 Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask}
George Keishing364e93d2020-03-05 04:31:49 -0600211 ... ${initial_lan_config['Default Gateway IP']} login=${0}
212
213
214Suite Setup Execution
215 [Documentation] Suite Setup Execution.
216
217 Redfish.Login
Anves Kumar rayankula1ee53322020-07-06 23:46:44 -0500218
219 ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
220 Set Suite Variable ${initial_lan_config}
221
George Keishing364e93d2020-03-05 04:31:49 -0600222 Run Inband IPMI Standard Command
223 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1}
224
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500225 ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST}
226 Set Suite Variable ${ip_address}
227
George Keishing364e93d2020-03-05 04:31:49 -0600228 @{network_configurations}= Get Network Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500229 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 Rayankulae354c1c2020-03-09 06:01:13 -0500234
235Test Teardown Execution
236 [Documentation] Test Teardown Execution.
237
238 FFDC On Test Case Fail
239 Create VLAN Via IPMI off
240 Restore Configuration