blob: 237ae3bd64979d447c88404c2bb3b41fa2088938 [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
4Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
6Resource ../lib/bmc_network_utils.robot
7
8Force Tags Network_Test
9
10Library String
11Library SSHLibrary
12
Steven Sombarfac31e92017-12-15 09:40:34 -060013Test Setup Test Setup Execution
Prashanth Kattia994bc32017-10-18 06:16:31 -050014Test Teardown Close All Connections
Prashanth Kattie79c5402017-06-08 07:40:49 -050015
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050016*** Variables ***
17
18${alpha_ip} xx.xx.xx.xx
19
20# 10.x.x.x series is a private IP address range and does not exist in
21# our network, so this is chosen to avoid IP conflict.
22
23${valid_ip} 10.6.6.6
24${valid_gateway} 10.6.6.1
Prashanth Katti90f9ff22017-08-11 06:17:12 -050025${valid_prefix_len} ${24}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050026${broadcast_ip} 10.6.6.255
27${loopback_ip} 127.0.0.1
28${multicast_ip} 224.6.6.255
29${out_of_range_ip} 10.6.6.256
30
31# There will be 4 octets in IP address (e.g. xx.xx.xx.xx)
32# but trying to configure xx.xx.xx
33
34${less_octet_ip} 10.3.36
35
36# For the address 10.6.6.6, the 10.6.6.0 portion describes the
37# network ID and the 6 describe the host.
38
39${network_id} 10.6.6.0
40${hex_ip} 0xa.0xb.0xc.0xd
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050041${negative_ip} 10.-6.-6.6
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050042
Prashanth Kattie79c5402017-06-08 07:40:49 -050043*** Test Cases ***
44
45Get BMC IPv4 Address And Verify
46 [Documentation] Get BMC IPv4 address and verify.
47 [Tags] Get_BMC_IPv4_Address_And_Verify
48
49 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
50 \ ${ipv4_addr}= Read Attribute ${ipv4_uri} Address
51 \ Validate IP on BMC ${ipv4_addr}
52
53Verify IPv4 Prefix Length
54 [Documentation] Get prefix length and verify.
55 [Tags] Verify_IPv4_Prefix_Length
56
57 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
58 \ ${prefix_length}= Read Attribute ${ipv4_uri} PrefixLength
59 \ Validate Prefix Length On BMC ${prefix_length}
60
61Verify Gateway Address
62 [Documentation] Get gateway address and verify.
63 [Tags] Verify_Gateway_Address
64
65 :FOR ${ipv4_uri} IN @{IPv4_URI_List}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050066 \ ${gateway_ip}= Read Attribute ${ipv4_uri} Gateway
67 \ Validate Route On BMC ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -050068
69Verify MAC Address
70 [Documentation] Get MAC address and verify.
71 [Tags] Verify_MAC_Address
manasarm104cc6b2018-02-07 12:35:05 +053072 ${macaddr}= Read Attribute ${NETWORK_MANAGER}/eth0 MACAddress
Prashanth Kattie79c5402017-06-08 07:40:49 -050073 Validate MAC On BMC ${macaddr}
74
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050075Add New Valid IP And Verify
76 [Documentation] Add new IP address and verify.
77 [Tags] Add_New_Valid_IP_And_Verify
78
79 Configure Network Settings ${valid_ip} ${valid_prefix_len}
80 ... ${valid_gateway} valid
81
Prashanth Katti90f9ff22017-08-11 06:17:12 -050082 # Verify whether new IP object is created for the given IP via REST.
83 # Delete IP address and IP object after verification.
84 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050085
86Configure Invalid IP String
87 # IP Address Prefix_length Gateway_IP Expected_Result
88 ${alpha_ip} ${valid_prefix_len} ${valid_gateway} error
89
90 [Documentation] Configure invalid IP address which is a string.
91 [Tags] Configure_Invalid_IP_String
92
Prashanth Katti40fb8ca2017-07-25 06:47:23 -050093 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -050094
95Configure Out Of Range IP
96 # IP Address Prefix_length Gateway_IP Expected_Result
97 ${out_of_range_ip} ${valid_prefix_len} ${valid_gateway} error
98
Prashanth Katti388bdc72017-07-19 08:54:58 -050099 [Documentation] Configure out-of-range IP address.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500100 [Tags] Configure_Out_Of_Range_IP
101
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500102 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500103
104Configure Broadcast IP
105 # IP Address Prefix_length Gateway_IP Expected_Result
106 ${broadcast_ip} ${valid_prefix_len} ${valid_gateway} error
107
108 [Documentation] Configure broadcast IP address.
109 [Tags] Configure_Broadcast_IP
110
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500111 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500112
113Configure Multicast IP
114 # IP Address Prefix_length Gateway_IP Expected_Result
115 ${multicast_ip} ${valid_prefix_len} ${valid_gateway} error
116
117 [Documentation] Configure multicast IP address.
118 [Tags] Configure_Multicast_IP
119
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500120 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500121
122Configure Loopback IP
123 # IP Address Prefix_length Gateway_IP Expected_Result
124 ${loopback_ip} ${valid_prefix_len} ${valid_gateway} error
125
126 [Documentation] Configure loopback IP address.
127 [Tags] Configure_Loopback_IP
128
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500129 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500130
131Configure Network ID
132 # IP Address Prefix_length Gateway_IP Expected_Result
133 ${network_id} ${valid_prefix_len} ${valid_gateway} error
134
135 [Documentation] Configure network ID IP address.
136 [Tags] Configure_Network_ID
137
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500138 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500139
140Configure Less Octet IP
141 # IP Address Prefix_length Gateway_IP Expected_Result
142 ${less_octet_ip} ${valid_prefix_len} ${valid_gateway} error
143
144 [Documentation] Configure less octet IP address.
145 [Tags] Configure_Less_Octet_IP
146
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500147 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500148
149Configure Empty IP
150 # IP Address Prefix_length Gateway_IP Expected_Result
151 ${EMPTY} ${valid_prefix_len} ${valid_gateway} error
152
153 [Documentation] Configure less octet IP address.
154 [Tags] Configure_Empty_IP
155
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500156 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500157
158Configure Special Char IP
159 # IP Address Prefix_length Gateway_IP Expected_Result
160 @@@.%%.44.11 ${valid_prefix_len} ${valid_gateway} error
161
162 [Documentation] Configure invalid IP address contaning special chars.
163 [Tags] Configure_Special_Char_IP
164
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500165 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500166
167Configure Hexadecimal IP
168 # IP Address Prefix_length Gateway_IP Expected_Result
169 ${hex_ip} ${valid_prefix_len} ${valid_gateway} error
170
171 [Documentation] Configure invalid IP address contaning hex value.
172 [Tags] Configure_Hexadecimal_IP
173
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500174 [Template] Configure Network Settings
175
176Configure Negative Octet IP
177 # IP Address Prefix_length Gateway_IP Expected_Result
178 ${negative_ip} ${valid_prefix_len} ${valid_gateway} error
179
180 [Documentation] Configure invalid IP address containing negative octet.
181 [Tags] Configure_Negative_Octet_IP
182
183 [Template] Configure Network Settings
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500184
Prashanth Katti388bdc72017-07-19 08:54:58 -0500185Add New Valid IP With Blank Gateway
186 [Documentation] Add new IP with blank gateway.
187 [Tags] Add_New_Valid_IP_With_Blank_Gateway
188
189 Configure Network Settings ${valid_ip} ${valid_prefix_len} ${EMPTY}
190 ... valid
191
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500192 # Verify whether new IP object is created for the given IP via REST.
193 # Delete IP address and IP object after verification.
194 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500195
196Configure Invalid Gateway String
197 # IP Address Prefix_length Gateway_IP Expected_Result
198 ${valid_ip} ${valid_prefix_len} ${alpha_ip} error
199
200 [Documentation] Configure invalid IP address to a gateway which is
201 ... an alpha string and expect an error.
202 [Tags] Configure_Invalid_Gateway_String
203
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500204 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500205
206Configure Out Of Range IP For Gateway
207 # IP Address Prefix_length Gateway_IP Expected_Result
208 ${valid_ip} ${valid_prefix_len} ${out_of_range_ip} error
209
210 [Documentation] Configure out-of-range IP for gateway and expect an error.
211 [Tags] Configure_Out_Of_Range_IP_For_Gateway
212
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500213 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500214
215Configure Broadcast IP For Gateway
216 # IP Address Prefix_length Gateway_IP Expected_Result
217 ${valid_ip} ${valid_prefix_len} ${broadcast_ip} error
218
219 [Documentation] Configure broadcast IP for gateway and expect an error.
220 [Tags] Configure_Broadcast_IP_For_Gateway
221
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500222 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500223
224Configure Loopback IP For Gateway
225 # IP Address Prefix_length Gateway_IP Expected_Result
226 ${valid_ip} ${valid_prefix_len} ${loopback_ip} error
227
228 [Documentation] Configure loopback IP for gateway and expect an error.
229 [Tags] Configure_Loopback_IP_For_Gateway
230
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500231 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500232
233Configure Multicast IP For Gateway
234 # IP Address Prefix_length Gateway_IP Expected_Result
235 ${valid_ip} ${valid_prefix_len} ${multicast_ip} error
236
237 [Documentation] Configure multicast IP for gateway and expect an error.
238 [Tags] Configure_Multicast_IP_For_Gateway
239
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500240 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500241
242Configure Network ID For Gateway
243 # IP Address Prefix_length Gateway_IP Expected_Result
244 ${valid_ip} ${valid_prefix_len} ${network_id} error
245
246 [Documentation] Configure network ID for gateway and expect an error.
247 [Tags] Configure_Network_ID_For_Gateway
248
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500249 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500250
251Configure Less Octet IP For Gateway
252 # IP Address Prefix_length Gateway_IP Expected_Result
253 ${valid_ip} ${valid_prefix_len} ${less_octet_ip} error
254
255 [Documentation] Configure less octet IP for gateway and expect an error.
256 [Tags] Configure_Less_Octet_IP_For_Gateway
257
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500258 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500259
260Configure Special Char IP For Gateway
261 # IP Address Prefix_length Gateway_IP Expected_Result
262 ${valid_ip} ${valid_prefix_len} @@@.%%.44.11 error
263
264 [Documentation] Configure special char IP for gateway and expect an error.
265 [Tags] Configure_Special_Char_IP_For_Gateway
266
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500267 [Template] Configure Network Settings
Prashanth Katti388bdc72017-07-19 08:54:58 -0500268
269Configure Hexadecimal IP For Gateway
270 # IP Address Prefix_length Gateway_IP Expected_Result
271 ${valid_ip} ${valid_prefix_len} ${hex_ip} error
272
273 [Documentation] Configure hexadecimal IP for gateway and expect an error.
274 [Tags] Configure_Hexadecimal_IP_For_Gateway
275
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500276 [Template] Configure Network Settings
277
278Configure Out Of Range Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500279 # IP Address Prefix_length Gateway_IP Expected_Result
280 ${valid_ip} 33 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500281
282 [Documentation] Configure out-of-range prefix length and expect an error.
283 [Tags] Configure_Out_Of_Range_Prefix_Length
284
285 [Template] Configure Network Settings
286
287Configure Negative Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500288 # IP Address Prefix_length Gateway_IP Expected_Result
289 ${valid_ip} -10 ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500290
291 [Documentation] Configure negative prefix length and expect an error.
292 [Tags] Configure_Negative_Value_For_Prefix_Length
293
294 [Template] Configure Network Settings
295
296Configure Non Numeric Value For Prefix Length
Prashanth Kattia994bc32017-10-18 06:16:31 -0500297 # IP Address Prefix_length Gateway_IP Expected_Result
298 ${valid_ip} xx ${valid_gateway} error
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500299
300 [Documentation] Configure non numeric value prefix length and expect
301 ... an error.
302 [Tags] Configure_String_Value_For_Prefix_Length
303
304 [Template] Configure Network Settings
305
306Add Fourth Octet Threshold IP And Verify
307 [Documentation] Add fourth octet threshold IP and verify.
308 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify
309
310 Configure Network Settings 10.6.6.254 ${valid_prefix_len}
311 ... ${valid_gateway} valid
312
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500313 # Verify whether new IP object is created for the given IP via REST.
314 # Delete IP address and IP object after verification.
315
316 Verify IP Address Via REST And Delete 10.6.6.254
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500317
318Add Third Octet Threshold IP And Verify
319 [Documentation] Add third octet threshold IP and verify.
320 [Tags] Add_Third_Octet_Threshold_IP_And_Verify
321
322 Configure Network Settings 10.6.255.6 ${valid_prefix_len}
323 ... ${valid_gateway} valid
324
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500325 # Verify whether new IP object is created for the given IP via REST.
326 # Delete IP address and IP object after verification.
327
328 Verify IP Address Via REST And Delete 10.6.255.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500329
330Add Second Octet Threshold IP And Verify
331 [Documentation] Add second octet threshold IP and verify.
332 [Tags] Add_Second_Octet_Threshold_IP_And_Verify
333
334 Configure Network Settings 10.255.6.6 ${valid_prefix_len}
335 ... ${valid_gateway} valid
336
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500337 # Verify whether new IP object is created for the given IP via REST.
338 # Delete IP address and IP object after verification.
339
340 Verify IP Address Via REST And Delete 10.255.6.6
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500341
342Add First Octet Threshold IP And Verify
343 [Documentation] Add first octet threshold IP and verify.
344 [Tags] Add_First_Octet_Threshold_IP_And_Verify
345
346 Configure Network Settings 223.6.6.6 ${valid_prefix_len}
347 ... ${valid_gateway} valid
348
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500349 # Verify whether new IP object is created for the given IP via REST.
350 # Delete IP address and IP object after verification.
351
352 Verify IP Address Via REST And Delete 223.6.6.6
353
354Configure Lowest Prefix Length
355 [Documentation] Configure lowest prefix length.
356 [Tags] Configure_Lowest_Prefix_Length
357
Prashanth Katti3690dc02017-11-22 07:21:24 -0600358 Configure Network Settings ${valid_ip} ${1}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500359 ... ${valid_gateway} valid
360
361 # Verify whether new IP object is created for the given IP via REST.
362 # Delete IP address and IP object after verification.
363 Verify IP Address Via REST And Delete ${valid_ip}
364
365Configure Threshold Prefix Length
366 [Documentation] Configure threshold prefix length.
367 [Tags] Configure_Threshold_Prefix_Length
368
369 Configure Network Settings ${valid_ip} ${32}
370 ... ${valid_gateway} valid
371
372 # Verify whether new IP object is created for the given IP via REST.
373 # Delete IP address and IP object after verification.
374 Verify IP Address Via REST And Delete ${valid_ip}
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500375
376Verify Default Gateway
377 [Documentation] Verify default gateway.
378 [Tags] Verify that the default gateway has a valid route.
379
manasarm104cc6b2018-02-07 12:35:05 +0530380 ${default_gw}= Read Attribute ${NETWORK_MANAGER}/config
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500381 ... DefaultGateway
382 Validate Route On BMC ${default_gw}
383
384Verify Hostname
385 [Documentation] Verify that the hostname read via REST is the same as the
386 ... hostname configured on system.
387 [Tags] Verify_Hostname
388
manasarm104cc6b2018-02-07 12:35:05 +0530389 ${hostname}= Read Attribute ${NETWORK_MANAGER}/config HostName
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500390 Validate Hostname On BMC ${hostname}
Prashanth Katti388bdc72017-07-19 08:54:58 -0500391
Prashanth Kattie79c5402017-06-08 07:40:49 -0500392*** Keywords ***
393
Steven Sombarfac31e92017-12-15 09:40:34 -0600394Test Setup Execution
Prashanth Kattie79c5402017-06-08 07:40:49 -0500395 [Documentation] Network setup.
396 Open Connection And Login
397
398 @{IPv4_URI_List}= Get IPv4 URI List
399 Set Test Variable @{IPv4_URI_List}
400
401 # Get BMC IP address and prefix length.
402 ${ip_data}= Get BMC IP Info
403 Set Test Variable ${ip_data}
404
405Get IPv4 URI List
406 [Documentation] Get all IPv4 URIs.
407
408 # Sample output:
409 # "data": [
410 # "/xyz/openbmc_project/network/eth0/ipv4/e9767624",
411 # "/xyz/openbmc_project/network/eth0/ipv4/31f4ce8b"
412 # ],
413
manasarm104cc6b2018-02-07 12:35:05 +0530414 @{ipv4_uri_list}= Read Properties ${NETWORK_MANAGER}/eth0/ipv4/
Prashanth Kattie79c5402017-06-08 07:40:49 -0500415 Should Not Be Empty ${ipv4_uri_list} msg=IPv4 URI list is empty.
416
417 [Return] @{ipv4_uri_list}
418
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500419Validate IP On BMC
Prashanth Kattie79c5402017-06-08 07:40:49 -0500420 [Documentation] Validate IP on BMC.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500421 [Arguments] ${ip_address} ${ip_info}=${ip_data}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500422
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500423 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500424 # ip_address IP address of the system.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500425 # ip_info List of IP address and prefix length values.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500426
Prashanth Kattie8a74532017-11-07 06:45:07 -0600427 Should Contain Match ${ip_info} ${ip_address}/*
Prashanth Kattie79c5402017-06-08 07:40:49 -0500428 ... msg=IP address does not exist.
429
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500430Verify IP Address Via REST And Delete
431 [Documentation] Verify IP address via REST and delete.
432 [Arguments] ${ip_addr}
433
434 # Description of argument(s):
435 # ip_addr IP address to be verified.
436
437 @{ip_uri_list}= Get IPv4 URI List
438 @{ip_list}= Get List Of IP Address Via REST @{ip_uri_list}
439
440 List Should Contain Value ${ip_list} ${ip_addr}
441 ... msg=IP address is not configured.
442
443 # If IP address is configured, delete it.
444 Delete IP And Object ${ip_addr} @{ip_uri_list}
445
Prashanth Kattie79c5402017-06-08 07:40:49 -0500446Validate Prefix Length On BMC
447 [Documentation] Validate prefix length on BMC.
448 [Arguments] ${prefix_length}
449
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500450 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500451 # prefix_length It indicates netmask, netmask value 255.255.255.0
452 # is equal to prefix length 24.
453 # ip_data Suite variable which has list of IP address and
454 # prefix length values.
455
456 Should Contain Match ${ip_data} */${prefix_length}
457 ... msg=Prefix length does not exist.
458
459Validate Route On BMC
460 [Documentation] Validate route.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500461 [Arguments] ${gateway_ip}
Prashanth Kattie79c5402017-06-08 07:40:49 -0500462
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500463 # Description of argument(s):
464 # gateway_ip Gateway IP address.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500465
466 ${route_info}= Get BMC Route Info
Prashanth Kattie8a74532017-11-07 06:45:07 -0600467
468 # If gateway IP is empty or 0.0.0.0 it will not have route entry.
469
470 Run Keyword If '${gateway_ip}' == '0.0.0.0'
471 ... Pass Execution Gatway IP is "0.0.0.0".
472 ... ELSE
473 ... Should Contain ${route_info} ${gateway_ip}
474 ... msg=Gateway IP address not matching.
Prashanth Kattie79c5402017-06-08 07:40:49 -0500475
476Validate MAC on BMC
477 [Documentation] Validate MAC on BMC.
478 [Arguments] ${macaddr}
479
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500480 # Description of argument(s):
Prashanth Kattie79c5402017-06-08 07:40:49 -0500481 # macaddr MAC address of the BMC.
482
483 ${system_mac}= Get BMC MAC Address
484
485 Should Contain ${system_mac} ${macaddr}
486 ... ignore_case=True msg=MAC address does not exist.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500487
488Configure Network Settings
489 [Documentation] Configure network settings.
490 [Arguments] ${ip_addr} ${prefix_len} ${gateway_ip} ${expected_result}
491
492 # Description of argument(s):
493 # ip_addr IP address of BMC.
494 # prefix_len Prefix length.
495 # gateway_ip Gateway IP address.
496 # expected_result Expected status of network setting configuration.
497
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500498 @{ip_parm_list}= Create List xyz.openbmc_project.Network.IP.Protocol.IPv4
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500499 ... ${ip_addr} ${prefix_len} ${gateway_ip}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500500
501 ${data}= Create Dictionary data=@{ip_parm_list}
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500502
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500503 Run Keyword And Ignore Error OpenBMC Post Request
manasarm104cc6b2018-02-07 12:35:05 +0530504 ... ${NETWORK_MANAGER}/eth0/action/IP data=${data}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500505
506 # After any modification on network interface, BMC restarts network
507 # module, wait until it is reachable.
508
Prashanth Katti3690dc02017-11-22 07:21:24 -0600509 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_RETRY_TIME}
510 ... ${NETWORK_TIMEOUT}
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500511
512 # Verify whether new IP address is populated on BMC system.
513 # It should not allow to configure invalid settings.
514
515 ${ip_data}= Get BMC IP Info
516 ${status}= Run Keyword And Return Status
517 ... Validate IP On BMC ${ip_addr} ${ip_data}
518
519 Run Keyword If '${expected_result}' == 'error'
520 ... Should Be Equal ${status} ${False}
521 ... msg=Allowing the configuration of an invalid IP.
Prashanth Katti4cf87bd2017-06-28 08:56:02 -0500522 ... ELSE
Prashanth Katti90f9ff22017-08-11 06:17:12 -0500523 ... Should Be Equal ${status} ${True}
524 ... msg=Not allowing the configuration of a valid IP.
Prashanth Katti40fb8ca2017-07-25 06:47:23 -0500525
526Validate Hostname On BMC
527 [Documentation] Verify that the hostname read via REST is the same as the
528 ... hostname configured on system.
529 [Arguments] ${hostname}
530
531 # Description of argument(s):
532 # hostname A hostname value which is to be compared to the hostname
533 # configured on system.
534
535 ${sys_hostname}= Get BMC Hostname
536
537 Should Contain ${sys_hostname} ${hostname}
538 ... ignore_case=True msg=Hostname does not exist.