blob: 9b076332a1e187f5254ec09f311aa123e470c93a [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
11Test Setup Test Setup Execution
12Test Teardown Test Teardown Execution
Prashanth Kattib478d902020-05-08 10:05:32 -050013Suite Setup Suite Setup Execution
Prashanth Kattif58cce02019-02-06 03:05:14 -060014
Prashanth Kattif34fafa2019-06-20 05:04:40 -050015Force Tags Network_Conf_Test
16
Prashanth Katti23efc6e2019-03-13 06:07:15 -050017*** Variables ***
Vijayde3bf7b2019-04-16 04:56:09 -050018${test_hostname} openbmc
19${test_ipv4_addr} 10.7.7.7
20${test_ipv4_invalid_addr} 0.0.1.a
21${test_subnet_mask} 255.255.0.0
Prashanth Kattib36a7522019-05-22 05:32:39 -050022${broadcast_ip} 10.7.7.255
23${loopback_ip} 127.0.0.2
24${multicast_ip} 224.6.6.6
25${out_of_range_ip} 10.7.7.256
Prashanth Katti568df5f2020-05-15 06:00:37 -050026${test_ipv4_addr2} 10.7.7.8
Prashanth Katti23efc6e2019-03-13 06:07:15 -050027
Prashanth Katti040c8c12019-05-31 04:42:05 -050028# Valid netmask is 4 bytes long and has continuos block of 1s.
29# Maximum valid value in each octet is 255 and least value is 0.
30# 253 is not valid, as binary value is 11111101.
31${invalid_netmask} 255.255.253.0
32${alpha_netmask} ff.ff.ff.ff
33# Maximum value of octet in netmask is 255.
34${out_of_range_netmask} 255.256.255.0
35${more_byte_netmask} 255.255.255.0.0
36${less_byte_netmask} 255.255.255
Prashanth Kattic6ad6472019-06-14 03:33:39 -050037${threshold_netmask} 255.255.255.255
38${lowest_netmask} 128.0.0.0
39
40# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
41# but trying to configure xx.xx.xx
42${less_octet_ip} 10.3.36
43
44# For the address 10.6.6.6, the 10.6.6.0 portion describes the
45# network ID and the 6 describe the host.
46
47${network_id} 10.7.7.0
48${hex_ip} 0xa.0xb.0xc.0xd
49${negative_ip} 10.-7.-7.7
50${hex_ip} 0xa.0xb.0xc.0xd
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
113
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500114 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500115
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500116 Configure Hostname ${test_hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500117 Validate Hostname On BMC ${test_hostname}
118
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500119 # Revert back to initial hostname.
120 Configure Hostname ${hostname}
121 Validate Hostname On BMC ${hostname}
122
Vijayde3bf7b2019-04-16 04:56:09 -0500123Add Valid IPv4 Address And Verify
124 [Documentation] Add IPv4 Address via Redfish and verify.
125 [Tags] Add_Valid_IPv4_Addres_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500126 [Teardown] Run Keywords
127 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Vijayde3bf7b2019-04-16 04:56:09 -0500128
129 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Vijayde3bf7b2019-04-16 04:56:09 -0500130
131Add Invalid IPv4 Address And Verify
132 [Documentation] Add Invalid IPv4 Address via Redfish and verify.
133 [Tags] Add_Invalid_IPv4_Addres_And_Verify
134
135 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask}
136 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST}
137
Prashanth Kattib36a7522019-05-22 05:32:39 -0500138Configure Out Of Range IP
139 [Documentation] Configure out-of-range IP address.
140 [Tags] Configure_Out_Of_Range_IP
141 [Template] Add IP Address
142
143 # ip subnet_mask gateway valid_status_codes
144 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
145
146Configure Broadcast IP
147 [Documentation] Configure broadcast IP address.
148 [Tags] Configure_Broadcast_IP
149 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500150 [Teardown] Clear IP Settings On Fail ${broadcast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500151
152 # ip subnet_mask gateway valid_status_codes
153 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
154
155Configure Multicast IP
156 [Documentation] Configure multicast IP address.
157 [Tags] Configure_Multicast_IP
158 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500159 [Teardown] Clear IP Settings On Fail ${multicast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500160
161 # ip subnet_mask gateway valid_status_codes
162 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
163
164Configure Loopback IP
165 [Documentation] Configure loopback IP address.
166 [Tags] Configure_Loopback_IP
167 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500168 [Teardown] Clear IP Settings On Fail ${loopback_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500169
170 # ip subnet_mask gateway valid_status_codes
171 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
172
173Add Valid IPv4 Address And Check Persistency
174 [Documentation] Add IPv4 address and check peristency.
175 [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500176 [Teardown] Run Keywords
177 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattib36a7522019-05-22 05:32:39 -0500178
179 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
180
181 # Reboot BMC and verify persistency.
182 OBMC Reboot (off)
George Keishing5c498742019-08-09 02:14:44 -0500183 Redfish.Login
Prashanth Kattib36a7522019-05-22 05:32:39 -0500184 Verify IP On BMC ${test_ipv4_addr}
Vijayde3bf7b2019-04-16 04:56:09 -0500185
Prashanth Katti6cedca22019-05-30 02:31:11 -0500186Add Fourth Octet Threshold IP And Verify
187 [Documentation] Add fourth octet threshold IP and verify.
188 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500189 [Teardown] Run Keywords
190 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500191
192 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500193
194Add Fourth Octet Lowest IP And Verify
195 [Documentation] Add fourth octet lowest IP and verify.
196 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500197 [Teardown] Run Keywords
198 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500199
200 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500201
202Add Third Octet Threshold IP And Verify
203 [Documentation] Add third octet threshold IP and verify.
204 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500205 [Teardown] Run Keywords
206 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500207
208 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500209
210Add Third Octet Lowest IP And Verify
211 [Documentation] Add third octet lowest IP and verify.
212 [Tags] Add_Third_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500213 [Teardown] Run Keywords
214 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500215
216 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500217
218Add Second Octet Threshold IP And Verify
219 [Documentation] Add second octet threshold IP and verify.
220 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500221 [Teardown] Run Keywords
222 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500223
224 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500225
226Add Second Octet Lowest IP And Verify
227 [Documentation] Add second octet lowest IP and verify.
228 [Tags] Add_Second_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500229 [Teardown] Run Keywords
230 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500231
232 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500233
234Add First Octet Threshold IP And Verify
235 [Documentation] Add first octet threshold IP and verify.
236 [Tags] Add_First_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500237 [Teardown] Run Keywords
Anves Kumar rayankulaf757b102020-07-27 20:41:36 -0500238 ... Delete IP Address 223.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500239
240 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500241
242Add First Octet Lowest IP And Verify
243 [Documentation] Add first octet lowest IP and verify.
244 [Tags] Add_First_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500245 [Teardown] Run Keywords
246 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500247
248 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500249
Prashanth Katti040c8c12019-05-31 04:42:05 -0500250Configure Invalid Netmask
251 [Documentation] Verify error while setting invalid netmask.
252 [Tags] Configure_Invalid_Netmask
253 [Template] Add IP Address
254
255 # ip subnet_mask gateway valid_status_codes
256 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
257
258Configure Out Of Range Netmask
259 [Documentation] Verify error while setting out of range netmask.
260 [Tags] Configure_Out_Of_Range_Netmask
261 [Template] Add IP Address
262
263 # ip subnet_mask gateway valid_status_codes
264 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
265
266Configure Alpha Netmask
267 [Documentation] Verify error while setting alpha netmask.
268 [Tags] Configure_Alpha_Netmask
269 [Template] Add IP Address
270
271 # ip subnet_mask gateway valid_status_codes
272 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
273
274Configure More Byte Netmask
275 [Documentation] Verify error while setting more byte netmask.
276 [Tags] Configure_More_Byte_Netmask
277 [Template] Add IP Address
278
279 # ip subnet_mask gateway valid_status_codes
280 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
281
282Configure Less Byte Netmask
283 [Documentation] Verify error while setting less byte netmask.
284 [Tags] Configure_Less_Byte_Netmask
285 [Template] Add IP Address
286
287 # ip subnet_mask gateway valid_status_codes
288 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
289
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500290Configure Threshold Netmask And Verify
291 [Documentation] Configure threshold netmask and verify.
292 [Tags] Configure_Threshold_Netmask_And_verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500293 [Teardown] Run Keywords
294 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500295
296 Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500297
298Configure Lowest Netmask And Verify
299 [Documentation] Configure lowest netmask and verify.
300 [Tags] Configure_Lowest_Netmask_And_verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500301 [Teardown] Run Keywords
302 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500303
304 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500305
306Configure Network ID
307 [Documentation] Verify error while configuring network ID.
308 [Tags] Configure_Network_ID
309 [Template] Add IP Address
310 [Teardown] Clear IP Settings On Fail ${network_id}
311
312 # ip subnet_mask gateway valid_status_codes
313 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
314
315Configure Less Octet IP
316 [Documentation] Verify error while Configuring less octet IP address.
317 [Tags] Configure_Less_Octet_IP
318 [Template] Add IP Address
319
320 # ip subnet_mask gateway valid_status_codes
321 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
322
323Configure Empty IP
324 [Documentation] Verify error while Configuring empty IP address.
325 [Tags] Configure_Empty_IP
326 [Template] Add IP Address
327
328 # ip subnet_mask gateway valid_status_codes
329 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
330
331Configure Special Char IP
332 [Documentation] Configure invalid IP address containing special chars.
333 [Tags] Configure_Special_Char_IP
334 [Template] Add IP Address
335
336 # ip subnet_mask gateway valid_status_codes
337 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
338
339Configure Hexadecimal IP
340 [Documentation] Configure invalid IP address containing hex value.
341 [Tags] Configure_Hexadecimal_IP
342 [Template] Add IP Address
343
344 # ip subnet_mask gateway valid_status_codes
345 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
346
347Configure Negative Octet IP
348 [Documentation] Configure invalid IP address containing negative octet.
349 [Tags] Configure_Negative_Octet_IP
350 [Template] Add IP Address
351
352 # ip subnet_mask gateway valid_status_codes
353 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
354
Prashanth Katti5cad5a02019-06-20 07:27:10 -0500355Configure Incomplete IP For Gateway
356 [Documentation] Configure incomplete IP for gateway and expect an error.
357 [Tags] Configure_Incomplete_IP_For_Gateway
358 [Template] Add IP Address
359
360 # ip subnet_mask gateway valid_status_codes
361 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST}
362
363Configure Special Char IP For Gateway
364 [Documentation] Configure special char IP for gateway and expect an error.
365 [Tags] Configure_Special_Char_IP_For_Gateway
366 [Template] Add IP Address
367
368 # ip subnet_mask gateway valid_status_codes
369 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST}
370
371Configure Hexadecimal IP For Gateway
372 [Documentation] Configure hexadecimal IP for gateway and expect an error.
373 [Tags] Configure_Hexadecimal_IP_For_Gateway
374 [Template] Add IP Address
375
376 # ip subnet_mask gateway valid_status_codes
377 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
378
Prashanth Katti7098c972019-07-03 06:56:42 -0500379Get DNS Server And Verify
380 [Documentation] Get DNS server via Redfish and verify.
381 [Tags] Get_DNS_Server_And_Verify
382
383 Verify CLI and Redfish Nameservers
384
385Configure DNS Server And Verify
386 [Documentation] Configure DNS server and verify.
387 [Tags] Configure_DNS_Server_And_Verify
Prashanth Kattic85957c2019-07-09 02:01:20 -0500388 [Setup] DNS Test Setup Execution
Prashanth Katti7098c972019-07-03 06:56:42 -0500389 [Teardown] Run Keywords
390 ... Configure Static Name Servers AND Test Teardown Execution
391
Prashanth Katti7098c972019-07-03 06:56:42 -0500392 Configure Static Name Servers ${static_name_servers}
393 Verify CLI and Redfish Nameservers
394
Prashanth Kattic85957c2019-07-09 02:01:20 -0500395Delete DNS Server And Verify
396 [Documentation] Delete DNS server and verify.
397 [Tags] Delete_DNS_Server_And_Verify
398 [Setup] DNS Test Setup Execution
399 [Teardown] Run Keywords
400 ... Configure Static Name Servers AND Test Teardown Execution
401
402 Delete Static Name Servers
403 Verify CLI and Redfish Nameservers
404
405Configure DNS Server And Check Persistency
406 [Documentation] Configure DNS server and check persistency on reboot.
407 [Tags] Configure_DNS_Server_And_Check_Persistency
408 [Setup] DNS Test Setup Execution
409 [Teardown] Run Keywords
410 ... Configure Static Name Servers AND Test Teardown Execution
411
412 Configure Static Name Servers ${static_name_servers}
413 # Reboot BMC and verify persistency.
414 OBMC Reboot (off)
415 Verify CLI and Redfish Nameservers
416
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500417Configure Loopback IP For Gateway
418 [Documentation] Configure loopback IP for gateway and expect an error.
419 [Tags] Configure_Loopback_IP_For_Gateway
420 [Template] Add IP Address
421 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
422
423 # ip subnet_mask gateway valid_status_codes
424 ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST}
425
426Configure Network ID For Gateway
427 [Documentation] Configure network ID for gateway and expect an error.
428 [Tags] Configure_Network_ID_For_Gateway
429 [Template] Add IP Address
430 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
431
432 # ip subnet_mask gateway valid_status_codes
433 ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST}
434
435Configure Multicast IP For Gateway
436 [Documentation] Configure multicast IP for gateway and expect an error.
437 [Tags] Configure_Multicast_IP_For_Gateway
438 [Template] Add IP Address
439 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
440
441 # ip subnet_mask gateway valid_status_codes
Tony Lee412c6682020-04-01 17:34:30 +0800442 ${test_ipv4_addr} ${test_subnet_mask} ${multicast_ip} ${HTTP_BAD_REQUEST}
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500443
444Configure Broadcast IP For Gateway
445 [Documentation] Configure broadcast IP for gateway and expect an error.
446 [Tags] Configure_Broadcast_IP_For_Gateway
447 [Template] Add IP Address
448 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
449
450 # ip subnet_mask gateway valid_status_codes
451 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500452
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500453Configure Null Value For DNS Server
454 [Documentation] Configure null value for DNS server and expect an error.
455 [Tags] Configure_Null_Value_For_DNS_Server
456 [Setup] DNS Test Setup Execution
457 [Teardown] Run Keywords
458 ... Configure Static Name Servers AND Test Teardown Execution
459
460 Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST}
461
Prashanth Kattiafe16b72019-08-02 00:29:45 -0500462Configure Empty Value For DNS Server
463 [Documentation] Configure empty value for DNS server and expect an error.
464 [Tags] Configure_Empty_Value_For_DNS_Server
465 [Setup] DNS Test Setup Execution
466 [Teardown] Run Keywords
467 ... Configure Static Name Servers AND Test Teardown Execution
468
469 Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST}
470
471Configure String Value For DNS Server
472 [Documentation] Configure string value for DNS server and expect an error.
473 [Tags] Configure_String_Value_For_DNS_Server
474 [Setup] DNS Test Setup Execution
475 [Teardown] Run Keywords
476 ... Configure Static Name Servers AND Test Teardown Execution
477
478 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST}
479
Prashanth Katti568df5f2020-05-15 06:00:37 -0500480Modify IPv4 Address And Verify
481 [Documentation] Modify IP address via Redfish and verify.
482 [Tags] Modify_IPv4_Addres_And_Verify
483 [Teardown] Run Keywords
484 ... Delete IP Address ${test_ipv4_addr2} AND Delete IP Address ${test_ipv4_addr}
485 ... AND Test Teardown Execution
486
487 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
488
489 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
490
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500491
Prashanth Kattif58cce02019-02-06 03:05:14 -0600492*** Keywords ***
493
494Test Setup Execution
495 [Documentation] Test setup execution.
496
George Keishing97c93942019-03-04 12:45:07 -0600497 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600498
499 @{network_configurations}= Get Network Configuration
500 Set Test Variable @{network_configurations}
501
502 # Get BMC IP address and prefix length.
503 ${ip_data}= Get BMC IP Info
504 Set Test Variable ${ip_data}
505
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600506
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600507Verify Netmask On BMC
508 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600509 [Arguments] ${netmask}
510
511 # Description of the argument(s):
512 # netmask netmask value to be verified.
513
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600514 ${prefix_length}= Netmask Prefix Length ${netmask}
515
516 Should Contain Match ${ip_data} */${prefix_length}
517 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600518
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600519Verify IP And Netmask On BMC
520 [Documentation] Verify IP and netmask on BMC.
521 [Arguments] ${ip} ${netmask}
522
523 # Description of the argument(s):
524 # ip IP address to be verified.
525 # netmask netmask value to be verified.
526
527 ${prefix_length}= Netmask Prefix Length ${netmask}
528 @{ip_data}= Get BMC IP Info
529
530 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
531 Should Contain ${ip_data} ${ip_with_netmask}
532 ... msg=IP and netmask pair does not exist.
533
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500534Validate Hostname On BMC
535 [Documentation] Verify that the hostname read via Redfish is the same as the
536 ... hostname configured on system.
537 [Arguments] ${hostname}
538
539 # Description of argument(s):
540 # hostname A hostname value which is to be compared to the hostname
541 # configured on system.
542
543 ${sys_hostname}= Get BMC Hostname
Prashanth Katti466d8342019-03-21 08:58:50 -0500544 Should Be Equal ${sys_hostname} ${hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500545 ... ignore_case=True msg=Hostname does not exist.
546
Prashanth Kattif58cce02019-02-06 03:05:14 -0600547Test Teardown Execution
548 [Documentation] Test teardown execution.
549
550 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600551 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500552
553Clear IP Settings On Fail
554 [Documentation] Clear IP settings on fail.
555 [Arguments] ${ip}
556
557 # Description of argument(s):
558 # ip IP address to be deleted.
559
560 Run Keyword If '${TEST STATUS}' == 'FAIL'
561 ... Delete IP Address ${ip}
562
563 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500564
Prashanth Katti7098c972019-07-03 06:56:42 -0500565Verify CLI and Redfish Nameservers
566 [Documentation] Verify that nameservers obtained via Redfish do not
567 ... match those found in /etc/resolv.conf.
568
Tony Lee412c6682020-04-01 17:34:30 +0800569 ${active_channel_config}= Get Active Channel Config
570 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
571
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500572 ${redfish_nameservers}= Redfish.Get Attribute
573 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Prashanth Katti7098c972019-07-03 06:56:42 -0500574 ${resolve_conf_nameservers}= CLI Get Nameservers
Michael Walsh39c00512019-07-17 10:54:06 -0500575 Rqprint Vars redfish_nameservers resolve_conf_nameservers
Prashanth Katti7098c972019-07-03 06:56:42 -0500576
577 # Check that the 2 lists are equivalent.
578 ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers)
579 Should Be True ${match}
580 ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
581
Prashanth Katti7098c972019-07-03 06:56:42 -0500582
583Configure Static Name Servers
584 [Documentation] Configure DNS server on BMC.
Prashanth Kattic85957c2019-07-09 02:01:20 -0500585 [Arguments] ${static_name_servers}=${original_nameservers}
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500586 ... ${valid_status_codes}=${HTTP_OK}
Prashanth Katti7098c972019-07-03 06:56:42 -0500587
George Keishing9cb2e592019-07-12 09:37:33 -0500588 # Description of the argument(s):
Prashanth Katti7098c972019-07-03 06:56:42 -0500589 # static_name_servers A list of static name server IPs to be
590 # configured on the BMC.
591
Tony Lee412c6682020-04-01 17:34:30 +0800592 ${active_channel_config}= Get Active Channel Config
593 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
594
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500595 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios.
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500596 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
597 ... body={'StaticNameServers': ${static_name_servers}}
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500598 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}]
Prashanth Kattic85957c2019-07-09 02:01:20 -0500599
Prashanth Kattif247be32019-10-07 04:40:43 -0500600 # Patch operation takes 1 to 3 seconds to set new value.
601 Sleep 3s
602
Prashanth Katti7f9e60f2019-07-26 01:18:41 -0500603 # Check if newly added DNS server is configured on BMC.
604 ${cli_nameservers}= CLI Get Nameservers
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500605 ${cmd_status}= Run Keyword And Return Status
606 ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers}
607
608 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}'
609 ... Should Be True ${cmd_status} == ${True}
610 ... ELSE Should Be True ${cmd_status} == ${False}
Prashanth Katti7f9e60f2019-07-26 01:18:41 -0500611
Prashanth Kattic85957c2019-07-09 02:01:20 -0500612Delete Static Name Servers
613 [Documentation] Delete static name servers.
614
615 Configure Static Name Servers @{EMPTY}
616
617 # Check if all name servers deleted on BMC.
618 ${nameservers}= CLI Get Nameservers
619 Should Be Empty ${nameservers}
620
621DNS Test Setup Execution
622 [Documentation] Do DNS test setup execution.
623
624 Redfish.Login
625
Tony Lee412c6682020-04-01 17:34:30 +0800626 ${active_channel_config}= Get Active Channel Config
627 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
628
Anves Kumar rayankula91548ea2020-06-18 00:28:13 -0500629 ${original_nameservers}= Redfish.Get Attribute
630 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers
Tony Lee412c6682020-04-01 17:34:30 +0800631
Prashanth Kattic85957c2019-07-09 02:01:20 -0500632 Rprint Vars original_nameservers
633 # Set suite variables to trigger restoration during teardown.
634 Set Suite Variable ${original_nameservers}
Prashanth Kattib478d902020-05-08 10:05:32 -0500635
636Suite Setup Execution
637 [Documentation] Do suite setup execution.
638
639 ${test_gateway}= Get BMC Default Gateway
640 Set Suite Variable ${test_gateway}
Prashanth Katti568df5f2020-05-15 06:00:37 -0500641
642Update IP Address
643 [Documentation] Update IP address of BMC.
644 [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} ${valid_status_codes}=${HTTP_OK}
645
646 # Description of argument(s):
647 # ip IP address to be replaced (e.g. "10.7.7.7").
648 # new_ip New IP address to be configured.
649 # netmask Netmask value.
650 # gw_ip Gateway IP address.
651 # valid_status_codes Expected return code from patch operation
652 # (e.g. "200"). See prolog of rest_request
653 # method in redfish_plus.py for details.
654
655 ${empty_dict}= Create Dictionary
656 ${patch_list}= Create List
657 ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip}
658
659 # Find the position of IP address to be modified.
660 @{network_configurations}= Get Network Configuration
661 FOR ${network_configuration} IN @{network_configurations}
662 Run Keyword If '${network_configuration['Address']}' == '${ip}'
663 ... Append To List ${patch_list} ${ip_data}
664 ... ELSE Append To List ${patch_list} ${empty_dict}
665 END
666
667 ${ip_found}= Run Keyword And Return Status List Should Contain Value
668 ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC
669 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC
670
671 # Run patch command only if given IP is found on BMC
672 ${data}= Create Dictionary IPv4StaticAddresses=${patch_list}
673
674 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} valid_status_codes=[${valid_status_codes}]
675
676 # Note: Network restart takes around 15-18s after patch request processing.
677 Sleep ${NETWORK_TIMEOUT}s
678 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
679
680 Verify IP On BMC ${new_ip}
681 Validate Network Config On BMC