Create NetconfDataTreeService with base and additional operations for netconf
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / NetconfDeviceSalProvider.java
index ead5348311672a507919a2fd0e645bc113fc75a3..8c77933ac3ff5f8e435599b1916fa75691ef0186 100644 (file)
@@ -23,9 +23,10 @@ import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMNotification;
 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
 import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.netconf.dom.api.NetconfDataTreeService;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -117,14 +118,14 @@ public class NetconfDeviceSalProvider implements AutoCloseable {
             this.id = requireNonNull(id);
         }
 
-        public void onTopologyDeviceConnected(final SchemaContext initialCtx,
+        public void onTopologyDeviceConnected(final EffectiveModelContext initialCtx,
                 final DOMDataBroker broker, final DOMRpcService rpc,
                 final NetconfDeviceNotificationService newNotificationService) {
-            onTopologyDeviceConnected(initialCtx, broker, rpc, newNotificationService, null);
+            onTopologyDeviceConnected(initialCtx, broker, null, rpc, newNotificationService, null);
         }
 
-        public synchronized void onTopologyDeviceConnected(final SchemaContext initialCtx,
-                final DOMDataBroker broker, final DOMRpcService rpc,
+        public synchronized void onTopologyDeviceConnected(final EffectiveModelContext initialCtx,
+                final DOMDataBroker broker, final NetconfDataTreeService netconfService, final DOMRpcService rpc,
                 final NetconfDeviceNotificationService newNotificationService, final DOMActionService deviceAction) {
             requireNonNull(mountService, "Closed");
             checkState(topologyRegistration == null, "Already initialized");
@@ -133,12 +134,17 @@ public class NetconfDeviceSalProvider implements AutoCloseable {
                     mountService.createMountPoint(id.getTopologyPath());
             mountBuilder.addInitialSchemaContext(initialCtx);
 
-            mountBuilder.addService(DOMDataBroker.class, broker);
+            if (broker != null) {
+                mountBuilder.addService(DOMDataBroker.class, broker);
+            }
             mountBuilder.addService(DOMRpcService.class, rpc);
             mountBuilder.addService(DOMNotificationService.class, newNotificationService);
             if (deviceAction != null) {
                 mountBuilder.addService(DOMActionService.class, deviceAction);
             }
+            if (netconfService != null) {
+                mountBuilder.addService(NetconfDataTreeService.class, netconfService);
+            }
             this.notificationService = newNotificationService;
 
             topologyRegistration = mountBuilder.register();