blob: a0b4dbbf8ec7485215ba7e90a8dc3bd7d41368df [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 Kattif58cce02019-02-06 03:05:14 -0600330*** Keywords ***
331
332Test Setup Execution
333 [Documentation] Test setup execution.
334
George Keishing97c93942019-03-04 12:45:07 -0600335 Redfish.Login
Prashanth Kattif58cce02019-02-06 03:05:14 -0600336
337 @{network_configurations}= Get Network Configuration
338 Set Test Variable @{network_configurations}
339
340 # Get BMC IP address and prefix length.
341 ${ip_data}= Get BMC IP Info
342 Set Test Variable ${ip_data}
343
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600344
Prashanth Kattif58cce02019-02-06 03:05:14 -0600345Get Network Configuration
346 [Documentation] Get network configuration.
347
348 # Sample output:
349 #{
350 # "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
351 # "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
352 # "@odata.type": "#EthernetInterface.v1_2_0.EthernetInterface",
353 # "Description": "Management Network Interface",
354 # "IPv4Addresses": [
355 # {
356 # "Address": "169.254.xx.xx",
357 # "AddressOrigin": "IPv4LinkLocal",
358 # "Gateway": "0.0.0.0",
359 # "SubnetMask": "255.255.0.0"
360 # },
361 # {
362 # "Address": "xx.xx.xx.xx",
363 # "AddressOrigin": "Static",
364 # "Gateway": "xx.xx.xx.1",
365 # "SubnetMask": "xx.xx.xx.xx"
366 # }
367 # ],
368 # "Id": "eth0",
369 # "MACAddress": "xx:xx:xx:xx:xx:xx",
370 # "Name": "Manager Ethernet Interface",
371 # "SpeedMbps": 0,
372 # "VLAN": {
373 # "VLANEnable": false,
374 # "VLANId": 0
375 # }
376
George Keishing97c93942019-03-04 12:45:07 -0600377 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI}
Prashanth Kattif58cce02019-02-06 03:05:14 -0600378 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4Addresses
379 [Return] @{network_configurations}
380
George Keishing5d467552019-02-08 23:30:48 -0600381
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600382Verify IP On BMC
383 [Documentation] Verify IP on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600384 [Arguments] ${ip}
385
Vijayde3bf7b2019-04-16 04:56:09 -0500386 # Description of argument(s):
387 # ip IP address to be verified (e.g. "10.7.7.7").
Prashanth Kattif58cce02019-02-06 03:05:14 -0600388
389 # Get IP address details on BMC using IP command.
390 @{ip_data}= Get BMC IP Info
391 Should Contain Match ${ip_data} ${ip}/*
392 ... msg=IP address does not exist.
393
Vijayde3bf7b2019-04-16 04:56:09 -0500394Add IP Address
395 [Documentation] Add IP Address To BMC.
396 [Arguments] ${ip} ${subnet_mask} ${gateway}
397 ... ${valid_status_codes}=${HTTP_OK}
398
399 # Description of argument(s):
400 # ip IP address to be added (e.g. "10.7.7.7").
401 # subnet_mask Subnet mask for the IP to be added
402 # (e.g. "255.255.0.0").
403 # gateway Gateway for the IP to be added (e.g. "10.7.7.1").
404 # valid_status_codes Expected return code from patch operation
405 # (e.g. "200"). See prolog of rest_request
406 # method in redfish_plut.py for details.
407
408 ${empty_dict}= Create Dictionary
409 ${ip_data}= Create Dictionary Address=${ip}
410 ... AddressOrigin=Static SubnetMask=${subnet_mask}
411 ... Gateway=${gateway}
412
413 ${patch_list}= Create List
414 ${network_configurations}= Get Network Configuration
415 ${num_entries}= Get Length ${network_configurations}
416
417 : FOR ${INDEX} IN RANGE 0 ${num_entries}
418 \ Append To List ${patch_list} ${empty_dict}
419
George Keishing98ffa862019-05-23 10:07:45 -0500420 # We need not check for existence of IP on BMC while adding.
Vijayde3bf7b2019-04-16 04:56:09 -0500421 Append To List ${patch_list} ${ip_data}
422 ${data}= Create Dictionary IPv4Addresses=${patch_list}
423
424 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
425 ... valid_status_codes=[${valid_status_codes}]
426
427 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK}'
428
429 # Note: Network restart takes around 15-18s after patch request processing.
430 Sleep ${NETWORK_TIMEOUT}s
431 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
432
433 Verify IP On BMC ${ip}
434 Validate Network Config On BMC
435
436
437Delete IP Address
438 [Documentation] Delete IP Address Of BMC.
439 [Arguments] ${ip} ${valid_status_codes}=${HTTP_OK}
440
441 # Description of argument(s):
442 # ip IP address to be deleted (e.g. "10.7.7.7").
443 # valid_status_codes Expected return code from patch operation
444 # (e.g. "200"). See prolog of rest_request
445 # method in redfish_plut.py for details.
446
447 ${empty_dict}= Create Dictionary
448 ${patch_list}= Create List
449
450 @{network_configurations}= Get Network Configuration
451 : FOR ${network_configuration} IN @{network_configurations}
452 \ Run Keyword If '${network_configuration['Address']}' == '${ip}'
453 ... Append To List ${patch_list} ${null}
454 ... ELSE Append To List ${patch_list} ${empty_dict}
455
456 ${ip_found}= Run Keyword And Return Status List Should Contain Value
457 ... ${patch_list} ${null} msg=${ip} does not exist on BMC
458 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC
459
460 # Run patch command only if given IP is found on BMC
461 ${data}= Create Dictionary IPv4Addresses=${patch_list}
462
463 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data}
464 ... valid_status_codes=[${valid_status_codes}]
465
466 # Note: Network restart takes around 15-18s after patch request processing
467 Sleep ${NETWORK_TIMEOUT}s
468 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
469
470 ${delete_status}= Run Keyword And Return Status Verify IP On BMC ${ip}
471 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}'
472 ... Should Be True ${delete_status} == ${False}
473 ... ELSE Should Be True ${delete_status} == ${True}
474
475 Validate Network Config On BMC
476
477
478Validate Network Config On BMC
479 [Documentation] Check that network info obtained via redfish matches info
480 ... obtained via CLI.
481
482 @{network_configurations}= Get Network Configuration
483 ${ip_data}= Get BMC IP Info
484 : FOR ${network_configuration} IN @{network_configurations}
485 \ Should Contain Match ${ip_data} ${network_configuration['Address']}/*
486 ... msg=IP address does not exist.
487
George Keishing5d467552019-02-08 23:30:48 -0600488
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600489Verify Netmask On BMC
490 [Documentation] Verify netmask on BMC.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600491 [Arguments] ${netmask}
492
493 # Description of the argument(s):
494 # netmask netmask value to be verified.
495
Prashanth Katti747ce9d2019-02-07 07:23:48 -0600496 ${prefix_length}= Netmask Prefix Length ${netmask}
497
498 Should Contain Match ${ip_data} */${prefix_length}
499 ... msg=Prefix length does not exist.
Prashanth Kattif58cce02019-02-06 03:05:14 -0600500
Prashanth Katti2ec9d8b2019-02-12 05:20:19 -0600501Verify Gateway On BMC
502 [Documentation] Verify gateway on BMC.
503 [Arguments] ${gateway_ip}=0.0.0.0
504
505 # Description of argument(s):
506 # gateway_ip Gateway IP address.
507
508 ${route_info}= Get BMC Route Info
509
510 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
511
512 Run Keyword If '${gateway_ip}' == '0.0.0.0'
513 ... Pass Execution Gateway IP is "0.0.0.0".
514 ... ELSE
515 ... Should Contain ${route_info} ${gateway_ip}
516 ... msg=Gateway IP address not matching.
George Keishing5d467552019-02-08 23:30:48 -0600517
Prashanth Katti2c5c3bb2019-02-14 04:23:07 -0600518Verify IP And Netmask On BMC
519 [Documentation] Verify IP and netmask on BMC.
520 [Arguments] ${ip} ${netmask}
521
522 # Description of the argument(s):
523 # ip IP address to be verified.
524 # netmask netmask value to be verified.
525
526 ${prefix_length}= Netmask Prefix Length ${netmask}
527 @{ip_data}= Get BMC IP Info
528
529 ${ip_with_netmask}= Catenate ${ip}/${prefix_length}
530 Should Contain ${ip_data} ${ip_with_netmask}
531 ... msg=IP and netmask pair does not exist.
532
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500533Validate Hostname On BMC
534 [Documentation] Verify that the hostname read via Redfish is the same as the
535 ... hostname configured on system.
536 [Arguments] ${hostname}
537
538 # Description of argument(s):
539 # hostname A hostname value which is to be compared to the hostname
540 # configured on system.
541
542 ${sys_hostname}= Get BMC Hostname
Prashanth Katti466d8342019-03-21 08:58:50 -0500543 Should Be Equal ${sys_hostname} ${hostname}
Prashanth Katti23efc6e2019-03-13 06:07:15 -0500544 ... ignore_case=True msg=Hostname does not exist.
545
Prashanth Kattif58cce02019-02-06 03:05:14 -0600546Test Teardown Execution
547 [Documentation] Test teardown execution.
548
549 FFDC On Test Case Fail
George Keishing97c93942019-03-04 12:45:07 -0600550 Redfish.Logout
Prashanth Kattia8442512019-06-07 06:47:09 -0500551
552Clear IP Settings On Fail
553 [Documentation] Clear IP settings on fail.
554 [Arguments] ${ip}
555
556 # Description of argument(s):
557 # ip IP address to be deleted.
558
559 Run Keyword If '${TEST STATUS}' == 'FAIL'
560 ... Delete IP Address ${ip}
561
562 Test Teardown Execution
Prashanth Kattiadf0b4e2019-06-10 04:20:30 -0500563