Verify has fe80 at the network and EUI64 in the host

    Changes:
        - Added a test case
        check linklocal has fe80 in the network and EUI64 in the host.
        - Added Keyword for
        check linklocal has fe80 in the network and EUI64 in the host.

    Tested:
        Ran and tested on BMC Environment.

Change-Id: I66244e9722c0e14986f3f726d57dacc48323faf6
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 22a3a5a..60cd440 100644
--- a/redfish/managers/test_bmc_ipv6.robot
+++ b/redfish/managers/test_bmc_ipv6.robot
@@ -178,12 +178,21 @@
     Check Coexistence Of Linklocalv6 And Static IPv6
 
 
+Verify IPv6 Linklocal Address Is In Corrrect Format
+    [Documentation]  Verify linklocal address has network part as fe80 and host part as EUI64.
+    [Tags]  Verify_IPv6_Linklocal_Address_Is_In_Correct_Format
+
+    Check If Linklocal Address Is In Correct Format
+
+
 *** Keywords ***
 
 Suite Setup Execution
     [Documentation]  Do suite setup execution.
 
     ${active_channel_config}=  Get Active Channel Config
+    Set Suite Variable  ${active_channel_config}
+
     ${ethernet_interface}=  Set Variable  ${active_channel_config['${CHANNEL_NUMBER}']['name']}
 
     Set Suite variable  ${ethernet_interface}
@@ -770,3 +779,34 @@
     Should Match Regexp  ${ipv6_linklocal_addr}        ${linklocal_addr_format}
     Should Contain       ${ipv6_addressorigin_list}    LinkLocal
     Should Contain       ${ipv6_addressorigin_list}    Static
+
+
+Check If Linklocal Address Is In Correct Format
+    [Documentation]  Linklocal address has network part fe80 and host part EUI64.
+
+    # Fetch the linklocal address.
+    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']}
+
+    @{ipv6_addresses}=  Get From Dictionary  ${resp.dict}  IPv6Addresses
+    ${ipv6_linklocal_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
+    END
+
+    # Follow EUI64 from MAC.
+    ${system_mac}=  Get BMC MAC Address
+    ${split_octets}=  Split String  ${system_mac}  :
+    ${first_octet}=  Evaluate  int('${split_octets[0]}', 16)
+    ${flipped_hex}=  Evaluate  format(${first_octet} ^ 2, '02x')
+    ${grp1}=  Evaluate  re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}')  modules=re
+    ${grp2}=  Evaluate  re.sub(r'^0+', '', '${split_octets[2]}ff')  modules=re
+    ${grp3}=  Evaluate  re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}')  modules=re
+    ${linklocal}=  Set Variable  fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3}
+
+    # Verify the linklocal obtained is the same as on the machine.
+    Should Be Equal  ${linklocal}  ${ipv6_linklocal_addr}
+