DHCPv6 Enable/ Disable Test Cases

    Changes:
        DHCPv6 enable/ disable test cases

    Tested:
        Ran and Tested on BMC Environment.

Change-Id: I85f034d3ba7fc424de4220f45deabc2d3dcd9a80
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 127b230..10b45bf 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -214,17 +214,6 @@
     Check BMC Gets SLAAC Address
 
 
-Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0
-    [Documentation]  Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0.
-    [Tags]  Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0
-    [Setup]  Get The Initial DHCPv6 Settings
-    [Teardown]  Run Keywords  Set And Verify DHCPv6 Property  ${dhcpv6_channel_1}  ${1}
-    ...  AND  Set And Verify DHCPv6 Property  ${dhcpv6_channel_2}  ${2}
-
-    Set And Verify DHCPv6 Property  Enabled  ${1}
-    Set And Verify DHCPv6 Property  Enabled  ${2}
-
-
 Verify Enable And Disable SLAAC On Both Interfaces
     [Documentation]  Verify enable and disable SLAAC on both the interfaces.
     [Tags]  Verify_Enable_And_Disable_SLAAC_On_Both_Interfaces
@@ -240,6 +229,22 @@
     ${False}           ${False}
 
 
+Configure And Validate DHCPv6 Settings On Both Network Interfaces
+    [Documentation]  Configure and validate the DHCPv6 enable/disable settings
+    ...  on both network interfaces.
+    [Tags]  Configure_And_Validate_DHCPv6_Settings_On_Both_Network_Interfaces
+    [Setup]  Get The Initial DHCPv6 Settings
+    [Template]  Set And Verify DHCPv6 Property On Both Interfaces
+    [Teardown]  Run Keywords  Set And Verify DHCPv6 Property  ${dhcpv6_channel_1}  ${1}  AND
+    ...  Set And Verify DHCPv6 Property  ${dhcpv6_channel_2}  ${2}
+
+    # DHCPv6_eth0      DHCPv6_eth1
+    Enabled            Enabled
+    Enabled            Disabled
+    Disabled           Enabled
+    Disabled           Disabled
+
+
 Verify Autoconfig Is Present On Ethernet Interface
     [Documentation]  Verify autoconfig is present on ethernet interface.
     [Tags]  Verify_Autoconfig_Is_Present_On_Ethernet_Interface
@@ -881,13 +886,27 @@
     # dhcpv6_operating_mode  Enable/ Disable DHCPv6.
     # channel_number         Channel number 1 or 2.
 
-    ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
+    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
 
     ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
     ${dhcpv6_verify}=  Get From Dictionary  ${resp.dict}  DHCPv6
 
     Should Be Equal  '${dhcpv6_verify['OperatingMode']}'  '${dhcpv6_operating_mode}'
 
+    Sleep  30s
+
+    @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
+    ...  Get Address Origin List And IPv4 or IPv6 Address  IPv6Addresses  ${channel_number}
+
+    IF  "${dhcpv6_operating_mode}" == "Enabled"
+        @{ipv6_addressorigin_list}  ${ipv6_dhcpv6_addr}=
+        ...  Get Address Origin List And Address For Type  DHCPv6  ${channel_number}
+        Should Not Be Empty  ${ipv6_dhcpv6_addr}  msg=DHCPv6 must be present.
+    ELSE
+        Should Not Contain  ${ipv6_addressorigin_list}  DHCPv6
+    END
+
+
 
 Get IPv6 Static Default Gateway
     [Documentation]  Get IPv6 static default gateway.
@@ -1300,3 +1319,18 @@
     Verify All The Addresses Are Intact  ${2}
     ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}
 
+
+Set And Verify DHCPv6 Property On Both Interfaces
+    [Documentation]  Set and verify DHCPv6 property on both interfaces.
+    [Arguments]  ${dhcpv6_value_1}  ${dhcpv6_value_2}
+
+    # Description of the argument(s):
+    # dhcpv6_value_1  DHCPv6 value for channel 1.
+    # dhcpv6_value_2  DHCPv6 value for channel 2.
+
+    Set And Verify DHCPv6 Property  ${dhcpv6_value_1}  ${1}
+    Set And Verify DHCPv6 Property  ${dhcpv6_value_2}  ${2}
+
+    Verify All The Addresses Are Intact  ${1}
+    Verify All The Addresses Are Intact  ${2}
+    ...    ${eth1_initial_ipv4_addressorigin_list}  ${eth1_initial_ipv4_addr_list}