deal with ODL Neon MRI base platform upgrade impacts
authorMichael Vorburger <mike@vorburger.ch>
Mon, 29 Oct 2018 18:25:14 +0000 (19:25 +0100)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:37:33 +0000 (01:37 +0200)
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
12 files changed:
pom.xml
src/main/java/org/opendaylight/controller/simple/ControllerWiring.java
src/main/java/org/opendaylight/genius/simple/GeniusWiring.java
src/main/java/org/opendaylight/infrautils/karaf/KarafStandaloneShell.java
src/main/java/org/opendaylight/infrautils/simple/CachesWiring.java
src/main/java/org/opendaylight/infrautils/simple/ReadyWiring.java
src/main/java/org/opendaylight/mdsal/simple/MdsalWiring.java
src/main/java/org/opendaylight/netvirt/simple/AclServiceWiring.java
src/main/java/org/opendaylight/neutron/simple/NeutronModule.java
src/test/java/org/opendaylight/aaa/simple/test/AAAWiringTest.java
src/test/java/org/opendaylight/mdsal/simple/test/MdsalWiringTest.java [deleted file]
src/test/java/org/opendaylight/netvirt/simple/test/NetvirtSimpleDistributionTest.java

diff --git a/pom.xml b/pom.xml
index 36638d3d2f366ac620b1383786f1816c41a13767..4129d7585568a3ab55cc744cb6ccef1ce666320b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -48,7 +48,7 @@
       <dependency>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>mdsal-artifacts</artifactId>
-        <version>2.6.0-SNAPSHOT</version>
+        <version>3.0.1</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
     </dependency>
 -->
 
-    <!-- TODO Replace pax-cdi-api with blueprint-maven-plugin-annotation after Neon-MRI -->
     <dependency>
-      <groupId>org.ops4j.pax.cdi</groupId>
-      <artifactId>pax-cdi-api</artifactId>
+      <groupId>org.apache.aries.blueprint</groupId>
+      <artifactId>blueprint-maven-plugin-annotation</artifactId>
       <optional>true</optional>
     </dependency>
     <!-- TODO Remove pax-web-api dependency eventually -->
     <dependency>
       <groupId>org.ops4j.pax.web</groupId>
       <artifactId>pax-web-api</artifactId>
-      <version>6.1.1</version>
     </dependency>
 
     <dependency>
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-slf4j-impl</artifactId>
-      <version>2.11.1</version>
     </dependency>
 
     <dependency>
       <scope>compile</scope>
     </dependency>
 
+    <!-- TODO remove when infrautils' ClasspathHellDuplicatesCheckRule pulls in classgraph, see https://git.opendaylight.org/gerrit/#/c/76625/ -->
     <dependency>
       <groupId>io.github.classgraph</groupId>
       <artifactId>classgraph</artifactId>
       </plugin>
       <plugin>
         <artifactId>maven-jar-plugin</artifactId>
-        <!-- TODO remove version once odlparent is up-to-date (currently still 3.0.2) -->
-        <version>3.1.0</version>
         <configuration>
           <archive>
             <manifest>
index c8b2e1fd84b5ae26ae7f601ebfc9b5be3b4fc746..acd7a9164a1bc3cd04e65fc55e7f99cf611715be 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.controller.md.sal.binding.test.DataBrokerTestModule;
 import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
 import org.opendaylight.infrautils.inject.guice.AbstractCloseableModule;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.ops4j.pax.cdi.api.OsgiService;
