handle the impacts of netconf using the mdsal instead of controller APIs
authorMichael Vorburger <mike@vorburger.ch>
Tue, 18 Dec 2018 19:29:30 +0000 (20:29 +0100)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:37:45 +0000 (01:37 +0200)
Signed-off-by: Michael Vorburger <mike@vorburger.ch>
pom.xml
src/main/java/org/opendaylight/mdsal/simple/MdsalWiring.java
src/main/java/org/opendaylight/restconf/simple/RestConfWiring.java

diff --git a/pom.xml b/pom.xml
index 18e7b496d351e95a1f1e26f0637c8c66311d9364..245917f3ff094c2b416955917df00ff59a52056a 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <type>pom</type>
         <scope>import</scope>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yangtools-artifacts</artifactId>
+        <version>2.1.5</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>mdsal-artifacts</artifactId>
@@ -48,7 +55,7 @@
       <dependency>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>mdsal-artifacts</artifactId>
-        <version>3.0.1</version>
+        <version>3.0.2</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
       <groupId>org.opendaylight.infrautils</groupId>
       <artifactId>caches-standard-impl</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>util</artifactId>
+    </dependency>
 
     <!-- Logging related -->
     <dependency>
index 0bc9bcf676f3bdf4057576c2fc47067b7780cc7c..5ade6d4a0bec67a3f312bcf1ba12ad9ab4999050 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ * Copyright (c) 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,
@@ -10,12 +10,19 @@ package org.opendaylight.mdsal.simple;
 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.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.broker.DOMMountPointServiceImpl;
 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;
 
+@SuppressWarnings("deprecation") // sure, but that's the point of this class...
 public class MdsalWiring extends AbstractModule {
 
     @Override
@@ -23,6 +30,24 @@ public class MdsalWiring extends AbstractModule {
         bind(DOMEntityOwnershipService.class).to(SimpleDOMEntityOwnershipService.class);
     }
 
+    @Provides
+    @Singleton DOMDataBroker getDOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker controllerDDB) {
+        return new DOMDataBrokerAdapter(controllerDDB);
+    }
+
+    @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) {
index 881b03d944dd2737d21699e474e9b15094f1ade7..5777cf394b37415dc76902b3c60cea2d4768a320 100644 (file)
@@ -19,10 +19,10 @@ import org.opendaylight.aaa.web.WebContext;
 import org.opendaylight.aaa.web.WebContextRegistration;
 import org.opendaylight.aaa.web.WebServer;
 import org.opendaylight.aaa.web.servlet.ServletSupport;
-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.api.DOMRpcService;
+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.DOMRpcService;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;