blob: d1a9fe4e7208d4f66de46a54c028e92c682353a6 [file] [log] [blame]
Prashanth Kattif58cce02019-02-06 03:05:14 -06001*** Settings ***
2Documentation Network interface configuration and verification
3 ... tests.
4
George Keishing5d467552019-02-08 23:30:48 -06005Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/bmc_network_utils.robot
7Resource ../../lib/openbmc_ffdc.robot
Prashanth Katti747ce9d2019-02-07 07:23:48 -06008Library ../../lib/bmc_network_utils.py
Vijayde3bf7b2019-04-16 04:56:09 -05009Library Collections
Prashanth Kattif58cce02019-02-06 03:05:14 -060010
aravinth0510ca054ee2022-06-16 13:26:15 +000011Suite Setup Suite Setup Execution
12Suite Teardown Suite Teardown Execution
13Test Setup Test Setup Execution
14Test Teardown Test Teardown Execution
Prashanth Kattif58cce02019-02-06 03:05:14 -060015
George Keishing9899a902023-09-07 20:57:53 +053016Force Tags Bmc_Network_Conf
Prashanth Kattif34fafa2019-06-20 05:04:40 -050017
Prashanth Katti23efc6e2019-03-13 06:07:15 -050018*** Variables ***
Vijayde3bf7b2019-04-16 04:56:09 -050019${test_hostname} openbmc
20${test_ipv4_addr} 10.7.7.7
21${test_ipv4_invalid_addr} 0.0.1.a
22${test_subnet_mask} 255.255.0.0
Prashanth Kattib36a7522019-05-22 05:32:39 -050023${broadcast_ip} 10.7.7.255
24${loopback_ip} 127.0.0.2
25${multicast_ip} 224.6.6.6
26${out_of_range_ip} 10.7.7.256
Prashanth Katti568df5f2020-05-15 06:00:37 -050027${test_ipv4_addr2} 10.7.7.8
Prashanth Katti23efc6e2019-03-13 06:07:15 -050028
George Keishing16b3c7b2021-01-28 09:23:37 -060029# Valid netmask is 4 bytes long and has continuous block of 1s.
Prashanth Katti040c8c12019-05-31 04:42:05 -050030# Maximum valid value in each octet is 255 and least value is 0.
31# 253 is not valid, as binary value is 11111101.
32${invalid_netmask} 255.255.253.0
33${alpha_netmask} ff.ff.ff.ff
34# Maximum value of octet in netmask is 255.
35${out_of_range_netmask} 255.256.255.0
36${more_byte_netmask} 255.255.255.0.0
37${less_byte_netmask} 255.255.255
Prashanth Kattic6ad6472019-06-14 03:33:39 -050038${threshold_netmask} 255.255.255.255
39${lowest_netmask} 128.0.0.0
40
41# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
42# but trying to configure xx.xx.xx
43${less_octet_ip} 10.3.36
44
45# For the address 10.6.6.6, the 10.6.6.0 portion describes the
46# network ID and the 6 describe the host.
47
48${network_id} 10.7.7.0
49${hex_ip} 0xa.0xb.0xc.0xd
50${negative_ip} 10.-7.-7.7
Prashanth Katti7098c972019-07-03 06:56:42 -050051@{static_name_servers} 10.5.5.5
Prashanth Katti3c7b6432019-07-26 06:53:37 -050052@{null_value} null
Prashanth Kattiafe16b72019-08-02 00:29:45 -050053@{empty_dictionary} {}
54@{string_value} aa.bb.cc.dd
55
Prashanth Kattif58cce02019-02-06 03:05:14 -060056*** Test Cases ***
57
58Get IP Address And Verify
59 [Documentation] Get IP Address And Verify.
George Keishing5d467552019-02-08 23:30:48 -060060 [Tags] Get_IP_Address_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060061
Sushil Singh50621142020-06-16 11:12:21 -050062 FOR ${network_configuration} IN @{network_configurations}
63 Verify IP On BMC ${network_configuration['Address']}
64 END
Prashanth Katti747ce9d2019-02-07 07:23:48 -060065
Prashanth Kattif58cce02019-02-06 03:05:14 -060066Get Netmask And Verify
67 [Documentation] Get Netmask And Verify.
George Keishing5d467552019-02-08 23:30:48 -060068 [Tags] Get_Netmask_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060069
Sushil Singh50621142020-06-16 11:12:21 -050070 FOR ${network_configuration} IN @{network_configurations}
71 Verify Netmask On BMC ${network_configuration['SubnetMask']}
72 END
Prashanth Katti747ce9d2019-02-07 07:23:48 -060073
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060074Get Gateway And Verify
75 [Documentation] Get gateway and verify it's existence on the BMC.
76 [Tags] Get_Gateway_And_Verify
77
Sushil Singh50621142020-06-16 11:12:21 -050078 FOR ${network_configuration} IN @{network_configurations}
79 Verify Gateway On BMC ${network_configuration['Gateway']}
80 END
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060081
82Get MAC Address And Verify
83 [Documentation] Get MAC address and verify it's existence on the BMC.
84 [Tags] Get_MAC_Address_And_Verify
85
Tony Lee412c6682020-04-01 17:34:30 +080086 ${active_channel_config}= Get Active Channel Config
87 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
88
89 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060090 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress
91 Validate MAC On BMC ${macaddr}
Prashanth Kattif58cce02019-02-06 03:05:14 -060092
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -060093Verify All Configured IP And Netmask
94 [Documentation] Verify all configured IP and netmask on BMC.
95 [Tags] Verify_All_Configured_IP_And_Netmask
96
Sushil Singh50621142020-06-16 11:12:21 -050097 FOR ${network_configuration} IN @{network_configurations}
98 Verify IP And Netmask On BMC ${network_configuration['Address']}
99 ... ${network_configuration['SubnetMask']}
100 END
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600101
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500102Get Hostname And Verify
103 [Documentation] Get hostname via Redfish and verify.
104 [Tags] Get_Hostname_And_Verify
105
106 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
107
108 Validate Hostname On BMC ${hostname}
109
110Configure Hostname And Verify
111 [Documentation] Configure hostname via Redfish and verify.
112 [Tags] Configure_Hostname_And_Verify
shrsuman123578276c2020-08-04 04:28:58 -0500113 [Teardown] Run Keywords
114 ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500115
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500116 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500117
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500118 Configure Hostname ${test_hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500119 Validate Hostname On BMC ${test_hostname}
120
nagarjunb2260784a42022-06-13 10:39:33 +0530121 # Verify configured hostname via redfish.
122 ${new_hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
123 Should Be Equal ${new_hostname} ${test_hostname}
124
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500125
Vijayde3bf7b2019-04-16 04:56:09 -0500126Add Valid IPv4 Address And Verify
127 [Documentation] Add IPv4 Address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600128 [Tags] Add_Valid_IPv4_Address_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500129 [Teardown] Run Keywords
130 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Vijayde3bf7b2019-04-16 04:56:09 -0500131
132 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Vijayde3bf7b2019-04-16 04:56:09 -0500133
134Add Invalid IPv4 Address And Verify
135 [Documentation] Add Invalid IPv4 Address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600136 [Tags] Add_Invalid_IPv4_Address_And_Verify
Vijayde3bf7b2019-04-16 04:56:09 -0500137
138 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask}
139 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST}
140
Prashanth Kattib36a7522019-05-22 05:32:39 -0500141Configure Out Of Range IP
142 [Documentation] Configure out-of-range IP address.
143 [Tags] Configure_Out_Of_Range_IP
144 [Template] Add IP Address
145
146 # ip subnet_mask gateway valid_status_codes
147 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
148
149Configure Broadcast IP
150 [Documentation] Configure broadcast IP address.
151 [Tags] Configure_Broadcast_IP
152 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500153 [Teardown] Clear IP Settings On Fail ${broadcast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500154
155 # ip subnet_mask gateway valid_status_codes
156 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
157
158Configure Multicast IP
159 [Documentation] Configure multicast IP address.
160 [Tags] Configure_Multicast_IP
161 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500162 [Teardown] Clear IP Settings On Fail ${multicast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500163
164 # ip subnet_mask gateway valid_status_codes
165 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
166
167Configure Loopback IP
168 [Documentation] Configure loopback IP address.
169 [Tags] Configure_Loopback_IP
170 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500171 [Teardown] Clear IP Settings On Fail ${loopback_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500172
173 # ip subnet_mask gateway valid_status_codes
174 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
175
176Add Valid IPv4 Address And Check Persistency
nagarjunb2260784a42022-06-13 10:39:33 +0530177 [Documentation] Add IPv4 address and check persistency.
George Keishing0c8100f2022-01-13 00:24:57 -0600178 [Tags] Add_Valid_IPv4_Address_And_Check_Persistency
nagarjunb2260784a42022-06-13 10:39:33 +0530179 [Teardown] Run Keywords
180 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattib36a7522019-05-22 05:32:39 -0500181
182 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
183
184 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500185 Redfish OBMC Reboot (off) stack_mode=skip
George Keishing5c498742019-08-09 02:14:44 -0500186 Redfish.Login
Prashanth Kattib36a7522019-05-22 05:32:39 -0500187 Verify IP On BMC ${test_ipv4_addr}
nagarjunb2260784a42022-06-13 10:39:33 +0530188 Verify IP On Redfish URI ${test_ipv4_addr}
189
Vijayde3bf7b2019-04-16 04:56:09 -0500190
Prashanth Katti6cedca22019-05-30 02:31:11 -0500191Add Fourth Octet Threshold IP And Verify
192 [Documentation] Add fourth octet threshold IP and verify.
193 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500194 [Teardown] Run Keywords
195 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500196
197 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500198
199Add Fourth Octet Lowest IP And Verify
200 [Documentation] Add fourth octet lowest IP and verify.
201 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500202 [Teardown] Run Keywords
203 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500204
205 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500206
207Add Third Octet Threshold IP And Verify
208 [Documentation] Add third octet threshold IP and verify.
209 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500210 [Teardown] Run Keywords
211 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500212
213 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500214
215Add Third Octet Lowest IP And Verify
216 [Documentation] Add third octet lowest IP and verify.
217 [Tags] Add_Third_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500218 [Teardown] Run Keywords
219 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500220
221 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500222
223Add Second Octet Threshold IP And Verify
224 [Documentation] Add second octet threshold IP and verify.
225 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500226 [Teardown] Run Keywords
227 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500228
229 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500230
231Add Second Octet Lowest IP And Verify
232 [Documentation] Add second octet lowest IP and verify.
233 [Tags] Add_Second_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500234 [Teardown] Run Keywords
235 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500236
237 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500238
239Add First Octet Threshold IP And Verify
240 [Documentation] Add first octet threshold IP and verify.
241 [Tags] Add_First_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500242 [Teardown] Run Keywords
Anves Kumar rayankulaf757b102020-07-27 20:41:36 -0500243 ... Delete IP Address 223.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500244
245 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500246
247Add First Octet Lowest IP And Verify
248 [Documentation] Add first octet lowest IP and verify.
249 [Tags] Add_First_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500250 [Teardown] Run Keywords
251 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500252
253 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500254
Prashanth Katti040c8c12019-05-31 04:42:05 -0500255Configure Invalid Netmask
256 [Documentation] Verify error while setting invalid netmask.
257 [Tags] Configure_Invalid_Netmask
258 [Template] Add IP Address
259
260 # ip subnet_mask gateway valid_status_codes
261 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
262
263Configure Out Of Range Netmask
264 [Documentation] Verify error while setting out of range netmask.
265 [Tags] Configure_Out_Of_Range_Netmask
266 [Template] Add IP Address
267
268 # ip subnet_mask gateway valid_status_codes
269 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
270
271Configure Alpha Netmask
272 [Documentation] Verify error while setting alpha netmask.
273 [Tags] Configure_Alpha_Netmask
274 [Template] Add IP Address
275
276 # ip subnet_mask gateway valid_status_codes
277 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
278
279Configure More Byte Netmask
280 [Documentation] Verify error while setting more byte netmask.
281 [Tags] Configure_More_Byte_Netmask
282 [Template] Add IP Address
283
284 # ip subnet_mask gateway valid_status_codes
285 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
286
287Configure Less Byte Netmask
288 [Documentation] Verify error while setting less byte netmask.
289 [Tags] Configure_Less_Byte_Netmask
290 [Template] Add IP Address
291
292 # ip subnet_mask gateway valid_status_codes
293 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
294
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500295Configure Threshold Netmask And Verify
296 [Documentation] Configure threshold netmask and verify.
George Keishing5236ec52022-01-31 12:07:58 -0600297 [Tags] Configure_Threshold_Netmask_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500298 [Teardown] Run Keywords
299 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500300
301 Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500302
303Configure Lowest Netmask And Verify
304 [Documentation] Configure lowest netmask and verify.
George Keishing5236ec52022-01-31 12:07:58 -0600305 [Tags] Configure_Lowest_Netmask_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500306 [Teardown] Run Keywords
307 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500308
309 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500310
311Configure Network ID
312 [Documentation] Verify error while configuring network ID.
313 [Tags] Configure_Network_ID
314 [Template] Add IP Address
315 [Teardown] Clear IP Settings On Fail ${network_id}
316
317 # ip subnet_mask gateway valid_status_codes
318 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
319
320Configure Less Octet IP
321 [Documentation] Verify error while Configuring less octet IP address.
322 [Tags] Configure_Less_Octet_IP
323 [Template] Add IP Address
324
325 # ip subnet_mask gateway valid_status_codes
326 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
327
328Configure Empty IP
329 [Documentation] Verify error while Configuring empty IP address.
330 [Tags] Configure_Empty_IP
331 [Template] Add IP Address
332
333 # ip subnet_mask gateway valid_status_codes
334 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
335
336Configure Special Char IP
337 [Documentation] Configure invalid IP address containing special chars.
338 [Tags] Configure_Special_Char_IP
339 [Template] Add IP Address
340
341 # ip subnet_mask gateway valid_status_codes
342 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
343
344Configure Hexadecimal IP
345 [Documentation] Configure invalid IP address containing hex value.
346 [Tags] Configure_Hexadecimal_IP
347 [Template] Add IP Address
348
349 # ip subnet_mask gateway valid_status_codes
350 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
351
352Configure Negative Octet IP
353 [Documentation] Configure invalid IP address containing negative octet.
354 [Tags] Configure_Negative_Octet_IP
355 [Template] Add IP Address
356
357 # ip subnet_mask gateway valid_status_codes
358 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
359
Prashanth Katti5cad5a02019-06-20 07:27:10 -0500360Configure Incomplete IP For Gateway
361 [Documentation] Configure incomplete IP for gateway and expect an error.
362 [Tags] Configure_Incomplete_IP_For_Gateway
363 [Template] Add IP Address
364
365 # ip subnet_mask gateway valid_status_codes
366 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST}
367
368Configure Special Char IP For Gateway
369 [Documentation] Configure special char IP for gateway and expect an error.
370 [Tags] Configure_Special_Char_IP_For_Gateway
371 [Template] Add IP Address
372
373 # ip subnet_mask gateway valid_status_codes
374 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST}
375
376Configure Hexadecimal IP For Gateway
377 [Documentation] Configure hexadecimal IP for gateway and expect an error.
378 [Tags] Configure_Hexadecimal_IP_For_Gateway
379 [Template] Add IP Address
380
381 # ip subnet_mask gateway valid_status_codes
382 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
383
Prashanth Katti7098c972019-07-03 06:56:42 -0500384Get DNS Server And Verify
385 [Documentation] Get DNS server via Redfish and verify.
386 [Tags] Get_DNS_Server_And_Verify
387
388 Verify CLI and Redfish Nameservers
389
390Configure DNS Server And Verify
391 [Documentation] Configure DNS server and verify.
392 [Tags] Configure_DNS_Server_And_Verify
Prashanth Kattic85957c2019-07-09 02:01:20 -0500393 [Setup] DNS Test Setup Execution
Prashanth Katti7098c972019-07-03 06:56:42 -0500394 [Teardown] Run Keywords
395 ... Configure Static Name Servers AND Test Teardown Execution
396
Prashanth Katti7098c972019-07-03 06:56:42 -0500397 Configure Static Name Servers ${static_name_servers}
398 Verify CLI and Redfish Nameservers
399
Prashanth Kattic85957c2019-07-09 02:01:20 -0500400Delete DNS Server And Verify
401 [Documentation] Delete DNS server and verify.
402 [Tags] Delete_DNS_Server_And_Verify
403 [Setup] DNS Test Setup Execution
404 [Teardown] Run Keywords
405 ... Configure Static Name Servers AND Test Teardown Execution
406
407 Delete Static Name Servers
408 Verify CLI and Redfish Nameservers
409
410Configure DNS Server And Check Persistency
411 [Documentation] Configure DNS server and check persistency on reboot.
412 [Tags] Configure_DNS_Server_And_Check_Persistency
413 [Setup] DNS Test Setup Execution
414 [Teardown] Run Keywords
415 ... Configure Static Name Servers AND Test Teardown Execution
416
417 Configure Static Name Servers ${static_name_servers}
418 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500419 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankula8c628b72021-02-05 05:03:45 -0600420 Redfish.Login
Prashanth Kattic85957c2019-07-09 02:01:20 -0500421 Verify CLI and Redfish Nameservers
422
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500423Configure Loopback IP For Gateway
424 [Documentation] Configure loopback IP for gateway and expect an error.
425 [Tags] Configure_Loopback_IP_For_Gateway
426 [Template] Add IP Address
427 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
428
429 # ip subnet_mask gateway valid_status_codes
430 ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST}
431
432Configure Network ID For Gateway
433 [Documentation] Configure network ID for gateway and expect an error.
434 [Tags] Configure_Network_ID_For_Gateway
435 [Template] Add IP Address
436 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
437
438 # ip subnet_mask gateway valid_status_codes
439 ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST}
440
441Configure Multicast IP For Gateway
442 [Documentation] Configure multicast IP for gateway and expect an error.
443 [Tags] Configure_Multicast_IP_For_Gateway
444 [Template] Add IP Address
445 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
446
447 # ip subnet_mask gateway valid_status_codes
Tony Lee412c6682020-04-01 17:34:30 +0800448 ${test_ipv4_addr} ${test_subnet_mask} ${multicast_ip} ${HTTP_BAD_REQUEST}
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500449
450Configure Broadcast IP For Gateway
451 [Documentation] Configure broadcast IP for gateway and expect an error.
452 [Tags] Configure_Broadcast_IP_For_Gateway
453 [Template] Add IP Address
454 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
455
456 # ip subnet_mask gateway valid_status_codes
457 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500458
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500459Configure Null Value For DNS Server
460 [Documentation] Configure null value for DNS server and expect an error.
461 [Tags] Configure_Null_Value_For_DNS_Server
462 [Setup] DNS Test Setup Execution
463 [Teardown] Run Keywords
464 ... Configure Static Name Servers AND Test Teardown Execution
465
466 Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST}
467
Prashanth Kattiafe16b72019-08-02 00:29:45 -0500468Configure Empty Value For DNS Server
469 [Documentation] Configure empty value for DNS server and expect an error.
470 [Tags] Configure_Empty_Value_For_DNS_Server
471 [Setup] DNS Test Setup Execution
472 [Teardown] Run Keywords
473 ... Configure Static Name Servers AND Test Teardown Execution
474
475 Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST}
476
477Configure String Value For DNS Server
478 [Documentation] Configure string value for DNS server and expect an error.
479 [Tags] Configure_String_Value_For_DNS_Server
480 [Setup] DNS Test Setup Execution
481 [Teardown] Run Keywords
482 ... Configure Static Name Servers AND Test Teardown Execution
483
484 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST}
485
Prashanth Katti568df5f2020-05-15 06:00:37 -0500486Modify IPv4 Address And Verify
487 [Documentation] Modify IP address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600488 [Tags] Modify_IPv4_Address_And_Verify
Prashanth Katti568df5f2020-05-15 06:00:37 -0500489 [Teardown] Run Keywords
Anves Kumar rayankula045814b2020-10-09 09:17:05 -0500490 ... Delete IP Address ${test_ipv4_addr2} AND Test Teardown Execution
Prashanth Katti568df5f2020-05-15 06:00:37 -0500491
492 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
493
494 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
495
Sweta Potthuri6e704782022-09-27 01:23:48 -0500496Verify Modifying IP Address Multiple Times
497 [Documentation] Verify modifying IP address multiple times.
498 [Tags] Verify_Modifying_IP_Address_Multiple_Times
499 [Teardown] Run Keywords
500 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
501
502 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
503 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
Sweta Potthurie392cc72022-11-15 06:54:21 -0600504 Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500505
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600506Configure Invalid Values For DNS Server
507 [Documentation] Configure invalid values for DNS server and expect an error.
George Keishing5236ec52022-01-31 12:07:58 -0600508 [Tags] Configure_Invalid_Values_For_DNS_Server
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600509 [Setup] DNS Test Setup Execution
510 [Template] Configure Static Name Servers
511 [Teardown] Run Keywords
512 ... Configure Static Name Servers AND Test Teardown Execution
513
514 # static_name_servers valid_status_codes
515 0xa.0xb.0xc.0xd ${HTTP_BAD_REQUEST}
516 10.-7.-7.-7 ${HTTP_BAD_REQUEST}
517 10.3.36 ${HTTP_BAD_REQUEST}
518 @@@.%%.44.11 ${HTTP_BAD_REQUEST}
519
520
521Config Multiple DNS Servers And Verify
522 [Documentation] Config multiple DNS servers and verify.
523 [Tags] Config_Multiple_DNS_Servers_And_Verify
524 [Setup] DNS Test Setup Execution
525 [Teardown] Run Keywords
526 ... Configure Static Name Servers AND Test Teardown Execution
527
528 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7
529 Configure Static Name Servers ${list_name_servers}
530 Verify CLI and Redfish Nameservers
531
532
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600533Configure And Verify Multiple Static IPv4 Addresses
534 [Documentation] Configure multiple static ipv4 address via Redfish and verify.
535 [Tags] Configure_And_Verify_Multiple_Static_IPv4_Addresses
536 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses}
537 ... AND Test Teardown Execution
538
539 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2}
540 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway}
541
542
543Configure Multiple Static IPv4 Addresses And Check Persistency
544 [Documentation] Configure multiple static ipv4 address via Redfish and check persistency.
545 [Tags] Configure_Multiple_Static_IPv4_Addresses_And_Check_Persistency
546 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses}
547 ... AND Test Teardown Execution
548
549 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2}
550 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway}
551
552 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500553 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankula8c628b72021-02-05 05:03:45 -0600554 Redfish.Login
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600555 FOR ${ip} IN @{test_ipv4_addresses}
556 Verify IP And Netmask On BMC ${ip} ${test_subnet_mask}
nagarjunb2260784a42022-06-13 10:39:33 +0530557 Verify IP On Redfish URI ${ip}
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600558 END
559
560
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600561Configure And Verify Multiple IPv4 Addresses
562 [Documentation] Configure multiple IPv4 addresses and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600563 [Tags] Configure_And_Verify_Multiple_IPv4_Addresses
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600564 [Teardown] Run Keywords
565 ... Delete IP Address ${test_ipv4_addr} AND Delete IP Address ${test_ipv4_addr2}
566 ... AND Test Teardown Execution
567
568 ${ip1}= Create dictionary Address=${test_ipv4_addr}
569 ... SubnetMask=255.255.0.0 Gateway=${test_gateway}
570 ${ip2}= Create dictionary Address=${test_ipv4_addr2}
571 ... SubnetMask=255.255.252.0 Gateway=${test_gateway}
572
573 ${empty_dict}= Create Dictionary
574 ${patch_list}= Create List
575 ${network_configurations}= Get Network Configuration
576 ${num_entries}= Get Length ${network_configurations}
577
578 FOR ${INDEX} IN RANGE 0 ${num_entries}
579 Append To List ${patch_list} ${empty_dict}
580 END
581
582 # We need not check for existence of IP on BMC while adding.
583 Append To List ${patch_list} ${ip1} ${ip2}
584 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list}
585 ${active_channel_config}= Get Active Channel Config
586 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
587 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload}
Anves Kumar rayankula53b80302021-05-21 01:50:03 -0500588 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600589
590 # Note: Network restart takes around 15-18s after patch request processing.
591 Sleep ${NETWORK_TIMEOUT}s
592 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
593 Verify IP On BMC ${test_ipv4_addr}
594 Verify IP On BMC ${test_ipv4_addr2}
595
596
Anves Kumar rayankulaeefdb562021-02-08 07:54:11 -0600597Config Multiple DNS Servers And Check Persistency
598 [Documentation] Config multiple DNS and check persistency.
599 [Tags] Config_Multiple_DNS_Servers_And_Check_Persistency
600 [Setup] DNS Test Setup Execution
601 [Teardown] Run Keywords
602 ... Configure Static Name Servers AND Test Teardown Execution
603
604 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7
605 Configure Static Name Servers ${list_name_servers}
606
607 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500608 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankulaeefdb562021-02-08 07:54:11 -0600609 Redfish.Login
610 Verify CLI and Redfish Nameservers
611
Anves Kumar rayankula2f137eb2021-03-29 01:12:01 -0500612
613Configure Static IP Without Using Gateway And Verify
614 [Documentation] Configure static IP without using gateway and verify error.
615 [Tags] Configure_Static_IP_Without_Using_Gateway_And_Verify
616
617 ${ip}= Create dictionary Address=${test_ipv4_addr}
618 ... SubnetMask=${test_subnet_mask}
619 ${empty_dict}= Create Dictionary
620 ${patch_list}= Create List
621 ${network_configurations}= Get Network Configuration
622
623 ${num_entries}= Get Length ${network_configurations}
624 FOR ${INDEX} IN RANGE 0 ${num_entries}
625 Append To List ${patch_list} ${empty_dict}
626 END
627
628 # We need not check for existence of IP on BMC while adding.
629 Append To List ${patch_list} ${ip}
630 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list}
631 ${active_channel_config}= Get Active Channel Config
632 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
633 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
634 ... body=&{payload} valid_status_codes=[${HTTP_BAD_REQUEST}]
635
Anves Kumar rayankulaac0a7ba2021-03-09 08:10:20 -0600636
637Test Network Response On Specified Host State
638 [Documentation] Verifying the BMC network response when host is on and off.
639 [Tags] Test_Network_Response_On_Specified_Host_State
640 [Template] Verify Network Response On Specified Host State
641
642 # host_state
643 on
644 off
645
Sweta Potthurifb001362022-03-14 02:21:14 -0500646
Prashanth Kattif58cce02019-02-06 03:05:14 -0600647*** Keywords ***
648
649Test Setup Execution
650 [Documentation] Test setup execution.
651
George Keishing97c93942019-03-04 12:45:07 -0600652 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600653
654 @{network_configurations}= Get Network Configuration
655 Set Test Variable @{network_configurations}
656
657 # Get BMC IP address and prefix length.
658 ${ip_data}= Get BMC IP Info
659 Set Test Variable ${ip_data}
660
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600661
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600662Verify Netmask On BMC
663 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600664 [Arguments] ${netmask}
665
666 # Description of the argument(s):
667 # netmask netmask value to be verified.
668
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600669 ${prefix_length}= Netmask Prefix Length ${netmask}
670
671 Should Contain Match ${ip_data} */${prefix_length}
672 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600673
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600674Verify IP And Netmask On BMC
675 [Documentation] Verify IP and netmask on BMC.
676 [Arguments] ${ip} ${netmask}
677
678 # Description of the argument(s):
679 # ip IP address to be verified.
680 # netmask netmask value to be verified.
681
682 ${prefix_length}= Netmask Prefix Length ${netmask}
683 @{ip_data}= Get BMC IP Info
684
685 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
686 Should Contain ${ip_data} ${ip_with_netmask}
687 ... msg=IP and netmask pair does not exist.
688
Prashanth Kattif58cce02019-02-06 03:05:14 -0600689Test Teardown Execution
690 [Documentation] Test teardown execution.
691
692 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600693 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500694
695Clear IP Settings On Fail
696 [Documentation] Clear IP settings on fail.
697 [Arguments] ${ip}
698
699 # Description of argument(s):
700 # ip IP address to be deleted.
701
702 Run Keyword If '${TEST STATUS}' == 'FAIL'
703 ... Delete IP Address ${ip}
704
705 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500706
Prashanth Katti7098c972019-07-03 06:56:42 -0500707Verify CLI and Redfish Nameservers
708 [Documentation] Verify that nameservers obtained via Redfish do not
709 ... match those found in /etc/resolv.conf.
710
Tony Lee412c6682020-04-01 17:34:30 +0800711 ${active_channel_config}= Get Active Channel Config
712 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
713
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500714 ${redfish_nameservers}= Redfish.Get Attribute
715 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Prashanth Katti7098c972019-07-03 06:56:42 -0500716 ${resolve_conf_nameservers}= CLI Get Nameservers
Michael Walsh39c00512019-07-17 10:54:06 -0500717 Rqprint Vars redfish_nameservers resolve_conf_nameservers
Prashanth Katti7098c972019-07-03 06:56:42 -0500718
Sweta Potthurid77ea982021-07-01 04:30:38 -0500719 List Should Contain Sub List ${resolve_conf_nameservers} ${redfish_nameservers}
720 ... msg=The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
Prashanth Katti7098c972019-07-03 06:56:42 -0500721
722Configure Static Name Servers
723 [Documentation] Configure DNS server on BMC.
Prashanth Kattic85957c2019-07-09 02:01:20 -0500724 [Arguments] ${static_name_servers}=${original_nameservers}
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500725 ... ${valid_status_codes}=${HTTP_OK}
Prashanth Katti7098c972019-07-03 06:56:42 -0500726
George Keishing9cb2e592019-07-12 09:37:33 -0500727 # Description of the argument(s):
Prashanth Katti7098c972019-07-03 06:56:42 -0500728 # static_name_servers A list of static name server IPs to be
729 # configured on the BMC.
730
Tony Lee412c6682020-04-01 17:34:30 +0800731 ${active_channel_config}= Get Active Channel Config
732 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
733
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600734 ${type} = Evaluate type($static_name_servers).__name__
735 ${static_name_servers}= Set Variable If '${type}'=='str'
736 ... '${static_name_servers}' ${static_name_servers}
737
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500738 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios.
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500739 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
740 ... body={'StaticNameServers': ${static_name_servers}}
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500741 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}]
Prashanth Kattic85957c2019-07-09 02:01:20 -0500742
Prashanth Kattif247be32019-10-07 04:40:43 -0500743 # Patch operation takes 1 to 3 seconds to set new value.
kothais878f4f92023-11-02 11:43:37 +0000744 Wait Until Keyword Succeeds 1 min 3 sec CLI Get and Verify Name Servers ${static_name_servers} ${valid_status_codes}
Prashanth Katti7f9e60f2019-07-26 01:18:41 -0500745
Prashanth Kattic85957c2019-07-09 02:01:20 -0500746Delete Static Name Servers
747 [Documentation] Delete static name servers.
748
Sweta Potthuridc325932022-06-15 12:51:27 -0500749 DNS Test Setup Execution
Anves Kumar rayankula045814b2020-10-09 09:17:05 -0500750 Configure Static Name Servers static_name_servers=@{EMPTY}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500751
752 # Check if all name servers deleted on BMC.
753 ${nameservers}= CLI Get Nameservers
Sweta Potthuridc325932022-06-15 12:51:27 -0500754 Should Not Contain ${nameservers} ${original_nameservers}
755
756 DNS Test Setup Execution
757
758 Should Be Empty ${original_nameservers}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500759
760DNS Test Setup Execution
761 [Documentation] Do DNS test setup execution.
762
763 Redfish.Login
764
Tony Lee412c6682020-04-01 17:34:30 +0800765 ${active_channel_config}= Get Active Channel Config
766 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
767
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500768 ${original_nameservers}= Redfish.Get Attribute
769 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Tony Lee412c6682020-04-01 17:34:30 +0800770
Prashanth Kattic85957c2019-07-09 02:01:20 -0500771 Rprint Vars original_nameservers
772 # Set suite variables to trigger restoration during teardown.
773 Set Suite Variable ${original_nameservers}
Prashanth Kattib478d902020-05-08 10:05:32 -0500774
aravinth0510ca054ee2022-06-16 13:26:15 +0000775
Prashanth Kattib478d902020-05-08 10:05:32 -0500776Suite Setup Execution
777 [Documentation] Do suite setup execution.
778
aravinth0510ca054ee2022-06-16 13:26:15 +0000779 # - Get DHCP IPv4 enabled/disabled status from redfish managers URI
780 # - If DHCP IPv4 is enabled ,
781 # - Get DHCP IPv4 settings - ip address, gateway, subnetmask
782 # - And set the same as static IP address
783
George Keishing1ac42212022-07-20 21:55:49 -0500784 Redfish.Login
Anvesh Kumar59188b62023-12-12 08:03:14 -0600785 ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${CHANNEL_NUMBER}
aravinth0510ca054ee2022-06-16 13:26:15 +0000786 Set Suite Variable ${DHCPEnabled}
787
Anvesh Kumar59188b62023-12-12 08:03:14 -0600788 ${ip_addr} ${gateway} ${subnetmask}= Run Keyword If ${DHCPEnabled}==True
789 ... Get DHCP IP Info
790
aravinth0510ca054ee2022-06-16 13:26:15 +0000791 Run Keyword If ${DHCPEnabled}==True
Anvesh Kumar59188b62023-12-12 08:03:14 -0600792 ... Add IP Address ${ip_addr} ${subnetmask} ${gateway}
aravinth0510ca054ee2022-06-16 13:26:15 +0000793
Prashanth Kattib478d902020-05-08 10:05:32 -0500794 ${test_gateway}= Get BMC Default Gateway
795 Set Suite Variable ${test_gateway}
Prashanth Katti568df5f2020-05-15 06:00:37 -0500796
aravinth0510ca054ee2022-06-16 13:26:15 +0000797
798Suite Teardown Execution
799 [Documentation] Do suite teardown execution.
800
801 # - If the DHCP IPv4 is enabled before suite setup execution
802 # - Restore the DHCP IPv4 to enabled state
803
Anvesh Kumar59188b62023-12-12 08:03:14 -0600804 Redfish.Login
aravinth0510ca054ee2022-06-16 13:26:15 +0000805 Run Keyword If ${DHCPEnabled}==True
806 ... Enable IPv4 DHCP Settings
807
808
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600809Configure Multiple Static IPv4 Addresses
810 [Documentation] Configure multiple static ipv4 address via Redfish and verify.
811 [Arguments] ${ip_addreses} ${subnet_mask} ${gateway}
812
813 # Description of argument(s):
814 # ip_addreses A list of IP addresses to be added (e.g.["10.7.7.7"]).
815 # subnet_mask Subnet mask for the IP to be added (e.g. "255.255.0.0").
816 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
817
818 FOR ${ip} IN @{ip_addreses}
819 Add IP Address ${ip} ${subnet_mask} ${gateway}
820 END
821 Validate Network Config On BMC
822
823
824Delete Multiple Static IPv4 Addresses
825 [Documentation] Delete multiple static ipv4 address via Redfish.
826 [Arguments] ${ip_addreses}
827
828 # Description of argument(s):
829 # ip_addreses A list of IP addresses to be deleted (e.g.["10.7.7.7"]).
830
831 FOR ${ip} IN @{ip_addreses}
832 Delete IP Address ${ip}
833 END
834 Validate Network Config On BMC
Anves Kumar rayankulaac0a7ba2021-03-09 08:10:20 -0600835
836Verify Network Response On Specified Host State
837 [Documentation] Verifying the BMC network response when host is on and off.
838 [Arguments] ${host_state}
839
840 # Description of argument(s):
841 # host_state if host_state is on then host is booted to operating system.
842 # if host_state is off then host is power off.
843 # (eg. on, off).
844
845 ${active_channel_config}= Get Active Channel Config
846 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
847
848 Run Keyword If '${host_state}' == 'on'
849 ... Redfish Power On stack_mode=skip
850 ... ELSE
851 ... Redfish Power off stack_mode=skip
852
853 Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
854 Ping Host ${OPENBMC_HOST}
855
nagarjunb2260784a42022-06-13 10:39:33 +0530856
857Verify IP On Redfish URI
858 [Documentation] Verify given IP on redfish URI.
859 [Arguments] ${ip_address}
860
861 # Description of argument(s):
862 # ip_address Configured IP address which need to verified.
863
864 ${network_configurations}= Get Network Configuration
865
866 FOR ${network_configuration} IN @{network_configurations}
867 ${ip_found}= Set Variable If '${network_configuration['Address']}' == '${ip_address}' ${True}
868 ... ${False}
869 Exit For Loop If ${ip_found}
870 END
871 Run Keyword If '${ip_found}' == '${False}'
872 ... Fail msg=Configured IP address not found on EthernetInterface URI.
aravinth0510ca054ee2022-06-16 13:26:15 +0000873
874
875Enable IPv4 DHCP Settings
876 [Documentation] Set IPv4 DHCP enabled status true/false in redfish URI.
877 [Arguments] ${status}=${True}
878
879 # Description of argument(s):
880 # status IPv4 DHCPEnabled status which needs to be set.
881 # (e.g. True or False)
882
883 ${active_channel_config}= Get Active Channel Config
884 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
885 ${DHCPv4}= Create Dictionary DHCPEnabled=${status}
886
887 ${payload}= Create Dictionary DHCPv4=${DHCPv4}
888 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
889 ... body=&{payload} valid_status_codes=[${HTTP_NO_CONTENT}, ${HTTP_OK}]
890
891 Sleep ${NETWORK_TIMEOUT}s
892 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}