blob: c862ed4fed98cb863ae7817a9532a290297182b5 [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
7Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
9Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
11
12Suite Setup Suite Setup Execution
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050013Suite Teardown Redfish.Logout
George Keishing364e93d2020-03-05 04:31:49 -060014Test Setup Printn
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050015Test Teardown Test Teardown Execution
George Keishing364e93d2020-03-05 04:31:49 -060016
17Force Tags IPMI_Network_Config
18
19
20*** Variables ***
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050021${vlan_id_for_ipmi} ${10}
George Keishing364e93d2020-03-05 04:31:49 -060022@{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 Rayankulae354c1c2020-03-09 06:01:13 -050027${netmask} ${24}
28${gateway} 0.0.0.0
29${vlan_id_for_rest} ${30}
30
George Keishing364e93d2020-03-05 04:31:49 -060031
32*** Test Cases ***
33
34Verify 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
50Disable 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 Keishing364e93d2020-03-05 04:31:49 -060053
54 FOR ${id} IN @{vlan_ids}
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050055 Create VLAN ${vlan_id_for_rest}
George Keishing364e93d2020-03-05 04:31:49 -060056 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
64Configure IP On VLAN Via IPMI
65 [Documentation] Configure IP On VLAN Via IPMI.
66 [Tags] Configure_IP_On_VLAN_Via_IPMI
George Keishing364e93d2020-03-05 04:31:49 -060067
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050068 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -060069
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 Rayankulae354c1c2020-03-09 06:01:13 -050074 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
George Keishing364e93d2020-03-05 04:31:49 -060075 Valid Value lan_config['IP Address'] ["${ip}"]
76
77
78Create 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 Rayankulae354c1c2020-03-09 06:01:13 -050081 [Setup] Create VLAN ${vlan_id_for_rest}
George Keishing364e93d2020-03-05 04:31:49 -060082
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050083 Create VLAN Via IPMI ${vlan_id_for_ipmi}
George Keishing364e93d2020-03-05 04:31:49 -060084
85 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050086 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
George Keishing364e93d2020-03-05 04:31:49 -060087
88
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050089Create VLAN Via IPMI And Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060090 [Documentation] Create and verify VLAN via IPMI.
91 [Tags] Create_VLAN_Via_IPMI_And_Verify
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060092
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050093 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060094
95 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -050096 Valid Value lan_config['802.1q VLAN ID'] ['${vlan_id_for_ipmi}']
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -050097 Valid Value lan_config['IP Address'] ['${ip_address}']
98 Valid Value lan_config['Subnet Mask'] ['${subnet_mask}']
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -060099
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500100Test Disabling Of VLAN Via IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600101 [Documentation] Disable VLAN and verify via IPMI.
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500102 [Tags] Test_Disabling_Of_VLAN_Via_IPMI
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600103
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500104 Create VLAN Via IPMI ${vlan_id_for_ipmi}
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600105 Create VLAN Via IPMI off
106
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500107 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER} ipmi_cmd_type=inband
Anvesh Kumar Rayankula74ed7392020-02-10 01:00:11 -0600108 Valid Value lan_config['802.1q VLAN ID'] ['Disabled']
109
110
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500111Create 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 Rayankula8e25b8f2020-04-06 01:18:37 -0500123
124Create 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 Keishing364e93d2020-03-05 04:31:49 -0600145*** Keywords ***
146
147Create 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
158Set 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
178Restore Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500179 [Documentation] Restore the configuration to its pre-test state.
180
George Keishing364e93d2020-03-05 04:31:49 -0600181 ${length}= Get Length ${initial_lan_config}
182 Return From Keyword If ${length} == ${0}
183
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500184 Set IPMI Inband Network Configuration ${ip_address} ${subnet_mask}
George Keishing364e93d2020-03-05 04:31:49 -0600185 ... ${initial_lan_config['Default Gateway IP']} login=${0}
186
187
188Suite Setup Execution
189 [Documentation] Suite Setup Execution.
190
191 Redfish.Login
George Keishing364e93d2020-03-05 04:31:49 -0600192 Run Inband IPMI Standard Command
193 ... lan set ${CHANNEL_NUMBER} ipsrc static login_host=${1}
194
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500195 ${host_name} ${ip_address}= Get Host Name IP host=${OPENBMC_HOST}
196 Set Suite Variable ${ip_address}
197
George Keishing364e93d2020-03-05 04:31:49 -0600198 @{network_configurations}= Get Network Configuration
Anvesh Kumar Rayankula8e25b8f2020-04-06 01:18:37 -0500199 FOR ${network_configuration} IN @{network_configurations}
200 Run Keyword If '${network_configuration['Address']}' == '${ip_address}'
201 ... Run Keywords Set Suite Variable ${subnet_mask} ${network_configuration['SubnetMask']} AND
202 ... Exit For Loop
203 END
Anvesh Kumar Rayankulae354c1c2020-03-09 06:01:13 -0500204
205Test Teardown Execution
206 [Documentation] Test Teardown Execution.
207
208 FFDC On Test Case Fail
209 Create VLAN Via IPMI off
210 Restore Configuration