Skip to content

Commit 5f7d2e4

Browse files
prkatti1Anvesh-Kumar-Rayankula
authored andcommitted
IPv6 address changes
Changes: - Added "Modify IPv6 Address And Verify" - Added "Modify IPv6 Address" keyword Tested: - Ran successfully test_bmc_ipv6.robot Change-Id: I513203559a2170f8bb89aeadb623c5b7ee60c926 Signed-off-by: Prashanth Katti <[email protected]>
1 parent aaf7d1c commit 5f7d2e4

File tree

1 file changed

+117
-1
lines changed

1 file changed

+117
-1
lines changed

redfish/managers/test_bmc_ipv6.robot

+117-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Test Tags BMC_IPv6
1717
*** Variables ***
1818
${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888
1919
${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
20+
${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999
2021

2122
# Valid prefix length is a integer ranges from 1 to 128.
2223
${test_prefix_length} 64
@@ -80,6 +81,16 @@ Delete IPv6 Address And Verify
8081
Delete IPv6 Address ${test_ipv6_addr}
8182

8283

84+
85+
Modify IPv6 Address And verify
86+
[Documentation] Modify IPv6 address and verify.
87+
[Tags] Modify_IPv6_Address_And_Verify
88+
89+
Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
90+
91+
Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length}
92+
93+
8394
*** Keywords ***
8495

8596
Suite Setup Execution
@@ -275,7 +286,7 @@ Configure IPv6 Address On BMC
275286
Validate IPv6 Network Config On BMC
276287
[Documentation] Check that IPv6 network info obtained via redfish matches info
277288
... obtained via CLI.
278-
@{network_configurations}= Get IPv6 Network Configuration
289+
@{ipv6_network_configurations}= Get IPv6 Network Configuration
279290
${ipv6_data}= Get BMC IPv6 Info
280291
FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
281292
Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/*
@@ -331,3 +342,108 @@ Delete IPv6 Address
331342
END
332343

333344
Validate IPv6 Network Config On BMC
345+
346+
347+
Modify IPv6 Address
348+
[Documentation] Modify and verify IPv6 address of BMC.
349+
[Arguments] ${ipv6} ${new_ipv6} ${prefix_len}
350+
... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
351+
352+
# Description of argument(s):
353+
# ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
354+
# new_ipv6 New IPv6 address to be configured.
355+
# prefix_len Prefix length value (Range 1 to 128).
356+
# valid_status_codes Expected return code from patch operation
357+
# (e.g. "200", "201").
358+
359+
${empty_dict}= Create Dictionary
360+
${patch_list}= Create List
361+
${prefix_length}= Convert To Integer ${prefix_len}
362+
${ipv6_data}= Create Dictionary
363+
... Address=${new_ipv6} PrefixLength=${prefix_length}
364+
365+
# Sample IPv6 network configurations:
366+
# "IPv6AddressPolicyTable": [],
367+
# "IPv6Addresses": [
368+
# {
369+
# "Address": "X002:db8:0:2::XX0",
370+
# "AddressOrigin": "DHCPv6",
371+
# "PrefixLength": 128
372+
# },
373+
# {
374+
# "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX",
375+
# "AddressOrigin": "SLAAC",
376+
# "PrefixLength": 64
377+
# },
378+
# {
379+
# "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
380+
# "AddressOrigin": "Static",
381+
# "PrefixLength": 56
382+
# },
383+
# {
384+
# "Address": “Z002:db8:0:2:a94:efff:fe82:5000",
385+
# "AddressOrigin": "Static",
386+
# "PrefixLength": 56
387+
# },
388+
# {
389+
# "Address": “Xe80::a94:efff:YYYY:XXXX",
390+
# "AddressOrigin": "LinkLocal",
391+
# "PrefixLength": 64
392+
# },
393+
# {
394+
# "Address": “X002:db8:1:2:eff:233:fee:546",
395+
# "AddressOrigin": "Static",
396+
# "PrefixLength": 56
397+
# }
398+
# ],
399+
# "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”,
400+
# "IPv6StaticAddresses": [
401+
# {
402+
# "Address": “X002:db8:0:2:a94:efff:fe82:5000",
403+
# "PrefixLength": 56
404+
# },
405+
# {
406+
# "Address": “Y002:db8:0:2:a94:efff:fe82:5000",
407+
# "PrefixLength": 56
408+
# },
409+
# {
410+
# "Address": “Z002:db8:1:2:eff:233:fee:546",
411+
# "PrefixLength": 56
412+
# }
413+
# ],
414+
# "IPv6StaticDefaultGateways": [],
415+
416+
# Find the position of IPv6 address to be modified.
417+
@{ipv6_network_configurations}= Get IPv6 Network Configuration
418+
FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
419+
Run Keyword If '${ipv6_network_configuration['Address']}' == '${ipv6}'
420+
... Append To List ${patch_list} ${ipv6_data}
421+
... ELSE Append To List ${patch_list} ${empty_dict}
422+
END
423+
424+
# Modify the IPv6 address only if given IPv6 is found
425+
${ip_found}= Run Keyword And Return Status List Should Contain Value
426+
... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC
427+
Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC
428+
429+
${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
430+
431+
${active_channel_config}= Get Active Channel Config
432+
${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
433+
434+
Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
435+
... body=&{data} valid_status_codes=${valid_status_codes}
436+
437+
# Note: Network restart takes around 15-18s after patch request processing.
438+
Sleep ${NETWORK_TIMEOUT}s
439+
Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
440+
441+
# Verify if new IPv6 address is configured on BMC.
442+
Verify IPv6 On BMC ${new_ipv6}
443+
444+
# Verify if old IPv6 address is erased.
445+
${cmd_status}= Run Keyword And Return Status
446+
... Verify IPv6 On BMC ${ipv6}
447+
Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted.
448+
449+
Validate IPv6 Network Config On BMC

0 commit comments

Comments
 (0)