+import org.opendaylight.mdsal.simple.MdsalWiring;
 
 @SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
 public class ControllerWiring extends AbstractCloseableModule {
@@ -29,11 +29,12 @@ public class ControllerWiring extends AbstractCloseableModule {
 
     @Override
     protected void configureCloseables() {
+        install(new MdsalWiring());
+
         // TODO this is just for early stage POC! switch to real CDS wiring here, eventually..
         DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(true);
         DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
         bind(DataBroker.class).toInstance(dataBroker);
-        bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
 
         bindingToNormalizedNodeCodec = dataBrokerTestModule.getBindingToNormalizedNodeCodec();
         domNotificationPublishService = dataBrokerTestModule.getDOMNotificationRouter();
index 0b6a4d4c4113e07180d1ae6419cf423ffc6e164b..d5395bc145e8b2afd7568c7a84a89201d13155aa 100644 (file)
@@ -8,15 +8,14 @@
 package org.opendaylight.genius.simple;
 
 import com.google.inject.AbstractModule;
+import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.daexim.DataImportBootReady;
 import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
 import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
 import org.opendaylight.infrautils.simple.InfraUtilsWiring;
-import org.opendaylight.mdsal.simple.MdsalWiring;
 import org.opendaylight.neutron.simple.NeutronModule;
 import org.opendaylight.openflowplugin.simple.OpenFlowPluginWiring;
 import org.opendaylight.serviceutils.simple.ServiceUtilsWiring;
-import org.ops4j.pax.cdi.api.OsgiService;
 
 public class GeniusWiring extends AbstractModule {
 
@@ -35,11 +34,11 @@ public class GeniusWiring extends AbstractModule {
         install(new InfraUtilsWiring());
 
         // MD SAL
-        install(new MdsalWiring());
+        install(new ControllerWiring());
 
         // Daexim
         // TODO write real DaeximWiring, and replace this line with an install(new DaeximWiring());
-        bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {});
+        bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {});
 
         // Neutron
         install(new NeutronModule());
index a58651ee2afdf214c636d820e8c5f30681bddabb..aa538c30af15d8ba50235cc7326e47a24850644c 100644 (file)
@@ -11,6 +11,8 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.inject.Injector;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Set;
 import org.apache.karaf.shell.api.action.Action;
 import org.apache.karaf.shell.api.console.Session;
@@ -37,6 +39,7 @@ public class KarafStandaloneShell {
     }
 
     @VisibleForTesting
+    // TODO This should ideally only be in src/test, not src/main ...
     public void testAllRegisteredCommands() throws Exception {
         karafMain.testAllRegisteredCommands();
     }
@@ -54,13 +57,22 @@ public class KarafStandaloneShell {
         }
 
         @SuppressWarnings("checkstyle:RegexpSingleLineJava")
+        // TODO This should ideally only be in src/test, not src/main ...
         private void testAllRegisteredCommands() throws Exception {
             SessionFactory sessionFactory = createSessionFactory(null);
-            Session session = createSession(sessionFactory, null, System.out, System.err, null);
+            Session session = createSession(sessionFactory, new EmptyInputStream(), System.out, System.err, null);
             discoverCommands(session, getClass().getClassLoader(), null);
             for (Action action : actions) {
                 manager.instantiate(action.getClass());
             }
         }
     }
+
+    // TODO when we're on Java 11, replace this with InputStream.nullInputStream()
+    private static class EmptyInputStream extends InputStream {
+        @Override
+        public int read() throws IOException {
+            return -1;
+        }
+    }
 }
index 23ae8f5e61e0fd6a32ba4cf732ad810306f9294a..c0cba32e1ea9b2c775098808cabd7dd8c35ef291 100644 (file)
@@ -12,15 +12,12 @@ import org.opendaylight.infrautils.caches.CacheProvider;
 import org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry;
 import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
 import org.opendaylight.infrautils.caches.standard.StandardCacheProvider;
-import org.ops4j.pax.cdi.api.OsgiService;
 
 public class CachesWiring extends AbstractModule {
 
     @Override
     protected void configure() {
         bind(CacheManagersRegistry.class).to(CacheManagersRegistryImpl.class);
-        bind(CacheProvider.class).annotatedWith(OsgiService.class).to(StandardCacheProvider.class);
         bind(CacheProvider.class).to(StandardCacheProvider.class);
     }
-
 }
index f3b0b4f096322b1dd3b108ac22b2654d9d654265..2042516cade3c95789441863bcb114a04ce072a4 100644 (file)
@@ -11,7 +11,6 @@ import com.google.inject.AbstractModule;
 import org.opendaylight.infrautils.inject.PostFullSystemInjectionListener;
 import org.opendaylight.infrautils.ready.SystemReadyMonitor;
 import org.opendaylight.infrautils.ready.spi.SimpleSystemReadyMonitor;
-import org.ops4j.pax.cdi.api.OsgiService;
 
 public class ReadyWiring extends AbstractModule implements PostFullSystemInjectionListener {
 
@@ -20,7 +19,6 @@ public class ReadyWiring extends AbstractModule implements PostFullSystemInjecti
     @Override
     protected void configure() {
         bind(SystemReadyMonitor.class).toInstance(systemReadyMonitor);
-        bind(SystemReadyMonitor.class).annotatedWith(OsgiService.class).toInstance(systemReadyMonitor);
         bind(PostFullSystemInjectionListener.class).toInstance(this);
     }
 
index 76dbebe74f33690a42fa4aa5487b609a660c49fc..0bc9bcf676f3bdf4057576c2fc47067b7780cc7c 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.mdsal.simple;
 import com.google.inject.AbstractModule;
 import com.google.inject.Provides;
 import javax.inject.Singleton;
-import org.opendaylight.controller.simple.ControllerWiring;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
 import org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter;
@@ -21,8 +20,6 @@ public class MdsalWiring extends AbstractModule {
 
     @Override
     protected void configure() {
-        install(new ControllerWiring());
-
         bind(DOMEntityOwnershipService.class).to(SimpleDOMEntityOwnershipService.class);
     }
 
@@ -31,5 +28,4 @@ public class MdsalWiring extends AbstractModule {
             DOMEntityOwnershipService domService, BindingNormalizedNodeSerializer conversionCodec) {
         return new BindingDOMEntityOwnershipServiceAdapter(domService, conversionCodec);
     }
-
 }
index 80e82d9961d5e635304a6b8bbc3e4a61b7b3a217..bd47554e46af4d9ea4ee93183728ccba98ce5a1f 100644 (file)
@@ -26,5 +26,4 @@ public class AclServiceWiring extends AbstractModule {
         bind(AclInterfaceListener.class);
         bind(AclEventListener.class);
     }
-
 }
index b6ee3b210781155b1a99ad30a8ff046f68bb5f85..42ede6a34c1e1b1638c6f937cd8fcf6781b39247 100644 (file)
@@ -71,7 +71,6 @@ import org.opendaylight.neutron.transcriber.NeutronVpnIkePolicyInterface;
 import org.opendaylight.neutron.transcriber.NeutronVpnIpSecPolicyInterface;
 import org.opendaylight.neutron.transcriber.NeutronVpnIpSecSiteConnectionsInterface;
 import org.opendaylight.neutron.transcriber.NeutronVpnServiceInterface;
-import org.ops4j.pax.cdi.api.OsgiService;
 
 /**
  * Guice module for Neutron.
@@ -87,47 +86,37 @@ public class NeutronModule extends AbstractModule {
         // The following is currently copy/pasted from
         // org.opendaylight.neutron.e2etest.NeutronTestWiring
         // but likely will get replaced with automated classpath scanning anyway later
-        // (strangely though it needs .annotatedWith(OsgiService.class) everywhere, only here)
-        bind(INeutronNetworkCRUD.class).annotatedWith(OsgiService.class).to(NeutronNetworkInterface.class);
-        bind(INeutronSubnetCRUD.class).annotatedWith(OsgiService.class).to(NeutronSubnetInterface.class);
-        bind(INeutronPortCRUD.class).annotatedWith(OsgiService.class).to(NeutronPortInterface.class);
-        bind(INeutronRouterCRUD.class).annotatedWith(OsgiService.class).to(NeutronRouterInterface.class);
-        bind(INeutronFloatingIpCRUD.class).annotatedWith(OsgiService.class).to(NeutronFloatingIpInterface.class);
-        bind(INeutronSecurityGroupCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityGroupInterface.class);
-        bind(INeutronSecurityRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityRuleInterface.class);
-        bind(INeutronFirewallCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallInterface.class);
-        bind(INeutronFirewallPolicyCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronFirewallPolicyInterface.class);
-        bind(INeutronFirewallRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallRuleInterface.class);
-        bind(INeutronLoadBalancerCRUD.class).annotatedWith(OsgiService.class).to(NeutronLoadBalancerInterface.class);
-        bind(INeutronLoadBalancerListenerCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronLoadBalancerListenerInterface.class);
-        bind(INeutronLoadBalancerPoolCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronLoadBalancerPoolInterface.class);
-        bind(INeutronBgpvpnCRUD.class).annotatedWith(OsgiService.class).to(NeutronBgpvpnInterface.class);
-        bind(INeutronL2gatewayCRUD.class).annotatedWith(OsgiService.class).to(NeutronL2gatewayInterface.class);
-        bind(INeutronL2gatewayConnectionCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronL2gatewayConnectionInterface.class);
-        bind(INeutronLoadBalancerHealthMonitorCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronLoadBalancerHealthMonitorInterface.class);
-        bind(INeutronMeteringLabelCRUD.class).annotatedWith(OsgiService.class).to(NeutronMeteringLabelInterface.class);
-        bind(INeutronMeteringLabelRuleCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronMeteringLabelRuleInterface.class);
-        bind(INeutronVpnServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnServiceInterface.class);
-        bind(INeutronVpnIkePolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnIkePolicyInterface.class);
-        bind(INeutronVpnIpSecPolicyCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronVpnIpSecPolicyInterface.class);
-        bind(INeutronSFCFlowClassifierCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronSFCFlowClassifierInterface.class);
-        bind(INeutronSFCPortChainCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortChainInterface.class);
-        bind(INeutronSFCPortPairGroupCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronSFCPortPairGroupInterface.class);
-        bind(INeutronSFCPortPairCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortPairInterface.class);
-        bind(INeutronQosPolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronQosPolicyInterface.class);
-        bind(INeutronTrunkCRUD.class).annotatedWith(OsgiService.class).to(NeutronTrunkInterface.class);
-        bind(INeutronTapServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapServiceInterface.class);
-        bind(INeutronTapFlowCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapFlowInterface.class);
-        bind(INeutronVpnIpSecSiteConnectionsCRUD.class).annotatedWith(OsgiService.class)
-                .to(NeutronVpnIpSecSiteConnectionsInterface.class);
+        // (strangely though it needs  everywhere, only here)
+        bind(INeutronNetworkCRUD.class).to(NeutronNetworkInterface.class);
+        bind(INeutronSubnetCRUD.class).to(NeutronSubnetInterface.class);
+        bind(INeutronPortCRUD.class).to(NeutronPortInterface.class);
+        bind(INeutronRouterCRUD.class).to(NeutronRouterInterface.class);
+        bind(INeutronFloatingIpCRUD.class).to(NeutronFloatingIpInterface.class);
+        bind(INeutronSecurityGroupCRUD.class).to(NeutronSecurityGroupInterface.class);
+        bind(INeutronSecurityRuleCRUD.class).to(NeutronSecurityRuleInterface.class);
+        bind(INeutronFirewallCRUD.class).to(NeutronFirewallInterface.class);
+        bind(INeutronFirewallPolicyCRUD.class).to(NeutronFirewallPolicyInterface.class);
+        bind(INeutronFirewallRuleCRUD.class).to(NeutronFirewallRuleInterface.class);
+        bind(INeutronLoadBalancerCRUD.class).to(NeutronLoadBalancerInterface.class);
+        bind(INeutronLoadBalancerListenerCRUD.class).to(NeutronLoadBalancerListenerInterface.class);
+        bind(INeutronLoadBalancerPoolCRUD.class).to(NeutronLoadBalancerPoolInterface.class);
+        bind(INeutronBgpvpnCRUD.class).to(NeutronBgpvpnInterface.class);
+        bind(INeutronL2gatewayCRUD.class).to(NeutronL2gatewayInterface.class);
+        bind(INeutronL2gatewayConnectionCRUD.class).to(NeutronL2gatewayConnectionInterface.class);
+        bind(INeutronLoadBalancerHealthMonitorCRUD.class).to(NeutronLoadBalancerHealthMonitorInterface.class);
+        bind(INeutronMeteringLabelCRUD.class).to(NeutronMeteringLabelInterface.class);
+        bind(INeutronMeteringLabelRuleCRUD.class).to(NeutronMeteringLabelRuleInterface.class);
+        bind(INeutronVpnServiceCRUD.class).to(NeutronVpnServiceInterface.class);
+        bind(INeutronVpnIkePolicyCRUD.class).to(NeutronVpnIkePolicyInterface.class);
+        bind(INeutronVpnIpSecPolicyCRUD.class).to(NeutronVpnIpSecPolicyInterface.class);
+        bind(INeutronSFCFlowClassifierCRUD.class).to(NeutronSFCFlowClassifierInterface.class);
+        bind(INeutronSFCPortChainCRUD.class).to(NeutronSFCPortChainInterface.class);
+        bind(INeutronSFCPortPairGroupCRUD.class).to(NeutronSFCPortPairGroupInterface.class);
+        bind(INeutronSFCPortPairCRUD.class).to(NeutronSFCPortPairInterface.class);
+        bind(INeutronQosPolicyCRUD.class).to(NeutronQosPolicyInterface.class);
+        bind(INeutronTrunkCRUD.class).to(NeutronTrunkInterface.class);
+        bind(INeutronTapServiceCRUD.class).to(NeutronTapServiceInterface.class);
+        bind(INeutronTapFlowCRUD.class).to(NeutronTapFlowInterface.class);
+        bind(INeutronVpnIpSecSiteConnectionsCRUD.class).to(NeutronVpnIpSecSiteConnectionsInterface.class);
     }
 }
index 0c25ac9ccff037af751c49adae9f7559be76d509..5774b303a2500ff461d2c3f3357e9bd3f3b2bdd2 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTe
 public class AAAWiringTest extends AbstractSimpleDistributionTest {
 
     public @Rule GuiceRule guice = new GuiceRule(new AAAWiring(), new ControllerWiring(),
-            // TODO new WebWiring(true), new OsgiServicesWiring(),
+            // TODO new WebWiring(true), new ReferencesWiring(),
             new AnnotationsModule());
 
 }
diff --git a/src/test/java/org/opendaylight/mdsal/simple/test/MdsalWiringTest.java b/src/test/java/org/opendaylight/mdsal/simple/test/MdsalWiringTest.java
deleted file mode 100644 (file)
index bae90bb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 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.simple.test;
-
-import org.junit.Rule;
-import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
-import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
-import org.opendaylight.mdsal.simple.MdsalWiring;
-
-public class MdsalWiringTest extends AbstractSimpleDistributionTest {
-
-    public @Rule GuiceRule guice = new GuiceRule(
-            /* ControllerWiring.class, */ MdsalWiring.class, AnnotationsModule.class);
-
-}
index d49a79f32956b853d1584bdbf3921e9d093805ed..07c177c7b5c48d72b5ec8377836e5aa22e4fe4ee 100644 (file)
@@ -9,7 +9,9 @@ package org.opendaylight.netvirt.simple.test;
 
 import org.junit.Ignore;
 import org.junit.Rule;
+import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
+import org.opendaylight.infrautils.simple.ShellTestWiring;
 import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
 import org.opendaylight.netvirt.simple.NetvirtWiring;
 
@@ -21,6 +23,8 @@ import org.opendaylight.netvirt.simple.NetvirtWiring;
 @Ignore // TODO un-ignore netvirt, once genius works...
 public class NetvirtSimpleDistributionTest extends AbstractSimpleDistributionTest {
 
-    public @Rule GuiceRule2 guice = new GuiceRule2(NetvirtWiring.class);
+    private static final GuiceClassPathBinder CLASS_PATH_BINDER = new GuiceClassPathBinder("org.opendaylight");
+
+    public @Rule GuiceRule2 guice = new GuiceRule2(new NetvirtWiring(CLASS_PATH_BINDER), new ShellTestWiring());
 
 }