blob: cfa25ef38ce71c20ab4ad974ca8358500fcea683 [file] [log] [blame]
Prashanth Kattie79c5402017-06-08 07:40:49 -05001*** Settings ***
Prashanth Katti4cf87bd2017-06-28 08:56:02 -05002Documentation Network interface and functionalities test module on BMC.
Prashanth Kattie79c5402017-06-08 07:40:49 -05003
manasarm88f00062018-03-07 12:07:33 +05304Resource ../lib/ipmi_client.robot
Prashanth Kattie79c5402017-06-08 07:40:49 -05005Resource ../lib/rest_client.robot
6Resource ../lib/utils.robot
7Resource ../lib/bmc_network_utils.robot
8
9Force Tags Network_Test
10
11Library String
12Library SSHLibrary
13
Steven Sombarfac31e92017-12-15 09:40:34 -060014Test Setup Test Setup Execution
Prashanth Kattia994bc32017-10-18 06:16:31 -050015Test Teardown Close All Connections
Prashanth Kattie79c5402017-06-08 07:40:49 -050016
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050017*** Variables ***
18
19${alpha_ip} xx.xx.xx.xx
20
21# 10.x.x.x series is a private IP address range and does not exist in
22# our network, so this is chosen to avoid IP conflict.
23
24${valid_ip} 10.6.6.6
manasarm88f00062018-03-07 12:07:33 +053025${valid_ip2} 10.6.6.7
26@{valid_ips} ${valid_ip} ${valid_ip2}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050027${valid_gateway} 10.6.6.1
Prashanth Katti90f9ff22017-08-11 06:17:12 -050028${valid_prefix_len} ${24}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050029${broadcast_ip} 10.6.6.255
30${loopback_ip} 127.0.0.1
31${multicast_ip} 224.6.6.255
32${out_of_range_ip} 10.6.6.256
33
34# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
35# but trying to configure xx.xx.xx
36
37${less_octet_ip} 10.3.36
38
39# For the address 10.6.6.6, the 10.6.6.0 portion describes the
40# network ID and the 6 describe the host.
41
42${network_id} 10.6.6.0
43${hex_ip} 0xa.0xb.0xc.0xd
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050044${negative_ip} 10.-6.-6.6
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050045
Prashanth Kattie79c5402017-06-08 07:40:49 -050046*** Test Cases ***
47
48Get BMC IPv4 Address And Verify
49 [Documentation] Get BMC IPv4 address and verify.
50 [Tags] Get_BMC_IPv4_Address_And_Verify
51
52 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
53 \ ${ipv4_addr}= Read Attribute ${ipv4_uri} Address
54 \ Validate IP on BMC ${ipv4_addr}
55
56Verify IPv4 Prefix Length
57 [Documentation] Get prefix length and verify.
58 [Tags] Verify_IPv4_Prefix_Length
59
60 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
61 \ ${prefix_length}= Read Attribute ${ipv4_uri} PrefixLength
62 \ Validate Prefix Length On BMC ${prefix_length}
63
64Verify Gateway Address
65 [Documentation] Get gateway address and verify.
66 [Tags] Verify_Gateway_Address
67
68 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050069 \ ${gateway_ip}= Read Attribute ${ipv4_uri} Gateway
70 \ Validate Route On BMC ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -050071
72Verify MAC Address
73 [Documentation] Get MAC address and verify.
74 [Tags] Verify_MAC_Address
manasarm104cc6b2018-02-07 12:35:05 +053075 ${macaddr}= Read Attribute ${NETWORK_MANAGER}/eth0 MACAddress
Prashanth Kattie79c5402017-06-08 07:40:49 -050076 Validate MAC On BMC ${macaddr}
77
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050078Add New Valid IP And Verify
79 [Documentation] Add new IP address and verify.
80 [Tags] Add_New_Valid_IP_And_Verify
81
82 Configure Network Settings ${valid_ip} ${valid_prefix_len}
83 ... ${valid_gateway} valid
84
Prashanth Katti90f9ff22017-08-11 06:17:12 -050085 # Verify whether new IP object is created for the given IP via REST.
86 # Delete IP address and IP object after verification.
87 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050088
89Configure Invalid IP String
90 # IP Address Prefix_length Gateway_IP Expected_Result
91 ${alpha_ip} ${valid_prefix_len} ${valid_gateway} error
92
93 [Documentation] Configure invalid IP address which is a string.
94 [Tags] Configure_Invalid_IP_String
95
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050096 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050097
98Configure Out Of Range IP
99 # IP Address Prefix_length Gateway_IP Expected_Result
100 ${out_of_range_ip} ${valid_prefix_len} ${valid_gateway} error
101
Prashanth Katti388bdc72017-07-19 08:54:58 -0500102 [Documentation] Configure out-of-range IP address.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500103 [Tags] Configure_Out_Of_Range_IP
104
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500105 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500106
107Configure Broadcast IP
108 # IP Address Prefix_length Gateway_IP Expected_Result
109 ${broadcast_ip} ${valid_prefix_len} ${valid_gateway} error
110
111 [Documentation] Configure broadcast IP address.
112 [Tags] Configure_Broadcast_IP
113
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500114 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500115
116Configure Multicast IP
117 # IP Address Prefix_length Gateway_IP Expected_Result
118 ${multicast_ip} ${valid_prefix_len} ${valid_gateway} error
119
120 [Documentation] Configure multicast IP address.
121 [Tags] Configure_Multicast_IP
122
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500123 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500124
125Configure Loopback IP
126 # IP Address Prefix_length Gateway_IP Expected_Result
127 ${loopback_ip} ${valid_prefix_len} ${valid_gateway} error
128
129 [Documentation] Configure loopback IP address.
130 [Tags] Configure_Loopback_IP
131
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500132 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500133
134Configure Network ID
135 # IP Address Prefix_length Gateway_IP Expected_Result
136 ${network_id} ${valid_prefix_len} ${valid_gateway} error
137
138 [Documentation] Configure network ID IP address.
139 [Tags] Configure_Network_ID
140
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500141 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500142
143Configure Less Octet IP
144 # IP Address Prefix_length Gateway_IP Expected_Result
145 ${less_octet_ip} ${valid_prefix_len} ${valid_gateway} error
146
147 [Documentation] Configure less octet IP address.
148 [Tags] Configure_Less_Octet_IP
149
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500150 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500151
152Configure Empty IP
153 # IP Address Prefix_length Gateway_IP Expected_Result
154 ${EMPTY} ${valid_prefix_len} ${valid_gateway} error
155
156 [Documentation] Configure less octet IP address.
157 [Tags] Configure_Empty_IP
158
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500159 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500160
161Configure Special Char IP
162 # IP Address Prefix_length Gateway_IP Expected_Result
163 @@@.%%.44.11 ${valid_prefix_len} ${valid_gateway} error
164
165 [Documentation] Configure invalid IP address contaning special chars.
166 [Tags] Configure_Special_Char_IP
167
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500168 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500169
170Configure Hexadecimal IP
171 # IP Address Prefix_length Gateway_IP Expected_Result
172 ${hex_ip} ${valid_prefix_len} ${valid_gateway} error
173
174 [Documentation] Configure invalid IP address contaning hex value.
175 [Tags] Configure_Hexadecimal_IP
176
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500177 [Template] Configure Network Settings
178
179Configure Negative Octet IP
180 # IP Address Prefix_length Gateway_IP Expected_Result
181 ${negative_ip} ${valid_prefix_len} ${valid_gateway} error
182
183 [Documentation] Configure invalid IP address containing negative octet.
184 [Tags] Configure_Negative_Octet_IP
185
186 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500187
Prashanth Katti388bdc72017-07-19 08:54:58 -0500188Add New Valid IP With Blank Gateway
189 [Documentation] Add new IP with blank gateway.
190 [Tags] Add_New_Valid_IP_With_Blank_Gateway
191
192 Configure Network Settings ${valid_ip} ${valid_prefix_len} ${EMPTY}
193 ... valid
194
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500195 # Verify whether new IP object is created for the given IP via REST.
196 # Delete IP address and IP object after verification.
197 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500198
199Configure Invalid Gateway String
200 # IP Address Prefix_length Gateway_IP Expected_Result
201 ${valid_ip} ${valid_prefix_len} ${alpha_ip} error
202
203 [Documentation] Configure invalid IP address to a gateway which is
204 ... an alpha string and expect an error.
205 [Tags] Configure_Invalid_Gateway_String
206
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500207 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500208
209Configure Out Of Range IP For Gateway
210 # IP Address Prefix_length Gateway_IP Expected_Result
211 ${valid_ip} ${valid_prefix_len} ${out_of_range_ip} error
212
213 [Documentation] Configure out-of-range IP for gateway and expect an error.
214 [Tags] Configure_Out_Of_Range_IP_For_Gateway
215
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500216 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500217
218Configure Broadcast IP For Gateway
219 # IP Address Prefix_length Gateway_IP Expected_Result
220 ${valid_ip} ${valid_prefix_len} ${broadcast_ip} error
221
222 [Documentation] Configure broadcast IP for gateway and expect an error.
223 [Tags] Configure_Broadcast_IP_For_Gateway
224
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500225 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500226
227Configure Loopback IP For Gateway
228 # IP Address Prefix_length Gateway_IP Expected_Result
229 ${valid_ip} ${valid_prefix_len} ${loopback_ip} error
230
231 [Documentation] Configure loopback IP for gateway and expect an error.
232 [Tags] Configure_Loopback_IP_For_Gateway
233
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500234 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500235
236Configure Multicast IP For Gateway
237 # IP Address Prefix_length Gateway_IP Expected_Result
238 ${valid_ip} ${valid_prefix_len} ${multicast_ip} error
239
240 [Documentation] Configure multicast IP for gateway and expect an error.
241 [Tags] Configure_Multicast_IP_For_Gateway
242
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500243 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500244
245Configure Network ID For Gateway
246 # IP Address Prefix_length Gateway_IP Expected_Result
247 ${valid_ip} ${valid_prefix_len} ${network_id} error
248
249 [Documentation] Configure network ID for gateway and expect an error.
250 [Tags] Configure_Network_ID_For_Gateway
251
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500252 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500253
254Configure Less Octet IP For Gateway
255 # IP Address Prefix_length Gateway_IP Expected_Result
256 ${valid_ip} ${valid_prefix_len} ${less_octet_ip} error
257
258 [Documentation] Configure less octet IP for gateway and expect an error.
259 [Tags] Configure_Less_Octet_IP_For_Gateway
260
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500261 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500262
263Configure Special Char IP For Gateway
264 # IP Address Prefix_length Gateway_IP Expected_Result
265 ${valid_ip} ${valid_prefix_len} @@@.%%.44.11 error
266
267 [Documentation] Configure special char IP for gateway and expect an error.
268 [Tags] Configure_Special_Char_IP_For_Gateway
269
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500270 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500271
272Configure Hexadecimal IP For Gateway
273 # IP Address Prefix_length Gateway_IP Expected_Result
274 ${valid_ip} ${valid_prefix_len} ${hex_ip} error
275
276 [Documentation] Configure hexadecimal IP for gateway and expect an error.
277 [Tags] Configure_Hexadecimal_IP_For_Gateway
278
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500279 [Template] Configure Network Settings
280
281Configure Out Of Range Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500282 # IP Address Prefix_length Gateway_IP Expected_Result
283 ${valid_ip} 33 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500284
285 [Documentation] Configure out-of-range prefix length and expect an error.
286 [Tags] Configure_Out_Of_Range_Prefix_Length
287
288 [Template] Configure Network Settings
289
290Configure Negative Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500291 # IP Address Prefix_length Gateway_IP Expected_Result
292 ${valid_ip} -10 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500293
294 [Documentation] Configure negative prefix length and expect an error.
295 [Tags] Configure_Negative_Value_For_Prefix_Length
296
297 [Template] Configure Network Settings
298
299Configure Non Numeric Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500300 # IP Address Prefix_length Gateway_IP Expected_Result
301 ${valid_ip} xx ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500302
303 [Documentation] Configure non numeric value prefix length and expect
304 ... an error.
305 [Tags] Configure_String_Value_For_Prefix_Length
306
307 [Template] Configure Network Settings
308
309Add Fourth Octet Threshold IP And Verify
310 [Documentation] Add fourth octet threshold IP and verify.
311 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
312
313 Configure Network Settings 10.6.6.254 ${valid_prefix_len}
314 ... ${valid_gateway} valid
315
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500316 # Verify whether new IP object is created for the given IP via REST.
317 # Delete IP address and IP object after verification.
318
319 Verify IP Address Via REST And Delete 10.6.6.254
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500320
321Add Third Octet Threshold IP And Verify
322 [Documentation] Add third octet threshold IP and verify.
323 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
324
325 Configure Network Settings 10.6.255.6 ${valid_prefix_len}
326 ... ${valid_gateway} valid
327
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500328 # Verify whether new IP object is created for the given IP via REST.
329 # Delete IP address and IP object after verification.
330
331 Verify IP Address Via REST And Delete 10.6.255.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500332
333Add Second Octet Threshold IP And Verify
334 [Documentation] Add second octet threshold IP and verify.
335 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
336
337 Configure Network Settings 10.255.6.6 ${valid_prefix_len}
338 ... ${valid_gateway} valid
339
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500340 # Verify whether new IP object is created for the given IP via REST.
341 # Delete IP address and IP object after verification.
342
343 Verify IP Address Via REST And Delete 10.255.6.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500344
345Add First Octet Threshold IP And Verify
346 [Documentation] Add first octet threshold IP and verify.
347 [Tags] Add_First_Octet_Threshold_IP_And_Verify
348
349 Configure Network Settings 223.6.6.6 ${valid_prefix_len}
350 ... ${valid_gateway} valid
351
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500352 # Verify whether new IP object is created for the given IP via REST.
353 # Delete IP address and IP object after verification.
354
355 Verify IP Address Via REST And Delete 223.6.6.6
356
357Configure Lowest Prefix Length
358 [Documentation] Configure lowest prefix length.
359 [Tags] Configure_Lowest_Prefix_Length
360
Prashanth Katti3690dc02017-11-22 07:21:24 -0600361 Configure Network Settings ${valid_ip} ${1}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500362 ... ${valid_gateway} valid
363
364 # Verify whether new IP object is created for the given IP via REST.
365 # Delete IP address and IP object after verification.
366 Verify IP Address Via REST And Delete ${valid_ip}
367
368Configure Threshold Prefix Length
369 [Documentation] Configure threshold prefix length.
370 [Tags] Configure_Threshold_Prefix_Length
371
372 Configure Network Settings ${valid_ip} ${32}
373 ... ${valid_gateway} valid
374
375 # Verify whether new IP object is created for the given IP via REST.
376 # Delete IP address and IP object after verification.
377 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500378
379Verify Default Gateway
380 [Documentation] Verify default gateway.
381 [Tags] Verify that the default gateway has a valid route.
382
manasarm104cc6b2018-02-07 12:35:05 +0530383 ${default_gw}= Read Attribute ${NETWORK_MANAGER}/config
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500384 ... DefaultGateway
385 Validate Route On BMC ${default_gw}
386
387Verify Hostname
388 [Documentation] Verify that the hostname read via REST is the same as the
389 ... hostname configured on system.
390 [Tags] Verify_Hostname
391
manasarm104cc6b2018-02-07 12:35:05 +0530392 ${hostname}= Read Attribute ${NETWORK_MANAGER}/config HostName
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500393 Validate Hostname On BMC ${hostname}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500394
manasarm88f00062018-03-07 12:07:33 +0530395Run IPMI With Multiple IPs Configured
396 [Documentation] Test out-of-band IPMI command with multiple IPs configured.
397 [Tags] Run_IPMI_With_Multiple_IPs_Configured
398 [Teardown] Clear IP Address
399
400 # Configure two IPs and verify.
401
402 :FOR ${loc_valid_ip} IN @{valid_ips}
403 \ Configure Network Settings ${loc_valid_ip} ${valid_prefix_len}
404 \ ... ${valid_gateway} valid
405
406 @{ip_uri_list}= Get IPv4 URI List
407 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
408
409 List Should Contain Sub List ${ip_list} ${valid_ips}
410 ... msg=IP address is not configured.
411
412 Run External IPMI Standard Command chassis bootparam get 5
413
Prashanth Kattie79c5402017-06-08 07:40:49 -0500414*** Keywords ***
415
manasarm88f00062018-03-07 12:07:33 +0530416Clear IP Address
417 [Documentation] Delete the IPs
418 @{ip_uri_list}= Get IPv4 URI List
419 :FOR ${loc_valid_ip} IN @{valid_ips}
420 \ Delete IP And Object ${loc_valid_ip} @{ip_uri_list}
421
Steven Sombarfac31e92017-12-15 09:40:34 -0600422Test Setup Execution
Prashanth Kattie79c5402017-06-08 07:40:49 -0500423 [Documentation] Network setup.
424 Open Connection And Login
425
426 @{IPv4_URI_List}= Get IPv4 URI List
427 Set Test Variable @{IPv4_URI_List}
428
429 # Get BMC IP address and prefix length.
430 ${ip_data}= Get BMC IP Info
431 Set Test Variable ${ip_data}
432
433Get IPv4 URI List
434 [Documentation] Get all IPv4 URIs.
435
436 # Sample output:
437 # "data": [
438 # "/xyz/openbmc_project/network/eth0/ipv4/e9767624",
439 # "/xyz/openbmc_project/network/eth0/ipv4/31f4ce8b"
440 # ],
441
manasarm104cc6b2018-02-07 12:35:05 +0530442 @{ipv4_uri_list}= Read Properties ${NETWORK_MANAGER}/eth0/ipv4/
Prashanth Kattie79c5402017-06-08 07:40:49 -0500443 Should Not Be Empty ${ipv4_uri_list} msg=IPv4 URI list is empty.
444
445 [Return] @{ipv4_uri_list}
446
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500447Validate IP On BMC
Prashanth Kattie79c5402017-06-08 07:40:49 -0500448 [Documentation] Validate IP on BMC.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500449 [Arguments] ${ip_address} ${ip_info}=${ip_data}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500450
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500451 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500452 # ip_address IP address of the system.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500453 # ip_info List of IP address and prefix length values.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500454
Prashanth Kattie8a74532017-11-07 06:45:07 -0600455 Should Contain Match ${ip_info} ${ip_address}/*
Prashanth Kattie79c5402017-06-08 07:40:49 -0500456 ... msg=IP address does not exist.
457
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500458Verify IP Address Via REST And Delete
459 [Documentation] Verify IP address via REST and delete.
460 [Arguments] ${ip_addr}
461
462 # Description of argument(s):
463 # ip_addr IP address to be verified.
464
465 @{ip_uri_list}= Get IPv4 URI List
466 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
467
468 List Should Contain Value ${ip_list} ${ip_addr}
469 ... msg=IP address is not configured.
470
471 # If IP address is configured, delete it.
472 Delete IP And Object ${ip_addr} @{ip_uri_list}
473
Prashanth Kattie79c5402017-06-08 07:40:49 -0500474Validate Prefix Length On BMC
475 [Documentation] Validate prefix length on BMC.
476 [Arguments] ${prefix_length}
477
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500478 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500479 # prefix_length It indicates netmask, netmask value 255.255.255.0
480 # is equal to prefix length 24.
481 # ip_data Suite variable which has list of IP address and
482 # prefix length values.
483
484 Should Contain Match ${ip_data} */${prefix_length}
485 ... msg=Prefix length does not exist.
486
487Validate Route On BMC
488 [Documentation] Validate route.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500489 [Arguments] ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500490
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500491 # Description of argument(s):
492 # gateway_ip Gateway IP address.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500493
494 ${route_info}= Get BMC Route Info
Prashanth Kattie8a74532017-11-07 06:45:07 -0600495
496 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
497
498 Run Keyword If '${gateway_ip}' == '0.0.0.0'
499 ... Pass Execution Gatway IP is "0.0.0.0".
500 ... ELSE
501 ... Should Contain ${route_info} ${gateway_ip}
502 ... msg=Gateway IP address not matching.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500503
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500504
505Configure Network Settings
506 [Documentation] Configure network settings.
507 [Arguments] ${ip_addr} ${prefix_len} ${gateway_ip} ${expected_result}
508
509 # Description of argument(s):
510 # ip_addr IP address of BMC.
511 # prefix_len Prefix length.
512 # gateway_ip Gateway IP address.
513 # expected_result Expected status of network setting configuration.
514
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500515 @{ip_parm_list}= Create List xyz.openbmc_project.Network.IP.Protocol.IPv4
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500516 ... ${ip_addr} ${prefix_len} ${gateway_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500517
518 ${data}= Create Dictionary data=@{ip_parm_list}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500519
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500520 Run Keyword And Ignore Error OpenBMC Post Request
manasarm104cc6b2018-02-07 12:35:05 +0530521 ... ${NETWORK_MANAGER}/eth0/action/IP data=${data}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500522
523 # After any modification on network interface, BMC restarts network
524 # module, wait until it is reachable.
525
Prashanth Katti3690dc02017-11-22 07:21:24 -0600526 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_RETRY_TIME}
527 ... ${NETWORK_TIMEOUT}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500528
529 # Verify whether new IP address is populated on BMC system.
530 # It should not allow to configure invalid settings.
531
532 ${ip_data}= Get BMC IP Info
533 ${status}= Run Keyword And Return Status
534 ... Validate IP On BMC ${ip_addr} ${ip_data}
535
536 Run Keyword If '${expected_result}' == 'error'
537 ... Should Be Equal ${status} ${False}
538 ... msg=Allowing the configuration of an invalid IP.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500539 ... ELSE
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500540 ... Should Be Equal ${status} ${True}
541 ... msg=Not allowing the configuration of a valid IP.
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500542
543Validate Hostname On BMC
544 [Documentation] Verify that the hostname read via REST is the same as the
545 ... hostname configured on system.
546 [Arguments] ${hostname}
547
548 # Description of argument(s):
549 # hostname A hostname value which is to be compared to the hostname
550 # configured on system.
551
552 ${sys_hostname}= Get BMC Hostname
553
554 Should Contain ${sys_hostname} ${hostname}
555 ... ignore_case=True msg=Hostname does not exist.