summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-common/vpp-translate-utils/src/main/java')
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java22
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java16
2 files changed, 17 insertions, 21 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
index c4a4ba38e..664bdc37d 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
@@ -16,20 +16,15 @@
package io.fd.hc2vpp.common.translate.util;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
import com.google.common.net.InetAddresses;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.*;
+
+import javax.annotation.Nonnull;
import java.net.InetAddress;
import java.net.UnknownHostException;
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.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+
+import static com.google.common.base.Preconditions.*;
/**
* Trait providing logic for translation of ipv6-related data
@@ -104,9 +99,7 @@ public interface Ipv6Translator extends ByteDataTranslator {
/**
* Detects whether {@code IpAddress} is ipv6
*/
- default boolean isIpv6(IpAddress address) {
- checkNotNull(address, "Address cannot be null");
-
+ default boolean isIpv6(@Nonnull final IpAddress address) {
checkState(!(address.getIpv4Address() == null && address.getIpv6Address() == null), "Invalid address");
return address.getIpv6Address() != null;
}
@@ -114,8 +107,7 @@ public interface Ipv6Translator extends ByteDataTranslator {
/**
* Detects whether {@code IpPrefix} is ipv6
*/
- default boolean isIpv6(IpPrefix address) {
- checkNotNull(address, "Address cannot be null");
+ default boolean isIpv6(@Nonnull final IpPrefix address) {
checkState(!(address.getIpv4Prefix() == null && address.getIpv6Prefix() == null), "Invalid address");
return address.getIpv6Prefix() != null;
}
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
index db656e721..d55446c82 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/JvppReplyConsumer.java
@@ -16,20 +16,21 @@
package io.fd.hc2vpp.common.translate.util;
-import static com.google.common.base.Preconditions.checkArgument;
-
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.VppBaseCallException;
import io.fd.vpp.jvpp.dto.JVppReply;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import javax.annotation.Nonnegative;
+import javax.annotation.Nonnull;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+import static com.google.common.base.Preconditions.checkArgument;
/**
* Trait providing logic for consuming reply's to jvpp api calls
@@ -38,6 +39,9 @@ public interface JvppReplyConsumer {
int DEFAULT_TIMEOUT_IN_SECONDS = 5;
+ JvppReplyConsumer INSTANCE = new JvppReplyConsumer() {
+ };
+
/**
* Consumes reply for jvpp call representing any write operation
* Should be used in case of calls where it's not clear which write crud operation respective