blob: cca5d8eb82445da9baf74fa8ce365c37f80dd051 [file] [log] [blame]
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -05001*** Settings ***
2Documentation Test BMC multiple network interface functionalities.
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -05003... Run on setup with both eth0 and eth1 in static mode.
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -05004
5# User input BMC IP for the eth1.
6# Use can input as -v OPENBMC_HOST_1:xx.xxx.xx from command line.
7Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT}
8... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1
9
10Resource ../../lib/resource.robot
11Resource ../../lib/common_utils.robot
12Resource ../../lib/connection_client.robot
13Resource ../../lib/bmc_network_utils.robot
14Resource ../../lib/openbmc_ffdc.robot
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050015Resource ../../lib/bmc_ldap_utils.robot
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050016Resource ../../lib/snmp/resource.robot
17Resource ../../lib/snmp/redfish_snmp_utils.robot
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -050018Resource ../../lib/certificate_utils.robot
Anves Kumar rayankulaa38ec2e2021-07-10 01:09:23 -050019Library ../../lib/jobs_processing.py
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -050020Library OperatingSystem
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050021
22Suite Setup Suite Setup Execution
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050023Test Setup Run Keywords Redfish.Login AND Redfish1.Login
24Test Teardown Run Keywords FFDC On Test Case Fail AND Redfish.Logout AND Redfish1.Logout
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050025
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -050026*** Variables ***
27
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050028${cmd_prefix} ipmitool -I lanplus -C 17 -p 623 -U ${IPMI_USERNAME} -P ${IPMI_PASSWORD}
Sweta Potthuri2667f2c2022-10-11 07:55:21 -050029${test_ipv4_addr} 10.7.7.7
30${test_ipv4_addr2} 10.7.7.8
31${test_subnet_mask} 255.255.255.0
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -050032
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050033*** Test Cases ***
34
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050035Verify Both Interfaces BMC IP Addresses Accessible Via SSH
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050036 [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH.
37 [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH
38
39 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST}
40 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1}
41 Close All Connections
42
43
Anves Kumar rayankula55d51922021-07-01 06:37:00 -050044Verify Redfish Works On Both Interfaces
45 [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish.
46 [Tags] Verify_Redfish_Works_On_Both_Interfaces
47 [Teardown] Run Keywords
48 ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname}
49
Anves Kumar rayankula55d51922021-07-01 06:37:00 -050050 ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
51 ${data}= Create Dictionary HostName=openbmc
52 Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data}
53 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
54
55 Validate Hostname On BMC openbmc
56
57 ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0
58 ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1
59 Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']}
60
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050061
62Verify LDAP Login Works When Eth1 IP Is Not Configured
63 [Documentation] Verify LDAP login works when eth1 IP is erased.
64 [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured
kothais01f95fc2023-11-01 14:12:51 +000065 [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER}
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050066 ... AND Redfish.Login AND Delete IP Address ${OPENBMC_HOST_1}
67 [Teardown] Run Keywords Redfish.Logout AND Redfish.Login AND
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050068 ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
69
70 Create LDAP Configuration
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050071 Redfish.Logout
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050072 Sleep 30
Sweta Potthurib9513c62023-03-01 01:11:43 -060073 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
74
75
76Verify LDAP Login Works When Both Interfaces Are Configured
77 [Documentation] Verify LDAP login works when both interfaces are configured.
78 [Tags] Verify_LDAP_Login_Works_When_Both_Interfaces_Are_Configured
Sweta Potthurib9513c62023-03-01 01:11:43 -060079
80 Create LDAP Configuration
81 Redfish.Logout
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050082 Sleep 30
Sweta Potthurib9513c62023-03-01 01:11:43 -060083 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
84
85
86Verify Secure LDAP Login Works When Both Interfaces Are Configured
87 [Documentation] Verify Secure LDAP login works when both the interfaces are configured.
88 [Tags] Verify_Secure_LDAP_Login_Works_When_Both_Interfaces_Are_Configured
Sweta Potthurib9513c62023-03-01 01:11:43 -060089
90 Create LDAP Configuration ${LDAP_TYPE} ${LDAP_SERVER_URI_1} ${LDAP_BIND_DN}
91 ... ${LDAP_BIND_DN_PASSWORD} ${LDAP_BASE_DN}
92 Redfish.Logout
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -050093 Sleep 30
Sweta Potthurib9513c62023-03-01 01:11:43 -060094 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050095
96
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050097Verify SNMP Works When Eth1 IP Is Not Configured
98 [Documentation] Verify SNMP works when eth1 IP is not configured.
99 [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -0500100 [Setup] Run Keywords Redfish.Login AND
101 ... Set Test Variable ${CHANNEL_NUMBER} ${SECONDARY_CHANNEL_NUMBER}
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -0500102 ... AND Delete IP Address ${OPENBMC_HOST_1}
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -0500103 [Teardown] Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -0500104
105 Create Error On BMC And Verify Trap
106
107
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -0500108Disable And Enable Eth0 Interface
109 [Documentation] Disable and Enable eth0 ethernet interface via redfish.
110 [Tags] Disable_And_Enable_Eth0_Interface
111 [Template] Set BMC Ethernet Interfaces State
112
113 # interface_ip interface enabled
114 ${OPENBMC_HOST} eth0 ${False}
115 ${OPENBMC_HOST} eth0 ${True}
116
117
Anves Kumar rayankulaa38ec2e2021-07-10 01:09:23 -0500118Verify Both Interfaces Access Concurrently Via Redfish
119 [Documentation] Verify both interfaces access conurrently via redfish.
120 [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish
121
Anves Kumar rayankulaa38ec2e2021-07-10 01:09:23 -0500122 ${dict}= Execute Process Multi Keyword ${2}
123 ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}}
124 ... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}}
125
126 Dictionary Should Not Contain Value ${dict} False
127 ... msg=One or more operations has failed.
128
129 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0
130 ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1
131
132 Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True}
133 Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True}
134
Anves Kumar rayankula54482cd2021-07-09 07:13:25 -0500135Able To Access Serial Console Via Both Network Interfaces
136 [Documentation] Able to access serial console via both network interfaces.
George Keishingc4914b72021-07-27 08:03:19 -0500137 [Tags] Able_To_Access_Serial_Console_Via_Both_Network_Interfaces
Anves Kumar rayankula54482cd2021-07-09 07:13:25 -0500138
139 Open Connection And Log In host=${OPENBMC_HOST} port=2200
140 Open Connection And Log In host=${OPENBMC_HOST_1} port=2200
141 Close All Connections
142
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -0500143Verify IPMI Works On Both Network Interfaces
144 [Documentation] Verify IPMI works on both network interfaces.
145 [Tags] Verify_IPMI_Works_On_Both_Network_Interfaces
146
147 Run IPMI ${OPENBMC_HOST_1} power on
148 ${status1}= Run IPMI ${OPENBMC_HOST} power status
149 ${status2}= Run IPMI ${OPENBMC_HOST_1} power status
150 Should Be Equal ${status1} ${status2}
151
Sweta Potthuri2667f2c2022-10-11 07:55:21 -0500152Verify Modifying IP Address Multiple Times On Interface
153 [Documentation] Verify modifying IP address multiple times on interface.
154 [Tags] Verify_Modifying_IP_Address_Multiple_Times_On_Interface
155 [Teardown] Run Keywords
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -0500156 ... Delete IP Address ${test_ipv4_addr} AND Redfish.Logout
Sweta Potthuri2667f2c2022-10-11 07:55:21 -0500157
158 ${test_gateway}= Get BMC Default Gateway
159 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
160 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
161 Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
162 Run Keyword Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
163 Run Keyword Wait For Host To Ping ${OPENBMC_HOST_1} ${NETWORK_TIMEOUT}
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500164
165Verify Able To Load Certificates Via Eth1 IP Address
George Keishingb13682a2021-07-20 08:52:39 -0500166 [Documentation] Verify able to load certificates via eth1 IP address.
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500167 [Tags] Verify_Able_To_Load_Certificates_Via_Eth1_IP_Address
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500168 [Template] Install Certificate Via Redfish And Verify
169
170 # cert_type cert_format expected_status
171 CA Valid Certificate ok
172 Client Valid Certificate Valid Privatekey ok
173
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -0500174*** Keywords ***
175
176Get Network Configuration Using Channel Number
177 [Documentation] Get ethernet interface.
178 [Arguments] ${channel_number}
179
180 # Description of argument(s):
181 # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
182
183 ${active_channel_config}= Get Active Channel Config
184 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
185 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
186
187 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
George Keishing409df052024-01-17 22:36:14 +0530188 RETURN @{network_configurations}
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -0500189
190
191Suite Setup Execution
192 [Documentation] Do suite setup task.
193
194 Valid Value OPENBMC_HOST_1
195
196 # Check both interfaces are configured and reachable.
197 Ping Host ${OPENBMC_HOST}
198 Ping Host ${OPENBMC_HOST_1}
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -0500199
kothais01f95fc2023-11-01 14:12:51 +0000200 ${network_configurations}= Get Network Configuration Using Channel Number ${SECONDARY_CHANNEL_NUMBER}
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -0500201 FOR ${network_configuration} IN @{network_configurations}
202
203 Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}'
204 ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']}
205 ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']}
206 ... AND Exit For Loop
207
208 END
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -0500209
210
211Set BMC Ethernet Interfaces State
212 [Documentation] Set BMC ethernet interface state.
213 [Arguments] ${interface_ip} ${interface} ${enabled}
214 [Teardown] Redfish1.Logout
215
216 # Description of argument(s):
217 # interface_ip IP address of ethernet interface.
218 # interface The ethernet interface name (eg. eth0 or eth1).
219 # enabled Indicates interface should be enabled (eg. True or False).
220
221 Redfish1.Login
222
223 ${data}= Create Dictionary InterfaceEnabled=${enabled}
224
225 Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data}
226 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
227
228 Sleep ${NETWORK_TIMEOUT}s
229 ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled
230 Should Be Equal ${interface_status} ${enabled}
231
232 ${status}= Run Keyword And Return Status Ping Host ${interface_ip}
233
234 Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True}
235 ... ELSE Should Be Equal ${status} ${False}
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -0500236
237
238Run IPMI
239 [Documentation] Run IPMI command.
240 [Arguments] ${host} ${sub_cmd}
241
242 # Description of argument(s):
243 # host BMC host name or IP address.
244 # sub_cmd The IPMI command string to be executed.
245
246 ${rc} ${output}= Run And Return Rc And Output ${cmd_prefix} -H ${host} ${sub_cmd}
247 Should Be Equal As Strings ${rc} 0
George Keishing409df052024-01-17 22:36:14 +0530248 RETURN ${output}
Anves Kumar rayankulad0a2f332021-07-14 07:53:12 -0500249
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500250
251Install Certificate Via Redfish And Verify
252 [Documentation] Install and verify certificate using Redfish.
253 [Arguments] ${cert_type} ${cert_format} ${expected_status} ${delete_cert}=${True}
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -0500254 [Teardown] Remove Directory certificate_dir recursive=True
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500255
256 # Description of argument(s):
257 # cert_type Certificate type (e.g. "Client" or "CA").
258 # cert_format Certificate file format
259 # (e.g. "Valid_Certificate_Valid_Privatekey").
260 # expected_status Expected status of certificate replace Redfish
261 # request (i.e. "ok" or "error").
262 # delete_cert Certificate will be deleted before installing if this True.
263
Anvesh-Kumar_Rayankula58b55692024-09-13 03:23:03 -0500264 Create Directory certificate_dir
Anves Kumar rayankula75ac4292021-07-14 01:30:43 -0500265 # AUTH_URI is a global variable defined in lib/resource.robot
266 Set Test Variable ${AUTH_URI} https://${OPENBMC_HOST_1}
267 Run Keyword If '${cert_type}' == 'CA' and '${delete_cert}' == '${True}'
268 ... Delete All CA Certificate Via Redfish
269 ... ELSE IF '${cert_type}' == 'Client' and '${delete_cert}' == '${True}'
270 ... Delete Certificate Via BMC CLI ${cert_type}
271
272 ${cert_file_path}= Generate Certificate File Via Openssl ${cert_format}
273 ${bytes}= OperatingSystem.Get Binary File ${cert_file_path}
274 ${file_data}= Decode Bytes To String ${bytes} UTF-8
275
276 ${certificate_uri}= Set Variable If
277 ... '${cert_type}' == 'Client' ${REDFISH_LDAP_CERTIFICATE_URI}
278 ... '${cert_type}' == 'CA' ${REDFISH_CA_CERTIFICATE_URI}
279
280 ${cert_id}= Install Certificate File On BMC ${certificate_uri} ${expected_status} data=${file_data}
281 Logging Installed certificate id: ${cert_id}
282
283 Sleep 30s
284 ${cert_file_content}= OperatingSystem.Get File ${cert_file_path}
285 ${bmc_cert_content}= Run Keyword If '${expected_status}' == 'ok' redfish_utils.Get Attribute
286 ... ${certificate_uri}/${cert_id} CertificateString
287 Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content}
George Keishing409df052024-01-17 22:36:14 +0530288 RETURN ${cert_id}