Verify co-existence of linklocal and static IPv6 Addresses

    Changes:
        Verify co-existence of linklocal and static IPv6 Addresses.

    Tested:
        Ran and Tested on BMC Environment.

Change-Id: I81be98242a9a9fe6de26e0609054b81b8c8cd5cc
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 0aaa58b..22a3a5a 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -8,6 +8,7 @@
 Resource       ../../lib/external_intf/vmi_utils.robot
 Library        ../../lib/bmc_network_utils.py
 Library        Collections
+Library        Process
 
 Test Setup     Test Setup Execution
 Test Teardown  Test Teardown Execution
@@ -25,6 +26,7 @@
 ${ipv6_gw_addr}              2002:903:15F:32:9:3:32:1
 ${prefix_length_def}         None
 ${invalid_staticv6_gateway}  9.41.164.1
+${linklocal_addr_format}     fe80::[0-9a-f:]+$
 
 *** Test Cases ***
 
@@ -86,7 +88,6 @@
     Delete IPv6 Address  ${test_ipv6_addr}
 
 
-
 Modify IPv6 Address And Verify
     [Documentation]  Modify IPv6 address and verify.
     [Tags]  Modify_IPv6_Address_And_Verify
@@ -168,6 +169,15 @@
     Delete IPv6 Static Default Gateway  ${ipv6_gw_addr}
 
 
+Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC
+    [Documentation]  Verify linklocalv6 And static IPv6 both exist.
+    [Tags]  Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC
+    [Setup]  Configure IPv6 Address On BMC  ${IP_ADDR_TEST}  ${test_prefix_length}
+    [Teardown]  Delete IPv6 Address  ${IP_ADDR_TEST}
+
+    Check Coexistence Of Linklocalv6 And Static IPv6
+
+
 *** Keywords ***
 
 Suite Setup Execution
@@ -735,3 +745,28 @@
     @{ipv6_static_defgw_configurations}=  Get IPv6 Static Default Gateway
     Should Not Contain Match  ${ipv6_static_defgw_configurations}  ${ipv6_gw_addr}
     ...  msg=IPv6 Static default gateway does not exist.
+
+
+Check Coexistence Of Linklocalv6 And Static IPv6
+    [Documentation]  Verify both linklocalv6 and static IPv6 exist.
+
+    ${active_channel_config}=  Get Active Channel Config
+    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+    # Verify the address origin contains static and linklocal.
+    @{ipv6_addresses}=  Get From Dictionary  ${resp.dict}  IPv6Addresses
+    ${ipv6_linklocal_addr}=  Set Variable  ${None}
+    ${ipv6_static_addr}=  Set Variable  ${None}
+    ${ipv6_addressorigin_list}=  Create List
+
+    FOR  ${ipv6_address}  IN  @{ipv6_addresses}
+        ${ipv6_addressorigin}=  Get From Dictionary  ${ipv6_address}  AddressOrigin
+        IF  '${ipv6_addressorigin}' == 'LinkLocal'
+            Set Test Variable  ${ipv6_linklocal_addr}  ${ipv6_address['Address']}
+        END
+        Append To List  ${ipv6_addressorigin_list}  ${ipv6_addressorigin}
+    END
+
+    Should Match Regexp  ${ipv6_linklocal_addr}        ${linklocal_addr_format}
+    Should Contain       ${ipv6_addressorigin_list}    LinkLocal
+    Should Contain       ${ipv6_addressorigin_list}    Static