blob: f44286349741593a868ca30b529b1b18096df8f9 [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
George Keishing5abfe602018-07-05 11:54:37 -050091 [Documentation] Configure invalid IP address which is a string.
92 [Tags] Configure_Invalid_IP_String
93 [Template] Configure Network Settings
94
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050095 # IP Address Prefix_length Gateway_IP Expected_Result
96 ${alpha_ip} ${valid_prefix_len} ${valid_gateway} error
97
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050098
99Configure Out Of Range IP
George Keishing5abfe602018-07-05 11:54:37 -0500100 [Documentation] Configure out-of-range IP address.
101 [Tags] Configure_Out_Of_Range_IP
102 [Template] Configure Network Settings
103
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500104 # IP Address Prefix_length Gateway_IP Expected_Result
105 ${out_of_range_ip} ${valid_prefix_len} ${valid_gateway} error
106
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500107
108Configure Broadcast IP
George Keishing5abfe602018-07-05 11:54:37 -0500109 [Documentation] Configure broadcast IP address.
110 [Tags] Configure_Broadcast_IP
111 [Template] Configure Network Settings
112
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500113 # IP Address Prefix_length Gateway_IP Expected_Result
114 ${broadcast_ip} ${valid_prefix_len} ${valid_gateway} error
115
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500116
117Configure Multicast IP
George Keishing5abfe602018-07-05 11:54:37 -0500118 [Documentation] Configure multicast IP address.
119 [Tags] Configure_Multicast_IP
120 [Template] Configure Network Settings
121
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500122 # IP Address Prefix_length Gateway_IP Expected_Result
123 ${multicast_ip} ${valid_prefix_len} ${valid_gateway} error
124
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500125
126Configure Loopback IP
George Keishing5abfe602018-07-05 11:54:37 -0500127 [Documentation] Configure loopback IP address.
128 [Tags] Configure_Loopback_IP
129 [Template] Configure Network Settings
130
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500131 # IP Address Prefix_length Gateway_IP Expected_Result
132 ${loopback_ip} ${valid_prefix_len} ${valid_gateway} error
133
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500134
135Configure Network ID
George Keishing5abfe602018-07-05 11:54:37 -0500136 [Documentation] Configure network ID IP address.
137 [Tags] Configure_Network_ID
138 [Template] Configure Network Settings
139
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500140 # IP Address Prefix_length Gateway_IP Expected_Result
141 ${network_id} ${valid_prefix_len} ${valid_gateway} error
142
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500143
144Configure Less Octet IP
George Keishing5abfe602018-07-05 11:54:37 -0500145 [Documentation] Configure less octet IP address.
146 [Tags] Configure_Less_Octet_IP
147 [Template] Configure Network Settings
148
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500149 # IP Address Prefix_length Gateway_IP Expected_Result
150 ${less_octet_ip} ${valid_prefix_len} ${valid_gateway} error
151
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500152
153Configure Empty IP
George Keishing5abfe602018-07-05 11:54:37 -0500154 [Documentation] Configure less octet IP address.
155 [Tags] Configure_Empty_IP
156 [Template] Configure Network Settings
157
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500158 # IP Address Prefix_length Gateway_IP Expected_Result
159 ${EMPTY} ${valid_prefix_len} ${valid_gateway} error
160
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500161
162Configure Special Char IP
George Keishing5abfe602018-07-05 11:54:37 -0500163 [Documentation] Configure invalid IP address containing special chars.
164 [Tags] Configure_Special_Char_IP
165 [Template] Configure Network Settings
166
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500167 # IP Address Prefix_length Gateway_IP Expected_Result
168 @@@.%%.44.11 ${valid_prefix_len} ${valid_gateway} error
169
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500170
171Configure Hexadecimal IP
George Keishing5abfe602018-07-05 11:54:37 -0500172 [Documentation] Configure invalid IP address containing hex value.
173 [Tags] Configure_Hexadecimal_IP
174 [Template] Configure Network Settings
175
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500176 # IP Address Prefix_length Gateway_IP Expected_Result
177 ${hex_ip} ${valid_prefix_len} ${valid_gateway} error
178
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500179
180Configure Negative Octet IP
George Keishing5abfe602018-07-05 11:54:37 -0500181 [Documentation] Configure invalid IP address containing negative octet.
182 [Tags] Configure_Negative_Octet_IP
183 [Template] Configure Network Settings
184
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500185 # IP Address Prefix_length Gateway_IP Expected_Result
186 ${negative_ip} ${valid_prefix_len} ${valid_gateway} error
187
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
Prashanth Katti388bdc72017-07-19 08:54:58 -0500200
George Keishing5abfe602018-07-05 11:54:37 -0500201Configure Invalid Gateway String
Prashanth Katti388bdc72017-07-19 08:54:58 -0500202 [Documentation] Configure invalid IP address to a gateway which is
203 ... an alpha string and expect an error.
204 [Tags] Configure_Invalid_Gateway_String
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500205 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500206
George Keishing5abfe602018-07-05 11:54:37 -0500207 # IP Address Prefix_length Gateway_IP Expected_Result
208 ${valid_ip} ${valid_prefix_len} ${alpha_ip} error
209
210
Prashanth Katti388bdc72017-07-19 08:54:58 -0500211Configure Out Of Range IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500212 [Documentation] Configure out-of-range IP for gateway and expect an error.
213 [Tags] Configure_Out_Of_Range_IP_For_Gateway
214 [Template] Configure Network Settings
215
Prashanth Katti388bdc72017-07-19 08:54:58 -0500216 # IP Address Prefix_length Gateway_IP Expected_Result
217 ${valid_ip} ${valid_prefix_len} ${out_of_range_ip} error
218
Prashanth Katti388bdc72017-07-19 08:54:58 -0500219
220Configure Broadcast IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500221 [Documentation] Configure broadcast IP for gateway and expect an error.
222 [Tags] Configure_Broadcast_IP_For_Gateway
223 [Template] Configure Network Settings
224
Prashanth Katti388bdc72017-07-19 08:54:58 -0500225 # IP Address Prefix_length Gateway_IP Expected_Result
226 ${valid_ip} ${valid_prefix_len} ${broadcast_ip} error
227
Prashanth Katti388bdc72017-07-19 08:54:58 -0500228
229Configure Loopback IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500230 [Documentation] Configure loopback IP for gateway and expect an error.
231 [Tags] Configure_Loopback_IP_For_Gateway
232 [Template] Configure Network Settings
233
Prashanth Katti388bdc72017-07-19 08:54:58 -0500234 # IP Address Prefix_length Gateway_IP Expected_Result
235 ${valid_ip} ${valid_prefix_len} ${loopback_ip} error
236
Prashanth Katti388bdc72017-07-19 08:54:58 -0500237
238Configure Multicast IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500239 [Documentation] Configure multicast IP for gateway and expect an error.
240 [Tags] Configure_Multicast_IP_For_Gateway
241 [Template] Configure Network Settings
242
Prashanth Katti388bdc72017-07-19 08:54:58 -0500243 # IP Address Prefix_length Gateway_IP Expected_Result
244 ${valid_ip} ${valid_prefix_len} ${multicast_ip} error
245
Prashanth Katti388bdc72017-07-19 08:54:58 -0500246
247Configure Network ID For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500248 [Documentation] Configure network ID for gateway and expect an error.
249 [Tags] Configure_Network_ID_For_Gateway
250 [Template] Configure Network Settings
251
Prashanth Katti388bdc72017-07-19 08:54:58 -0500252 # IP Address Prefix_length Gateway_IP Expected_Result
253 ${valid_ip} ${valid_prefix_len} ${network_id} error
254
Prashanth Katti388bdc72017-07-19 08:54:58 -0500255
256Configure Less Octet IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500257 [Documentation] Configure less octet IP for gateway and expect an error.
258 [Tags] Configure_Less_Octet_IP_For_Gateway
259 [Template] Configure Network Settings
260
Prashanth Katti388bdc72017-07-19 08:54:58 -0500261 # IP Address Prefix_length Gateway_IP Expected_Result
262 ${valid_ip} ${valid_prefix_len} ${less_octet_ip} error
263
Prashanth Katti388bdc72017-07-19 08:54:58 -0500264
265Configure Special Char IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500266 [Documentation] Configure special char IP for gateway and expect an error.
267 [Tags] Configure_Special_Char_IP_For_Gateway
268 [Template] Configure Network Settings
269
Prashanth Katti388bdc72017-07-19 08:54:58 -0500270 # IP Address Prefix_length Gateway_IP Expected_Result
271 ${valid_ip} ${valid_prefix_len} @@@.%%.44.11 error
272
Prashanth Katti388bdc72017-07-19 08:54:58 -0500273
274Configure Hexadecimal IP For Gateway
George Keishing5abfe602018-07-05 11:54:37 -0500275 [Documentation] Configure hexadecimal IP for gateway and expect an error.
276 [Tags] Configure_Hexadecimal_IP_For_Gateway
277 [Template] Configure Network Settings
278
Prashanth Katti388bdc72017-07-19 08:54:58 -0500279 # IP Address Prefix_length Gateway_IP Expected_Result
280 ${valid_ip} ${valid_prefix_len} ${hex_ip} error
281
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500282
283Configure Out Of Range Prefix Length
George Keishing5abfe602018-07-05 11:54:37 -0500284 [Documentation] Configure out-of-range prefix length and expect an error.
285 [Tags] Configure_Out_Of_Range_Prefix_Length
286 [Template] Configure Network Settings
287
Prashanth Kattia994bc32017-10-18 06:16:31 -0500288 # IP Address Prefix_length Gateway_IP Expected_Result
289 ${valid_ip} 33 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500290
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500291
292Configure Negative Value For Prefix Length
George Keishing5abfe602018-07-05 11:54:37 -0500293 [Documentation] Configure negative prefix length and expect an error.
294 [Tags] Configure_Negative_Value_For_Prefix_Length
295 [Template] Configure Network Settings
296
Prashanth Kattia994bc32017-10-18 06:16:31 -0500297 # IP Address Prefix_length Gateway_IP Expected_Result
298 ${valid_ip} -10 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500299
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500300
301Configure Non Numeric Value For Prefix Length
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500302 [Documentation] Configure non numeric value prefix length and expect
303 ... an error.
304 [Tags] Configure_String_Value_For_Prefix_Length
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500305 [Template] Configure Network Settings
306
George Keishing5abfe602018-07-05 11:54:37 -0500307 # IP Address Prefix_length Gateway_IP Expected_Result
308 ${valid_ip} xx ${valid_gateway} error
309
310
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500311Add Fourth Octet Threshold IP And Verify
312 [Documentation] Add fourth octet threshold IP and verify.
313 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
314
315 Configure Network Settings 10.6.6.254 ${valid_prefix_len}
316 ... ${valid_gateway} valid
317
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500318 # Verify whether new IP object is created for the given IP via REST.
319 # Delete IP address and IP object after verification.
320
321 Verify IP Address Via REST And Delete 10.6.6.254
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500322
323Add Third Octet Threshold IP And Verify
324 [Documentation] Add third octet threshold IP and verify.
325 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
326
327 Configure Network Settings 10.6.255.6 ${valid_prefix_len}
328 ... ${valid_gateway} valid
329
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500330 # Verify whether new IP object is created for the given IP via REST.
331 # Delete IP address and IP object after verification.
332
333 Verify IP Address Via REST And Delete 10.6.255.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500334
335Add Second Octet Threshold IP And Verify
336 [Documentation] Add second octet threshold IP and verify.
337 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
338
339 Configure Network Settings 10.255.6.6 ${valid_prefix_len}
340 ... ${valid_gateway} valid
341
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500342 # Verify whether new IP object is created for the given IP via REST.
343 # Delete IP address and IP object after verification.
344
345 Verify IP Address Via REST And Delete 10.255.6.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500346
347Add First Octet Threshold IP And Verify
348 [Documentation] Add first octet threshold IP and verify.
349 [Tags] Add_First_Octet_Threshold_IP_And_Verify
350
351 Configure Network Settings 223.6.6.6 ${valid_prefix_len}
352 ... ${valid_gateway} valid
353
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500354 # Verify whether new IP object is created for the given IP via REST.
355 # Delete IP address and IP object after verification.
356
357 Verify IP Address Via REST And Delete 223.6.6.6
358
359Configure Lowest Prefix Length
360 [Documentation] Configure lowest prefix length.
361 [Tags] Configure_Lowest_Prefix_Length
362
Prashanth Katti3690dc02017-11-22 07:21:24 -0600363 Configure Network Settings ${valid_ip} ${1}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500364 ... ${valid_gateway} valid
365
366 # Verify whether new IP object is created for the given IP via REST.
367 # Delete IP address and IP object after verification.
368 Verify IP Address Via REST And Delete ${valid_ip}
369
370Configure Threshold Prefix Length
371 [Documentation] Configure threshold prefix length.
372 [Tags] Configure_Threshold_Prefix_Length
373
374 Configure Network Settings ${valid_ip} ${32}
375 ... ${valid_gateway} valid
376
377 # Verify whether new IP object is created for the given IP via REST.
378 # Delete IP address and IP object after verification.
379 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500380
381Verify Default Gateway
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500382 [Documentation] Verify that the default gateway has a valid route.
383 [Tags] Verify_Default_Gateway.
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500384
manasarm104cc6b2018-02-07 12:35:05 +0530385 ${default_gw}= Read Attribute ${NETWORK_MANAGER}/config
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500386 ... DefaultGateway
387 Validate Route On BMC ${default_gw}
388
389Verify Hostname
390 [Documentation] Verify that the hostname read via REST is the same as the
391 ... hostname configured on system.
392 [Tags] Verify_Hostname
393
manasarm104cc6b2018-02-07 12:35:05 +0530394 ${hostname}= Read Attribute ${NETWORK_MANAGER}/config HostName
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500395 Validate Hostname On BMC ${hostname}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500396
manasarm88f00062018-03-07 12:07:33 +0530397Run IPMI With Multiple IPs Configured
398 [Documentation] Test out-of-band IPMI command with multiple IPs configured.
399 [Tags] Run_IPMI_With_Multiple_IPs_Configured
400 [Teardown] Clear IP Address
401
402 # Configure two IPs and verify.
403
404 :FOR ${loc_valid_ip} IN @{valid_ips}
405 \ Configure Network Settings ${loc_valid_ip} ${valid_prefix_len}
406 \ ... ${valid_gateway} valid
407
408 @{ip_uri_list}= Get IPv4 URI List
409 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
410
411 List Should Contain Sub List ${ip_list} ${valid_ips}
412 ... msg=IP address is not configured.
413
414 Run External IPMI Standard Command chassis bootparam get 5
415
Prashanth Kattie79c5402017-06-08 07:40:49 -0500416*** Keywords ***
417
manasarm88f00062018-03-07 12:07:33 +0530418Clear IP Address
419 [Documentation] Delete the IPs
George Keishing44bc84d2018-04-12 00:51:04 -0500420
421 # Get the current IPv4 list post delete and sleep 10s for sync.
manasarm88f00062018-03-07 12:07:33 +0530422 :FOR ${loc_valid_ip} IN @{valid_ips}
George Keishing44bc84d2018-04-12 00:51:04 -0500423 \ @{ip_uri_list}= Get IPv4 URI List
manasarm88f00062018-03-07 12:07:33 +0530424 \ Delete IP And Object ${loc_valid_ip} @{ip_uri_list}
George Keishing44bc84d2018-04-12 00:51:04 -0500425 \ Sleep 10s
manasarm88f00062018-03-07 12:07:33 +0530426
Steven Sombarfac31e92017-12-15 09:40:34 -0600427Test Setup Execution
Prashanth Kattie79c5402017-06-08 07:40:49 -0500428 [Documentation] Network setup.
429 Open Connection And Login
430
431 @{IPv4_URI_List}= Get IPv4 URI List
432 Set Test Variable @{IPv4_URI_List}
433
434 # Get BMC IP address and prefix length.
435 ${ip_data}= Get BMC IP Info
436 Set Test Variable ${ip_data}
437
438Get IPv4 URI List
439 [Documentation] Get all IPv4 URIs.
440
441 # Sample output:
442 # "data": [
443 # "/xyz/openbmc_project/network/eth0/ipv4/e9767624",
444 # "/xyz/openbmc_project/network/eth0/ipv4/31f4ce8b"
445 # ],
446
manasarm104cc6b2018-02-07 12:35:05 +0530447 @{ipv4_uri_list}= Read Properties ${NETWORK_MANAGER}/eth0/ipv4/
Prashanth Kattie79c5402017-06-08 07:40:49 -0500448 Should Not Be Empty ${ipv4_uri_list} msg=IPv4 URI list is empty.
449
450 [Return] @{ipv4_uri_list}
451
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500452Validate IP On BMC
Prashanth Kattie79c5402017-06-08 07:40:49 -0500453 [Documentation] Validate IP on BMC.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500454 [Arguments] ${ip_address} ${ip_info}=${ip_data}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500455
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500456 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500457 # ip_address IP address of the system.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500458 # ip_info List of IP address and prefix length values.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500459
Prashanth Kattie8a74532017-11-07 06:45:07 -0600460 Should Contain Match ${ip_info} ${ip_address}/*
Prashanth Kattie79c5402017-06-08 07:40:49 -0500461 ... msg=IP address does not exist.
462
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500463Verify IP Address Via REST And Delete
464 [Documentation] Verify IP address via REST and delete.
465 [Arguments] ${ip_addr}
466
467 # Description of argument(s):
468 # ip_addr IP address to be verified.
469
470 @{ip_uri_list}= Get IPv4 URI List
471 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
472
473 List Should Contain Value ${ip_list} ${ip_addr}
474 ... msg=IP address is not configured.
475
476 # If IP address is configured, delete it.
477 Delete IP And Object ${ip_addr} @{ip_uri_list}
478
Prashanth Kattie79c5402017-06-08 07:40:49 -0500479Validate Prefix Length On BMC
480 [Documentation] Validate prefix length on BMC.
481 [Arguments] ${prefix_length}
482
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500483 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500484 # prefix_length It indicates netmask, netmask value 255.255.255.0
485 # is equal to prefix length 24.
486 # ip_data Suite variable which has list of IP address and
487 # prefix length values.
488
489 Should Contain Match ${ip_data} */${prefix_length}
490 ... msg=Prefix length does not exist.
491
492Validate Route On BMC
493 [Documentation] Validate route.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500494 [Arguments] ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500495
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500496 # Description of argument(s):
497 # gateway_ip Gateway IP address.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500498
499 ${route_info}= Get BMC Route Info
Prashanth Kattie8a74532017-11-07 06:45:07 -0600500
501 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
502
503 Run Keyword If '${gateway_ip}' == '0.0.0.0'
504 ... Pass Execution Gatway IP is "0.0.0.0".
505 ... ELSE
506 ... Should Contain ${route_info} ${gateway_ip}
507 ... msg=Gateway IP address not matching.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500508
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500509
510Configure Network Settings
511 [Documentation] Configure network settings.
512 [Arguments] ${ip_addr} ${prefix_len} ${gateway_ip} ${expected_result}
513
514 # Description of argument(s):
515 # ip_addr IP address of BMC.
516 # prefix_len Prefix length.
517 # gateway_ip Gateway IP address.
518 # expected_result Expected status of network setting configuration.
519
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500520 @{ip_parm_list}= Create List xyz.openbmc_project.Network.IP.Protocol.IPv4
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500521 ... ${ip_addr} ${prefix_len} ${gateway_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500522
523 ${data}= Create Dictionary data=@{ip_parm_list}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500524
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500525 Run Keyword And Ignore Error OpenBMC Post Request
manasarm104cc6b2018-02-07 12:35:05 +0530526 ... ${NETWORK_MANAGER}/eth0/action/IP data=${data}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500527
528 # After any modification on network interface, BMC restarts network
Prashanth Katti549c63a2018-07-17 06:13:37 -0500529 # module, wait until it is reachable. Then wait 15 seconds for new
530 # configuration to be updated on BMC.
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500531
Prashanth Katti549c63a2018-07-17 06:13:37 -0500532 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
533 ... ${NETWORK_RETRY_TIME}
534 Sleep 15s
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500535
536 # Verify whether new IP address is populated on BMC system.
537 # It should not allow to configure invalid settings.
538
539 ${ip_data}= Get BMC IP Info
540 ${status}= Run Keyword And Return Status
541 ... Validate IP On BMC ${ip_addr} ${ip_data}
542
543 Run Keyword If '${expected_result}' == 'error'
544 ... Should Be Equal ${status} ${False}
545 ... msg=Allowing the configuration of an invalid IP.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500546 ... ELSE
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500547 ... Should Be Equal ${status} ${True}
548 ... msg=Not allowing the configuration of a valid IP.
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500549
550Validate Hostname On BMC
551 [Documentation] Verify that the hostname read via REST is the same as the
552 ... hostname configured on system.
553 [Arguments] ${hostname}
554
555 # Description of argument(s):
556 # hostname A hostname value which is to be compared to the hostname
557 # configured on system.
558
559 ${sys_hostname}= Get BMC Hostname
560
561 Should Contain ${sys_hostname} ${hostname}
562 ... ignore_case=True msg=Hostname does not exist.
George Keishingbf58f012018-04-12 00:21:08 -0500563
564Test Teardown Execution
565 [Documentation] Do the post test teardown.
566
567 FFDC On Test Case Fail
568 Close All Connections