diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-10-10 15:37:04 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-10-17 08:16:30 +0000 |
commit | c88886b6e74c69693ac38b5440424577c9a5616e (patch) | |
tree | c65f5fab0317b3f2c6b3703960bcfb531870082c /vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb | |
parent | 0a9d6acb44d91fbbedfe4b481dd58d62c7f58e6b (diff) |
HONEYCOMB-249 Add External IP pool management
Change-Id: I3e57b09733b8c7060445ed1af7a5edb3348dd4e1
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb')
-rw-r--r-- | vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java index 8408e79f4..7528c5464 100644 --- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java +++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java @@ -20,16 +20,22 @@ import java.util.Objects; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * IPv4 address range representation. */ public final class Ipv4AddressRange { + private static final Logger LOG = LoggerFactory.getLogger(Ipv4AddressRange.class); + private final Ipv4AddressNoZone start; private final Ipv4AddressNoZone end; - private Ipv4AddressRange(@Nonnull final Ipv4AddressNoZone start, @Nonnull final Ipv4AddressNoZone end) { + private Ipv4AddressRange( + @Nonnull final Ipv4AddressNoZone start, + @Nonnull final Ipv4AddressNoZone end) { this.start = start; this.end = end; } @@ -71,9 +77,9 @@ public final class Ipv4AddressRange { /** * Create address range from prefix. */ - public static Ipv4AddressRange fromPrefix(final Ipv4Prefix externalIpPool) { - final String addressString = externalIpPool.getValue().split("/")[0]; - byte prefixLength = Ipv4Translator.INSTANCE.extractPrefix(externalIpPool); + public static Ipv4AddressRange fromPrefix(@Nonnull final Ipv4Prefix prefix) { + final String addressString = prefix.getValue().split("/")[0]; + byte prefixLength = Ipv4Translator.INSTANCE.extractPrefix(prefix); if (prefixLength == 32) { // 32 Prefix can be handled instantly @@ -108,7 +114,8 @@ public final class Ipv4AddressRange { prefixAddrBytesF[i] = (byte) 255; } - return new Ipv4AddressRange(Ipv4Translator.INSTANCE.arrayToIpv4AddressNoZoneReversed(prefixAddrBytes0), + return new Ipv4AddressRange( + Ipv4Translator.INSTANCE.arrayToIpv4AddressNoZoneReversed(prefixAddrBytes0), Ipv4Translator.INSTANCE.arrayToIpv4AddressNoZoneReversed(prefixAddrBytesF)); } } |