blob: d97e15df6e954d1f8b9bb268326086b099354000 [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
12
13Suite Setup Suite Setup Execution
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050014Suite Teardown Redfish.Logout
George Keishing364e93d2020-03-05 04:31:49 -060015Test Setup Printn
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050016Test Teardown Test Teardown Execution
George Keishing364e93d2020-03-05 04:31:49 -060017
18Force Tags IPMI_Network_Config
19
20
21*** Variables ***
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050022${vlan_id_for_ipmi} ${10}
George Keishing364e93d2020-03-05 04:31:49 -060023@{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 Rayankulae354c1c2020-03-09 06:01:13 -050028${netmask} ${24}
29${gateway} 0.0.0.0
30${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
38 [Teardown] Run Keywords Restore Configuration AND FFDC On Test Case Fail
39
40 Redfish Power On
41
Tony Lee374a5382021-08-09 19:22:44 +080042 Set IPMI Inband Network Configuration ${STATIC_IP} ${NETMASK} ${GATEWAY}
George Keishing364e93d2020-03-05 04:31:49 -060043 Sleep 10
44
45 ${lan_print_output}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Tony Lee374a5382021-08-09 19:22:44 +080046 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 Keishing364e93d2020-03-05 04:31:49 -060049
50
51Disable VLAN Via IPMI When Multiple VLAN Exist On BMC
52 [Documentation] Disable VLAN Via IPMI When Multiple VLAN Exist On BMC.
George Keishingb98036a2022-01-31 12:39:47 -060053 [Tags] Disable_VLAN_Via_IPMI_When_Multiple_VLAN_Exist_On_BMC
George Keishing364e93d2020-03-05 04:31:49 -060054
Anves Kumar rayankula1ee53322020-07-06 23:46:44 -050055 FOR ${vlan_id} IN @{vlan_ids}
56 Create VLAN ${vlan_id}
George Keishing364e93d2020-03-05 04:31:49 -060057 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
65Configure IP On VLAN Via IPMI
66 [Documentation] Configure IP On VLAN Via IPMI.
67 [Tags] Configure_IP_On_VLAN_Via_IPMI
George Keishing364e93d2020-03-05 04:31:49 -060068
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050069 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -060070
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 Rayankulae354c1c2020-03-09 06:01:13 -050075 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
George Keishing364e93d2020-03-05 04:31:49 -060076 Valid Value lan_config['IP Address'] ["${ip}"]
77
78
79Create 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 Rayankulae354c1c2020-03-09 06:01:13 -050082 [Setup] Create VLAN ${vlan_id_for_rest}
George Keishing364e93d2020-03-05 04:31:49 -060083
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050084 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -060085
86 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050087 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
George Keishing364e93d2020-03-05 04:31:49 -060088
89
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050090Create VLAN Via IPMI And Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060091 [Documentation] Create and verify VLAN via IPMI.
92 [Tags] Create_VLAN_Via_IPMI_And_Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060093
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050094 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060095
96 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050097 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -050098 Valid Value lan_config['IP Address'] ['${ip_address}']
99 Valid Value lan_config['Subnet Mask'] ['${subnet_mask}']
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600100
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500101Test Disabling Of VLAN Via IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600102 [Documentation] Disable VLAN and verify via IPMI.
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500103 [Tags] Test_Disabling_Of_VLAN_Via_IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600104
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500105 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600106 Create VLAN Via IPMI off
107
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500108 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600109 Valid Value lan_config['802.1q VLAN ID'] ['Disabled']
110
111
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500112Create 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 Mac658f1d2022-03-11 16:35:41 +0800115 [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 Rayankulae354c1c2020-03-09 06:01:13 -0500118
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 Rayankula8e25b8f2020-04-06 01:18:37 -0500125
126Create 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 Keishing364e93d2020-03-05 04:31:49 -0600147*** Keywords ***
148
149Create 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
160Set 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
180Restore Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500181 [Documentation] Restore the configuration to its pre-test state.
182
George Keishing364e93d2020-03-05 04:31:49 -0600183 ${length}= Get Length ${initial_lan_config}
184 Return From Keyword If ${length} == ${0}
185
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500186 Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask}
George Keishing364e93d2020-03-05 04:31:49 -0600187 ... ${initial_lan_config['Default Gateway IP']} login=${0}
188
189
190Suite Setup Execution
191 [Documentation] Suite Setup Execution.
192
193 Redfish.Login
Anves Kumar rayankula1ee53322020-07-06 23:46:44 -0500194
195 ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
196 Set Suite Variable ${initial_lan_config}
197
George Keishing364e93d2020-03-05 04:31:49 -0600198 Run Inband IPMI Standard Command
199 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1}
200
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500201 ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST}
202 Set Suite Variable ${ip_address}
203
George Keishing364e93d2020-03-05 04:31:49 -0600204 @{network_configurations}= Get Network Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500205 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 Rayankulae354c1c2020-03-09 06:01:13 -0500210
211Test Teardown Execution
212 [Documentation] Test Teardown Execution.
213
214 FFDC On Test Case Fail
215 Create VLAN Via IPMI off
216 Restore Configuration