IPv6 address changes
Changes:
- Added "Delete IPv6 Address And Verify" test case
- Added "Delete IPv6 Address" keyword
Tested:
- Ran successfully test_bmc_ipv6.robot
Change-Id: Id088ab18a62aca0499d60ff5a5df3957990210ea
Signed-off-by: Prashanth Katti <prkatti1@in.ibm.com>
diff --git a/redfish/managers/test_bmc_ipv6.robot b/redfish/managers/test_bmc_ipv6.robot
index 8ab1f92..aa78bf8 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -18,7 +18,7 @@
${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK
# Valid prefix length is a integer ranges from 1 to 128.
-${test_prefix_lenght} 64
+${test_prefix_length} 64
*** Test Cases ***
@@ -70,6 +70,15 @@
${test_ipv6_addr} ${test_prefix_length}
+Delete IPv6 Address And Verify
+ [Documentation] Delete IPv6 address and verify.
+ [Tags] Delete_IPv6_Address_And_Verify
+
+ Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length}
+
+ Delete IPv6 Address ${test_ipv6_addr}
+
+
*** Keywords ***
Suite Setup Execution
@@ -217,9 +226,10 @@
# valid_status_codes Expected return code from patch operation
# (e.g. "200").
+ ${prefix_length}= Convert To Integer ${prefix_len}
${empty_dict}= Create Dictionary
${ipv6_data}= Create Dictionary Address=${ipv6_addr}
- ... PrefixLength=${prefix_len}
+ ... PrefixLength=${prefix_length}
${patch_list}= Create List
@@ -271,3 +281,52 @@
... msg=IPv6 address does not exist.
END
+
+Delete IPv6 Address
+ [Documentation] Delete IPv6 address of BMC.
+ [Arguments] ${ipv6_addr} ${valid_status_codes}=${HTTP_OK}
+
+ # Description of argument(s):
+ # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234").
+ # valid_status_codes Expected return code from patch operation
+ # (e.g. "200"). See prolog of rest_request
+ # method in redfish_plus.py for details.
+
+ ${empty_dict}= Create Dictionary
+ ${patch_list}= Create List
+
+ @{ipv6_network_configurations}= Get IPv6 Network Configuration
+ FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations}
+ IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}'
+ Append To List ${patch_list} ${null}
+ ELSE
+ Append To List ${patch_list} ${empty_dict}
+ END
+ END
+
+ ${ip_found}= Run Keyword And Return Status List Should Contain Value
+ ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC
+ Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC
+
+ # Run patch command only if given IP is found on BMC
+ ${data}= Create Dictionary IPv6StaticAddresses=${patch_list}
+
+ ${active_channel_config}= Get Active Channel Config
+ ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data}
+ ... valid_status_codes=[${valid_status_codes}]
+
+ # Note: Network restart takes around 15-18s after patch request processing
+ Sleep ${NETWORK_TIMEOUT}s
+ Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT}
+
+ # IPv6 address that is deleted should not be there on BMC.
+ ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr}
+ IF '${valid_status_codes}' == '${HTTP_OK}'
+ Should Be True '${delete_status}' == '${False}'
+ ELSE
+ Should Be True '${delete_status}' == '${True}'
+ END
+
+ Validate IPv6 Network Config On BMC