blob: 3ee5d16ae8252152ae9d0de2f43a65a70d246b58 [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
62 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060063 \ Verify IP On BMC ${network_configuration['Address']}
64
Prashanth Kattif58cce02019-02-06 03:05:14 -060065Get Netmask And Verify
66 [Documentation] Get Netmask And Verify.
George Keishing5d467552019-02-08 23:30:48 -060067 [Tags] Get_Netmask_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060068
69 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060070 \ Verify Netmask On BMC ${network_configuration['SubnetMask']}
71
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060072Get Gateway And Verify
73 [Documentation] Get gateway and verify it's existence on the BMC.
74 [Tags] Get_Gateway_And_Verify
75
76 : FOR ${network_configuration} IN @{network_configurations}
77 \ Verify Gateway On BMC ${network_configuration['Gateway']}
78
79Get MAC Address And Verify
80 [Documentation] Get MAC address and verify it's existence on the BMC.
81 [Tags] Get_MAC_Address_And_Verify
82
George Keishing97c93942019-03-04 12:45:07 -060083 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060084 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress
85 Validate MAC On BMC ${macaddr}
Prashanth Kattif58cce02019-02-06 03:05:14 -060086
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -060087Verify All Configured IP And Netmask
88 [Documentation] Verify all configured IP and netmask on BMC.
89 [Tags] Verify_All_Configured_IP_And_Netmask
90
91 : FOR ${network_configuration} IN @{network_configurations}
92 \ Verify IP And Netmask On BMC ${network_configuration['Address']}
93 ... ${network_configuration['SubnetMask']}
94
Prashanth Katti23efc6e2019-03-13 06:07:15 -050095Get Hostname And Verify
96 [Documentation] Get hostname via Redfish and verify.
97 [Tags] Get_Hostname_And_Verify
98
99 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
100
101 Validate Hostname On BMC ${hostname}
102
103Configure Hostname And Verify
104 [Documentation] Configure hostname via Redfish and verify.
105 [Tags] Configure_Hostname_And_Verify
106
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500107 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500108
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500109 Configure Hostname ${test_hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500110 Validate Hostname On BMC ${test_hostname}
111
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500112 # Revert back to initial hostname.
113 Configure Hostname ${hostname}
114 Validate Hostname On BMC ${hostname}
115
Vijayde3bf7b2019-04-16 04:56:09 -0500116Add Valid IPv4 Address And Verify
117 [Documentation] Add IPv4 Address via Redfish and verify.
118 [Tags] Add_Valid_IPv4_Addres_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500119 [Teardown] Run Keywords
120 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Vijayde3bf7b2019-04-16 04:56:09 -0500121
122 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
Vijayde3bf7b2019-04-16 04:56:09 -0500123
124Add Invalid IPv4 Address And Verify
125 [Documentation] Add Invalid IPv4 Address via Redfish and verify.
126 [Tags] Add_Invalid_IPv4_Addres_And_Verify
127
128 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask}
129 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST}
130
Prashanth Kattib36a7522019-05-22 05:32:39 -0500131Configure Out Of Range IP
132 [Documentation] Configure out-of-range IP address.
133 [Tags] Configure_Out_Of_Range_IP
134 [Template] Add IP Address
135
136 # ip subnet_mask gateway valid_status_codes
137 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
138
139Configure Broadcast IP
140 [Documentation] Configure broadcast IP address.
141 [Tags] Configure_Broadcast_IP
142 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500143 [Teardown] Clear IP Settings On Fail ${broadcast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500144
145 # ip subnet_mask gateway valid_status_codes
146 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
147
148Configure Multicast IP
149 [Documentation] Configure multicast IP address.
150 [Tags] Configure_Multicast_IP
151 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500152 [Teardown] Clear IP Settings On Fail ${multicast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500153
154 # ip subnet_mask gateway valid_status_codes
155 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
156
157Configure Loopback IP
158 [Documentation] Configure loopback IP address.
159 [Tags] Configure_Loopback_IP
160 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500161 [Teardown] Clear IP Settings On Fail ${loopback_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500162
163 # ip subnet_mask gateway valid_status_codes
164 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
165
166Add Valid IPv4 Address And Check Persistency
167 [Documentation] Add IPv4 address and check peristency.
168 [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500169 [Teardown] Run Keywords
170 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattib36a7522019-05-22 05:32:39 -0500171
172 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
173
174 # Reboot BMC and verify persistency.
175 OBMC Reboot (off)
George Keishing5c498742019-08-09 02:14:44 -0500176 Redfish.Login
Prashanth Kattib36a7522019-05-22 05:32:39 -0500177 Verify IP On BMC ${test_ipv4_addr}
Vijayde3bf7b2019-04-16 04:56:09 -0500178
Prashanth Katti6cedca22019-05-30 02:31:11 -0500179Add Fourth Octet Threshold IP And Verify
180 [Documentation] Add fourth octet threshold IP and verify.
181 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500182 [Teardown] Run Keywords
183 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500184
185 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500186
187Add Fourth Octet Lowest IP And Verify
188 [Documentation] Add fourth octet lowest IP and verify.
189 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500190 [Teardown] Run Keywords
191 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500192
193 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500194
195Add Third Octet Threshold IP And Verify
196 [Documentation] Add third octet threshold IP and verify.
197 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500198 [Teardown] Run Keywords
199 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500200
201 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500202
203Add Third Octet Lowest IP And Verify
204 [Documentation] Add third octet lowest IP and verify.
205 [Tags] Add_Third_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500206 [Teardown] Run Keywords
207 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500208
209 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500210
211Add Second Octet Threshold IP And Verify
212 [Documentation] Add second octet threshold IP and verify.
213 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500214 [Teardown] Run Keywords
215 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500216
217 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500218
219Add Second Octet Lowest IP And Verify
220 [Documentation] Add second octet lowest IP and verify.
221 [Tags] Add_Second_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500222 [Teardown] Run Keywords
223 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500224
225 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500226
227Add First Octet Threshold IP And Verify
228 [Documentation] Add first octet threshold IP and verify.
229 [Tags] Add_First_Octet_Threshold_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500230 [Teardown] Run Keywords
231 ... Delete IP Address 233.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500232
233 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500234
235Add First Octet Lowest IP And Verify
236 [Documentation] Add first octet lowest IP and verify.
237 [Tags] Add_First_Octet_Lowest_IP_And_Verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500238 [Teardown] Run Keywords
239 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution
Prashanth Katti6cedca22019-05-30 02:31:11 -0500240
241 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway}
Prashanth Katti6cedca22019-05-30 02:31:11 -0500242
Prashanth Katti040c8c12019-05-31 04:42:05 -0500243Configure Invalid Netmask
244 [Documentation] Verify error while setting invalid netmask.
245 [Tags] Configure_Invalid_Netmask
246 [Template] Add IP Address
247
248 # ip subnet_mask gateway valid_status_codes
249 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
250
251Configure Out Of Range Netmask
252 [Documentation] Verify error while setting out of range netmask.
253 [Tags] Configure_Out_Of_Range_Netmask
254 [Template] Add IP Address
255
256 # ip subnet_mask gateway valid_status_codes
257 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
258
259Configure Alpha Netmask
260 [Documentation] Verify error while setting alpha netmask.
261 [Tags] Configure_Alpha_Netmask
262 [Template] Add IP Address
263
264 # ip subnet_mask gateway valid_status_codes
265 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
266
267Configure More Byte Netmask
268 [Documentation] Verify error while setting more byte netmask.
269 [Tags] Configure_More_Byte_Netmask
270 [Template] Add IP Address
271
272 # ip subnet_mask gateway valid_status_codes
273 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
274
275Configure Less Byte Netmask
276 [Documentation] Verify error while setting less byte netmask.
277 [Tags] Configure_Less_Byte_Netmask
278 [Template] Add IP Address
279
280 # ip subnet_mask gateway valid_status_codes
281 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
282
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500283Configure Threshold Netmask And Verify
284 [Documentation] Configure threshold netmask and verify.
285 [Tags] Configure_Threshold_Netmask_And_verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500286 [Teardown] Run Keywords
287 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500288
289 Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500290
291Configure Lowest Netmask And Verify
292 [Documentation] Configure lowest netmask and verify.
293 [Tags] Configure_Lowest_Netmask_And_verify
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500294 [Teardown] Run Keywords
295 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500296
297 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway}
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500298
299Configure Network ID
300 [Documentation] Verify error while configuring network ID.
301 [Tags] Configure_Network_ID
302 [Template] Add IP Address
303 [Teardown] Clear IP Settings On Fail ${network_id}
304
305 # ip subnet_mask gateway valid_status_codes
306 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
307
308Configure Less Octet IP
309 [Documentation] Verify error while Configuring less octet IP address.
310 [Tags] Configure_Less_Octet_IP
311 [Template] Add IP Address
312
313 # ip subnet_mask gateway valid_status_codes
314 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
315
316Configure Empty IP
317 [Documentation] Verify error while Configuring empty IP address.
318 [Tags] Configure_Empty_IP
319 [Template] Add IP Address
320
321 # ip subnet_mask gateway valid_status_codes
322 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
323
324Configure Special Char IP
325 [Documentation] Configure invalid IP address containing special chars.
326 [Tags] Configure_Special_Char_IP
327 [Template] Add IP Address
328
329 # ip subnet_mask gateway valid_status_codes
330 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
331
332Configure Hexadecimal IP
333 [Documentation] Configure invalid IP address containing hex value.
334 [Tags] Configure_Hexadecimal_IP
335 [Template] Add IP Address
336
337 # ip subnet_mask gateway valid_status_codes
338 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
339
340Configure Negative Octet IP
341 [Documentation] Configure invalid IP address containing negative octet.
342 [Tags] Configure_Negative_Octet_IP
343 [Template] Add IP Address
344
345 # ip subnet_mask gateway valid_status_codes
346 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
347
Prashanth Katti5cad5a02019-06-20 07:27:10 -0500348Configure Incomplete IP For Gateway
349 [Documentation] Configure incomplete IP for gateway and expect an error.
350 [Tags] Configure_Incomplete_IP_For_Gateway
351 [Template] Add IP Address
352
353 # ip subnet_mask gateway valid_status_codes
354 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST}
355
356Configure Special Char IP For Gateway
357 [Documentation] Configure special char IP for gateway and expect an error.
358 [Tags] Configure_Special_Char_IP_For_Gateway
359 [Template] Add IP Address
360
361 # ip subnet_mask gateway valid_status_codes
362 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST}
363
364Configure Hexadecimal IP For Gateway
365 [Documentation] Configure hexadecimal IP for gateway and expect an error.
366 [Tags] Configure_Hexadecimal_IP_For_Gateway
367 [Template] Add IP Address
368
369 # ip subnet_mask gateway valid_status_codes
370 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
371
Prashanth Katti7098c972019-07-03 06:56:42 -0500372Get DNS Server And Verify
373 [Documentation] Get DNS server via Redfish and verify.
374 [Tags] Get_DNS_Server_And_Verify
375
376 Verify CLI and Redfish Nameservers
377
378Configure DNS Server And Verify
379 [Documentation] Configure DNS server and verify.
380 [Tags] Configure_DNS_Server_And_Verify
Prashanth Kattic85957c2019-07-09 02:01:20 -0500381 [Setup] DNS Test Setup Execution
Prashanth Katti7098c972019-07-03 06:56:42 -0500382 [Teardown] Run Keywords
383 ... Configure Static Name Servers AND Test Teardown Execution
384
Prashanth Katti7098c972019-07-03 06:56:42 -0500385 Configure Static Name Servers ${static_name_servers}
386 Verify CLI and Redfish Nameservers
387
Prashanth Kattic85957c2019-07-09 02:01:20 -0500388Delete DNS Server And Verify
389 [Documentation] Delete DNS server and verify.
390 [Tags] Delete_DNS_Server_And_Verify
391 [Setup] DNS Test Setup Execution
392 [Teardown] Run Keywords
393 ... Configure Static Name Servers AND Test Teardown Execution
394
395 Delete Static Name Servers
396 Verify CLI and Redfish Nameservers
397
398Configure DNS Server And Check Persistency
399 [Documentation] Configure DNS server and check persistency on reboot.
400 [Tags] Configure_DNS_Server_And_Check_Persistency
401 [Setup] DNS Test Setup Execution
402 [Teardown] Run Keywords
403 ... Configure Static Name Servers AND Test Teardown Execution
404
405 Configure Static Name Servers ${static_name_servers}
406 # Reboot BMC and verify persistency.
407 OBMC Reboot (off)
408 Verify CLI and Redfish Nameservers
409
Prashanth Katti3063ffe2019-07-25 04:35:25 -0500410Configure Loopback IP For Gateway
411 [Documentation] Configure loopback IP for gateway and expect an error.
412 [Tags] Configure_Loopback_IP_For_Gateway
413 [Template] Add IP Address
414 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
415
416 # ip subnet_mask gateway valid_status_codes
417 ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST}
418
419Configure Network ID For Gateway
420 [Documentation] Configure network ID for gateway and expect an error.
421 [Tags] Configure_Network_ID_For_Gateway
422 [Template] Add IP Address
423 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
424
425 # ip subnet_mask gateway valid_status_codes
426 ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST}
427
428Configure Multicast IP For Gateway
429 [Documentation] Configure multicast IP for gateway and expect an error.
430 [Tags] Configure_Multicast_IP_For_Gateway
431 [Template] Add IP Address
432 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
433
434 # ip subnet_mask gateway valid_status_codes
435 ${test_ipv4_addr} ${test_subnet_mask} ${multicaste_ip} ${HTTP_BAD_REQUEST}
436
437Configure Broadcast IP For Gateway
438 [Documentation] Configure broadcast IP for gateway and expect an error.
439 [Tags] Configure_Broadcast_IP_For_Gateway
440 [Template] Add IP Address
441 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr}
442
443 # ip subnet_mask gateway valid_status_codes
444 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST}
Prashanth Kattic85957c2019-07-09 02:01:20 -0500445
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500446Configure Null Value For DNS Server
447 [Documentation] Configure null value for DNS server and expect an error.
448 [Tags] Configure_Null_Value_For_DNS_Server
449 [Setup] DNS Test Setup Execution
450 [Teardown] Run Keywords
451 ... Configure Static Name Servers AND Test Teardown Execution
452
453 Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST}
454
Prashanth Kattiafe16b72019-08-02 00:29:45 -0500455Configure Empty Value For DNS Server
456 [Documentation] Configure empty value for DNS server and expect an error.
457 [Tags] Configure_Empty_Value_For_DNS_Server
458 [Setup] DNS Test Setup Execution
459 [Teardown] Run Keywords
460 ... Configure Static Name Servers AND Test Teardown Execution
461
462 Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST}
463
464Configure String Value For DNS Server
465 [Documentation] Configure string value for DNS server and expect an error.
466 [Tags] Configure_String_Value_For_DNS_Server
467 [Setup] DNS Test Setup Execution
468 [Teardown] Run Keywords
469 ... Configure Static Name Servers AND Test Teardown Execution
470
471 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST}
472
Prashanth Katti568df5f2020-05-15 06:00:37 -0500473Modify IPv4 Address And Verify
474 [Documentation] Modify IP address via Redfish and verify.
475 [Tags] Modify_IPv4_Addres_And_Verify
476 [Teardown] Run Keywords
477 ... Delete IP Address ${test_ipv4_addr2} AND Delete IP Address ${test_ipv4_addr}
478 ... AND Test Teardown Execution
479
480 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
481
482 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway}
483
Anvesh Kumar9c7238d2020-04-21 03:56:21 -0500484
Prashanth Kattif58cce02019-02-06 03:05:14 -0600485*** Keywords ***
486
487Test Setup Execution
488 [Documentation] Test setup execution.
489
George Keishing97c93942019-03-04 12:45:07 -0600490 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600491
492 @{network_configurations}= Get Network Configuration
493 Set Test Variable @{network_configurations}
494
495 # Get BMC IP address and prefix length.
496 ${ip_data}= Get BMC IP Info
497 Set Test Variable ${ip_data}
498
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600499
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600500Verify Netmask On BMC
501 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600502 [Arguments] ${netmask}
503
504 # Description of the argument(s):
505 # netmask netmask value to be verified.
506
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600507 ${prefix_length}= Netmask Prefix Length ${netmask}
508
509 Should Contain Match ${ip_data} */${prefix_length}
510 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600511
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600512Verify IP And Netmask On BMC
513 [Documentation] Verify IP and netmask on BMC.
514 [Arguments] ${ip} ${netmask}
515
516 # Description of the argument(s):
517 # ip IP address to be verified.
518 # netmask netmask value to be verified.
519
520 ${prefix_length}= Netmask Prefix Length ${netmask}
521 @{ip_data}= Get BMC IP Info
522
523 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
524 Should Contain ${ip_data} ${ip_with_netmask}
525 ... msg=IP and netmask pair does not exist.
526
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500527Validate Hostname On BMC
528 [Documentation] Verify that the hostname read via Redfish is the same as the
529 ... hostname configured on system.
530 [Arguments] ${hostname}
531
532 # Description of argument(s):
533 # hostname A hostname value which is to be compared to the hostname
534 # configured on system.
535
536 ${sys_hostname}= Get BMC Hostname
Prashanth Katti466d8342019-03-21 08:58:50 -0500537 Should Be Equal ${sys_hostname} ${hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500538 ... ignore_case=True msg=Hostname does not exist.
539
Prashanth Kattif58cce02019-02-06 03:05:14 -0600540Test Teardown Execution
541 [Documentation] Test teardown execution.
542
543 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600544 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500545
546Clear IP Settings On Fail
547 [Documentation] Clear IP settings on fail.
548 [Arguments] ${ip}
549
550 # Description of argument(s):
551 # ip IP address to be deleted.
552
553 Run Keyword If '${TEST STATUS}' == 'FAIL'
554 ... Delete IP Address ${ip}
555
556 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500557
Prashanth Katti7098c972019-07-03 06:56:42 -0500558Verify CLI and Redfish Nameservers
559 [Documentation] Verify that nameservers obtained via Redfish do not
560 ... match those found in /etc/resolv.conf.
561
562 ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
563 ${resolve_conf_nameservers}= CLI Get Nameservers
Michael Walsh39c00512019-07-17 10:54:06 -0500564 Rqprint Vars redfish_nameservers resolve_conf_nameservers
Prashanth Katti7098c972019-07-03 06:56:42 -0500565
566 # Check that the 2 lists are equivalent.
567 ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers)
568 Should Be True ${match}
569 ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf.
570
Prashanth Katti7098c972019-07-03 06:56:42 -0500571
572Configure Static Name Servers
573 [Documentation] Configure DNS server on BMC.
Prashanth Kattic85957c2019-07-09 02:01:20 -0500574 [Arguments] ${static_name_servers}=${original_nameservers}
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500575 ... ${valid_status_codes}=${HTTP_OK}
Prashanth Katti7098c972019-07-03 06:56:42 -0500576
George Keishing9cb2e592019-07-12 09:37:33 -0500577 # Description of the argument(s):
Prashanth Katti7098c972019-07-03 06:56:42 -0500578 # static_name_servers A list of static name server IPs to be
579 # configured on the BMC.
580
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500581 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios.
Prashanth Katti7098c972019-07-03 06:56:42 -0500582 Redfish.Patch ${REDFISH_NW_ETH0_URI} body={'StaticNameServers': ${static_name_servers}}
Prashanth Katti9d995fc2019-09-24 01:29:06 -0500583 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}]
Prashanth Kattic85957c2019-07-09 02:01:20 -0500584
Prashanth Kattif247be32019-10-07 04:40:43 -0500585 # Patch operation takes 1 to 3 seconds to set new value.
586 Sleep 3s
587
Prashanth Katti7f9e60f2019-07-26 01:18:41 -0500588 # Check if newly added DNS server is configured on BMC.
589 ${cli_nameservers}= CLI Get Nameservers
Prashanth Katti3c7b6432019-07-26 06:53:37 -0500590 ${cmd_status}= Run Keyword And Return Status
591 ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers}
592
593 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}'
594 ... Should Be True ${cmd_status} == ${True}
595 ... ELSE Should Be True ${cmd_status} == ${False}
Prashanth Katti7f9e60f2019-07-26 01:18:41 -0500596
Prashanth Kattic85957c2019-07-09 02:01:20 -0500597Delete Static Name Servers
598 [Documentation] Delete static name servers.
599
600 Configure Static Name Servers @{EMPTY}
601
602 # Check if all name servers deleted on BMC.
603 ${nameservers}= CLI Get Nameservers
604 Should Be Empty ${nameservers}
605
606DNS Test Setup Execution
607 [Documentation] Do DNS test setup execution.
608
609 Redfish.Login
610
611 ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers
612 Rprint Vars original_nameservers
613 # Set suite variables to trigger restoration during teardown.
614 Set Suite Variable ${original_nameservers}
Prashanth Kattib478d902020-05-08 10:05:32 -0500615
616Suite Setup Execution
617 [Documentation] Do suite setup execution.
618
619 ${test_gateway}= Get BMC Default Gateway
620 Set Suite Variable ${test_gateway}
Prashanth Katti568df5f2020-05-15 06:00:37 -0500621
622Update IP Address
623 [Documentation] Update IP address of BMC.
624 [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} ${valid_status_codes}=${HTTP_OK}
625
626 # Description of argument(s):
627 # ip IP address to be replaced (e.g. "10.7.7.7").
628 # new_ip New IP address to be configured.
629 # netmask Netmask value.
630 # gw_ip Gateway IP address.
631 # valid_status_codes Expected return code from patch operation
632 # (e.g. "200"). See prolog of rest_request
633 # method in redfish_plus.py for details.
634
635 ${empty_dict}= Create Dictionary
636 ${patch_list}= Create List
637 ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip}
638
639 # Find the position of IP address to be modified.
640 @{network_configurations}= Get Network Configuration
641 FOR ${network_configuration} IN @{network_configurations}
642 Run Keyword If '${network_configuration['Address']}' == '${ip}'
643 ... Append To List ${patch_list} ${ip_data}
644 ... ELSE Append To List ${patch_list} ${empty_dict}
645 END
646
647 ${ip_found}= Run Keyword And Return Status List Should Contain Value
648 ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC
649 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC
650
651 # Run patch command only if given IP is found on BMC
652 ${data}= Create Dictionary IPv4StaticAddresses=${patch_list}
653
654 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} valid_status_codes=[${valid_status_codes}]
655
656 # Note: Network restart takes around 15-18s after patch request processing.
657 Sleep ${NETWORK_TIMEOUT}s
658 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
659
660 Verify IP On BMC ${new_ip}
661 Validate Network Config On BMC