diff options
author | 2017-06-19 12:37:56 +0200 | |
---|---|---|
committer | 2017-06-19 11:48:10 +0000 | |
commit | d9307b4011b14fe9fbb94ceee98f47c327a7919c (patch) | |
tree | 59e8737dfe15be60ad0c1e60083850ac6e331bdd /vpp-common | |
parent | 71b28394e5024ecc87c2a8dc5adbabd812cae740 (diff) |
HC2VPP-168 - Gpe native entries support(operational read)
Change-Id: I50155013874a9e69d926a48a212d402e93945d9b
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'vpp-common')
-rw-r--r-- | vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/AddressTranslator.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/AddressTranslator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/AddressTranslator.java index 170ff43e5..b602dc569 100644 --- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/AddressTranslator.java +++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/AddressTranslator.java @@ -18,6 +18,7 @@ package io.fd.hc2vpp.common.translate.util; import static com.google.common.base.Preconditions.checkNotNull; +import java.util.Arrays; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; @@ -68,4 +69,10 @@ public interface AddressTranslator extends Ipv4Translator, Ipv6Translator, MacTr return new IpAddress(arrayToIpv4AddressNoZone(ip)); } } + + // safest way to compare addresses - prevents returning false while using different types from hierarchy + // Ex. Key for MapResolver contains Ipv4Address as value but we translate addresses from binary data to Ipv4AddressNoZone + default boolean addressesEqual(final IpAddress left, final IpAddress right) { + return Arrays.equals(left.getValue(), right.getValue()); + } } |