blob: 7cbaadfef4fddb3892c5def1bf14901742965890 [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
George Keishingbf58f012018-04-12 00:21:08 -05008Resource ../lib/openbmc_ffdc.robot
Prashanth Kattie79c5402017-06-08 07:40:49 -05009
10Force Tags Network_Test
11
12Library String
13Library SSHLibrary
14
Steven Sombarfac31e92017-12-15 09:40:34 -060015Test Setup Test Setup Execution
George Keishingbf58f012018-04-12 00:21:08 -050016Test Teardown Test Teardown Execution
Prashanth Kattie79c5402017-06-08 07:40:49 -050017
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050018*** Variables ***
19
20${alpha_ip} xx.xx.xx.xx
21
22# 10.x.x.x series is a private IP address range and does not exist in
23# our network, so this is chosen to avoid IP conflict.
24
25${valid_ip} 10.6.6.6
manasarm88f00062018-03-07 12:07:33 +053026${valid_ip2} 10.6.6.7
27@{valid_ips} ${valid_ip} ${valid_ip2}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050028${valid_gateway} 10.6.6.1
Prashanth Katti90f9ff22017-08-11 06:17:12 -050029${valid_prefix_len} ${24}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050030${broadcast_ip} 10.6.6.255
31${loopback_ip} 127.0.0.1
32${multicast_ip} 224.6.6.255
33${out_of_range_ip} 10.6.6.256
34
35# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
36# but trying to configure xx.xx.xx
37
38${less_octet_ip} 10.3.36
39
40# For the address 10.6.6.6, the 10.6.6.0 portion describes the
41# network ID and the 6 describe the host.
42
43${network_id} 10.6.6.0
44${hex_ip} 0xa.0xb.0xc.0xd
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050045${negative_ip} 10.-6.-6.6
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050046
Prashanth Kattie79c5402017-06-08 07:40:49 -050047*** Test Cases ***
48
49Get BMC IPv4 Address And Verify
50 [Documentation] Get BMC IPv4 address and verify.
51 [Tags] Get_BMC_IPv4_Address_And_Verify
52
53 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
54 \ ${ipv4_addr}= Read Attribute ${ipv4_uri} Address
55 \ Validate IP on BMC ${ipv4_addr}
56
57Verify IPv4 Prefix Length
58 [Documentation] Get prefix length and verify.
59 [Tags] Verify_IPv4_Prefix_Length
60
61 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
62 \ ${prefix_length}= Read Attribute ${ipv4_uri} PrefixLength
63 \ Validate Prefix Length On BMC ${prefix_length}
64
65Verify Gateway Address
66 [Documentation] Get gateway address and verify.
67 [Tags] Verify_Gateway_Address
68
69 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050070 \ ${gateway_ip}= Read Attribute ${ipv4_uri} Gateway
71 \ Validate Route On BMC ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -050072
73Verify MAC Address
74 [Documentation] Get MAC address and verify.
75 [Tags] Verify_MAC_Address
manasarm104cc6b2018-02-07 12:35:05 +053076 ${macaddr}= Read Attribute ${NETWORK_MANAGER}/eth0 MACAddress
Prashanth Kattie79c5402017-06-08 07:40:49 -050077 Validate MAC On BMC ${macaddr}
78
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050079Add New Valid IP And Verify
80 [Documentation] Add new IP address and verify.
81 [Tags] Add_New_Valid_IP_And_Verify
82
83 Configure Network Settings ${valid_ip} ${valid_prefix_len}
84 ... ${valid_gateway} valid
85
Prashanth Katti90f9ff22017-08-11 06:17:12 -050086 # Verify whether new IP object is created for the given IP via REST.
87 # Delete IP address and IP object after verification.
88 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050089
90Configure Invalid IP String
91 # IP Address Prefix_length Gateway_IP Expected_Result
92 ${alpha_ip} ${valid_prefix_len} ${valid_gateway} error
93
94 [Documentation] Configure invalid IP address which is a string.
95 [Tags] Configure_Invalid_IP_String
96
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050097 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050098
99Configure Out Of Range IP
100 # IP Address Prefix_length Gateway_IP Expected_Result
101 ${out_of_range_ip} ${valid_prefix_len} ${valid_gateway} error
102
Prashanth Katti388bdc72017-07-19 08:54:58 -0500103 [Documentation] Configure out-of-range IP address.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500104 [Tags] Configure_Out_Of_Range_IP
105
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500106 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500107
108Configure Broadcast IP
109 # IP Address Prefix_length Gateway_IP Expected_Result
110 ${broadcast_ip} ${valid_prefix_len} ${valid_gateway} error
111
112 [Documentation] Configure broadcast IP address.
113 [Tags] Configure_Broadcast_IP
114
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500115 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500116
117Configure Multicast IP
118 # IP Address Prefix_length Gateway_IP Expected_Result
119 ${multicast_ip} ${valid_prefix_len} ${valid_gateway} error
120
121 [Documentation] Configure multicast IP address.
122 [Tags] Configure_Multicast_IP
123
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500124 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500125
126Configure Loopback IP
127 # IP Address Prefix_length Gateway_IP Expected_Result
128 ${loopback_ip} ${valid_prefix_len} ${valid_gateway} error
129
130 [Documentation] Configure loopback IP address.
131 [Tags] Configure_Loopback_IP
132
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500133 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500134
135Configure Network ID
136 # IP Address Prefix_length Gateway_IP Expected_Result
137 ${network_id} ${valid_prefix_len} ${valid_gateway} error
138
139 [Documentation] Configure network ID IP address.
140 [Tags] Configure_Network_ID
141
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500142 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500143
144Configure Less Octet IP
145 # IP Address Prefix_length Gateway_IP Expected_Result
146 ${less_octet_ip} ${valid_prefix_len} ${valid_gateway} error
147
148 [Documentation] Configure less octet IP address.
149 [Tags] Configure_Less_Octet_IP
150
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500151 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500152
153Configure Empty IP
154 # IP Address Prefix_length Gateway_IP Expected_Result
155 ${EMPTY} ${valid_prefix_len} ${valid_gateway} error
156
157 [Documentation] Configure less octet IP address.
158 [Tags] Configure_Empty_IP
159
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500160 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500161
162Configure Special Char IP
163 # IP Address Prefix_length Gateway_IP Expected_Result
164 @@@.%%.44.11 ${valid_prefix_len} ${valid_gateway} error
165
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500166 [Documentation] Configure invalid IP address containing special chars.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500167 [Tags] Configure_Special_Char_IP
168
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500169 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500170
171Configure Hexadecimal IP
172 # IP Address Prefix_length Gateway_IP Expected_Result
173 ${hex_ip} ${valid_prefix_len} ${valid_gateway} error
174
Gunnar Mills917ba1a2018-04-08 16:42:12 -0500175 [Documentation] Configure invalid IP address containing hex value.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500176 [Tags] Configure_Hexadecimal_IP
177
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500178 [Template] Configure Network Settings
179
180Configure Negative Octet IP
181 # IP Address Prefix_length Gateway_IP Expected_Result
182 ${negative_ip} ${valid_prefix_len} ${valid_gateway} error
183
184 [Documentation] Configure invalid IP address containing negative octet.
185 [Tags] Configure_Negative_Octet_IP
186
187 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500188
Prashanth Katti388bdc72017-07-19 08:54:58 -0500189Add New Valid IP With Blank Gateway
190 [Documentation] Add new IP with blank gateway.
191 [Tags] Add_New_Valid_IP_With_Blank_Gateway
192
193 Configure Network Settings ${valid_ip} ${valid_prefix_len} ${EMPTY}
194 ... valid
195
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500196 # Verify whether new IP object is created for the given IP via REST.
197 # Delete IP address and IP object after verification.
198 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500199
200Configure Invalid Gateway String
201 # IP Address Prefix_length Gateway_IP Expected_Result
202 ${valid_ip} ${valid_prefix_len} ${alpha_ip} error
203
204 [Documentation] Configure invalid IP address to a gateway which is
205 ... an alpha string and expect an error.
206 [Tags] Configure_Invalid_Gateway_String
207
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500208 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500209
210Configure Out Of Range IP For Gateway
211 # IP Address Prefix_length Gateway_IP Expected_Result
212 ${valid_ip} ${valid_prefix_len} ${out_of_range_ip} error
213
214 [Documentation] Configure out-of-range IP for gateway and expect an error.
215 [Tags] Configure_Out_Of_Range_IP_For_Gateway
216
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500217 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500218
219Configure Broadcast IP For Gateway
220 # IP Address Prefix_length Gateway_IP Expected_Result
221 ${valid_ip} ${valid_prefix_len} ${broadcast_ip} error
222
223 [Documentation] Configure broadcast IP for gateway and expect an error.
224 [Tags] Configure_Broadcast_IP_For_Gateway
225
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500226 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500227
228Configure Loopback IP For Gateway
229 # IP Address Prefix_length Gateway_IP Expected_Result
230 ${valid_ip} ${valid_prefix_len} ${loopback_ip} error
231
232 [Documentation] Configure loopback IP for gateway and expect an error.
233 [Tags] Configure_Loopback_IP_For_Gateway
234
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500235 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500236
237Configure Multicast IP For Gateway
238 # IP Address Prefix_length Gateway_IP Expected_Result
239 ${valid_ip} ${valid_prefix_len} ${multicast_ip} error
240
241 [Documentation] Configure multicast IP for gateway and expect an error.
242 [Tags] Configure_Multicast_IP_For_Gateway
243
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500244 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500245
246Configure Network ID For Gateway
247 # IP Address Prefix_length Gateway_IP Expected_Result
248 ${valid_ip} ${valid_prefix_len} ${network_id} error
249
250 [Documentation] Configure network ID for gateway and expect an error.
251 [Tags] Configure_Network_ID_For_Gateway
252
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500253 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500254
255Configure Less Octet IP For Gateway
256 # IP Address Prefix_length Gateway_IP Expected_Result
257 ${valid_ip} ${valid_prefix_len} ${less_octet_ip} error
258
259 [Documentation] Configure less octet IP for gateway and expect an error.
260 [Tags] Configure_Less_Octet_IP_For_Gateway
261
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500262 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500263
264Configure Special Char IP For Gateway
265 # IP Address Prefix_length Gateway_IP Expected_Result
266 ${valid_ip} ${valid_prefix_len} @@@.%%.44.11 error
267
268 [Documentation] Configure special char IP for gateway and expect an error.
269 [Tags] Configure_Special_Char_IP_For_Gateway
270
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500271 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500272
273Configure Hexadecimal IP For Gateway
274 # IP Address Prefix_length Gateway_IP Expected_Result
275 ${valid_ip} ${valid_prefix_len} ${hex_ip} error
276
277 [Documentation] Configure hexadecimal IP for gateway and expect an error.
278 [Tags] Configure_Hexadecimal_IP_For_Gateway
279
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500280 [Template] Configure Network Settings
281
282Configure Out Of Range Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500283 # IP Address Prefix_length Gateway_IP Expected_Result
284 ${valid_ip} 33 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500285
286 [Documentation] Configure out-of-range prefix length and expect an error.
287 [Tags] Configure_Out_Of_Range_Prefix_Length
288
289 [Template] Configure Network Settings
290
291Configure Negative Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500292 # IP Address Prefix_length Gateway_IP Expected_Result
293 ${valid_ip} -10 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500294
295 [Documentation] Configure negative prefix length and expect an error.
296 [Tags] Configure_Negative_Value_For_Prefix_Length
297
298 [Template] Configure Network Settings
299
300Configure Non Numeric Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500301 # IP Address Prefix_length Gateway_IP Expected_Result
302 ${valid_ip} xx ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500303
304 [Documentation] Configure non numeric value prefix length and expect
305 ... an error.
306 [Tags] Configure_String_Value_For_Prefix_Length
307
308 [Template] Configure Network Settings
309
310Add Fourth Octet Threshold IP And Verify
311 [Documentation] Add fourth octet threshold IP and verify.
312 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
313
314 Configure Network Settings 10.6.6.254 ${valid_prefix_len}
315 ... ${valid_gateway} valid
316
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500317 # Verify whether new IP object is created for the given IP via REST.
318 # Delete IP address and IP object after verification.
319
320 Verify IP Address Via REST And Delete 10.6.6.254
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500321
322Add Third Octet Threshold IP And Verify
323 [Documentation] Add third octet threshold IP and verify.
324 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
325
326 Configure Network Settings 10.6.255.6 ${valid_prefix_len}
327 ... ${valid_gateway} valid
328
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500329 # Verify whether new IP object is created for the given IP via REST.
330 # Delete IP address and IP object after verification.
331
332 Verify IP Address Via REST And Delete 10.6.255.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500333
334Add Second Octet Threshold IP And Verify
335 [Documentation] Add second octet threshold IP and verify.
336 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
337
338 Configure Network Settings 10.255.6.6 ${valid_prefix_len}
339 ... ${valid_gateway} valid
340
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500341 # Verify whether new IP object is created for the given IP via REST.
342 # Delete IP address and IP object after verification.
343
344 Verify IP Address Via REST And Delete 10.255.6.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500345
346Add First Octet Threshold IP And Verify
347 [Documentation] Add first octet threshold IP and verify.
348 [Tags] Add_First_Octet_Threshold_IP_And_Verify
349
350 Configure Network Settings 223.6.6.6 ${valid_prefix_len}
351 ... ${valid_gateway} valid
352
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500353 # Verify whether new IP object is created for the given IP via REST.
354 # Delete IP address and IP object after verification.
355
356 Verify IP Address Via REST And Delete 223.6.6.6
357
358Configure Lowest Prefix Length
359 [Documentation] Configure lowest prefix length.
360 [Tags] Configure_Lowest_Prefix_Length
361
Prashanth Katti3690dc02017-11-22 07:21:24 -0600362 Configure Network Settings ${valid_ip} ${1}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500363 ... ${valid_gateway} valid
364
365 # Verify whether new IP object is created for the given IP via REST.
366 # Delete IP address and IP object after verification.
367 Verify IP Address Via REST And Delete ${valid_ip}
368
369Configure Threshold Prefix Length
370 [Documentation] Configure threshold prefix length.
371 [Tags] Configure_Threshold_Prefix_Length
372
373 Configure Network Settings ${valid_ip} ${32}
374 ... ${valid_gateway} valid
375
376 # Verify whether new IP object is created for the given IP via REST.
377 # Delete IP address and IP object after verification.
378 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500379
380Verify Default Gateway
381 [Documentation] Verify default gateway.
382 [Tags] Verify that the default gateway has a valid route.
383
manasarm104cc6b2018-02-07 12:35:05 +0530384 ${default_gw}= Read Attribute ${NETWORK_MANAGER}/config
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500385 ... DefaultGateway
386 Validate Route On BMC ${default_gw}
387
388Verify Hostname
389 [Documentation] Verify that the hostname read via REST is the same as the
390 ... hostname configured on system.
391 [Tags] Verify_Hostname
392
manasarm104cc6b2018-02-07 12:35:05 +0530393 ${hostname}= Read Attribute ${NETWORK_MANAGER}/config HostName
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500394 Validate Hostname On BMC ${hostname}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500395
manasarm88f00062018-03-07 12:07:33 +0530396Run IPMI With Multiple IPs Configured
397 [Documentation] Test out-of-band IPMI command with multiple IPs configured.
398 [Tags] Run_IPMI_With_Multiple_IPs_Configured
399 [Teardown] Clear IP Address
400
401 # Configure two IPs and verify.
402
403 :FOR ${loc_valid_ip} IN @{valid_ips}
404 \ Configure Network Settings ${loc_valid_ip} ${valid_prefix_len}
405 \ ... ${valid_gateway} valid
406
407 @{ip_uri_list}= Get IPv4 URI List
408 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
409
410 List Should Contain Sub List ${ip_list} ${valid_ips}
411 ... msg=IP address is not configured.
412
413 Run External IPMI Standard Command chassis bootparam get 5
414
Prashanth Kattie79c5402017-06-08 07:40:49 -0500415*** Keywords ***
416
manasarm88f00062018-03-07 12:07:33 +0530417Clear IP Address
418 [Documentation] Delete the IPs
George Keishing44bc84d2018-04-12 00:51:04 -0500419
420 # Get the current IPv4 list post delete and sleep 10s for sync.
manasarm88f00062018-03-07 12:07:33 +0530421 :FOR ${loc_valid_ip} IN @{valid_ips}
George Keishing44bc84d2018-04-12 00:51:04 -0500422 \ @{ip_uri_list}= Get IPv4 URI List
manasarm88f00062018-03-07 12:07:33 +0530423 \ Delete IP And Object ${loc_valid_ip} @{ip_uri_list}
George Keishing44bc84d2018-04-12 00:51:04 -0500424 \ Sleep 10s
manasarm88f00062018-03-07 12:07:33 +0530425
Steven Sombarfac31e92017-12-15 09:40:34 -0600426Test Setup Execution
Prashanth Kattie79c5402017-06-08 07:40:49 -0500427 [Documentation] Network setup.
428 Open Connection And Login
429
430 @{IPv4_URI_List}= Get IPv4 URI List
431 Set Test Variable @{IPv4_URI_List}
432
433 # Get BMC IP address and prefix length.
434 ${ip_data}= Get BMC IP Info
435 Set Test Variable ${ip_data}
436
437Get IPv4 URI List
438 [Documentation] Get all IPv4 URIs.
439
440 # Sample output:
441 # "data": [
442 # "/xyz/openbmc_project/network/eth0/ipv4/e9767624",
443 # "/xyz/openbmc_project/network/eth0/ipv4/31f4ce8b"
444 # ],
445
manasarm104cc6b2018-02-07 12:35:05 +0530446 @{ipv4_uri_list}= Read Properties ${NETWORK_MANAGER}/eth0/ipv4/
Prashanth Kattie79c5402017-06-08 07:40:49 -0500447 Should Not Be Empty ${ipv4_uri_list} msg=IPv4 URI list is empty.
448
449 [Return] @{ipv4_uri_list}
450
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500451Validate IP On BMC
Prashanth Kattie79c5402017-06-08 07:40:49 -0500452 [Documentation] Validate IP on BMC.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500453 [Arguments] ${ip_address} ${ip_info}=${ip_data}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500454
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500455 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500456 # ip_address IP address of the system.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500457 # ip_info List of IP address and prefix length values.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500458
Prashanth Kattie8a74532017-11-07 06:45:07 -0600459 Should Contain Match ${ip_info} ${ip_address}/*
Prashanth Kattie79c5402017-06-08 07:40:49 -0500460 ... msg=IP address does not exist.
461
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500462Verify IP Address Via REST And Delete
463 [Documentation] Verify IP address via REST and delete.
464 [Arguments] ${ip_addr}
465
466 # Description of argument(s):
467 # ip_addr IP address to be verified.
468
469 @{ip_uri_list}= Get IPv4 URI List
470 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
471
472 List Should Contain Value ${ip_list} ${ip_addr}
473 ... msg=IP address is not configured.
474
475 # If IP address is configured, delete it.
476 Delete IP And Object ${ip_addr} @{ip_uri_list}
477
Prashanth Kattie79c5402017-06-08 07:40:49 -0500478Validate Prefix Length On BMC
479 [Documentation] Validate prefix length on BMC.
480 [Arguments] ${prefix_length}
481
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500482 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500483 # prefix_length It indicates netmask, netmask value 255.255.255.0
484 # is equal to prefix length 24.
485 # ip_data Suite variable which has list of IP address and
486 # prefix length values.
487
488 Should Contain Match ${ip_data} */${prefix_length}
489 ... msg=Prefix length does not exist.
490
491Validate Route On BMC
492 [Documentation] Validate route.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500493 [Arguments] ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500494
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500495 # Description of argument(s):
496 # gateway_ip Gateway IP address.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500497
498 ${route_info}= Get BMC Route Info
Prashanth Kattie8a74532017-11-07 06:45:07 -0600499
500 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
501
502 Run Keyword If '${gateway_ip}' == '0.0.0.0'
503 ... Pass Execution Gatway IP is "0.0.0.0".
504 ... ELSE
505 ... Should Contain ${route_info} ${gateway_ip}
506 ... msg=Gateway IP address not matching.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500507
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500508
509Configure Network Settings
510 [Documentation] Configure network settings.
511 [Arguments] ${ip_addr} ${prefix_len} ${gateway_ip} ${expected_result}
512
513 # Description of argument(s):
514 # ip_addr IP address of BMC.
515 # prefix_len Prefix length.
516 # gateway_ip Gateway IP address.
517 # expected_result Expected status of network setting configuration.
518
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500519 @{ip_parm_list}= Create List xyz.openbmc_project.Network.IP.Protocol.IPv4
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500520 ... ${ip_addr} ${prefix_len} ${gateway_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500521
522 ${data}= Create Dictionary data=@{ip_parm_list}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500523
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500524 Run Keyword And Ignore Error OpenBMC Post Request
manasarm104cc6b2018-02-07 12:35:05 +0530525 ... ${NETWORK_MANAGER}/eth0/action/IP data=${data}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500526
527 # After any modification on network interface, BMC restarts network
528 # module, wait until it is reachable.
529
Prashanth Katti3690dc02017-11-22 07:21:24 -0600530 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_RETRY_TIME}
531 ... ${NETWORK_TIMEOUT}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500532
533 # Verify whether new IP address is populated on BMC system.
534 # It should not allow to configure invalid settings.
535
536 ${ip_data}= Get BMC IP Info
537 ${status}= Run Keyword And Return Status
538 ... Validate IP On BMC ${ip_addr} ${ip_data}
539
540 Run Keyword If '${expected_result}' == 'error'
541 ... Should Be Equal ${status} ${False}
542 ... msg=Allowing the configuration of an invalid IP.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500543 ... ELSE
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500544 ... Should Be Equal ${status} ${True}
545 ... msg=Not allowing the configuration of a valid IP.
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500546
547Validate Hostname On BMC
548 [Documentation] Verify that the hostname read via REST is the same as the
549 ... hostname configured on system.
550 [Arguments] ${hostname}
551
552 # Description of argument(s):
553 # hostname A hostname value which is to be compared to the hostname
554 # configured on system.
555
556 ${sys_hostname}= Get BMC Hostname
557
558 Should Contain ${sys_hostname} ${hostname}
559 ... ignore_case=True msg=Hostname does not exist.
George Keishingbf58f012018-04-12 00:21:08 -0500560
561Test Teardown Execution
562 [Documentation] Do the post test teardown.
563
564 FFDC On Test Case Fail
565 Close All Connections