From 3f93e39fbb780f19ce34ea407e0534eea7c1af30 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Fri, 19 Aug 2016 12:20:33 +0200 Subject: [PATCH] HONEYCOMB-18 Fixing comments from reviews Change-Id: Ic0565d601d13b5f50ec3c714a43600e32a7e456b Signed-off-by: Maros Marsalek --- samples/interfaces/mapping/pom.xml | 9 +++++---- samples/minimal-distribution/pom.xml | 6 ++++-- v3po/v3po2vpp/pom.xml | 18 ------------------ .../io/fd/honeycomb/translate/v3po/V3poModule.java | 19 +++---------------- .../v3po/VppStateHoneycombReaderFactory.java | 8 ++++---- ...Initializer.java => VppClassifierInitializer.java} | 4 ++-- vpp-common/minimal-distribution/pom.xml | 8 ++------ .../vpp/distro/ContextsReaderFactoryProvider.groovy | 3 ++- .../io/fd/honeycomb/vpp/distro/JVppProvider.groovy | 7 +++++-- .../io/fd/honeycomb/vpp/distro/VppCommonModule.groovy | 2 +- vpp-integration/minimal-distribution/pom.xml | 6 ++++-- 11 files changed, 32 insertions(+), 58 deletions(-) rename v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/{VppClasifierInitializer.java => VppClassifierInitializer.java} (90%) diff --git a/samples/interfaces/mapping/pom.xml b/samples/interfaces/mapping/pom.xml index 5cd903acd..d5f6b07ad 100644 --- a/samples/interfaces/mapping/pom.xml +++ b/samples/interfaces/mapping/pom.xml @@ -30,6 +30,7 @@ 4.1.0 1.2.0 + 1.0.0-SNAPSHOT @@ -58,22 +59,22 @@ io.fd.honeycomb translate-impl - 1.0.0-SNAPSHOT + ${honeycomb.infra.version} io.fd.honeycomb translate-api - 1.0.0-SNAPSHOT + ${honeycomb.infra.version} io.fd.honeycomb notification-api - 1.0.0-SNAPSHOT + ${honeycomb.infra.version} io.fd.honeycomb cfg-init - 1.0.0-SNAPSHOT + ${honeycomb.infra.version} diff --git a/samples/minimal-distribution/pom.xml b/samples/minimal-distribution/pom.xml index 900d66ae9..5592b981c 100644 --- a/samples/minimal-distribution/pom.xml +++ b/samples/minimal-distribution/pom.xml @@ -30,6 +30,8 @@ -Xms128m -Xmx128m io.fd.honeycomb.samples.distro.Main + 1.0.0-SNAPSHOT + 1.0.0-SNAPSHOT @@ -59,12 +61,12 @@ io.fd.honeycomb.samples.interfaces interfaces-mapping - 1.0.0-SNAPSHOT + ${interfaces.mapping.version} io.fd.honeycomb minimal-distribution - 1.0.0-SNAPSHOT + ${honeycomb.min.distro.version} diff --git a/v3po/v3po2vpp/pom.xml b/v3po/v3po2vpp/pom.xml index 4848ae949..62fced58d 100644 --- a/v3po/v3po2vpp/pom.xml +++ b/v3po/v3po2vpp/pom.xml @@ -55,29 +55,11 @@ ${project.version} - - - org.opendaylight.controller - config-util - 0.4.2-Beryllium-SR2 - - - org.opendaylight.controller - threadpool-config-api - 0.4.2-Beryllium-SR2 - - - io.fd.honeycomb translate-impl ${project.version} - - io.fd.honeycomb.vpp - vpp-jvpp-cfg - ${project.version} - io.fd.honeycomb cfg-init diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java index aafd0154a..4effb70e3 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/V3poModule.java @@ -24,7 +24,7 @@ import io.fd.honeycomb.notification.ManagedNotificationProducer; import io.fd.honeycomb.translate.read.ReaderFactory; import io.fd.honeycomb.translate.v3po.cfgattrs.V3poConfiguration; import io.fd.honeycomb.translate.v3po.initializers.InterfacesInitializer; -import io.fd.honeycomb.translate.v3po.initializers.VppClasifierInitializer; +import io.fd.honeycomb.translate.v3po.initializers.VppClassifierInitializer; import io.fd.honeycomb.translate.v3po.initializers.VppInitializer; import io.fd.honeycomb.translate.v3po.notification.InterfaceChangeNotificationProducer; import io.fd.honeycomb.translate.v3po.util.NamingContext; @@ -32,7 +32,6 @@ import io.fd.honeycomb.translate.write.WriterFactory; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import net.jmob.guice.conf.core.ConfigurationModule; -import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; public class V3poModule extends AbstractModule { @@ -53,19 +52,7 @@ public class V3poModule extends AbstractModule { .toInstance(new NamingContext("classify-table-", "classify-table-context")); // Executor needed for keepalives - // TODO-minimal remove the funny wrapper. it is only here because of config subsystem - final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); - bind(ScheduledThreadPool.class).toInstance(new ScheduledThreadPool() { - @Override - public ScheduledExecutorService getExecutor() { - return executor; - } - - @Override - public int getMaxThreadCount() { - return 1; - } - }); + bind(ScheduledExecutorService.class).toInstance(Executors.newScheduledThreadPool(1)); // Readers final Multibinder readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); @@ -83,7 +70,7 @@ public class V3poModule extends AbstractModule { final Multibinder initializerBinder = Multibinder.newSetBinder(binder(), DataTreeInitializer.class); initializerBinder.addBinding().to(InterfacesInitializer.class); - initializerBinder.addBinding().to(VppClasifierInitializer.class); + initializerBinder.addBinding().to(VppClassifierInitializer.class); initializerBinder.addBinding().to(VppInitializer.class); // Notifications diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java index f39502c09..d8e4f29b5 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/VppStateHoneycombReaderFactory.java @@ -28,7 +28,7 @@ import io.fd.honeycomb.translate.v3po.util.ReadTimeoutException; import io.fd.honeycomb.translate.v3po.vppstate.BridgeDomainCustomizer; import io.fd.honeycomb.translate.v3po.vppstate.L2FibEntryCustomizer; import io.fd.honeycomb.translate.v3po.vppstate.VersionCustomizer; -import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; +import java.util.concurrent.ScheduledExecutorService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTable; @@ -50,13 +50,13 @@ public final class VppStateHoneycombReaderFactory implements ReaderFactory, Auto private final FutureJVpp jVpp; private final NamingContext ifcCtx; private final NamingContext bdCtx; - private final ScheduledThreadPool keepaliveExecutor; + private final ScheduledExecutorService keepaliveExecutor; @Inject public VppStateHoneycombReaderFactory(final FutureJVpp jVpp, @Named("interface-context") final NamingContext ifcCtx, @Named("bridge-domain-context") final NamingContext bdCtx, - final ScheduledThreadPool keepaliveExecutorDependency) { + final ScheduledExecutorService keepaliveExecutorDependency) { this.jVpp = jVpp; this.ifcCtx = ifcCtx; this.bdCtx = bdCtx; @@ -75,7 +75,7 @@ public final class VppStateHoneycombReaderFactory implements ReaderFactory, Auto // is truly generic registry.add(new KeepaliveReaderWrapper<>( new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)), - keepaliveExecutor.getExecutor(), ReadTimeoutException.class, 30, + keepaliveExecutor, ReadTimeoutException.class, 30, // FIXME-minimal trigger jvpp reinitialization here () -> LOG.error("Keepalive failed. VPP is probably DOWN!"))); // BridgeDomains(Structural) diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClasifierInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClassifierInitializer.java similarity index 90% rename from v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClasifierInitializer.java rename to v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClassifierInitializer.java index b97586830..038b6caa3 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClasifierInitializer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/initializers/VppClassifierInitializer.java @@ -31,13 +31,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** * Initializes vpp-classfier node in config data tree based on operational state. */ -public final class VppClasifierInitializer extends AbstractDataTreeConverter { +public final class VppClassifierInitializer extends AbstractDataTreeConverter { private static final InstanceIdentifier OPER_ID = InstanceIdentifier.create(VppClassifierState.class); private static final InstanceIdentifier CFG_ID = InstanceIdentifier.create(VppClassifier.class); @Inject - public VppClasifierInitializer(@Named("honeycomb-initializer") @Nonnull final DataBroker bindingDataBroker) { + public VppClassifierInitializer(@Named("honeycomb-initializer") @Nonnull final DataBroker bindingDataBroker) { super(bindingDataBroker, OPER_ID, CFG_ID); } diff --git a/vpp-common/minimal-distribution/pom.xml b/vpp-common/minimal-distribution/pom.xml index 4500a633d..4efe12b54 100644 --- a/vpp-common/minimal-distribution/pom.xml +++ b/vpp-common/minimal-distribution/pom.xml @@ -29,6 +29,7 @@ io.fd.honeycomb.vpp.distro.Main + 1.0.0-SNAPSHOT @@ -75,7 +76,7 @@ io.fd.honeycomb minimal-distribution - 1.0.0-SNAPSHOT + ${honeycomb.min.distro.version} ${project.groupId} @@ -87,11 +88,6 @@ naming-context-impl ${project.version} - - ${project.groupId} - vpp-jvpp-cfg - ${project.version} - io.fd.vpp jvpp diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy index 5016d4e19..e056f38f8 100644 --- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy +++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/ContextsReaderFactoryProvider.groovy @@ -21,6 +21,7 @@ import com.google.inject.name.Named import groovy.transform.ToString import groovy.util.logging.Slf4j import io.fd.honeycomb.infra.distro.ProviderTrait +import io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule import io.fd.honeycomb.translate.read.ReaderFactory import org.opendaylight.controller.md.sal.binding.api.DataBroker import io.fd.honeycomb.vpp.context.ContextsReaderFactory @@ -33,7 +34,7 @@ import io.fd.honeycomb.vpp.context.ContextsReaderFactory class ContextsReaderFactoryProvider extends ProviderTrait { @Inject - @Named("honeycomb-context") + @Named(ContextPipelineModule.HONEYCOMB_CONTEXT) DataBroker contextDataBroker def create() { new ContextsReaderFactory(contextDataBroker) } diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy index dfd0c44ae..51bf5be9e 100644 --- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy +++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/JVppProvider.groovy @@ -25,6 +25,9 @@ import org.openvpp.jvpp.VppJNIConnection import org.openvpp.jvpp.future.FutureJVpp import org.openvpp.jvpp.future.FutureJVppFacade +/** + * This must be a singleton due to shutdown hook usage. + */ @Slf4j @ToString class JVppProvider extends ProviderTrait { @@ -38,8 +41,8 @@ class JVppProvider extends ProviderTrait { def jVpp = new JVppImpl(connection) // Closing JVpp connection with shutdown hook to erase the connection from VPP so HC will be able - // to connect next time - // TODO is there a safer way than a shutdown hook ? + // to connect next time. If JVM is force closed, this will not be executed and VPP connection + // with name from config will stay open and prevent next startup of HC to success Runtime.addShutdownHook { log.info("Disconnecting from VPP") jVpp.close() diff --git a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy index 4c2573ca1..68261c34d 100644 --- a/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy +++ b/vpp-common/minimal-distribution/src/main/java/io/fd/honeycomb/vpp/distro/VppCommonModule.groovy @@ -34,7 +34,7 @@ public final class VppCommonModule extends AbstractModule { bind(FutureJVpp).toProvider(JVppProvider).in(Singleton) - // Naming contexts reader exposing context storage over REST/NETCONF + // Naming contexts reader exposing context storage over REST/HONEYCOMB_NETCONF Multibinder.newSetBinder(binder(), ReaderFactory.class).with { addBinding().toProvider(ContextsReaderFactoryProvider).in(Singleton) } diff --git a/vpp-integration/minimal-distribution/pom.xml b/vpp-integration/minimal-distribution/pom.xml index 80f03f845..6985b3bbb 100644 --- a/vpp-integration/minimal-distribution/pom.xml +++ b/vpp-integration/minimal-distribution/pom.xml @@ -29,6 +29,8 @@ io.fd.honeycomb.vpp.integration.distro.Main + 1.0.0-SNAPSHOT + 1.0.0-SNAPSHOT @@ -58,12 +60,12 @@ io.fd.honeycomb.vpp minimal-distribution - 1.0.0-SNAPSHOT + ${vpp.common.min.distro.version} io.fd.honeycomb.v3po v3po2vpp - 1.0.0-SNAPSHOT + ${v3po.version} -- 2.16.6