blob: 6df4f5eb98031f3584876458cdbefbbcd8b9d4b6 [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
Anvesh-Kumar_Rayankulacff10212024-01-04 00:15:54 -0600125Configure Invalid HostName And Verify
126 [Documentation] Configure invalid hostname via Redfish and Verify.
127 [Tags] Configure_Invalid_HostName_And_Verify
128 [Template] Configure Hostname
129
130 # hostname status_code
131 !#@ [${HTTP_BAD_REQUEST}]
132 ${EMPTY} [${HTTP_BAD_REQUEST}]
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500133
Vijayde3bf7b2019-04-16 04:56:09 -0500134Add Valid IPv4 Address And Verify
135 [Documentation] Add IPv4 Address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600136 [Tags] Add_Valid_IPv4_Address_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500137 [Teardown] Run Keywords
138 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Vijayde3bf7b2019-04-16 04:56:09 -0500139
140 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Vijayde3bf7b2019-04-16 04:56:09 -0500141
142Add Invalid IPv4 Address And Verify
143 [Documentation] Add Invalid IPv4 Address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600144 [Tags] Add_Invalid_IPv4_Address_And_Verify
Vijayde3bf7b2019-04-16 04:56:09 -0500145
146 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask}
147 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST}
148
Prashanth Kattib36a7522019-05-22 05:32:39 -0500149Configure Out Of Range IP
150 [Documentation] Configure out-of-range IP address.
151 [Tags] Configure_Out_Of_Range_IP
152 [Template] Add IP Address
153
154 # ip subnet_mask gateway valid_status_codes
155 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
156
157Configure Broadcast IP
158 [Documentation] Configure broadcast IP address.
159 [Tags] Configure_Broadcast_IP
160 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500161 [Teardown] Clear IP Settings On Fail ${broadcast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500162
163 # ip subnet_mask gateway valid_status_codes
164 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
165
166Configure Multicast IP
167 [Documentation] Configure multicast IP address.
168 [Tags] Configure_Multicast_IP
169 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500170 [Teardown] Clear IP Settings On Fail ${multicast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500171
172 # ip subnet_mask gateway valid_status_codes
173 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
174
175Configure Loopback IP
176 [Documentation] Configure loopback IP address.
177 [Tags] Configure_Loopback_IP
178 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500179 [Teardown] Clear IP Settings On Fail ${loopback_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500180
181 # ip subnet_mask gateway valid_status_codes
182 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
183
184Add Valid IPv4 Address And Check Persistency
nagarjunb2260784a42022-06-13 10:39:33 +0530185 [Documentation] Add IPv4 address and check persistency.
George Keishing0c8100f2022-01-13 00:24:57 -0600186 [Tags] Add_Valid_IPv4_Address_And_Check_Persistency
nagarjunb2260784a42022-06-13 10:39:33 +0530187 [Teardown] Run Keywords
188 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattib36a7522019-05-22 05:32:39 -0500189
190 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
191
192 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500193 Redfish OBMC Reboot (off) stack_mode=skip
George Keishing5c498742019-08-09 02:14:44 -0500194 Redfish.Login
Prashanth Kattib36a7522019-05-22 05:32:39 -0500195 Verify IP On BMC ${test_ipv4_addr}
nagarjunb2260784a42022-06-13 10:39:33 +0530196 Verify IP On Redfish URI ${test_ipv4_addr}
197
Vijayde3bf7b2019-04-16 04:56:09 -0500198
Prashanth Katti6cedca22019-05-30 02:31:11 -0500199Add Fourth Octet Threshold IP And Verify
200 [Documentation] Add fourth octet threshold IP and verify.
201 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500202 [Teardown] Run Keywords
203 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500204
205 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500206
207Add Fourth Octet Lowest IP And Verify
208 [Documentation] Add fourth octet lowest IP and verify.
209 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500210 [Teardown] Run Keywords
211 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500212
213 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500214
215Add Third Octet Threshold IP And Verify
216 [Documentation] Add third octet threshold IP and verify.
217 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500218 [Teardown] Run Keywords
219 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500220
221 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500222
223Add Third Octet Lowest IP And Verify
224 [Documentation] Add third octet lowest IP and verify.
225 [Tags] Add_Third_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500226 [Teardown] Run Keywords
227 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500228
229 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500230
231Add Second Octet Threshold IP And Verify
232 [Documentation] Add second octet threshold IP and verify.
233 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500234 [Teardown] Run Keywords
235 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500236
237 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500238
239Add Second Octet Lowest IP And Verify
240 [Documentation] Add second octet lowest IP and verify.
241 [Tags] Add_Second_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500242 [Teardown] Run Keywords
243 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500244
245 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500246
247Add First Octet Threshold IP And Verify
248 [Documentation] Add first octet threshold IP and verify.
249 [Tags] Add_First_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500250 [Teardown] Run Keywords
Anves Kumar rayankulaf757b102020-07-27 20:41:36 -0500251 ... Delete IP Address 223.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500252
253 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500254
255Add First Octet Lowest IP And Verify
256 [Documentation] Add first octet lowest IP and verify.
257 [Tags] Add_First_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500258 [Teardown] Run Keywords
259 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500260
261 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500262
Prashanth Katti040c8c12019-05-31 04:42:05 -0500263Configure Invalid Netmask
264 [Documentation] Verify error while setting invalid netmask.
265 [Tags] Configure_Invalid_Netmask
266 [Template] Add IP Address
267
268 # ip subnet_mask gateway valid_status_codes
269 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
270
271Configure Out Of Range Netmask
272 [Documentation] Verify error while setting out of range netmask.
273 [Tags] Configure_Out_Of_Range_Netmask
274 [Template] Add IP Address
275
276 # ip subnet_mask gateway valid_status_codes
277 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
278
279Configure Alpha Netmask
280 [Documentation] Verify error while setting alpha netmask.
281 [Tags] Configure_Alpha_Netmask
282 [Template] Add IP Address
283
284 # ip subnet_mask gateway valid_status_codes
285 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
286
287Configure More Byte Netmask
288 [Documentation] Verify error while setting more byte netmask.
289 [Tags] Configure_More_Byte_Netmask
290 [Template] Add IP Address
291
292 # ip subnet_mask gateway valid_status_codes
293 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
294
295Configure Less Byte Netmask
296 [Documentation] Verify error while setting less byte netmask.
297 [Tags] Configure_Less_Byte_Netmask
298 [Template] Add IP Address
299
300 # ip subnet_mask gateway valid_status_codes
301 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
302
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500303Configure Threshold Netmask And Verify
304 [Documentation] Configure threshold netmask and verify.
George Keishing5236ec52022-01-31 12:07:58 -0600305 [Tags] Configure_Threshold_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} ${threshold_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500310
311Configure Lowest Netmask And Verify
312 [Documentation] Configure lowest netmask and verify.
George Keishing5236ec52022-01-31 12:07:58 -0600313 [Tags] Configure_Lowest_Netmask_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500314 [Teardown] Run Keywords
315 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500316
317 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500318
319Configure Network ID
320 [Documentation] Verify error while configuring network ID.
321 [Tags] Configure_Network_ID
322 [Template] Add IP Address
323 [Teardown] Clear IP Settings On Fail ${network_id}
324
325 # ip subnet_mask gateway valid_status_codes
326 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
327
328Configure Less Octet IP
329 [Documentation] Verify error while Configuring less octet IP address.
330 [Tags] Configure_Less_Octet_IP
331 [Template] Add IP Address
332
333 # ip subnet_mask gateway valid_status_codes
334 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
335
336Configure Empty IP
337 [Documentation] Verify error while Configuring empty IP address.
338 [Tags] Configure_Empty_IP
339 [Template] Add IP Address
340
341 # ip subnet_mask gateway valid_status_codes
342 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
343
344Configure Special Char IP
345 [Documentation] Configure invalid IP address containing special chars.
346 [Tags] Configure_Special_Char_IP
347 [Template] Add IP Address
348
349 # ip subnet_mask gateway valid_status_codes
350 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
351
352Configure Hexadecimal IP
353 [Documentation] Configure invalid IP address containing hex value.
354 [Tags] Configure_Hexadecimal_IP
355 [Template] Add IP Address
356
357 # ip subnet_mask gateway valid_status_codes
358 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
359
360Configure Negative Octet IP
361 [Documentation] Configure invalid IP address containing negative octet.
362 [Tags] Configure_Negative_Octet_IP
363 [Template] Add IP Address
364
365 # ip subnet_mask gateway valid_status_codes
366 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
367
Prashanth Katti5cad5a02019-06-20 07:27:10 -0500368Configure Incomplete IP For Gateway
369 [Documentation] Configure incomplete IP for gateway and expect an error.
370 [Tags] Configure_Incomplete_IP_For_Gateway
371 [Template] Add IP Address
372
373 # ip subnet_mask gateway valid_status_codes
374 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST}
375
376Configure Special Char IP For Gateway
377 [Documentation] Configure special char IP for gateway and expect an error.
378 [Tags] Configure_Special_Char_IP_For_Gateway
379 [Template] Add IP Address
380
381 # ip subnet_mask gateway valid_status_codes
382 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST}
383
384Configure Hexadecimal IP For Gateway
385 [Documentation] Configure hexadecimal IP for gateway and expect an error.
386 [Tags] Configure_Hexadecimal_IP_For_Gateway
387 [Template] Add IP Address
388
389 # ip subnet_mask gateway valid_status_codes
390 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
391
Prashanth Katti7098c972019-07-03 06:56:42 -0500392Get DNS Server And Verify
393 [Documentation] Get DNS server via Redfish and verify.
394 [Tags] Get_DNS_Server_And_Verify
395
396 Verify CLI and Redfish Nameservers
397
398Configure DNS Server And Verify
399 [Documentation] Configure DNS server and verify.
400 [Tags] Configure_DNS_Server_And_Verify
Prashanth Kattic85957c2019-07-09 02:01:20 -0500401 [Setup] DNS Test Setup Execution
Prashanth Katti7098c972019-07-03 06:56:42 -0500402 [Teardown] Run Keywords
403 ... Configure Static Name Servers AND Test Teardown Execution
404
Prashanth Katti7098c972019-07-03 06:56:42 -0500405 Configure Static Name Servers ${static_name_servers}
406 Verify CLI and Redfish Nameservers
407
Prashanth Kattic85957c2019-07-09 02:01:20 -0500408Delete DNS Server And Verify
409 [Documentation] Delete DNS server and verify.
410 [Tags] Delete_DNS_Server_And_Verify
411 [Setup] DNS Test Setup Execution
412 [Teardown] Run Keywords
413 ... Configure Static Name Servers AND Test Teardown Execution
414
415 Delete Static Name Servers
416 Verify CLI and Redfish Nameservers
417
418Configure DNS Server And Check Persistency
419 [Documentation] Configure DNS server and check persistency on reboot.
420 [Tags] Configure_DNS_Server_And_Check_Persistency
421 [Setup] DNS Test Setup Execution
422 [Teardown] Run Keywords
423 ... Configure Static Name Servers AND Test Teardown Execution
424
425 Configure Static Name Servers ${static_name_servers}
426 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500427 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankula8c628b72021-02-05 05:03:45 -0600428 Redfish.Login
Prashanth Kattic85957c2019-07-09 02:01:20 -0500429 Verify CLI and Redfish Nameservers
430
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500431Configure Loopback IP For Gateway
432 [Documentation] Configure loopback IP for gateway and expect an error.
433 [Tags] Configure_Loopback_IP_For_Gateway
434 [Template] Add IP Address
435 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
436
437 # ip subnet_mask gateway valid_status_codes
438 ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST}
439
440Configure Network ID For Gateway
441 [Documentation] Configure network ID for gateway and expect an error.
442 [Tags] Configure_Network_ID_For_Gateway
443 [Template] Add IP Address
444 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
445
446 # ip subnet_mask gateway valid_status_codes
447 ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST}
448
449Configure Multicast IP For Gateway
450 [Documentation] Configure multicast IP for gateway and expect an error.
451 [Tags] Configure_Multicast_IP_For_Gateway
452 [Template] Add IP Address
453 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
454
455 # ip subnet_mask gateway valid_status_codes
Tony Lee412c6682020-04-01 17:34:30 +0800456 ${test_ipv4_addr} ${test_subnet_mask} ${multicast_ip} ${HTTP_BAD_REQUEST}
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500457
458Configure Broadcast IP For Gateway
459 [Documentation] Configure broadcast IP for gateway and expect an error.
460 [Tags] Configure_Broadcast_IP_For_Gateway
461 [Template] Add IP Address
462 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
463
464 # ip subnet_mask gateway valid_status_codes
465 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500466
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500467Configure Null Value For DNS Server
468 [Documentation] Configure null value for DNS server and expect an error.
469 [Tags] Configure_Null_Value_For_DNS_Server
470 [Setup] DNS Test Setup Execution
471 [Teardown] Run Keywords
472 ... Configure Static Name Servers AND Test Teardown Execution
473
474 Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST}
475
Prashanth Kattiafe16b72019-08-02 00:29:45 -0500476Configure Empty Value For DNS Server
477 [Documentation] Configure empty value for DNS server and expect an error.
478 [Tags] Configure_Empty_Value_For_DNS_Server
479 [Setup] DNS Test Setup Execution
480 [Teardown] Run Keywords
481 ... Configure Static Name Servers AND Test Teardown Execution
482
483 Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST}
484
485Configure String Value For DNS Server
486 [Documentation] Configure string value for DNS server and expect an error.
487 [Tags] Configure_String_Value_For_DNS_Server
488 [Setup] DNS Test Setup Execution
489 [Teardown] Run Keywords
490 ... Configure Static Name Servers AND Test Teardown Execution
491
492 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST}
493
Prashanth Katti568df5f2020-05-15 06:00:37 -0500494Modify IPv4 Address And Verify
495 [Documentation] Modify IP address via Redfish and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600496 [Tags] Modify_IPv4_Address_And_Verify
Prashanth Katti568df5f2020-05-15 06:00:37 -0500497 [Teardown] Run Keywords
Anves Kumar rayankula045814b2020-10-09 09:17:05 -0500498 ... Delete IP Address ${test_ipv4_addr2} AND Test Teardown Execution
Prashanth Katti568df5f2020-05-15 06:00:37 -0500499
500 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
501
502 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
503
Sweta Potthuri6e704782022-09-27 01:23:48 -0500504Verify Modifying IP Address Multiple Times
505 [Documentation] Verify modifying IP address multiple times.
506 [Tags] Verify_Modifying_IP_Address_Multiple_Times
507 [Teardown] Run Keywords
508 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
509
510 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
511 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
Sweta Potthurie392cc72022-11-15 06:54:21 -0600512 Update IP Address ${test_ipv4_addr2} ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500513
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600514Configure Invalid Values For DNS Server
515 [Documentation] Configure invalid values for DNS server and expect an error.
George Keishing5236ec52022-01-31 12:07:58 -0600516 [Tags] Configure_Invalid_Values_For_DNS_Server
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600517 [Setup] DNS Test Setup Execution
518 [Template] Configure Static Name Servers
519 [Teardown] Run Keywords
520 ... Configure Static Name Servers AND Test Teardown Execution
521
522 # static_name_servers valid_status_codes
523 0xa.0xb.0xc.0xd ${HTTP_BAD_REQUEST}
524 10.-7.-7.-7 ${HTTP_BAD_REQUEST}
525 10.3.36 ${HTTP_BAD_REQUEST}
526 @@@.%%.44.11 ${HTTP_BAD_REQUEST}
527
528
529Config Multiple DNS Servers And Verify
530 [Documentation] Config multiple DNS servers and verify.
531 [Tags] Config_Multiple_DNS_Servers_And_Verify
532 [Setup] DNS Test Setup Execution
533 [Teardown] Run Keywords
534 ... Configure Static Name Servers AND Test Teardown Execution
535
536 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7
537 Configure Static Name Servers ${list_name_servers}
538 Verify CLI and Redfish Nameservers
539
540
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600541Configure And Verify Multiple Static IPv4 Addresses
542 [Documentation] Configure multiple static ipv4 address via Redfish and verify.
543 [Tags] Configure_And_Verify_Multiple_Static_IPv4_Addresses
544 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses}
545 ... AND Test Teardown Execution
546
547 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2}
548 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway}
549
550
551Configure Multiple Static IPv4 Addresses And Check Persistency
552 [Documentation] Configure multiple static ipv4 address via Redfish and check persistency.
553 [Tags] Configure_Multiple_Static_IPv4_Addresses_And_Check_Persistency
554 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses}
555 ... AND Test Teardown Execution
556
557 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2}
558 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway}
559
560 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500561 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankula8c628b72021-02-05 05:03:45 -0600562 Redfish.Login
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600563 FOR ${ip} IN @{test_ipv4_addresses}
564 Verify IP And Netmask On BMC ${ip} ${test_subnet_mask}
nagarjunb2260784a42022-06-13 10:39:33 +0530565 Verify IP On Redfish URI ${ip}
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600566 END
567
568
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600569Configure And Verify Multiple IPv4 Addresses
570 [Documentation] Configure multiple IPv4 addresses and verify.
George Keishing0c8100f2022-01-13 00:24:57 -0600571 [Tags] Configure_And_Verify_Multiple_IPv4_Addresses
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600572 [Teardown] Run Keywords
573 ... Delete IP Address ${test_ipv4_addr} AND Delete IP Address ${test_ipv4_addr2}
574 ... AND Test Teardown Execution
575
576 ${ip1}= Create dictionary Address=${test_ipv4_addr}
577 ... SubnetMask=255.255.0.0 Gateway=${test_gateway}
578 ${ip2}= Create dictionary Address=${test_ipv4_addr2}
579 ... SubnetMask=255.255.252.0 Gateway=${test_gateway}
580
581 ${empty_dict}= Create Dictionary
582 ${patch_list}= Create List
583 ${network_configurations}= Get Network Configuration
584 ${num_entries}= Get Length ${network_configurations}
585
586 FOR ${INDEX} IN RANGE 0 ${num_entries}
587 Append To List ${patch_list} ${empty_dict}
588 END
589
590 # We need not check for existence of IP on BMC while adding.
591 Append To List ${patch_list} ${ip1} ${ip2}
592 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list}
593 ${active_channel_config}= Get Active Channel Config
594 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
595 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload}
Anves Kumar rayankula53b80302021-05-21 01:50:03 -0500596 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
Anves Kumar rayankula43e93e12021-01-27 03:52:37 -0600597
598 # Note: Network restart takes around 15-18s after patch request processing.
599 Sleep ${NETWORK_TIMEOUT}s
600 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
601 Verify IP On BMC ${test_ipv4_addr}
602 Verify IP On BMC ${test_ipv4_addr2}
603
604
Anves Kumar rayankulaeefdb562021-02-08 07:54:11 -0600605Config Multiple DNS Servers And Check Persistency
606 [Documentation] Config multiple DNS and check persistency.
607 [Tags] Config_Multiple_DNS_Servers_And_Check_Persistency
608 [Setup] DNS Test Setup Execution
609 [Teardown] Run Keywords
610 ... Configure Static Name Servers AND Test Teardown Execution
611
612 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7
613 Configure Static Name Servers ${list_name_servers}
614
615 # Reboot BMC and verify persistency.
Sweta Potthuri63f0b102022-08-03 23:11:46 -0500616 Redfish OBMC Reboot (off) stack_mode=skip
Anves Kumar rayankulaeefdb562021-02-08 07:54:11 -0600617 Redfish.Login
618 Verify CLI and Redfish Nameservers
619
Anves Kumar rayankula2f137eb2021-03-29 01:12:01 -0500620
621Configure Static IP Without Using Gateway And Verify
622 [Documentation] Configure static IP without using gateway and verify error.
623 [Tags] Configure_Static_IP_Without_Using_Gateway_And_Verify
624
625 ${ip}= Create dictionary Address=${test_ipv4_addr}
626 ... SubnetMask=${test_subnet_mask}
627 ${empty_dict}= Create Dictionary
628 ${patch_list}= Create List
629 ${network_configurations}= Get Network Configuration
630
631 ${num_entries}= Get Length ${network_configurations}
632 FOR ${INDEX} IN RANGE 0 ${num_entries}
633 Append To List ${patch_list} ${empty_dict}
634 END
635
636 # We need not check for existence of IP on BMC while adding.
637 Append To List ${patch_list} ${ip}
638 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list}
639 ${active_channel_config}= Get Active Channel Config
640 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
641 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
642 ... body=&{payload} valid_status_codes=[${HTTP_BAD_REQUEST}]
643
Anves Kumar rayankulaac0a7ba2021-03-09 08:10:20 -0600644
645Test Network Response On Specified Host State
646 [Documentation] Verifying the BMC network response when host is on and off.
647 [Tags] Test_Network_Response_On_Specified_Host_State
648 [Template] Verify Network Response On Specified Host State
649
650 # host_state
651 on
652 off
653
Sweta Potthurifb001362022-03-14 02:21:14 -0500654
Prashanth Kattif58cce02019-02-06 03:05:14 -0600655*** Keywords ***
656
657Test Setup Execution
658 [Documentation] Test setup execution.
659
George Keishing97c93942019-03-04 12:45:07 -0600660 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600661
662 @{network_configurations}= Get Network Configuration
663 Set Test Variable @{network_configurations}
664
665 # Get BMC IP address and prefix length.
666 ${ip_data}= Get BMC IP Info
667 Set Test Variable ${ip_data}
668
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600669
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600670Verify Netmask On BMC
671 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600672 [Arguments] ${netmask}
673
674 # Description of the argument(s):
675 # netmask netmask value to be verified.
676
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600677 ${prefix_length}= Netmask Prefix Length ${netmask}
678
679 Should Contain Match ${ip_data} */${prefix_length}
680 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600681
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600682Verify IP And Netmask On BMC
683 [Documentation] Verify IP and netmask on BMC.
684 [Arguments] ${ip} ${netmask}
685
686 # Description of the argument(s):
687 # ip IP address to be verified.
688 # netmask netmask value to be verified.
689
690 ${prefix_length}= Netmask Prefix Length ${netmask}
691 @{ip_data}= Get BMC IP Info
692
693 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
694 Should Contain ${ip_data} ${ip_with_netmask}
695 ... msg=IP and netmask pair does not exist.
696
Prashanth Kattif58cce02019-02-06 03:05:14 -0600697Test Teardown Execution
698 [Documentation] Test teardown execution.
699
700 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600701 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500702
703Clear IP Settings On Fail
704 [Documentation] Clear IP settings on fail.
705 [Arguments] ${ip}
706
707 # Description of argument(s):
708 # ip IP address to be deleted.
709
710 Run Keyword If '${TEST STATUS}' == 'FAIL'
711 ... Delete IP Address ${ip}
712
713 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500714
Prashanth Katti7098c972019-07-03 06:56:42 -0500715Verify CLI and Redfish Nameservers
716 [Documentation] Verify that nameservers obtained via Redfish do not
717 ... match those found in /etc/resolv.conf.
718
Tony Lee412c6682020-04-01 17:34:30 +0800719 ${active_channel_config}= Get Active Channel Config
720 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
721
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500722 ${redfish_nameservers}= Redfish.Get Attribute
723 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Prashanth Katti7098c972019-07-03 06:56:42 -0500724 ${resolve_conf_nameservers}= CLI Get Nameservers
Michael Walsh39c00512019-07-17 10:54:06 -0500725 Rqprint Vars redfish_nameservers resolve_conf_nameservers
Prashanth Katti7098c972019-07-03 06:56:42 -0500726
Sweta Potthurid77ea982021-07-01 04:30:38 -0500727 List Should Contain Sub List ${resolve_conf_nameservers} ${redfish_nameservers}
728 ... msg=The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
Prashanth Katti7098c972019-07-03 06:56:42 -0500729
730Configure Static Name Servers
731 [Documentation] Configure DNS server on BMC.
Prashanth Kattic85957c2019-07-09 02:01:20 -0500732 [Arguments] ${static_name_servers}=${original_nameservers}
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500733 ... ${valid_status_codes}=${HTTP_OK}
Prashanth Katti7098c972019-07-03 06:56:42 -0500734
George Keishing9cb2e592019-07-12 09:37:33 -0500735 # Description of the argument(s):
Prashanth Katti7098c972019-07-03 06:56:42 -0500736 # static_name_servers A list of static name server IPs to be
737 # configured on the BMC.
738
Tony Lee412c6682020-04-01 17:34:30 +0800739 ${active_channel_config}= Get Active Channel Config
740 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
741
Anves Kumar rayankula6b9fcd12020-12-18 01:03:19 -0600742 ${type} = Evaluate type($static_name_servers).__name__
743 ${static_name_servers}= Set Variable If '${type}'=='str'
744 ... '${static_name_servers}' ${static_name_servers}
745
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500746 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios.
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500747 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
748 ... body={'StaticNameServers': ${static_name_servers}}
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500749 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}]
Prashanth Kattic85957c2019-07-09 02:01:20 -0500750
Prashanth Kattif247be32019-10-07 04:40:43 -0500751 # Patch operation takes 1 to 3 seconds to set new value.
kothais878f4f92023-11-02 11:43:37 +0000752 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 -0500753
Prashanth Kattic85957c2019-07-09 02:01:20 -0500754Delete Static Name Servers
755 [Documentation] Delete static name servers.
756
Sweta Potthuridc325932022-06-15 12:51:27 -0500757 DNS Test Setup Execution
Anves Kumar rayankula045814b2020-10-09 09:17:05 -0500758 Configure Static Name Servers static_name_servers=@{EMPTY}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500759
760 # Check if all name servers deleted on BMC.
761 ${nameservers}= CLI Get Nameservers
Sweta Potthuridc325932022-06-15 12:51:27 -0500762 Should Not Contain ${nameservers} ${original_nameservers}
763
764 DNS Test Setup Execution
765
766 Should Be Empty ${original_nameservers}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500767
768DNS Test Setup Execution
769 [Documentation] Do DNS test setup execution.
770
771 Redfish.Login
772
Tony Lee412c6682020-04-01 17:34:30 +0800773 ${active_channel_config}= Get Active Channel Config
774 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
775
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500776 ${original_nameservers}= Redfish.Get Attribute
777 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Tony Lee412c6682020-04-01 17:34:30 +0800778
Prashanth Kattic85957c2019-07-09 02:01:20 -0500779 Rprint Vars original_nameservers
780 # Set suite variables to trigger restoration during teardown.
781 Set Suite Variable ${original_nameservers}
Prashanth Kattib478d902020-05-08 10:05:32 -0500782
aravinth0510ca054ee2022-06-16 13:26:15 +0000783
Prashanth Kattib478d902020-05-08 10:05:32 -0500784Suite Setup Execution
785 [Documentation] Do suite setup execution.
786
aravinth0510ca054ee2022-06-16 13:26:15 +0000787 # - Get DHCP IPv4 enabled/disabled status from redfish managers URI
788 # - If DHCP IPv4 is enabled ,
789 # - Get DHCP IPv4 settings - ip address, gateway, subnetmask
790 # - And set the same as static IP address
791
George Keishing1ac42212022-07-20 21:55:49 -0500792 Redfish.Login
Anvesh Kumar59188b62023-12-12 08:03:14 -0600793 ${DHCPEnabled}= Get IPv4 DHCP Enabled Status ${CHANNEL_NUMBER}
aravinth0510ca054ee2022-06-16 13:26:15 +0000794 Set Suite Variable ${DHCPEnabled}
795
Anvesh Kumar59188b62023-12-12 08:03:14 -0600796 ${ip_addr} ${gateway} ${subnetmask}= Run Keyword If ${DHCPEnabled}==True
797 ... Get DHCP IP Info
798
aravinth0510ca054ee2022-06-16 13:26:15 +0000799 Run Keyword If ${DHCPEnabled}==True
Anvesh Kumar59188b62023-12-12 08:03:14 -0600800 ... Add IP Address ${ip_addr} ${subnetmask} ${gateway}
aravinth0510ca054ee2022-06-16 13:26:15 +0000801
Prashanth Kattib478d902020-05-08 10:05:32 -0500802 ${test_gateway}= Get BMC Default Gateway
803 Set Suite Variable ${test_gateway}
Prashanth Katti568df5f2020-05-15 06:00:37 -0500804
aravinth0510ca054ee2022-06-16 13:26:15 +0000805
806Suite Teardown Execution
807 [Documentation] Do suite teardown execution.
808
809 # - If the DHCP IPv4 is enabled before suite setup execution
810 # - Restore the DHCP IPv4 to enabled state
811
Anvesh Kumar59188b62023-12-12 08:03:14 -0600812 Redfish.Login
aravinth0510ca054ee2022-06-16 13:26:15 +0000813 Run Keyword If ${DHCPEnabled}==True
814 ... Enable IPv4 DHCP Settings
815
816
Anves Kumar rayankulad4cdd8c2021-01-11 04:10:05 -0600817Configure Multiple Static IPv4 Addresses
818 [Documentation] Configure multiple static ipv4 address via Redfish and verify.
819 [Arguments] ${ip_addreses} ${subnet_mask} ${gateway}
820
821 # Description of argument(s):
822 # ip_addreses A list of IP addresses to be added (e.g.["10.7.7.7"]).
823 # subnet_mask Subnet mask for the IP to be added (e.g. "255.255.0.0").
824 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
825
826 FOR ${ip} IN @{ip_addreses}
827 Add IP Address ${ip} ${subnet_mask} ${gateway}
828 END
829 Validate Network Config On BMC
830
831
832Delete Multiple Static IPv4 Addresses
833 [Documentation] Delete multiple static ipv4 address via Redfish.
834 [Arguments] ${ip_addreses}
835
836 # Description of argument(s):
837 # ip_addreses A list of IP addresses to be deleted (e.g.["10.7.7.7"]).
838
839 FOR ${ip} IN @{ip_addreses}
840 Delete IP Address ${ip}
841 END
842 Validate Network Config On BMC
Anves Kumar rayankulaac0a7ba2021-03-09 08:10:20 -0600843
844Verify Network Response On Specified Host State
845 [Documentation] Verifying the BMC network response when host is on and off.
846 [Arguments] ${host_state}
847
848 # Description of argument(s):
849 # host_state if host_state is on then host is booted to operating system.
850 # if host_state is off then host is power off.
851 # (eg. on, off).
852
853 ${active_channel_config}= Get Active Channel Config
854 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
855
856 Run Keyword If '${host_state}' == 'on'
857 ... Redfish Power On stack_mode=skip
858 ... ELSE
859 ... Redfish Power off stack_mode=skip
860
861 Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
862 Ping Host ${OPENBMC_HOST}
863
nagarjunb2260784a42022-06-13 10:39:33 +0530864
865Verify IP On Redfish URI
866 [Documentation] Verify given IP on redfish URI.
867 [Arguments] ${ip_address}
868
869 # Description of argument(s):
870 # ip_address Configured IP address which need to verified.
871
872 ${network_configurations}= Get Network Configuration
873
874 FOR ${network_configuration} IN @{network_configurations}
875 ${ip_found}= Set Variable If '${network_configuration['Address']}' == '${ip_address}' ${True}
876 ... ${False}
877 Exit For Loop If ${ip_found}
878 END
879 Run Keyword If '${ip_found}' == '${False}'
880 ... Fail msg=Configured IP address not found on EthernetInterface URI.
aravinth0510ca054ee2022-06-16 13:26:15 +0000881
882
883Enable IPv4 DHCP Settings
884 [Documentation] Set IPv4 DHCP enabled status true/false in redfish URI.
885 [Arguments] ${status}=${True}
886
887 # Description of argument(s):
888 # status IPv4 DHCPEnabled status which needs to be set.
889 # (e.g. True or False)
890
891 ${active_channel_config}= Get Active Channel Config
892 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
893 ${DHCPv4}= Create Dictionary DHCPEnabled=${status}
894
895 ${payload}= Create Dictionary DHCPv4=${DHCPv4}
896 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
897 ... body=&{payload} valid_status_codes=[${HTTP_NO_CONTENT}, ${HTTP_OK}]
898
899 Sleep ${NETWORK_TIMEOUT}s
900 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}