diff options
Diffstat (limited to 'lisp')
31 files changed, 53 insertions, 52 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContext.java index b21aa2a0f..16131382f 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContext.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContext.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.lisp.context.util; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.util.RWUtils; import java.util.stream.Collector; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactory.java index b9acc6a3e..947d28b67 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactory.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactory.java @@ -19,8 +19,8 @@ package io.fd.hc2vpp.lisp.context.util; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; import io.fd.honeycomb.translate.util.read.BindingBrokerReader; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.eid.mapping.context.rev160801.Contexts; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.eid.mapping.context.rev160801.ContextsBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactoryProvider.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactoryProvider.java index e6794ed38..af29824c5 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactoryProvider.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/ContextsReaderFactoryProvider.java @@ -20,7 +20,7 @@ import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.name.Named; import io.fd.honeycomb.translate.read.ReaderFactory; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataBroker; public class ContextsReaderFactoryProvider implements Provider<ReaderFactory> { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java index c10114036..9f3d91043 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/context/util/EidMappingContext.java @@ -18,7 +18,7 @@ package io.fd.hc2vpp.lisp.context.util; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.lisp.translate.util.EidTranslator; import io.fd.honeycomb.translate.MappingContext; import io.fd.honeycomb.translate.util.RWUtils; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java index a875cfd2f..803d472f6 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/GpeForwardEntryCustomizer.java @@ -18,7 +18,6 @@ package io.fd.hc2vpp.lisp.gpe.translate.read; import static java.lang.String.format; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; @@ -44,6 +43,7 @@ import io.fd.jvpp.core.types.GpeLocator; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; @@ -244,7 +244,7 @@ public class GpeForwardEntryCustomizer extends FutureJVppCustomizer private Stream<Integer> activeVnis(final InstanceIdentifier<GpeEntry> id, final ModificationCache cache) throws ReadFailedException { - final int[] vnis = activeVnisDumpManager.getDump(id, cache).or(() -> { + final int[] vnis = activeVnisDumpManager.getDump(id, cache).orElseGet(() -> { final GpeFwdEntryVnisGetReply reply = new GpeFwdEntryVnisGetReply(); reply.vnis = new int[0]; return reply; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java index 5d06b4c68..70cfa6d38 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathCustomizer.java @@ -170,13 +170,13 @@ public class NativeForwardPathCustomizer extends FutureJVppCustomizer final ModificationCache modificationCache, final DumpCacheManager<GpeNativeFwdRpathsGetReply, Integer> dumpCacheManager) throws ReadFailedException { - return dumpCacheManager.getDump(id, modificationCache, 1).or(DEFAULT_DUMP); + return dumpCacheManager.getDump(id, modificationCache, 1).orElse(DEFAULT_DUMP); } private static GpeNativeFwdRpathsGetReply v6Dump(final @Nonnull InstanceIdentifier<?> id, final ModificationCache modificationCache, final DumpCacheManager<GpeNativeFwdRpathsGetReply, Integer> dumpCacheManager) throws ReadFailedException { - return dumpCacheManager.getDump(id, modificationCache, 0).or(DEFAULT_DUMP); + return dumpCacheManager.getDump(id, modificationCache, 0).orElse(DEFAULT_DUMP); } } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java index 6fb1f4207..d9b7ca69d 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/read/NativeForwardPathsTableCustomizer.java @@ -143,7 +143,7 @@ public class NativeForwardPathsTableCustomizer extends FutureJVppCustomizer impl private Stream<Integer> v4FibsStream(final InstanceIdentifier<NativeForwardPathsTable> id, final ReadContext ctx) throws ReadFailedException { - return dumpCacheManagerV4.getDump(id, ctx.getModificationCache()).or(DEFAULT_REPLY_V4) + return dumpCacheManagerV4.getDump(id, ctx.getModificationCache()).orElse(DEFAULT_REPLY_V4) .ipFibDetails.stream() .map(ipFibDetails -> ipFibDetails.tableId); } @@ -151,7 +151,7 @@ public class NativeForwardPathsTableCustomizer extends FutureJVppCustomizer impl private Stream<Integer> v6FibsStream(final InstanceIdentifier<NativeForwardPathsTable> id, final ReadContext ctx) throws ReadFailedException { - return dumpCacheManagerV6.getDump(id, ctx.getModificationCache()).or(DEFAULT_REPLY_V6) + return dumpCacheManagerV6.getDump(id, ctx.getModificationCache()).orElse(DEFAULT_REPLY_V6) .ip6FibDetails.stream() .map(ip6FibDetails -> ip6FibDetails.tableId); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java index 5415e0fd6..d73abbaee 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/service/GpeStateCheckServiceImpl.java @@ -58,13 +58,13 @@ public final class GpeStateCheckServiceImpl implements GpeStateCheckService, Jvp @Override public void checkGpeEnabledBefore(@Nonnull final WriteContext writeContext) { - checkState(writeContext.readBefore(GPE_FEATURE_CONFIG_ID).or(DISABLED_GPE).isEnable(), + checkState(writeContext.readBefore(GPE_FEATURE_CONFIG_ID).orElse(DISABLED_GPE).isEnable(), "Gpe feature is disabled"); } @Override public void checkGpeEnabledAfter(@Nonnull final WriteContext writeContext) { - checkState(writeContext.readAfter(GPE_FEATURE_CONFIG_ID).or(DISABLED_GPE).isEnable(), + checkState(writeContext.readAfter(GPE_FEATURE_CONFIG_ID).orElse(DISABLED_GPE).isEnable(), "Gpe feature is disabled"); } @@ -73,7 +73,7 @@ public final class GpeStateCheckServiceImpl implements GpeStateCheckService, Jvp try { return byteToBoolean( dumpCacheManager.getDump(GPE_FEATURE_STATE_ID, readContext.getModificationCache()) - .or(DEFAULT_REPLY).gpeStatus); + .orElse(DEFAULT_REPLY).gpeStatus); } catch (ReadFailedException e) { throw new IllegalStateException("Unable to read Gpe feature status", e); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java index 600ae920f..54c54615c 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/AdjacencyCustomizer.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.lisp.context.util.AdjacenciesMappingContext; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/BridgeDomainSubtableCustomizer.java index 95de31a07..9c021f864 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/BridgeDomainSubtableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/BridgeDomainSubtableCustomizer.java @@ -18,7 +18,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.lisp.translate.read.dump.executor.params.SubtableDumpParams; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/InterfaceCustomizer.java index 3db6d8152..40c13d9ad 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/InterfaceCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/InterfaceCustomizer.java @@ -20,7 +20,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.base.Optional; +import java.util.Optional; import com.google.common.collect.ImmutableSet; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.NamingContext; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java index d5f242979..60c569f0a 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/ItrRemoteLocatorSetCustomizer.java @@ -17,7 +17,7 @@ package io.fd.hc2vpp.lisp.translate.read; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.lisp.translate.read.init.LispInitPathsMapper; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizer.java index 8f07eed55..98561dbb3 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizer.java @@ -17,7 +17,6 @@ package io.fd.hc2vpp.lisp.translate.read; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; @@ -33,6 +32,7 @@ import io.fd.jvpp.core.dto.OneLocatorSetDetailsReplyDump; import io.fd.jvpp.core.dto.ShowOneStatus; import io.fd.jvpp.core.dto.ShowOneStatusReply; import io.fd.jvpp.core.future.FutureJVppCore; +import java.util.Optional; import java.util.concurrent.TimeoutException; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.lisp.rev171013.Lisp; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java index f69d027e1..c91818cd6 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocalMappingCustomizer.java @@ -23,7 +23,7 @@ import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDump import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.QuantityType; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.lisp.context.util.EidMappingContext; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocatorSetCustomizer.java index 3b7bf1742..e21683e7c 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocatorSetCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/LocatorSetCustomizer.java @@ -16,7 +16,7 @@ package io.fd.hc2vpp.lisp.translate.read; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.lisp.translate.read.init.LispInitPathsMapper; import io.fd.hc2vpp.lisp.translate.read.trait.LocatorSetReader; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java index 683570e88..416ad16fe 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java @@ -16,7 +16,7 @@ package io.fd.hc2vpp.lisp.translate.read; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.AddressTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.lisp.translate.read.init.LispInitPathsMapper; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapServerCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapServerCustomizer.java index eeac659ea..cb21594c7 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapServerCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapServerCustomizer.java @@ -16,7 +16,7 @@ package io.fd.hc2vpp.lisp.translate.read; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.AddressTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.lisp.translate.service.LispStateCheckService; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java index 7f0240990..2ef291307 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java @@ -22,7 +22,6 @@ import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDump import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.FilterType; import static io.fd.hc2vpp.lisp.translate.read.dump.executor.params.MappingsDumpParams.MappingsDumpParamsBuilder; -import com.google.common.base.Optional; import com.google.common.collect.ImmutableSet; import io.fd.hc2vpp.common.translate.util.AddressTranslator; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; @@ -53,6 +52,7 @@ import io.fd.jvpp.core.dto.OneLocatorDetailsReplyDump; import io.fd.jvpp.core.future.FutureJVppCore; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.lisp.rev171013.MapReplyAction; @@ -248,7 +248,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer reply = locatorsDumpManager.getDump(locatorIfaceIdentifier, cache, new LocatorDumpParamsBuilder().setLocatorSetIndex(details.locatorSetIndex).build()); - bindPositiveMapping(builder, reply.or(new OneLocatorDetailsReplyDump())); + bindPositiveMapping(builder, reply.orElse(new OneLocatorDetailsReplyDump())); } } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VniTableCustomizer.java index 7eb4a3a88..e8cf821e2 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VniTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VniTableCustomizer.java @@ -18,7 +18,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static com.google.common.base.Preconditions.checkState; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.lisp.translate.service.LispStateCheckService; import io.fd.hc2vpp.lisp.translate.util.CheckedLispCustomizer; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VrfSubtableCustomizer.java index ac20f494f..9127343d9 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VrfSubtableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/VrfSubtableCustomizer.java @@ -18,7 +18,7 @@ package io.fd.hc2vpp.lisp.translate.read; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.lisp.translate.read.dump.executor.params.SubtableDumpParams; import io.fd.hc2vpp.lisp.translate.read.init.LispInitPathsMapper; diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImpl.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImpl.java index d6bad6403..6bb5ca56e 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImpl.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImpl.java @@ -55,14 +55,14 @@ public final class LispStateCheckServiceImpl implements LispStateCheckService, J public void checkLispEnabledBefore(@Nonnull final WriteContext ctx) { // no need to dump here, can be read directly from context checkState(ctx.readBefore(InstanceIdentifier.create(Lisp.class)) - .or(STATIC_LISP_INSTANCE).isEnable(), "Lisp feature not enabled"); + .orElse(STATIC_LISP_INSTANCE).isEnable(), "Lisp feature not enabled"); } @Override public void checkLispEnabledAfter(@Nonnull final WriteContext ctx) { // no need to dump here, can be read directly from context checkState(ctx.readAfter(InstanceIdentifier.create(Lisp.class)) - .or(STATIC_LISP_INSTANCE).isEnable(), "Lisp feature not enabled"); + .orElse(STATIC_LISP_INSTANCE).isEnable(), "Lisp feature not enabled"); } @Override @@ -70,7 +70,7 @@ public final class LispStateCheckServiceImpl implements LispStateCheckService, J // in this case it must be dumped try { return byteToBoolean(dumpManager.getDump(IDENTIFIER, ctx.getModificationCache()) - .or(DEFAULT_REPLY).featureStatus); + .orElse(DEFAULT_REPLY).featureStatus); } catch (ReadFailedException e) { throw new IllegalStateException("Unable to read Lisp Feature status", e); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java index 6b21c1871..73bc7eddd 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.nio.charset.StandardCharsets.UTF_8; -import com.google.common.base.Optional; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.common.translate.util.ReferenceCheck; @@ -35,6 +34,7 @@ import io.fd.jvpp.core.future.FutureJVppCore; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.lisp.rev171013.DpSubtableGrouping; @@ -100,7 +100,7 @@ public class LocatorSetCustomizer extends CheckedLispCustomizer if (eidTableData.isPresent()) { // due to non-functional LeafRefValidation, it must be checked like this final List<VniTable> vniTables = - Optional.fromNullable(eidTableData.get().getVniTable()).or(Collections.emptyList()); + Optional.ofNullable(eidTableData.get().getVniTable()).orElse(Collections.emptyList()); checkReferenceExist(id, vrfReferences(vniTables, locatorSetName)); checkReferenceExist(id, bdReferences(vniTables, locatorSetName)); } diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java index 4a135ae01..e9cca91a3 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java @@ -18,7 +18,7 @@ package io.fd.hc2vpp.lisp.translate.write; import static com.google.common.base.Preconditions.checkState; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.lisp.translate.service.LispStateCheckService; import io.fd.hc2vpp.lisp.translate.util.CheckedLispCustomizer; import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/LispModuleTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/LispModuleTest.java index ffaf3206b..b9f0bf837 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/LispModuleTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/LispModuleTest.java @@ -40,7 +40,7 @@ import java.util.Set; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataBroker; public class LispModuleTest { diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContextTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContextTest.java index 61ebcfbe3..4c8cfa262 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContextTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/context/util/AdjacenciesMappingContextTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; +import java.util.Optional; import com.google.common.collect.ImmutableSet; import io.fd.honeycomb.test.tools.HoneycombTestRunner; import io.fd.honeycomb.test.tools.annotations.InjectTestData; diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizerTest.java index 4ac7a241a..b64b862a3 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/read/LispStateCustomizerTest.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; +import java.util.Optional; import com.google.common.collect.ImmutableSet; import io.fd.hc2vpp.common.test.read.InitializingReaderCustomizerTest; import io.fd.hc2vpp.common.test.util.NamingContextHelper; @@ -131,9 +131,9 @@ public class LispStateCustomizerTest extends InitializingReaderCustomizerTest<Li when(mappingContext.read(namingContextId.child(Mappings.class))) .thenReturn(Optional.of(new MappingsBuilder().setMapping(Arrays.asList(loc1Data, loc2Data)).build())); - when(mappingContext.read(loc1Key)).thenReturn(Optional.absent()) + when(mappingContext.read(loc1Key)).thenReturn(Optional.empty()) .thenReturn(Optional.of(loc1Data)).thenReturn(Optional.of(loc1Data)); - when(mappingContext.read(loc2Key)).thenReturn(Optional.absent()) + when(mappingContext.read(loc2Key)).thenReturn(Optional.empty()) .thenReturn(Optional.of(loc2Data)).thenReturn(Optional.of(loc2Data)); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java index 294bd5466..4352c9b06 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/service/LispStateCheckServiceImplTest.java @@ -22,7 +22,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.hc2vpp.common.test.util.FutureProducer; import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.read.ReadContext; @@ -58,7 +58,7 @@ public class LispStateCheckServiceImplTest implements FutureProducer { @Test(expected = IllegalStateException.class) public void testCheckLispEnabledBeforeNoConfig() throws Exception { - when(writeContext.readBefore(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.absent()); + when(writeContext.readBefore(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.empty()); impl.checkLispEnabledBefore(writeContext); } @@ -79,7 +79,7 @@ public class LispStateCheckServiceImplTest implements FutureProducer { @Test(expected = IllegalStateException.class) public void testCheckLispEnabledAfterNoConfig() throws Exception { - when(writeContext.readAfter(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.absent()); + when(writeContext.readAfter(InstanceIdentifier.create(Lisp.class))).thenReturn(Optional.empty()); impl.checkLispEnabledAfter(writeContext); } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java index b8ad46b6f..74b22e41a 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java @@ -26,7 +26,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; @@ -36,6 +35,8 @@ import io.fd.jvpp.core.dto.OneLocatorSetDetails; import io.fd.jvpp.core.dto.OneLocatorSetDetailsReplyDump; import java.nio.charset.StandardCharsets; import java.util.Arrays; +import java.util.NoSuchElementException; +import java.util.Optional; import java.util.concurrent.ExecutionException; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -76,12 +77,12 @@ public class LocatorSetCustomizerTest extends LispWriterCustomizerTest { lispStateCheckService); } - @Test(expected = NullPointerException.class) + @Test(expected = NoSuchElementException.class) public void testWriteCurrentAttributesNullData() throws WriteFailedException { customizer.writeCurrentAttributes(null, null, writeContext); } - @Test(expected = NullPointerException.class) + @Test(expected = NoSuchElementException.class) public void testWriteCurrentAttributesBadData() throws WriteFailedException { customizer.writeCurrentAttributes(null, mock(LocatorSet.class), writeContext); } @@ -138,7 +139,7 @@ public class LocatorSetCustomizerTest extends LispWriterCustomizerTest { @Test public void testDeleteCurrentAttributes() throws InterruptedException, ExecutionException, WriteFailedException { - when(writeContext.readAfter(EID_TABLE_ID)).thenReturn(Optional.absent()); + when(writeContext.readAfter(EID_TABLE_ID)).thenReturn(Optional.empty()); verifySuccessfullDelete(LOCATOR_SET_TO_DELETE); } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizerTest.java index 19ff5cbba..ee5f1b092 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizerTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; -import com.google.common.base.Optional; +import java.util.Optional; import io.fd.honeycomb.translate.write.WriteFailedException; import org.junit.Before; import org.junit.Test; @@ -116,7 +116,7 @@ public class VniTableCustomizerTest extends LispWriterCustomizerTest { } private void whenReadBeforeReturnInvalid() { - when(writeContext.readBefore(validId)).thenReturn(Optional.absent()); + when(writeContext.readBefore(validId)).thenReturn(Optional.empty()); } private void whenReadAfterReturnValid() { @@ -124,6 +124,6 @@ public class VniTableCustomizerTest extends LispWriterCustomizerTest { } private void whenReadAfterReturnInvalid() { - when(writeContext.readAfter(validId)).thenReturn(Optional.absent()); + when(writeContext.readAfter(validId)).thenReturn(Optional.empty()); } } diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/AdjacencyMappingContextTestHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/AdjacencyMappingContextTestHelper.java index 76dd34ff5..52ae27570 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/AdjacencyMappingContextTestHelper.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/AdjacencyMappingContextTestHelper.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.lisp.util; import static com.google.common.base.Preconditions.checkNotNull; import static org.mockito.Mockito.doReturn; -import com.google.common.base.Optional; +import java.util.Optional; import com.google.common.collect.Lists; import io.fd.honeycomb.translate.MappingContext; import java.util.List; @@ -109,7 +109,7 @@ public interface AdjacencyMappingContextTestHelper { final List<Mapping> list = Common.getMappingList(mappingContext, iid); doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid); - doReturn(Optional.absent()).when(mappingContext).read(mappingIid(name, namingContextName)); + doReturn(Optional.empty()).when(mappingContext).read(mappingIid(name, namingContextName)); } final class Common { diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/EidMappingContextHelper.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/EidMappingContextHelper.java index bd2be3013..728bc7ea0 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/EidMappingContextHelper.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/util/EidMappingContextHelper.java @@ -19,7 +19,7 @@ package io.fd.hc2vpp.lisp.util; import static org.mockito.Mockito.doReturn; -import com.google.common.base.Optional; +import java.util.Optional; import com.google.common.collect.Lists; import io.fd.honeycomb.translate.MappingContext; import java.util.List; @@ -96,7 +96,7 @@ public interface EidMappingContextHelper { final List<Mapping> list = Common.getMappingList(mappingContext, iid); doReturn(Optional.of(new MappingsBuilder().setMapping(list).build())).when(mappingContext).read(iid); - doReturn(Optional.absent()).when(mappingContext).read(mappingIid(new MappingId(name), namingContextName)); + doReturn(Optional.empty()).when(mappingContext).read(mappingIid(new MappingId(name), namingContextName)); } final class Common { |