This patch is to bump up odlmicro to latest Aluminium.
This involves:
1. Version changes to poms to point to latest platform versions
2. There are lot of changes in MD-SAL and controller from Neon
to Aluminium. Some of the packages which were deprecated in controller
in earlier releases are completely removed and we are forced to migrate
to MD-SAL packages instead.
JIRA: ODLMICRO-29
Signed-off-by: VenkataSatya Jonnadula <rsankar@luminanetworks.com>
Change-Id: I9a09bd938d4d9be82d5a83b18f3cd9ba458c52d5
<relativePath>../</relativePath>
</parent>
- <groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<dependencies>
-
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
+ <version>2.7.5</version>
</dependency>
<dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
- <version>4.1.31.Final</version>
</dependency>
<!--infrautils-->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>netty-event-executor-config</artifactId>
- <version>0.10.0</version>
</dependency>
<!--controller-->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>netty-threadgroup-config</artifactId>
- <version>0.10.0</version>
</dependency>
<!--controller-->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>netty-timer-config</artifactId>
- <version>0.10.0</version>
</dependency>
<!--controller-->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>threadpool-config-impl</artifactId>
- <version>0.10.0</version>
</dependency>
<!--mdsal-->
<!--mdsal-->
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-api</artifactId>
+ </dependency>
+
+ <!--mdsal -->
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-dom-broker</artifactId>
+ </dependency>
+
+ <!--mdsal-->
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-spi</artifactId>
+ </dependency>
+
+ <!--mdsal-->
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-test-utils</artifactId>
+ </dependency>
+
+ <!--mdsal-->
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-codec-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-adapter</artifactId>
+ <type>test-jar</type>
+ <!-- We are building on top of abstract test classes -->
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-dom-inmemory-datastore</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-runtime-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-runtime-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>odl-mdsal-binding-runtime</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
</dependency>
<!--restconf-->
<!--aaa-->
<dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-cert</artifactId>
- <version>0.9.0</version>
- <scope>compile</scope>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-cert</artifactId>
+ <scope>compile</scope>
</dependency>
<!--aaa-->
<dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-encrypt-service-impl</artifactId>
- <version>0.9.0</version>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-encrypt-service-impl</artifactId>
</dependency>
<!--aaa-->
<dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-shiro</artifactId>
- <version>0.9.0</version>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-shiro</artifactId>
</dependency>
- <!--aaa -->
- <!--dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-shiro-api</artifactId>
- <version>0.9.0</version>
- </dependency-->
-
- <!--aaa-->
- <!--dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-shiro-act</artifactId>
- <version>0.9.0</version>
- </dependency-->
-
<!--aaa-->
<dependency>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-authn-api</artifactId>
- <version>0.9.0</version>
</dependency>
<!--aaa-->
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>web-jetty-impl</artifactId>
- <version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>servlet-jersey2</artifactId>
- <version>0.9.0</version>
</dependency>
<!--serviceutils-->
<dependency>
<groupId>org.opendaylight.serviceutils</groupId>
<artifactId>srm-api</artifactId>
- <version>0.3.0</version>
+ <version>0.6.0-SNAPSHOT</version>
</dependency>
<!--serviceutils-->
<dependency>
<groupId>org.opendaylight.serviceutils</groupId>
<artifactId>srm-impl</artifactId>
- <version>0.3.0</version>
+ <version>0.6.0-SNAPSHOT</version>
</dependency>
<!--serviceutils-->
<dependency>
<groupId>org.opendaylight.serviceutils</groupId>
<artifactId>upgrade</artifactId>
- <version>0.3.0</version>
+ <version>0.6.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>testutils</artifactId>
- <version>0.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>inject.guice.extensions.jsr250</artifactId>
<scope>compile</scope>
</dependency>
-
- <!--controller-->
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>blueprint</artifactId>
- <version>0.10.0</version>
- <scope>compile</scope>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ <version>2.28</version>
</dependency>
-
</dependencies>
<build>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!-- TODO upstream version into odlparent pluginManagement -->
- <version>3.1.1</version>
<configuration>
<descriptors>
<descriptor>src/assembly/micro.xml</descriptor>
</plugin>
</plugins>
</build>
-</project>
+</project>
\ No newline at end of file
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
-import javax.annotation.Nullable;
import javax.inject.Singleton;
-
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.aaa.api.AuthenticationException;
import org.opendaylight.aaa.api.Claim;
import org.opendaylight.aaa.api.CredentialAuth;
}
return null;
}
+
+ @Override
+ public @NonNull Class<PasswordCredentials> credentialClass() {
+ // TODO Auto-generated method stub
+ return PasswordCredentials.class;
+ }
};
}
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.micro;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Throwables;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
+import org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
+import org.opendaylight.mdsal.micro.binding.dom.adapter.AbstractConcurrentDataBrokerTest;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
+
+@Beta
+public class DataBrokerModule {
+ private final boolean useMTDataTreeChangeListenerExecutor;
+
+ private AbstractConcurrentDataBrokerTest dataBrokerTest;
+
+ public DataBrokerModule(final boolean useMTDataTreeChangeListenerExecutor) {
+ this.useMTDataTreeChangeListenerExecutor = useMTDataTreeChangeListenerExecutor;
+ }
+
+ public static DataBroker dataBroker() {
+ return new DataBrokerModule(false).getDataBroker();
+ }
+
+ // Suppress IllegalCatch because of AbstractDataBrokerTest (change later)
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ public DataBroker getDataBroker() {
+ try {
+ // This is a little bit "upside down" - in the future,
+ // we should probably put what is in AbstractDataBrokerTest
+ // into this DataBrokerTestModule, and make AbstractDataBrokerTest
+ // use it, instead of the way around it currently is (the opposite);
+ // this is just for historical reasons... and works for now.
+ dataBrokerTest = new AbstractConcurrentDataBrokerTest(useMTDataTreeChangeListenerExecutor) {};
+ dataBrokerTest.setup();
+ return dataBrokerTest.getDataBroker();
+ } catch (Exception e) {
+ Throwables.throwIfUnchecked(e);
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public DOMDataBroker getDOMDataBroker() {
+ return dataBrokerTest.getDomBroker();
+ }
+
+ public AdapterContext getAdapterContext() {
+ return dataBrokerTest.getDataBrokerTestCustomizer().getAdapterContext();
+ }
+
+ public CurrentAdapterSerializer getCurrentAdapterSerializer() {
+ return dataBrokerTest.getDataBrokerTestCustomizer().getAdapterContext().currentSerializer();
+ }
+
+ @SuppressFBWarnings(value = "NM_CONFUSING")
+ public DOMNotificationRouter getDOMNotificationRouter() {
+ return dataBrokerTest.getDataBrokerTestCustomizer().getDomNotificationRouter();
+ }
+
+ public DOMSchemaService getSchemaService() {
+ return dataBrokerTest.getDataBrokerTestCustomizer().getSchemaService();
+ }
+
+ public EffectiveModelContextProvider getSchemaContextProvider() {
+ return dataBrokerTest.getDataBrokerTestCustomizer().getSchemaService()::getGlobalContext;
+ }
+}
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import io.netty.channel.EventLoopGroup;
-
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
/**
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import io.netty.util.Timer;
-
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
/**
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import io.netty.channel.EventLoopGroup;
-
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
/**
import org.opendaylight.controller.config.yang.netty.eventexecutor.AutoCloseableEventExecutor;
import org.opendaylight.controller.config.yang.netty.threadgroup.NioEventLoopGroupCloseable;
import org.opendaylight.controller.config.yang.netty.timer.HashedWheelTimerCloseable;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
-import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcProviderServiceAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingDOMRpcServiceAdapter;
-import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
-import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
-import org.opendaylight.controller.md.sal.dom.broker.impl.PingPongDataBroker;
-import org.opendaylight.controller.md.sal.dom.broker.impl.mount.DOMMountPointServiceImpl;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.infrautils.inject.guice.AbstractCloseableModule;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcProviderServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
+import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
+import org.opendaylight.mdsal.dom.api.DOMActionService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
import org.opendaylight.mdsal.dom.api.DOMRpcService;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
+import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
+import org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter;
+import org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService;
import org.opendaylight.mdsal.micro.MdsalModule;
-import org.opendaylight.mdsal.micro.PingPong;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.dom.impl.DOMClusterSingletonServiceProviderImpl;
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public class InMemoryControllerModule extends AbstractCloseableModule {
- // TODO re-use org.opendaylight.controller.md.sal.binding.impl.BindingBrokerWiring
+ // TODO re-use
+ // org.opendaylight.controller.md.sal.binding.impl.BindingBrokerWiring
- // TODO propose @Inject and @PreDestroy close() annotations at source to simplify this, a lot...
+ // TODO propose @Inject and @PreDestroy close() annotations at source to
+ // simplify this, a lot...
- private BindingToNormalizedNodeCodec bindingToNormalizedNodeCodec;
+ private CurrentAdapterSerializer currentAdapterSerializer;
+ private AdapterContext adapterContext;
private BindingDOMNotificationPublishServiceAdapter bindingDOMNotificationPublishServiceAdapter;
private DOMNotificationRouter domNotificationPublishService;
protected void configureCloseables() {
install(new MdsalModule());
- // TODO this is just for early stage POC! switch to real CDS wiring here, eventually..
- DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(true);
+ // TODO this is just for early stage POC! switch to real CDS wiring here,
+ // eventually..
+ DataBrokerModule dataBrokerTestModule = new DataBrokerModule(true);
+
DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
- DOMSchemaService domSchemaService = dataBrokerTestModule.getSchemaService();
+ bind(DataBroker.class).toInstance(dataBroker);
+ DOMSchemaService domSchemaService = dataBrokerTestModule.getSchemaService();
bind(DOMSchemaService.class).toInstance(domSchemaService);
+
DOMDataBroker domDefaultDataBroker = dataBrokerTestModule.getDOMDataBroker();
bind(DOMDataBroker.class).toInstance(domDefaultDataBroker);
- bind(DataBroker.class).toInstance(dataBroker);
- bindingToNormalizedNodeCodec = dataBrokerTestModule.getBindingToNormalizedNodeCodec();
- bind(BindingToNormalizedNodeCodec.class).toInstance(bindingToNormalizedNodeCodec);
+ currentAdapterSerializer = dataBrokerTestModule.getCurrentAdapterSerializer();
+ bind(CurrentAdapterSerializer.class).toInstance(currentAdapterSerializer);
- PingPongDataBroker domPingPongDataBroker = new PingPongDataBroker(domDefaultDataBroker);
- bind(DOMDataBroker.class).annotatedWith(PingPong.class).toInstance(domPingPongDataBroker);
- bind(DataBroker.class).annotatedWith(PingPong.class)
- .toInstance(new BindingDOMDataBrokerAdapter(domPingPongDataBroker, bindingToNormalizedNodeCodec));
+ adapterContext = dataBrokerTestModule.getAdapterContext();
domNotificationPublishService = dataBrokerTestModule.getDOMNotificationRouter();
bind(DOMNotificationService.class).toInstance(domNotificationPublishService);
- bind(NotificationService.class).toInstance(
- new BindingDOMNotificationServiceAdapter(bindingToNormalizedNodeCodec, domNotificationPublishService));
+ bind(NotificationService.class)
+ .toInstance(new BindingDOMNotificationServiceAdapter(adapterContext, domNotificationPublishService));
- bindingDOMNotificationPublishServiceAdapter = new BindingDOMNotificationPublishServiceAdapter(
- bindingToNormalizedNodeCodec, domNotificationPublishService);
+ bindingDOMNotificationPublishServiceAdapter =
+ new BindingDOMNotificationPublishServiceAdapter(adapterContext, domNotificationPublishService);
bind(NotificationPublishService.class).toInstance(bindingDOMNotificationPublishServiceAdapter);
- bind(BindingNormalizedNodeSerializer.class).toInstance(bindingToNormalizedNodeCodec);
+ bind(BindingNormalizedNodeSerializer.class).toInstance(currentAdapterSerializer);
bind(DOMMountPointService.class).to(DOMMountPointServiceImpl.class);
DOMRpcRouter domRpcRouter = DOMRpcRouter.newInstance(domSchemaService);
bind(DOMRpcRouter.class).toInstance(domRpcRouter);
- DOMRpcService rpcService = domRpcRouter.getRpcService();
- bind(DOMRpcService.class).toInstance(rpcService);
-
- org.opendaylight.controller.md.sal.dom.broker.impl.DOMRpcRouter controllerDOMRpcService
- = new org.opendaylight.controller.md.sal.dom.broker.impl.DOMRpcRouter(
- rpcService, domRpcRouter.getRpcProviderService());
- bind(org.opendaylight.controller.md.sal.dom.api.DOMRpcService.class).toInstance(controllerDOMRpcService);
- bind(org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService.class)
- .toInstance(controllerDOMRpcService);
+ DOMRpcService domRpcService = domRpcRouter.getRpcService();
+ bind(DOMRpcService.class).toInstance(domRpcService);
DOMRpcProviderService domRpcProviderService = domRpcRouter.getRpcProviderService();
- org.opendaylight.controller.md.sal.dom.api.DOMRpcService controllerDomRpcService
- = new org.opendaylight.controller.md.sal.dom.broker.impl.DOMRpcRouter(rpcService, domRpcProviderService);
- BindingDOMRpcServiceAdapter bindingDOMRpcServiceAdapter
- = new BindingDOMRpcServiceAdapter(controllerDomRpcService, bindingToNormalizedNodeCodec);
- BindingDOMRpcProviderServiceAdapter bindingDOMRpcProviderServiceAdapter
- = new BindingDOMRpcProviderServiceAdapter(controllerDOMRpcService, bindingToNormalizedNodeCodec);
- bind(RpcProviderRegistry.class).toInstance(
- new HeliumRpcProviderRegistry(bindingDOMRpcServiceAdapter, bindingDOMRpcProviderServiceAdapter));
+ bind(DOMRpcProviderService.class).toInstance(domRpcProviderService);
+
+ DOMActionProviderService domActionProviderService = domRpcRouter.getActionProviderService();
+ bind(DOMActionProviderService.class).toInstance(domActionProviderService);
+
+ DOMActionService domActionService = domRpcRouter.getActionService();
+ bind(DOMActionService.class).toInstance(domActionService);
+
+ BindingDOMRpcServiceAdapter bindingDOMRpcServiceAdapter =
+ new BindingDOMRpcServiceAdapter(adapterContext, domRpcService);
+ bind(RpcConsumerRegistry.class).toInstance(bindingDOMRpcServiceAdapter);
+
+ BindingDOMRpcProviderServiceAdapter bindingDOMRpcProviderServiceAdapter =
+ new BindingDOMRpcProviderServiceAdapter(adapterContext, domRpcProviderService);
+ bind(RpcProviderService.class).toInstance(bindingDOMRpcProviderServiceAdapter);
+
+ SimpleDOMEntityOwnershipService eos = new SimpleDOMEntityOwnershipService();
+ bind(EntityOwnershipService.class).toInstance(new BindingDOMEntityOwnershipServiceAdapter(eos, adapterContext));
+ bind(ClusterSingletonServiceProvider.class).toInstance(new DOMClusterSingletonServiceProviderImpl(eos));
+
}
// NETCONF
@Override
public void close() throws Exception {
- bindingToNormalizedNodeCodec.close();
- bindingDOMNotificationPublishServiceAdapter.close();
domNotificationPublishService.close();
}
}
import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Injector;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.io.InputStream;
import java.util.Set;
}
@SuppressWarnings("checkstyle:RegexpSingleLineJava")
+ @SuppressFBWarnings(value = { "UPM_UNCALLED_PRIVATE_METHOD", "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" })
// TODO This should ideally only be in src/test, not src/main ...
private void testAllRegisteredCommands() throws Exception {
SessionFactory sessionFactory = createSessionFactory(null);
package org.opendaylight.infrautils.web;
import com.google.inject.AbstractModule;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.opendaylight.aaa.web.WebContextSecurer;
import org.opendaylight.aaa.web.WebServer;
import org.opendaylight.aaa.web.jetty.JettyWebServer;
*
* @author Michael Vorburger.ch
*/
+@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public class WebModule extends AbstractModule {
// TODO note (new) org.opendaylight.aaa.web.testutils.WebTestModule .. integrate?
+// private JettyWebServer webserver;
@Override
protected void configure() {
// TODO read port from a -D parameter or configuration file instead of hard-coding
- bind(WebServer.class).toInstance(new JettyWebServer(8181));
+// webserver = new JettyWebServer(8181);
+ bind(WebServer.class).to(JettyWebServer.class);
// JAX-RS
bind(ServletSupport.class).to(JerseyServletSupport.class);
+
// TODO replace this NOOP WebContextSecurer with one with a fixed uid/pwd for HTTP BASIC (and ditch AAA)
- bind(WebContextSecurer.class).toInstance((webContextBuilder, urlPatterns) -> { });
+ bind(WebContextSecurer.class).toInstance((webContextBuilder, asyncSupported, urlPatterns) -> { });
}
}
package org.opendaylight.mdsal.micro;
import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import javax.inject.Singleton;
-import org.opendaylight.controller.sal.core.compat.DOMDataBrokerAdapter;
-import org.opendaylight.controller.sal.core.compat.DOMNotificationServiceAdapter;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcProviderServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
-import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-import org.opendaylight.mdsal.dom.api.DOMNotificationService;
-import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMRpcService;
-import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
-import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
-import org.opendaylight.mdsal.dom.broker.pingpong.PingPongDataBroker;
-import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
-import org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
import org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.dom.impl.DOMClusterSingletonServiceProviderImpl;
@SuppressWarnings("deprecation") // sure, but that's the point of this class...
public class MdsalModule extends AbstractModule {
// TODO This is WRONG; later need to use the DistributedEntityOwnershipService instead here!
bind(DOMEntityOwnershipService.class).to(SimpleDOMEntityOwnershipService.class);
}
-
- @Provides
- @Singleton DataBroker getDataBroker(DOMDataBroker domDataBroker, BindingToNormalizedNodeCodec codec) {
- return new BindingDOMDataBrokerAdapter(domDataBroker, codec);
- }
-
- @Provides
- @Singleton DOMDataBroker getDOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker controllerDDB) {
- return new DOMDataBrokerAdapter(controllerDDB);
- }
-
- @Provides
- @Singleton
- @PingPong DOMDataBroker getDOMPingPongDataBroker(DOMDataBroker domDataBroker) {
- return new PingPongDataBroker(domDataBroker);
- }
-
- @Provides
- @Singleton
- @PingPong
- DataBroker getPingPongDOMDataBroker(@PingPong DOMDataBroker domDataBroker, BindingToNormalizedNodeCodec codec) {
- return new BindingDOMDataBrokerAdapter(domDataBroker, codec);
- }
-
- @Provides
- @Singleton
- BindingToNormalizedNodeCodec getBindingToNormalizedNodeCodec(
- org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec controllerCodec) {
- return controllerCodec;
- }
-
- @Provides
- @Singleton DOMNotificationService getDOMNotificationService(
- org.opendaylight.controller.md.sal.dom.api.DOMNotificationService controllerDNS) {
- return new DOMNotificationServiceAdapter(controllerDNS);
- }
-
- @Provides
- @Singleton DOMMountPointService getDOMMountPoint(
- /* org.opendaylight.controller.md.sal.dom.api.DOMMountPointService controllerDMP */) {
- // TODO doesn't the mdsal DOMMountPointServiceImpl need the controller DOMMountPointService ?!
- return new DOMMountPointServiceImpl();
- }
-
- @Provides
- @Singleton EntityOwnershipService getDOMEntityOwnershipService(
- DOMEntityOwnershipService domService, BindingNormalizedNodeSerializer conversionCodec) {
- return new BindingDOMEntityOwnershipServiceAdapter(domService, conversionCodec);
- }
-
- @Provides
- @Singleton ClusterSingletonServiceProvider getClusterSingletonServiceProvider(DOMEntityOwnershipService eos) {
- return new DOMClusterSingletonServiceProviderImpl(eos);
- }
-
-// @Provides
-// @Singleton DOMRpcService getDOMService(org.opendaylight.controller.md.sal.dom.api.DOMRpcService controllerDRSA) {
-// return new DOMRpcServiceAdapter(controllerDRSA);
-// }
-
- @Provides
- @Singleton
- RpcConsumerRegistry getRpcConsumerRegistry(DOMRpcService domService, BindingToNormalizedNodeCodec codec) {
- return new BindingDOMRpcServiceAdapter(domService, codec);
- }
-
- @Provides
- @Singleton
- RpcProviderService getRpcProviderService(DOMRpcProviderService domRpcRegistry, BindingToNormalizedNodeCodec codec) {
- return new BindingDOMRpcProviderServiceAdapter(domRpcRegistry, codec);
- }
-
- @Provides
- @Singleton DOMRpcProviderService getDOMRpcProviderService(DOMRpcRouter domRpcRouter) {
- return domRpcRouter.getRpcProviderService();
- }
}
--- /dev/null
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+public abstract class AbstractBaseDataBrokerTest extends AbstractSchemaAwareTest {
+ private static final int ASSERT_COMMIT_DEFAULT_TIMEOUT = 5000;
+
+ private AbstractDataBrokerTestCustomizer testCustomizer;
+ private DataBroker dataBroker;
+ private DOMDataBroker domBroker;
+
+ protected abstract AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer();
+
+ public AbstractDataBrokerTestCustomizer getDataBrokerTestCustomizer() {
+ if (testCustomizer == null) {
+ throw new IllegalStateException("testCustomizer not yet set by call to createDataBrokerTestCustomizer()");
+ }
+ return testCustomizer;
+ }
+
+ @Override
+ protected void setupWithSchema(final EffectiveModelContext context) {
+ testCustomizer = createDataBrokerTestCustomizer();
+ dataBroker = testCustomizer.createDataBroker();
+ domBroker = testCustomizer.getDOMDataBroker();
+ testCustomizer.updateSchema(context);
+ }
+
+ public DataBroker getDataBroker() {
+ return dataBroker;
+ }
+
+ public DOMDataBroker getDomBroker() {
+ return domBroker;
+ }
+
+ protected static final void assertCommit(final ListenableFuture<?> commit) {
+ assertCommit(commit, ASSERT_COMMIT_DEFAULT_TIMEOUT);
+ }
+
+ protected static final void assertCommit(final ListenableFuture<?> commit, final long timeoutInMS) {
+ try {
+ commit.get(timeoutInMS, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException | ExecutionException | TimeoutException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+/**
+ * Abstract base for DataBroker tests.
+ *
+ * <p>Uses single thread executor for the Serialized DOM DataBroker (instead of the direct executor used by the
+ * AbstractDataBrokerTest) in order to allow tests to use the DataBroker concurrently from several threads.
+ *
+ * @author Michael Vorburger
+ */
+public abstract class AbstractConcurrentDataBrokerTest extends AbstractBaseDataBrokerTest {
+ private final boolean useMTDataTreeChangeListenerExecutor;
+
+ protected AbstractConcurrentDataBrokerTest() {
+ this(false);
+ }
+
+ protected AbstractConcurrentDataBrokerTest(final boolean useMTDataTreeChangeListenerExecutor) {
+ this.useMTDataTreeChangeListenerExecutor = useMTDataTreeChangeListenerExecutor;
+ }
+
+ @Override
+ protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
+ return new ConcurrentDataBrokerTestCustomizer(useMTDataTreeChangeListenerExecutor);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+/**
+ * Abstract base for DataBroker tests. Note that it performs synchronous commits via a direct executor which can cause
+ * issues if used in a concurrent manner so it is recommended to use AbstractConcurrentDataBrokerTest instead.
+ */
+public class AbstractDataBrokerTest extends AbstractBaseDataBrokerTest {
+ @Override
+ protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
+ return new DataBrokerTestCustomizer();
+ }
+
+ @Override
+ protected void setupWithSchema(final EffectiveModelContext context) {
+ super.setupWithSchema(context);
+ setupWithDataBroker(getDataBroker());
+ }
+
+ protected void setupWithDataBroker(final DataBroker dataBroker) {
+ // Intentionally left No-op, subclasses may customize it
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
+import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
+import org.opendaylight.mdsal.dom.spi.store.DOMStore;
+import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+public abstract class AbstractDataBrokerTestCustomizer {
+
+ private DOMDataBroker domDataBroker;
+ private final DOMNotificationRouter domNotificationRouter;
+ private final MockSchemaService schemaService;
+ private ImmutableMap<LogicalDatastoreType, DOMStore> datastores;
+ private final MockAdapterContext adapterContext;
+
+ public ImmutableMap<LogicalDatastoreType, DOMStore> createDatastores() {
+ return ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
+ .put(LogicalDatastoreType.OPERATIONAL, createOperationalDatastore())
+ .put(LogicalDatastoreType.CONFIGURATION,createConfigurationDatastore())
+ .build();
+ }
+
+ public AbstractDataBrokerTestCustomizer() {
+ schemaService = new MockSchemaService();
+ adapterContext = new MockAdapterContext();
+ schemaService.registerSchemaContextListener(adapterContext);
+ domNotificationRouter = DOMNotificationRouter.create(16);
+ }
+
+ public DOMStore createConfigurationDatastore() {
+ final InMemoryDOMDataStore store = new InMemoryDOMDataStore("CFG", getDataTreeChangeListenerExecutor());
+ schemaService.registerSchemaContextListener(store);
+ return store;
+ }
+
+ public DOMStore createOperationalDatastore() {
+ final InMemoryDOMDataStore store = new InMemoryDOMDataStore("OPER", getDataTreeChangeListenerExecutor());
+ schemaService.registerSchemaContextListener(store);
+ return store;
+ }
+
+ public DOMDataBroker createDOMDataBroker() {
+ return new SerializedDOMDataBroker(getDatastores(), getCommitCoordinatorExecutor());
+ }
+
+ public NotificationService createNotificationService() {
+ return new BindingDOMNotificationServiceAdapter(adapterContext, domNotificationRouter);
+ }
+
+ public NotificationPublishService createNotificationPublishService() {
+ return new BindingDOMNotificationPublishServiceAdapter(adapterContext, domNotificationRouter);
+ }
+
+ public abstract ListeningExecutorService getCommitCoordinatorExecutor();
+
+ public ListeningExecutorService getDataTreeChangeListenerExecutor() {
+ return MoreExecutors.newDirectExecutorService();
+ }
+
+ public DataBroker createDataBroker() {
+ return new BindingDOMDataBrokerAdapter(adapterContext, getDOMDataBroker());
+ }
+
+ public AdapterContext getAdapterContext() {
+ return adapterContext;
+ }
+
+ public DOMSchemaService getSchemaService() {
+ return schemaService;
+ }
+
+ public DOMDataBroker getDOMDataBroker() {
+ if (domDataBroker == null) {
+ domDataBroker = createDOMDataBroker();
+ }
+ return domDataBroker;
+ }
+
+ private synchronized ImmutableMap<LogicalDatastoreType, DOMStore> getDatastores() {
+ if (datastores == null) {
+ datastores = createDatastores();
+ }
+ return datastores;
+ }
+
+ public void updateSchema(final EffectiveModelContext ctx) {
+ schemaService.changeSchema(ctx);
+ }
+
+ public DOMNotificationRouter getDomNotificationRouter() {
+ return domNotificationRouter;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2018 Inocybe Technologies and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import static org.junit.Assert.fail;
+
+import com.google.common.util.concurrent.SettableFuture;
+import com.google.common.util.concurrent.Uninterruptibles;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Function;
+import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
+import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
+import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
+import org.opendaylight.mdsal.binding.api.DataTreeModification;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Abstract base that provides a DTCL for verification.
+ *
+ * @author Thomas Pantelis
+ */
+public class AbstractDataTreeChangeListenerTest extends AbstractConcurrentDataBrokerTest {
+ protected static final class TestListener<T extends DataObject> implements DataTreeChangeListener<T> {
+ private final SettableFuture<Collection<DataTreeModification<T>>> future = SettableFuture.create();
+ private final List<DataTreeModification<T>> accumulatedChanges = new ArrayList<>();
+ private final Function<DataTreeModification<T>, Boolean>[] matchers;
+ private final int expChangeCount;
+
+ private TestListener(final Function<DataTreeModification<T>, Boolean>[] matchers) {
+ this.expChangeCount = matchers.length;
+ this.matchers = matchers;
+ }
+
+ @Override
+ public void onDataTreeChanged(final Collection<DataTreeModification<T>> changes) {
+ synchronized (accumulatedChanges) {
+ accumulatedChanges.addAll(changes);
+ if (expChangeCount == accumulatedChanges.size()) {
+ future.set(new ArrayList<>(accumulatedChanges));
+ }
+ }
+ }
+
+ public Collection<DataTreeModification<T>> changes() {
+ try {
+ final Collection<DataTreeModification<T>> changes = future.get(5, TimeUnit.SECONDS);
+ Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+ return changes;
+ } catch (InterruptedException | TimeoutException | ExecutionException e) {
+ throw new AssertionError(String.format(
+ "Data tree change notifications not received. Expected: %s. Actual: %s - %s",
+ expChangeCount, accumulatedChanges.size(), accumulatedChanges), e);
+ }
+ }
+
+ public void verify() {
+ Collection<DataTreeModification<T>> changes = new ArrayList<>(changes());
+ Iterator<DataTreeModification<T>> iter = changes.iterator();
+ while (iter.hasNext()) {
+ DataTreeModification<T> dataTreeModification = iter.next();
+ for (Function<DataTreeModification<T>, Boolean> matcher: matchers) {
+ if (matcher.apply(dataTreeModification)) {
+ iter.remove();
+ break;
+ }
+ }
+ }
+
+ if (!changes.isEmpty()) {
+ DataTreeModification<T> mod = changes.iterator().next();
+ fail(String.format("Received unexpected notification: type: %s, path: %s, before: %s, after: %s",
+ mod.getRootNode().getModificationType(), mod.getRootPath().getRootIdentifier(),
+ mod.getRootNode().getDataBefore(), mod.getRootNode().getDataAfter()));
+ }
+ }
+
+ public boolean hasChanges() {
+ synchronized (accumulatedChanges) {
+ return !accumulatedChanges.isEmpty();
+ }
+ }
+ }
+
+ protected AbstractDataTreeChangeListenerTest() {
+ super(true);
+ }
+
+ @SafeVarargs
+ protected final <T extends DataObject> TestListener<T> createListener(final LogicalDatastoreType store,
+ final InstanceIdentifier<T> path, final Function<DataTreeModification<T>, Boolean>... matchers) {
+ TestListener<T> listener = new TestListener<>(matchers);
+ getDataBroker().registerDataTreeChangeListener(DataTreeIdentifier.create(store, path), listener);
+ return listener;
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> match(
+ final ModificationType type, final InstanceIdentifier<T> path, final Function<T, Boolean> checkDataBefore,
+ final Function<T, Boolean> checkDataAfter) {
+ return modification -> type == modification.getRootNode().getModificationType()
+ && path.equals(modification.getRootPath().getRootIdentifier())
+ && checkDataBefore.apply(modification.getRootNode().getDataBefore())
+ && checkDataAfter.apply(modification.getRootNode().getDataAfter());
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> match(final ModificationType type,
+ final InstanceIdentifier<T> path, final T expDataBefore, final T expDataAfter) {
+ return match(type, path, dataBefore -> Objects.equals(expDataBefore, dataBefore),
+ (Function<T, Boolean>) dataAfter -> Objects.equals(expDataAfter, dataAfter));
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> added(
+ final InstanceIdentifier<T> path, final T data) {
+ return match(ModificationType.WRITE, path, null, data);
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> replaced(
+ final InstanceIdentifier<T> path, final T dataBefore, final T dataAfter) {
+ return match(ModificationType.WRITE, path, dataBefore, dataAfter);
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> deleted(
+ final InstanceIdentifier<T> path, final T dataBefore) {
+ return match(ModificationType.DELETE, path, dataBefore, null);
+ }
+
+ public static <T extends DataObject> Function<DataTreeModification<T>, Boolean> subtreeModified(
+ final InstanceIdentifier<T> path, final T dataBefore, final T dataAfter) {
+ return match(ModificationType.SUBTREE_MODIFIED, path, dataBefore, dataAfter);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+public class AbstractNotificationBrokerTest extends AbstractSchemaAwareTest {
+ private AdapterContext bindingToNormalizedNodeCodec;
+ private DOMNotificationRouter domNotificationRouter;
+ private NotificationService notificationService;
+ private NotificationPublishService notificationPublishService;
+
+
+ @Override
+ protected void setupWithSchema(final EffectiveModelContext context) {
+ final DataBrokerTestCustomizer testCustomizer = createDataBrokerTestCustomizer();
+ domNotificationRouter = testCustomizer.getDomNotificationRouter();
+ notificationService = testCustomizer.createNotificationService();
+ notificationPublishService = testCustomizer.createNotificationPublishService();
+ bindingToNormalizedNodeCodec = testCustomizer.getAdapterContext();
+ testCustomizer.updateSchema(context);
+ }
+
+ protected DataBrokerTestCustomizer createDataBrokerTestCustomizer() {
+ return new DataBrokerTestCustomizer();
+ }
+
+ public NotificationService getNotificationService() {
+ return notificationService;
+ }
+
+ public NotificationPublishService getNotificationPublishService() {
+ return notificationPublishService;
+ }
+
+ public DOMNotificationRouter getDomNotificationRouter() {
+ return domNotificationRouter;
+ }
+
+ public AdapterContext getBindingToNormalizedNodeCodec() {
+ return bindingToNormalizedNodeCodec;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import java.util.Set;
+import org.junit.Before;
+import org.opendaylight.binding.runtime.spi.BindingRuntimeHelpers;
+import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+public abstract class AbstractSchemaAwareTest {
+ private static final LoadingCache<Set<YangModuleInfo>, EffectiveModelContext> SCHEMA_CONTEXT_CACHE =
+ CacheBuilder.newBuilder().weakValues().build(
+ new CacheLoader<Set<YangModuleInfo>, EffectiveModelContext>() {
+ @Override
+ public EffectiveModelContext load(final Set<YangModuleInfo> key) {
+ return BindingRuntimeHelpers.createEffectiveModel(key);
+ }
+ });
+
+ @Before
+ public final void setup() throws Exception {
+ setupWithSchema(getSchemaContext());
+ }
+
+ protected Set<YangModuleInfo> getModuleInfos() throws Exception {
+ return BindingReflections.cacheModuleInfos(Thread.currentThread().getContextClassLoader());
+ }
+
+ protected EffectiveModelContext getSchemaContext() throws Exception {
+ return SCHEMA_CONTEXT_CACHE.getUnchecked(getModuleInfos());
+ }
+
+ /**
+ * Setups test with Schema context.
+ *
+ * @param context schema context
+ */
+ protected abstract void setupWithSchema(EffectiveModelContext context);
+}
--- /dev/null
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import java.util.Collection;
+import java.util.Map;
+import org.junit.Assert;
+
+public final class AssertCollections {
+ private AssertCollections() {
+ }
+
+ public static void assertEmpty(final Collection<?> set) {
+ Assert.assertTrue(set.isEmpty());
+ }
+
+ public static void assertEmpty(final Map<?,?> set) {
+ Assert.assertTrue(set.isEmpty());
+ }
+
+ public static void assertContains(final Collection<?> set, final Object... values) {
+ for (Object key : values) {
+ Assert.assertTrue(set.contains(key));
+ }
+ }
+
+ public static void assertContains(final Map<?,?> map, final Object... values) {
+ for (Object key : values) {
+ Assert.assertTrue(map.containsKey(key));
+ }
+ }
+
+ public static void assertNotContains(final Collection<?> set, final Object... values) {
+ for (Object key : values) {
+ Assert.assertFalse(set.contains(key));
+ }
+ }
+
+ public static void assertNotContains(final Map<?,?> map, final Object... values) {
+ for (Object key : values) {
+ Assert.assertFalse(map.containsKey(key));
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.Executors;
+
+/**
+ * AbstractDataBrokerTestCustomizer implementation that uses a single-threaded executor for commits.
+
+ * @author Michael Vorburger
+ */
+public class ConcurrentDataBrokerTestCustomizer extends AbstractDataBrokerTestCustomizer {
+
+ private final ListeningExecutorService dataTreeChangeListenerExecutorSingleton;
+
+ public ConcurrentDataBrokerTestCustomizer(boolean useMTDataTreeChangeListenerExecutor) {
+ if (useMTDataTreeChangeListenerExecutor) {
+ dataTreeChangeListenerExecutorSingleton = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
+ } else {
+ dataTreeChangeListenerExecutorSingleton = MoreExecutors.newDirectExecutorService();
+ }
+ }
+
+ @Override
+ public ListeningExecutorService getCommitCoordinatorExecutor() {
+ return MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
+ }
+
+ @Override
+ public ListeningExecutorService getDataTreeChangeListenerExecutor() {
+ return dataTreeChangeListenerExecutorSingleton;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+
+/**
+ * AbstractDataBrokerTestCustomizer implementation that performs synchronous commits via a direct executor.
+ * Note that this can cause issues if used in a concurrent manner so it is recommended to use
+ * ConcurrentDataBrokerTestCustomizer instead.
+ */
+public class DataBrokerTestCustomizer extends AbstractDataBrokerTestCustomizer {
+
+ @Override
+ public ListeningExecutorService getCommitCoordinatorExecutor() {
+ return MoreExecutors.newDirectExecutorService();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import static com.google.common.base.Verify.verifyNotNull;
+
+import org.opendaylight.binding.runtime.api.DefaultBindingRuntimeContext;
+import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
+import org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer;
+import org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext;
+import org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator;
+import org.opendaylight.yangtools.util.ClassLoaderUtils;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
+
+public final class MockAdapterContext implements AdapterContext, EffectiveModelContextListener {
+ private volatile CurrentAdapterSerializer serializer = null;
+
+ @Override
+ public CurrentAdapterSerializer currentSerializer() {
+ return verifyNotNull(serializer);
+ }
+
+ @Override
+ public void onModelContextUpdated(final EffectiveModelContext newModelContext) {
+ serializer = new CurrentAdapterSerializer(new BindingCodecContext(DefaultBindingRuntimeContext.create(
+ new DefaultBindingRuntimeGenerator().generateTypeMapping(newModelContext),
+ ClassLoaderUtils::loadClassWithTCCL)));
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.micro.binding.dom.adapter;
+
+import com.google.common.collect.ClassToInstanceMap;
+import com.google.common.collect.ImmutableClassToInstanceMap;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaServiceExtension;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
+
+public final class MockSchemaService implements DOMSchemaService, EffectiveModelContextProvider {
+
+ private EffectiveModelContext schemaContext;
+
+ final ListenerRegistry<EffectiveModelContextListener> listeners = ListenerRegistry.create();
+
+ @SuppressFBWarnings(value = "IS2_INCONSISTENT_SYNC")
+ @Override
+ public synchronized EffectiveModelContext getGlobalContext() {
+ return schemaContext;
+ }
+
+ @Override
+ public ListenerRegistration<EffectiveModelContextListener> registerSchemaContextListener(
+ final EffectiveModelContextListener listener) {
+ return listeners.register(listener);
+ }
+
+ @Override
+ public synchronized EffectiveModelContext getEffectiveModelContext() {
+ return schemaContext;
+ }
+
+ @Override
+ public ClassToInstanceMap<DOMSchemaServiceExtension> getExtensions() {
+ return ImmutableClassToInstanceMap.of();
+ }
+
+ public synchronized void changeSchema(final EffectiveModelContext newContext) {
+ schemaContext = newContext;
+ listeners.streamListeners().forEach(listener -> listener.onModelContextUpdated(schemaContext));
+ }
+}
import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
+import org.opendaylight.restconf.nb.rfc8040.handlers.ActionServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMDataBrokerHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.DOMMountPointServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.NotificationServiceHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.services.wrapper.ServicesWrapper;
+import org.opendaylight.restconf.nb.rfc8040.streams.Configuration;
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.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
@Inject
public RestConfWiring(RestConfConfig config, WebServer webServer, ServletSupport jaxRS,
DOMSchemaService domSchemaService, DOMMountPointService domMountPointService, DOMRpcService domRpcService,
- DOMDataBroker domDataBroker, DOMNotificationService domNotificationService) {
+ DOMDataBroker domDataBroker, DOMNotificationService domNotificationService,
+ TransactionChainHandler transactionChainHandler, SchemaContextHandler schemaCtxHandler,
+ DOMMountPointServiceHandler domMountPointServiceHandler, ControllerContext controllerContext,
+ BrokerFacade broker, RestconfImpl restconf, StatisticsRestconfServiceWrapper stats,
+ ActionServiceHandler actionServiceHandler) {
this.webServer = webServer;
LOG.info("config = {}", config);
-
+ //TO DO: Need to get them from properties. In Restconf this is being got from following blue print
+ //netconf/restconf/restconf-nb-rfc8040/src/main/resources/OSGI-INF/blueprint/restconf-bp.xml
+ Configuration configuration = new Configuration(0, 30000, 10000, true);
// WebSocket
- ControllerContext controllerContext = ControllerContext.newInstance(domSchemaService, domMountPointService,
- domSchemaService);
- BrokerFacade broker = BrokerFacade.newInstance(domRpcService, domDataBroker, domNotificationService,
- controllerContext);
- RestconfImpl restconf = RestconfImpl.newInstance(broker, controllerContext);
- StatisticsRestconfServiceWrapper stats = StatisticsRestconfServiceWrapper.newInstance(restconf);
IpAddress wsIpAddress = IpAddressBuilder.getDefaultInstance(config.webSocketAddress().getHostAddress());
this.webSockerServer = new RestconfProviderImpl(stats, wsIpAddress, new PortNumber(config.webSocketPort()));
// Servlet
- TransactionChainHandler transactionChainHandler = new TransactionChainHandler(domDataBroker);
- SchemaContextHandler schemaCtxHandler = SchemaContextHandler.newInstance(transactionChainHandler,
- domSchemaService);
- schemaCtxHandler.init();
- DOMMountPointServiceHandler domMountPointServiceHandler = DOMMountPointServiceHandler
- .newInstance(domMountPointService);
DOMDataBrokerHandler domDataBrokerHandler = new DOMDataBrokerHandler(domDataBroker);
RpcServiceHandler rpcServiceHandler = new RpcServiceHandler(domRpcService);
NotificationServiceHandler notificationServiceHandler = new NotificationServiceHandler(domNotificationService);
ServicesWrapper servicesWrapper = ServicesWrapper.newInstance(schemaCtxHandler, domMountPointServiceHandler,
- transactionChainHandler, domDataBrokerHandler, rpcServiceHandler, notificationServiceHandler,
- domSchemaService);
+ transactionChainHandler, domDataBrokerHandler, rpcServiceHandler, actionServiceHandler,
+ notificationServiceHandler, domSchemaService, configuration);
// This is currently hard-coded to DRAFT_18; if we ever actually need to support the
// older DRAFT_02 for anything, then (only) add it to the RestConfConfig and switch here
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.micro.ConfigReader;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.serviceutils.upgrade.UpgradeState;
import org.opendaylight.serviceutils.upgrade.impl.UpgradeStateListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.serviceutils.upgrade.rev180702.UpgradeConfig;
import javax.inject.Inject;
import org.junit.Rule;
import org.junit.Test;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
import org.opendaylight.controller.micro.InMemoryControllerModule;
import org.opendaylight.infrautils.micro.testutils.AbstractSimpleDistributionTest;
-import org.opendaylight.mdsal.micro.PingPong;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.odlguice.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.odlguice.inject.guice.testutils.GuiceRule;
public @Rule GuiceRule guice = new GuiceRule(InMemoryControllerModule.class, AnnotationsModule.class);
@Inject DataBroker dataBroker;
- @Inject @PingPong DataBroker pingPongDataBroker;
+ @Inject DataBroker pingPongDataBroker;
@Inject NotificationService notificationService;
@Test public void testDataBroker() throws InterruptedException, ExecutionException {
import org.junit.Test;
import org.opendaylight.infrautils.diagstatus.DiagStatusService;
import org.opendaylight.infrautils.micro.DiagStatusModule;
-import org.opendaylight.infrautils.ready.guice.ReadyModule;
+import org.opendaylight.infrautils.micro.inject.guice.ready.GuiceReadyModule;
import org.opendaylight.infrautils.web.WebModule;
import org.opendaylight.odlguice.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.odlguice.inject.guice.testutils.GuiceRule;
*/
public class DiagStatusModuleTest {
- public @Rule GuiceRule guice = new GuiceRule(WebModule.class, DiagStatusModule.class, ReadyModule.class,
+ public @Rule GuiceRule guice = new GuiceRule(WebModule.class, DiagStatusModule.class, GuiceReadyModule.class,
AnnotationsModule.class);
@Inject DiagStatusService diagStatusService;
- @Test public void testDiagStatusService() { }
+ @Test public void testDiagStatusService() {
+
+ }
// TODO separate DiagStatusWiring0Test VS DiagStatusWiring1Test where *1* registers a
// Module that actually does bind a ServiceStatusProvider ...
package org.opendaylight.infrautils.micro.test;
import org.opendaylight.infrautils.micro.Main;
-import org.opendaylight.infrautils.ready.guice.ReadyModule;
+import org.opendaylight.infrautils.micro.inject.guice.ready.GuiceReadyModule;
import org.opendaylight.odlguice.inject.guice.testutils.AbstractGuiceJsr250Module;
/**
public static class TestModule extends AbstractGuiceJsr250Module {
@Override
protected void configureBindings() {
- install(new ReadyModule());
+ install(new GuiceReadyModule());
// bind(SomeInterfaceWithPostConstruct.class).to(SomeClassWithPostConstruct.class);
}
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.micro.PingPong;
import org.opendaylight.odlguice.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.odlguice.inject.guice.testutils.GuiceRule;
public @Rule GuiceRule guice = new GuiceRule(InMemoryControllerModule.class, AnnotationsModule.class);
- @Inject @PingPong DataBroker pingPongDataBroker;
+// @Inject DataBroker pingPongDataBroker;
@Inject DataBroker dataBroker;
@Inject RpcProviderService rpcProviderService;
import static org.opendaylight.infrautils.testutils.web.TestWebClient.Method.GET;
import java.io.IOException;
+import java.net.URISyntaxException;
import javax.inject.Inject;
import org.junit.Rule;
import org.junit.Test;
@Inject WebServer webServer;
@Inject TestWebClient http;
- @Test public void testRestConf() throws IOException {
- assertThat(http.request(GET, "/restconf/modules/").getStatus()).isEqualTo(200);
+ @Test public void testRestConf() throws IOException, InterruptedException, URISyntaxException {
+ assertThat(http.request(GET.name(), "/restconf/modules/").statusCode()).isEqualTo(200);
// TODO test security; add auth support to TestHttpClient, check that w.o. auth it's 401
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2018 Red Hat, Inc. and others. All rights reserved.
-
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
<relativePath>../</relativePath>
</parent>
- <groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-netconf</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<dependencies>
<artifactId>netconf-topology</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.netconf</groupId>
+ <artifactId>netconf-topology-impl</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-topology-singleton</artifactId>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>threadpool-config-impl</artifactId>
- <version>0.10.0</version>
</dependency>
<!--infrautils-->
<!--aaa-->
<dependency>
- <groupId>org.opendaylight.aaa</groupId>
- <artifactId>aaa-cert</artifactId>
- <version>0.9.0</version>
- <scope>compile</scope>
- </dependency>
-
- <!--controller-->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>blueprint</artifactId>
- <version>0.10.0</version>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>aaa-cert</artifactId>
<scope>compile</scope>
</dependency>
-
</dependencies>
<build>
public final class NetconfMain {
- private NetconfMain() { }
+ private NetconfMain() {
+ }
public static void main(String[] args) {
GuiceClassPathBinder classPathBinder = new GuiceClassPathBinder("org.opendaylight");
import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
import org.opendaylight.aaa.api.CredentialAuth;
+import org.opendaylight.aaa.api.PasswordCredentialAuth;
import org.opendaylight.aaa.api.PasswordCredentials;
import org.opendaylight.aaa.encrypt.AAAEncryptionService;
import org.opendaylight.aaa.micro.AAAModule;
import org.opendaylight.netconf.micro.annotations.GlobalNetconfSshScheduledExecutor;
import org.opendaylight.netconf.micro.annotations.MdsalNetconfConnector;
import org.opendaylight.netconf.micro.annotations.NetconfAuthProvider;
+import org.opendaylight.netconf.sal.connect.impl.DefaultSchemaResourceManager;
+import org.opendaylight.netconf.sal.connect.netconf.DeviceActionFactoryImpl;
+import org.opendaylight.netconf.sal.connect.netconf.schema.mapping.DefaultBaseNetconfSchemas;
import org.opendaylight.netconf.topology.api.NetconfTopology;
import org.opendaylight.netconf.topology.impl.NetconfTopologyImpl;
-import org.opendaylight.netconf.topology.impl.SchemaRepositoryProviderImpl;
import org.opendaylight.odlguice.inject.guice.AutoWiringModule;
import org.opendaylight.odlguice.inject.guice.GuiceClassPathBinder;
import org.opendaylight.odlguice.inject.guice.testutils.AnnotationsModule;
// Converted here from netconf-topology/src/main/resources/OSGI-INF/blueprint/netconf-topology.xml
// START
- @Provides
- @Singleton
- SchemaRepositoryProviderImpl getSchemaRepositoryProviderImpl(
- ServerChannelInitializer serverChannelInitializer,
- @GlobalBossGroup EventLoopGroup globalBossGroup,
- @GlobalWorkerGroup EventLoopGroup globalWorkerGroup) {
- return new SchemaRepositoryProviderImpl("shared-schema-repository-impl");
- }
-
+ /*
+ * @Provides
+ *
+ * @Singleton SchemaRepositoryProviderImpl getSchemaRepositoryProviderImpl(
+ * ServerChannelInitializer serverChannelInitializer,
+ *
+ * @GlobalBossGroup EventLoopGroup globalBossGroup,
+ *
+ * @GlobalWorkerGroup EventLoopGroup globalWorkerGroup) { return new
+ * SchemaRepositoryProviderImpl("shared-schema-repository-impl"); }
+ */
@Provides
@Singleton
NetconfTopology getNetconfTopology(@org.opendaylight.netconf.micro.annotations.NetconfClientDispatcher
NetconfClientDispatcher clientDispatcherDependency,
@GlobalNetconfSshScheduledExecutor ScheduledThreadPool keepAliveExecutor,
@GlobalNetconfProcessingExecutor ThreadPool processingExecutor,
- SchemaRepositoryProviderImpl schemaRepositoryProvider,
+ DefaultSchemaResourceManager defaultSchemaResourceManager,
@GlobalEventExecutor EventExecutor eventExecutor,
DataBroker dataBroker,
DOMMountPointService mountPointService,
- AAAEncryptionService encryptionService) {
+ AAAEncryptionService encryptionService,
+ DefaultBaseNetconfSchemas defaultBaseNetconfSchemas,
+ DeviceActionFactoryImpl deviceActionFactoryImpl) {
NetconfTopologyImpl impl = new NetconfTopologyImpl("topology-netconf",
clientDispatcherDependency,
eventExecutor,
keepAliveExecutor,
processingExecutor,
- schemaRepositoryProvider,
+ defaultSchemaResourceManager,
dataBroker,
mountPointService,
- encryptionService);
+ encryptionService,
+ defaultBaseNetconfSchemas,
+ deviceActionFactoryImpl);
impl.init();
return impl;
}
@Singleton
@NetconfAuthProvider
CredentialServiceAuthProvider getNetconfAuthProvider(CredentialAuth<PasswordCredentials> credService) {
- return new CredentialServiceAuthProvider(credService);
+ return new CredentialServiceAuthProvider((PasswordCredentialAuth) credService);
}
// Converted here from netconf/aaa-authn-odl-plugin/src/main/resources/OSGI-INF/blueprint/aaa-authn-netconf.xml
// END
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
-
import org.opendaylight.netconf.auth.AuthProvider;
/**
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-
import javax.inject.Qualifier;
/**
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2018 Red Hat, Inc. and others. All rights reserved.
-
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
<artifactId>micro-netvirt</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.netvirt</groupId>
+ <artifactId>netvirt-artifacts</artifactId>
+ <version>0.11.0-SNAPSHOT</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
<dependency>
<groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-genius</artifactId>
</exclusion>
</exclusions>
</dependency>
-
</dependencies>
<build>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2018 Red Hat, Inc. and others. All rights reserved.
-
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
<relativePath>../</relativePath>
</parent>
- <groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-openflowplugin</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-artifacts</artifactId>
- <version>0.8.0</version>
+ <version>0.11.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
<dependencies>
-
<dependency>
<groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-core</artifactId>
<groupId>org.opendaylight.openflowplugin.openflowjava</groupId>
<artifactId>openflow-protocol-spi</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin.openflowjava</groupId>
+ <artifactId>openflow-protocol-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin.openflowjava</groupId>
<artifactId>openflow-protocol-impl</artifactId>
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>testutils</artifactId>
- <version>0.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- TODO <scope>test</scope> instead of compile here once I'll create
a new infrautils:inject.guice.testutils (non-testutils) for the run-time part.. -->
</dependency>
- <!-- TODO remove, this is just a temporary hack, see above -->
+ <!-- TODO remove, this is just a temporary hack, see above -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<artifactId>inject.guice.extensions.jsr250</artifactId>
<scope>compile</scope>
</dependency>
-
</dependencies>
<build>
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.micro.ConfigReader;
+import org.opendaylight.openflowjava.protocol.impl.core.OpenflowDiagStatusProviderImpl;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList;
@Inject
public OpenFlowJavaWiring(ConfigReader configReader,
- SwitchConnectionProviderFactory switchConnectionProviderFactory) {
+ SwitchConnectionProviderFactory switchConnectionProviderFactory,
+ OpenflowDiagStatusProviderImpl openflowDiagStatusProviderImpl) {
SwitchConnectionConfig defaultSwitchConnConfig = configReader
.read("/initial/default-openflow-connection-config", SwitchConnectionConfig.class,
"openflow-switch-connection-provider-default-impl");
SwitchConnectionProvider defaultSwitchConnProvider = switchConnectionProviderFactory
- .newInstance(defaultSwitchConnConfig);
+ .newInstance(defaultSwitchConnConfig, openflowDiagStatusProviderImpl);
SwitchConnectionConfig legacySwitchConnConfig = configReader
.read("/initial/legacy-openflow-connection-config",SwitchConnectionConfig.class,
"openflow-switch-connection-provider-legacy-impl");
SwitchConnectionProvider legacySwitchConnProvider = switchConnectionProviderFactory
- .newInstance(legacySwitchConnConfig);
+ .newInstance(legacySwitchConnConfig, openflowDiagStatusProviderImpl);
switchConnectionProviderList = new SwitchConnectionProviderList(
newArrayList(defaultSwitchConnProvider, legacySwitchConnProvider));
import com.google.inject.Provides;
import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.micro.ConfigReader;
+import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.micro.PingPong;
import org.opendaylight.odlguice.inject.guice.AutoWiringModule;
import org.opendaylight.odlguice.inject.guice.GuiceClassPathBinder;
+import org.opendaylight.openflowjava.protocol.api.connection.OpenflowDiagStatusProvider;
+import org.opendaylight.openflowjava.protocol.impl.core.OpenflowDiagStatusProviderImpl;
import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderFactoryImpl;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory;
import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderList;
protected void configureMore() {
// TODO curious that this is needed despite SwitchConnectionProviderFactoryImpl being annotated?!
bind(SwitchConnectionProviderFactory.class).to(SwitchConnectionProviderFactoryImpl.class);
+ bind(OpenflowDiagStatusProvider.class).to(OpenflowDiagStatusProviderImpl.class);
}
@Provides
}
@Provides
- @Singleton PingPongDataBroker getPingPongDataBroker(@PingPong DataBroker pingPongDataBroker) {
- return new ForwardingPingPongDataBroker(pingPongDataBroker);
+ @Singleton PingPongDataBroker getPingPongDataBroker(DataBroker dataBroker) {
+ return new ForwardingPingPongDataBroker(dataBroker);
}
@Provides
public final class OpenflowPluginMain {
- private OpenflowPluginMain() { }
+ private OpenflowPluginMain() {
+ }
public static void main(String[] args) {
GuiceClassPathBinder classPathBinder = new GuiceClassPathBinder("org.opendaylight");
@Inject DiagStatusService diagStatus;
@Test public void testConfig() throws InterruptedException {
- assertThat(ofpConfig.getGlobalNotificationQuota()).named("globalNotificationQuota").isEqualTo(64000L);
- assertThat(frmConfig.getReconciliationRetryCount()).named("reconciliationRetryCount").isEqualTo(5);
+ assertThat(ofpConfig.getGlobalNotificationQuota().longValue()).isEqualTo(64000L);
+ assertThat(frmConfig.getReconciliationRetryCount().intValue()).isEqualTo(5);
}
@Test
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2018 Red Hat, Inc. and others. All rights reserved.
-
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<relativePath>../</relativePath>
</parent>
- <groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-ovsdb</artifactId>
- <version>1.0.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>hwvtepsouthbound-artifacts</artifactId>
- <version>1.8.0</version>
+ <version>1.11.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>library-artifacts</artifactId>
- <version>1.8.0</version>
+ <version>1.11.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-artifacts</artifactId>
- <version>1.8.0</version>
+ <version>1.11.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependencies>
-
<dependency>
<groupId>org.opendaylight.odlmicro</groupId>
<artifactId>micro-core</artifactId>
<dependency>
<groupId>org.opendaylight.aaa.web</groupId>
<artifactId>testutils</artifactId>
- <version>0.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- TODO <scope>test</scope> instead of compile here once I'll create
a new infrautils:inject.guice.testutils (non-testutils) for the run-time part.. -->
</dependency>
- <!-- TODO remove, this is just a temporary hack, see above -->
+ <!-- TODO remove, this is just a temporary hack, see above -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<artifactId>inject.guice.extensions.jsr250</artifactId>
<scope>compile</scope>
</dependency>
-
</dependencies>
<build>
import org.opendaylight.aaa.micro.CertModule;
import org.opendaylight.controller.micro.InMemoryControllerModule;
import org.opendaylight.infrautils.micro.DiagStatusModule;
+import org.opendaylight.infrautils.micro.inject.guice.ready.GuiceReadyModule;
import org.opendaylight.infrautils.micro.testutils.AbstractSimpleDistributionTest;
-import org.opendaylight.infrautils.ready.guice.ReadyModule;
import org.opendaylight.infrautils.web.WebModule;
import org.opendaylight.odlguice.inject.guice.GuiceClassPathBinder;
import org.opendaylight.odlguice.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
import org.opendaylight.ovsdb.micro.OvsdbModule;
import org.opendaylight.ovsdb.southbound.SouthboundProvider;
+import org.opendaylight.serviceutils.micro.UpgradeModule;
public class OvsdbModuleTest extends AbstractSimpleDistributionTest {
private static final GuiceClassPathBinder CLASS_PATH_BINDER = new GuiceClassPathBinder("org.opendaylight");
public @Rule GuiceRule guice = new GuiceRule(new OvsdbModule(CLASS_PATH_BINDER), new CertModule(),
- new InMemoryControllerModule(), new DiagStatusModule(), new WebModule(), new ReadyModule(),
- new AnnotationsModule());
+ new InMemoryControllerModule(), new DiagStatusModule(), new WebModule(), new GuiceReadyModule(),
+ new AnnotationsModule(), new UpgradeModule());
@Inject OvsdbConnection ovsdbConnection;
@Inject SouthboundProvider southboundProvider;
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.infrautils</groupId>
- <artifactId>parent</artifactId>
- <version>1.5.0</version>
- <relativePath />
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>bundle-parent</artifactId>
+ <version>7.0.5</version>
</parent>
<groupId>org.opendaylight.odlmicro</groupId>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>1.5.0</version>
+ <version>1.8.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-artifacts</artifactId>
- <version>2.1.8</version>
+ <version>5.0.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-artifacts</artifactId>
- <version>0.9.0</version>
+ <version>0.12.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>1.9.0</version>
+ <artifactId>controller-artifacts</artifactId>
+ <version>2.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>3.0.6</version>
+ <version>6.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>1.6.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.netconf</groupId>
- <artifactId>restconf-artifacts</artifactId>
- <version>1.9.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
-<!--
- <dependency>
- <groupId>org.opendaylight.neutron</groupId>
- <artifactId>neutron-artifacts</artifactId>
- <version>0.10.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.daexim</groupId>
- <artifactId>daexim-artifacts</artifactId>
- <version>1.3.0</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- -->
- <dependency>
- <groupId>org.opendaylight.netvirt</groupId>
- <artifactId>netvirt-artifacts</artifactId>
- <version>0.8.0</version>
+ <version>1.9.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencyManagement>
<dependencies>
-
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>compile</scope>
</dependency>
- <!-- Logging related -->
+ <!-- Logging related -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
-
- <!--controller-->
+ <!--controller -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>blueprint</artifactId>
- <version>0.10.0</version>
- <scope>compile</scope>
- </dependency>
-
- <!--mdsal-->
- <dependency>
- <!-- TODO remove this temporary v0.1 hack; see org.opendaylight.controller.micro.ControllerModule -->
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <type>test-jar</type>
+ <version>2.0.3</version>
<scope>compile</scope>
-<!-- TODO
- <exclusions>
- <exclusion>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- </exclusions>
- -->
</dependency>
-
</dependencies>
<modules>
<module>micro-core</module>