blob: 870375cecf2b54819c251fd1ea28a09f8d5b0ab0 [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
13
Prashanth Kattif34fafa2019-06-20 05:04:40 -050014Force Tags Network_Conf_Test
15
Prashanth Katti23efc6e2019-03-13 06:07:15 -050016*** Variables ***
Vijayde3bf7b2019-04-16 04:56:09 -050017${test_hostname} openbmc
18${test_ipv4_addr} 10.7.7.7
19${test_ipv4_invalid_addr} 0.0.1.a
20${test_subnet_mask} 255.255.0.0
21${test_gateway} 10.7.7.1
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 Katti23efc6e2019-03-13 06:07:15 -050026
Prashanth Katti040c8c12019-05-31 04:42:05 -050027# Valid netmask is 4 bytes long and has continuos block of 1s.
28# Maximum valid value in each octet is 255 and least value is 0.
29# 253 is not valid, as binary value is 11111101.
30${invalid_netmask} 255.255.253.0
31${alpha_netmask} ff.ff.ff.ff
32# Maximum value of octet in netmask is 255.
33${out_of_range_netmask} 255.256.255.0
34${more_byte_netmask} 255.255.255.0.0
35${less_byte_netmask} 255.255.255
Prashanth Kattic6ad6472019-06-14 03:33:39 -050036${threshold_netmask} 255.255.255.255
37${lowest_netmask} 128.0.0.0
38
39# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
40# but trying to configure xx.xx.xx
41${less_octet_ip} 10.3.36
42
43# For the address 10.6.6.6, the 10.6.6.0 portion describes the
44# network ID and the 6 describe the host.
45
46${network_id} 10.7.7.0
47${hex_ip} 0xa.0xb.0xc.0xd
48${negative_ip} 10.-7.-7.7
49${hex_ip} 0xa.0xb.0xc.0xd
Prashanth Katti040c8c12019-05-31 04:42:05 -050050
Prashanth Kattif58cce02019-02-06 03:05:14 -060051*** Test Cases ***
52
53Get IP Address And Verify
54 [Documentation] Get IP Address And Verify.
George Keishing5d467552019-02-08 23:30:48 -060055 [Tags] Get_IP_Address_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060056
57 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060058 \ Verify IP On BMC ${network_configuration['Address']}
59
Prashanth Kattif58cce02019-02-06 03:05:14 -060060Get Netmask And Verify
61 [Documentation] Get Netmask And Verify.
George Keishing5d467552019-02-08 23:30:48 -060062 [Tags] Get_Netmask_And_Verify
Prashanth Kattif58cce02019-02-06 03:05:14 -060063
64 : FOR ${network_configuration} IN @{network_configurations}
Prashanth Katti747ce9d2019-02-07 07:23:48 -060065 \ Verify Netmask On BMC ${network_configuration['SubnetMask']}
66
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060067Get Gateway And Verify
68 [Documentation] Get gateway and verify it's existence on the BMC.
69 [Tags] Get_Gateway_And_Verify
70
71 : FOR ${network_configuration} IN @{network_configurations}
72 \ Verify Gateway On BMC ${network_configuration['Gateway']}
73
74Get MAC Address And Verify
75 [Documentation] Get MAC address and verify it's existence on the BMC.
76 [Tags] Get_MAC_Address_And_Verify
77
George Keishing97c93942019-03-04 12:45:07 -060078 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -060079 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress
80 Validate MAC On BMC ${macaddr}
Prashanth Kattif58cce02019-02-06 03:05:14 -060081
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -060082Verify All Configured IP And Netmask
83 [Documentation] Verify all configured IP and netmask on BMC.
84 [Tags] Verify_All_Configured_IP_And_Netmask
85
86 : FOR ${network_configuration} IN @{network_configurations}
87 \ Verify IP And Netmask On BMC ${network_configuration['Address']}
88 ... ${network_configuration['SubnetMask']}
89
Prashanth Katti23efc6e2019-03-13 06:07:15 -050090Get Hostname And Verify
91 [Documentation] Get hostname via Redfish and verify.
92 [Tags] Get_Hostname_And_Verify
93
94 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
95
96 Validate Hostname On BMC ${hostname}
97
98Configure Hostname And Verify
99 [Documentation] Configure hostname via Redfish and verify.
100 [Tags] Configure_Hostname_And_Verify
101
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500102 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500103
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500104 Configure Hostname ${test_hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500105 Validate Hostname On BMC ${test_hostname}
106
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500107 # Revert back to initial hostname.
108 Configure Hostname ${hostname}
109 Validate Hostname On BMC ${hostname}
110
Vijayde3bf7b2019-04-16 04:56:09 -0500111Add Valid IPv4 Address And Verify
112 [Documentation] Add IPv4 Address via Redfish and verify.
113 [Tags] Add_Valid_IPv4_Addres_And_Verify
114
115 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
116 Delete IP Address ${test_ipv4_addr}
117
118Add Invalid IPv4 Address And Verify
119 [Documentation] Add Invalid IPv4 Address via Redfish and verify.
120 [Tags] Add_Invalid_IPv4_Addres_And_Verify
121
122 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask}
123 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST}
124
Prashanth Kattib36a7522019-05-22 05:32:39 -0500125Configure Out Of Range IP
126 [Documentation] Configure out-of-range IP address.
127 [Tags] Configure_Out_Of_Range_IP
128 [Template] Add IP Address
129
130 # ip subnet_mask gateway valid_status_codes
131 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
132
133Configure Broadcast IP
134 [Documentation] Configure broadcast IP address.
135 [Tags] Configure_Broadcast_IP
136 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500137 [Teardown] Clear IP Settings On Fail ${broadcast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500138
139 # ip subnet_mask gateway valid_status_codes
140 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
141
142Configure Multicast IP
143 [Documentation] Configure multicast IP address.
144 [Tags] Configure_Multicast_IP
145 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500146 [Teardown] Clear IP Settings On Fail ${multicast_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500147
148 # ip subnet_mask gateway valid_status_codes
149 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
150
151Configure Loopback IP
152 [Documentation] Configure loopback IP address.
153 [Tags] Configure_Loopback_IP
154 [Template] Add IP Address
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500155 [Teardown] Clear IP Settings On Fail ${loopback_ip}
Prashanth Kattib36a7522019-05-22 05:32:39 -0500156
157 # ip subnet_mask gateway valid_status_codes
158 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
159
160Add Valid IPv4 Address And Check Persistency
161 [Documentation] Add IPv4 address and check peristency.
162 [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency
163
164 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway}
165
166 # Reboot BMC and verify persistency.
167 OBMC Reboot (off)
168 Verify IP On BMC ${test_ipv4_addr}
169 Delete IP Address ${test_ipv4_addr}
Vijayde3bf7b2019-04-16 04:56:09 -0500170
Prashanth Katti6cedca22019-05-30 02:31:11 -0500171Add Fourth Octet Threshold IP And Verify
172 [Documentation] Add fourth octet threshold IP and verify.
173 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
174
175 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway}
176 Delete IP Address 10.7.7.254
177
178Add Fourth Octet Lowest IP And Verify
179 [Documentation] Add fourth octet lowest IP and verify.
180 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify
181
182 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway}
183 Delete IP Address 10.7.7.1
184
185Add Third Octet Threshold IP And Verify
186 [Documentation] Add third octet threshold IP and verify.
187 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
188
189 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway}
190 Delete IP Address 10.7.255.7
191
192Add Third Octet Lowest IP And Verify
193 [Documentation] Add third octet lowest IP and verify.
194 [Tags] Add_Third_Octet_Lowest_IP_And_Verify
195
196 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway}
197 Delete IP Address 10.7.0.7
198
199Add Second Octet Threshold IP And Verify
200 [Documentation] Add second octet threshold IP and verify.
201 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
202
203 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway}
204 Delete IP Address 10.255.7.7
205
206Add Second Octet Lowest IP And Verify
207 [Documentation] Add second octet lowest IP and verify.
208 [Tags] Add_Second_Octet_Lowest_IP_And_Verify
209
210 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway}
211 Delete IP Address 10.0.7.7
212
213Add First Octet Threshold IP And Verify
214 [Documentation] Add first octet threshold IP and verify.
215 [Tags] Add_First_Octet_Threshold_IP_And_Verify
216
217 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway}
218 Delete IP Address 223.7.7.7
219
220Add First Octet Lowest IP And Verify
221 [Documentation] Add first octet lowest IP and verify.
222 [Tags] Add_First_Octet_Lowest_IP_And_Verify
223
224 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway}
225 Delete IP Address 1.7.7.7
226
Prashanth Katti040c8c12019-05-31 04:42:05 -0500227Configure Invalid Netmask
228 [Documentation] Verify error while setting invalid netmask.
229 [Tags] Configure_Invalid_Netmask
230 [Template] Add IP Address
231
232 # ip subnet_mask gateway valid_status_codes
233 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
234
235Configure Out Of Range Netmask
236 [Documentation] Verify error while setting out of range netmask.
237 [Tags] Configure_Out_Of_Range_Netmask
238 [Template] Add IP Address
239
240 # ip subnet_mask gateway valid_status_codes
241 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
242
243Configure Alpha Netmask
244 [Documentation] Verify error while setting alpha netmask.
245 [Tags] Configure_Alpha_Netmask
246 [Template] Add IP Address
247
248 # ip subnet_mask gateway valid_status_codes
249 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
250
251Configure More Byte Netmask
252 [Documentation] Verify error while setting more byte netmask.
253 [Tags] Configure_More_Byte_Netmask
254 [Template] Add IP Address
255
256 # ip subnet_mask gateway valid_status_codes
257 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
258
259Configure Less Byte Netmask
260 [Documentation] Verify error while setting less byte netmask.
261 [Tags] Configure_Less_Byte_Netmask
262 [Template] Add IP Address
263
264 # ip subnet_mask gateway valid_status_codes
265 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST}
266
Prashanth Kattic6ad6472019-06-14 03:33:39 -0500267Configure Threshold Netmask And Verify
268 [Documentation] Configure threshold netmask and verify.
269 [Tags] Configure_Threshold_Netmask_And_verify
270
271 Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway}
272 Delete IP Address ${test_ipv4_addr}
273
274Configure Lowest Netmask And Verify
275 [Documentation] Configure lowest netmask and verify.
276 [Tags] Configure_Lowest_Netmask_And_verify
277
278 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway}
279 Delete IP Address ${test_ipv4_addr}
280
281Configure Network ID
282 [Documentation] Verify error while configuring network ID.
283 [Tags] Configure_Network_ID
284 [Template] Add IP Address
285 [Teardown] Clear IP Settings On Fail ${network_id}
286
287 # ip subnet_mask gateway valid_status_codes
288 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
289
290Configure Less Octet IP
291 [Documentation] Verify error while Configuring less octet IP address.
292 [Tags] Configure_Less_Octet_IP
293 [Template] Add IP Address
294
295 # ip subnet_mask gateway valid_status_codes
296 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
297
298Configure Empty IP
299 [Documentation] Verify error while Configuring empty IP address.
300 [Tags] Configure_Empty_IP
301 [Template] Add IP Address
302
303 # ip subnet_mask gateway valid_status_codes
304 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
305
306Configure Special Char IP
307 [Documentation] Configure invalid IP address containing special chars.
308 [Tags] Configure_Special_Char_IP
309 [Template] Add IP Address
310
311 # ip subnet_mask gateway valid_status_codes
312 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
313
314Configure Hexadecimal IP
315 [Documentation] Configure invalid IP address containing hex value.
316 [Tags] Configure_Hexadecimal_IP
317 [Template] Add IP Address
318
319 # ip subnet_mask gateway valid_status_codes
320 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
321
322Configure Negative Octet IP
323 [Documentation] Configure invalid IP address containing negative octet.
324 [Tags] Configure_Negative_Octet_IP
325 [Template] Add IP Address
326
327 # ip subnet_mask gateway valid_status_codes
328 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST}
329
Prashanth Katti5cad5a02019-06-20 07:27:10 -0500330Configure Incomplete IP For Gateway
331 [Documentation] Configure incomplete IP for gateway and expect an error.
332 [Tags] Configure_Incomplete_IP_For_Gateway
333 [Template] Add IP Address
334
335 # ip subnet_mask gateway valid_status_codes
336 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST}
337
338Configure Special Char IP For Gateway
339 [Documentation] Configure special char IP for gateway and expect an error.
340 [Tags] Configure_Special_Char_IP_For_Gateway
341 [Template] Add IP Address
342
343 # ip subnet_mask gateway valid_status_codes
344 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST}
345
346Configure Hexadecimal IP For Gateway
347 [Documentation] Configure hexadecimal IP for gateway and expect an error.
348 [Tags] Configure_Hexadecimal_IP_For_Gateway
349 [Template] Add IP Address
350
351 # ip subnet_mask gateway valid_status_codes
352 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST}
353
Prashanth Kattif58cce02019-02-06 03:05:14 -0600354*** Keywords ***
355
356Test Setup Execution
357 [Documentation] Test setup execution.
358
George Keishing97c93942019-03-04 12:45:07 -0600359 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600360
361 @{network_configurations}= Get Network Configuration
362 Set Test Variable @{network_configurations}
363
364 # Get BMC IP address and prefix length.
365 ${ip_data}= Get BMC IP Info
366 Set Test Variable ${ip_data}
367
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600368
Prashanth Kattif58cce02019-02-06 03:05:14 -0600369Get Network Configuration
370 [Documentation] Get network configuration.
371
372 # Sample output:
373 #{
374 # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
375 # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
376 # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
377 # "Description": "Management Network Interface",
378 # "IPv4Addresses": [
379 # {
380 # "Address": "169.254.xx.xx",
381 # "AddressOrigin": "IPv4LinkLocal",
382 # "Gateway": "0.0.0.0",
383 # "SubnetMask": "255.255.0.0"
384 # },
385 # {
386 # "Address": "xx.xx.xx.xx",
387 # "AddressOrigin": "Static",
388 # "Gateway": "xx.xx.xx.1",
389 # "SubnetMask": "xx.xx.xx.xx"
390 # }
391 # ],
392 # "Id": "eth0",
393 # "MACAddress": "xx:xx:xx:xx:xx:xx",
394 # "Name": "Manager Ethernet Interface",
395 # "SpeedMbps": 0,
396 # "VLAN": {
397 # "VLANEnable": false,
398 # "VLANId": 0
399 # }
400
George Keishing97c93942019-03-04 12:45:07 -0600401 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
Prashanth Kattif58cce02019-02-06 03:05:14 -0600402 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
403 [Return] @{network_configurations}
404
George Keishing5d467552019-02-08 23:30:48 -0600405
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600406Verify IP On BMC
407 [Documentation] Verify IP on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600408 [Arguments] ${ip}
409
Vijayde3bf7b2019-04-16 04:56:09 -0500410 # Description of argument(s):
411 # ip IP address to be verified (e.g. "10.7.7.7").
Prashanth Kattif58cce02019-02-06 03:05:14 -0600412
413 # Get IP address details on BMC using IP command.
414 @{ip_data}= Get BMC IP Info
415 Should Contain Match ${ip_data} ${ip}/*
416 ... msg=IP address does not exist.
417
Vijayde3bf7b2019-04-16 04:56:09 -0500418Add IP Address
419 [Documentation] Add IP Address To BMC.
420 [Arguments] ${ip} ${subnet_mask} ${gateway}
421 ... ${valid_status_codes}=${HTTP_OK}
422
423 # Description of argument(s):
424 # ip IP address to be added (e.g. "10.7.7.7").
425 # subnet_mask Subnet mask for the IP to be added
426 # (e.g. "255.255.0.0").
427 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
428 # valid_status_codes Expected return code from patch operation
429 # (e.g. "200"). See prolog of rest_request
430 # method in redfish_plut.py for details.
431
432 ${empty_dict}= Create Dictionary
433 ${ip_data}= Create Dictionary Address=${ip}
434 ... AddressOrigin=Static SubnetMask=${subnet_mask}
435 ... Gateway=${gateway}
436
437 ${patch_list}= Create List
438 ${network_configurations}= Get Network Configuration
439 ${num_entries}= Get Length ${network_configurations}
440
441 : FOR ${INDEX} IN RANGE 0 ${num_entries}
442 \ Append To List ${patch_list} ${empty_dict}
443
George Keishing98ffa862019-05-23 10:07:45 -0500444 # We need not check for existence of IP on BMC while adding.
Vijayde3bf7b2019-04-16 04:56:09 -0500445 Append To List ${patch_list} ${ip_data}
446 ${data}= Create Dictionary IPv4Addresses=${patch_list}
447
448 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
449 ... valid_status_codes=[${valid_status_codes}]
450
451 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK}'
452
453 # Note: Network restart takes around 15-18s after patch request processing.
454 Sleep ${NETWORK_TIMEOUT}s
455 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
456
457 Verify IP On BMC ${ip}
458 Validate Network Config On BMC
459
460
461Delete IP Address
462 [Documentation] Delete IP Address Of BMC.
463 [Arguments] ${ip} ${valid_status_codes}=${HTTP_OK}
464
465 # Description of argument(s):
466 # ip IP address to be deleted (e.g. "10.7.7.7").
467 # valid_status_codes Expected return code from patch operation
468 # (e.g. "200"). See prolog of rest_request
469 # method in redfish_plut.py for details.
470
471 ${empty_dict}= Create Dictionary
472 ${patch_list}= Create List
473
474 @{network_configurations}= Get Network Configuration
475 : FOR ${network_configuration} IN @{network_configurations}
476 \ Run Keyword If '${network_configuration['Address']}' == '${ip}'
477 ... Append To List ${patch_list} ${null}
478 ... ELSE Append To List ${patch_list} ${empty_dict}
479
480 ${ip_found}= Run Keyword And Return Status List Should Contain Value
481 ... ${patch_list} ${null} msg=${ip} does not exist on BMC
482 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC
483
484 # Run patch command only if given IP is found on BMC
485 ${data}= Create Dictionary IPv4Addresses=${patch_list}
486
487 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
488 ... valid_status_codes=[${valid_status_codes}]
489
490 # Note: Network restart takes around 15-18s after patch request processing
491 Sleep ${NETWORK_TIMEOUT}s
492 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
493
494 ${delete_status}= Run Keyword And Return Status Verify IP On BMC ${ip}
495 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}'
496 ... Should Be True ${delete_status} == ${False}
497 ... ELSE Should Be True ${delete_status} == ${True}
498
499 Validate Network Config On BMC
500
501
502Validate Network Config On BMC
503 [Documentation] Check that network info obtained via redfish matches info
504 ... obtained via CLI.
505
506 @{network_configurations}= Get Network Configuration
507 ${ip_data}= Get BMC IP Info
508 : FOR ${network_configuration} IN @{network_configurations}
509 \ Should Contain Match ${ip_data} ${network_configuration['Address']}/*
510 ... msg=IP address does not exist.
511
George Keishing5d467552019-02-08 23:30:48 -0600512
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600513Verify Netmask On BMC
514 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600515 [Arguments] ${netmask}
516
517 # Description of the argument(s):
518 # netmask netmask value to be verified.
519
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600520 ${prefix_length}= Netmask Prefix Length ${netmask}
521
522 Should Contain Match ${ip_data} */${prefix_length}
523 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600524
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -0600525Verify Gateway On BMC
526 [Documentation] Verify gateway on BMC.
527 [Arguments] ${gateway_ip}=0.0.0.0
528
529 # Description of argument(s):
530 # gateway_ip Gateway IP address.
531
532 ${route_info}= Get BMC Route Info
533
534 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
535
536 Run Keyword If '${gateway_ip}' == '0.0.0.0'
537 ... Pass Execution Gateway IP is "0.0.0.0".
538 ... ELSE
539 ... Should Contain ${route_info} ${gateway_ip}
540 ... msg=Gateway IP address not matching.
George Keishing5d467552019-02-08 23:30:48 -0600541
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600542Verify IP And Netmask On BMC
543 [Documentation] Verify IP and netmask on BMC.
544 [Arguments] ${ip} ${netmask}
545
546 # Description of the argument(s):
547 # ip IP address to be verified.
548 # netmask netmask value to be verified.
549
550 ${prefix_length}= Netmask Prefix Length ${netmask}
551 @{ip_data}= Get BMC IP Info
552
553 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
554 Should Contain ${ip_data} ${ip_with_netmask}
555 ... msg=IP and netmask pair does not exist.
556
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500557Validate Hostname On BMC
558 [Documentation] Verify that the hostname read via Redfish is the same as the
559 ... hostname configured on system.
560 [Arguments] ${hostname}
561
562 # Description of argument(s):
563 # hostname A hostname value which is to be compared to the hostname
564 # configured on system.
565
566 ${sys_hostname}= Get BMC Hostname
Prashanth Katti466d8342019-03-21 08:58:50 -0500567 Should Be Equal ${sys_hostname} ${hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500568 ... ignore_case=True msg=Hostname does not exist.
569
Prashanth Kattif58cce02019-02-06 03:05:14 -0600570Test Teardown Execution
571 [Documentation] Test teardown execution.
572
573 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600574 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500575
576Clear IP Settings On Fail
577 [Documentation] Clear IP settings on fail.
578 [Arguments] ${ip}
579
580 # Description of argument(s):
581 # ip IP address to be deleted.
582
583 Run Keyword If '${TEST STATUS}' == 'FAIL'
584 ... Delete IP Address ${ip}
585
586 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500587