blob: cbf14632a701f6a64da06578e8cbe8da79e982d2 [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
115 [Setup] Run Keywords Create VLAN ${vlan_id_for_rest} AND Configure Network Settings On VLAN
116 ... ${vlan_id_for_rest} ${ip} ${netmask} ${gateway}
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}']
123
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500124
125Create Multiple VLANs Via IPMI And Verify
126 [Documentation] Create multiple VLANs through IPMI.
127 [Tags] Create_Multiple_VLANs_Via_IPMI_And_Verify
128
129 FOR ${vlan_id} IN @{vlan_ids}
130
131 Create VLAN Via IPMI ${vlan_id}
132
133 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
134
135 # Validate VLAN creation.
136 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id}']
137
138 # Validate existing IP address.
139 Valid Value lan_config['IP Address'] ['${ip_address}']
140
141 # Validate existing subnet mask.
142 Valid Value lan_config['Subnet Mask'] ['${subnet_mask}']
143 END
144
145
George Keishing364e93d2020-03-05 04:31:49 -0600146*** Keywords ***
147
148Create VLAN Via IPMI
149 [Documentation] Create VLAN via inband IPMI command.
150 [Arguments] ${vlan_id} ${channel_number}=${CHANNEL_NUMBER}
151
152 # Description of argument(s):
153 # vlan_id The VLAN ID (e.g. '10').
154
155 Run Inband IPMI Standard Command
156 ... lan set ${channel_number} vlan id ${vlan_id} login_host=${0}
157
158
159Set IPMI Inband Network Configuration
160 [Documentation] Run sequence of standard IPMI command in-band and set
161 ... the IP configuration.
162 [Arguments] ${ip} ${netmask} ${gateway} ${login}=${1}
163
164 # Description of argument(s):
165 # ip The IP address to be set using ipmitool-inband.
166 # netmask The Netmask to be set using ipmitool-inband.
167 # gateway The Gateway address to be set using ipmitool-inband.
168
169 Run Inband IPMI Standard Command
170 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${login}
171 Run Inband IPMI Standard Command
172 ... lan set ${CHANNEL_NUMBER} ipaddr ${ip} login_host=${0}
173 Run Inband IPMI Standard Command
174 ... lan set ${CHANNEL_NUMBER} netmask ${netmask} login_host=${0}
175 Run Inband IPMI Standard Command
176 ... lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway} login_host=${0}
177
178
179Restore Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500180 [Documentation] Restore the configuration to its pre-test state.
181
George Keishing364e93d2020-03-05 04:31:49 -0600182 ${length}= Get Length ${initial_lan_config}
183 Return From Keyword If ${length} == ${0}
184
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500185 Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask}
George Keishing364e93d2020-03-05 04:31:49 -0600186 ... ${initial_lan_config['Default Gateway IP']} login=${0}
187
188
189Suite Setup Execution
190 [Documentation] Suite Setup Execution.
191
192 Redfish.Login
Anves Kumar rayankula1ee53322020-07-06 23:46:44 -0500193
194 ${initial_lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
195 Set Suite Variable ${initial_lan_config}
196
George Keishing364e93d2020-03-05 04:31:49 -0600197 Run Inband IPMI Standard Command
198 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1}
199
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500200 ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST}
201 Set Suite Variable ${ip_address}
202
George Keishing364e93d2020-03-05 04:31:49 -0600203 @{network_configurations}= Get Network Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500204 FOR ${network_configuration} IN @{network_configurations}
205 Run Keyword If '${network_configuration['Address']}' == '${ip_address}'
206 ... Run Keywords Set Suite Variable ${subnet_mask} ${network_configuration['SubnetMask']} AND
207 ... Exit For Loop
208 END
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500209
210Test Teardown Execution
211 [Documentation] Test Teardown Execution.
212
213 FFDC On Test Case Fail
214 Create VLAN Via IPMI off
215 Restore Configuration