summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils/src/main/java
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-10-10 15:37:04 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-10-17 08:16:30 +0000
commit957461dcfd741fc3290e4317c2297c5618b593b5 (patch)
tree81606cfe4aa746bcde2948f80bbf5666cc1f1d30 /vpp-common/vpp-translate-utils/src/main/java
parent74d5f495d67f4e53d88142e9773559b15e0d9807 (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')
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/honeycomb/translate/vpp/util/Ipv4AddressRange.java17
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));
}
}