Configure or Modify Static Default Gateway And Verify
Changes:
- Added keyword - Configure or Modify Static Default Gateway.
- Added test case - Modify Static Default Gateway And Verify.
Tested:
Ran and tested on BMC Environment.
Change-Id: I84e24dfa051b0af83a0a81bd046a0230fb79bbbd
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/redfish/managers/test_bmc_ipv6.robot b/redfish/managers/test_bmc_ipv6.robot
index 77daa92..ba8f1a0 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -125,12 +125,14 @@
Set And Verify DHCPv6 Property Enabled
+
Disable DHCPv6 Property On BMC And Verify
[Documentation] Disable DHCPv6 property on BMC and verify.
[Tags] Disable_DHCPv6_Property_On_BMC_And_Verify
Set And Verify DHCPv6 Property Disabled
+
Configure Invalid Static IPv6 And Verify
[Documentation] Configure invalid static IPv6 and verify.
[Tags] Configure_Invalid_Static_IPv6_And_Verify
@@ -150,6 +152,14 @@
${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST}
+Modify Static Default Gateway And Verify
+ [Documentation] Modify static default gateway and verify.
+ [Tags] Modify_Static_Default_Gateway_And_Verify
+ [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def}
+
+ Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr}
+
+
*** Keywords ***
Suite Setup Execution
@@ -555,11 +565,19 @@
Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}'
+Get IPv6 Static Default Gateway
+ [Documentation] Get IPv6 static default gateway.
+
+ ${active_channel_config}= Get Active Channel Config
+ ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+ @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
+ RETURN @{ipv6_static_defgw_configurations}
+
Configure IPv6 Static Default Gateway On BMC
[Documentation] Configure IPv6 static default gateway on BMC.
[Arguments] ${ipv6_gw_addr} ${prefix_length_def}
... ${valid_status_codes}=${HTTP_OK}
-
# Description of argument(s):
# ipv6_gw_addr IPv6 Static Default Gateway address to be configured.
# prefix_len_def Prefix length value (Range 1 to 128).
@@ -609,12 +627,56 @@
Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
END
+Modify Static Default Gateway
+ [Documentation] Modify and verify IPv6 address of BMC.
+ [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length}
+ ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}]
-Get IPv6 Static Default Gateway
- [Documentation] Get IPv6 static default gateway.
+ # Description of argument(s):
+ # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF").
+ # new_static_def_gw New static default gateway address to be configured.
+ # prefix length Prefix length value (Range 1 to 128).
+ # valid_status_codes Expected return code from patch operation
+ # (e.g. "200", "204").
- ${active_channel_config}= Get Active Channel Config
- ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
+ ${empty_dict}= Create Dictionary
+ ${patch_list}= Create List
+ # Prefix Length is passed as None.
+ IF '${prefix_length_def}' == '${None}'
+ ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw}
+ ELSE
+ ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def}
+ END
- @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways
- RETURN @{ipv6_static_defgw_configurations}
+ @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway
+
+ FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list}
+ IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}'
+ Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data}
+ ELSE
+ Append To List ${patch_list} ${empty_dict}
+ END
+ END
+
+ # Modify the IPv6 address only if given IPv6 static default gateway is found.
+ ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value
+ ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC
+ Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC
+
+ ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list}
+
+ Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
+ ... body=&{data} valid_status_codes=${valid_status_codes}
+
+ ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway
+
+ ${ipv6_static_def_gw_list}= Create List
+ FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway}
+ ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address
+ Append To List ${ipv6_static_def_gw_list} ${value}
+ END
+
+ Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw}
+ # Verify if old static default gateway address is erased.
+ Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr}
+