X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnect%2Fnetconf%2Fsal%2FNetconfDeviceSalProvider.java;h=6b96e25fae479770f21d22ccc973d5683e51164c;hb=469a10465ebe09a9199c9316917e13dfd525e11c;hp=bf870bf36a07ccd421f86e9eeba1571ad73f0e5e;hpb=e433e0aa67cc6d144cd3d8d6117de864eb7ebf97;p=controller.git diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java index bf870bf36a..6b96e25fae 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java @@ -32,7 +32,6 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding private static final Logger logger = LoggerFactory.getLogger(NetconfDeviceSalProvider.class); private final RemoteDeviceId id; - private volatile NetconfDeviceDatastoreAdapter datastoreAdapter; private MountInstance mountInstance; private volatile NetconfDeviceTopologyAdapter topologyDatastoreAdapter; @@ -47,12 +46,6 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding return mountInstance; } - public NetconfDeviceDatastoreAdapter getDatastoreAdapter() { - Preconditions.checkState(datastoreAdapter != null, - "%s: Sal provider %s was not initialized by sal. Cannot get datastore adapter", id); - return datastoreAdapter; - } - public NetconfDeviceTopologyAdapter getTopologyDatastoreAdapter() { Preconditions.checkState(topologyDatastoreAdapter != null, "%s: Sal provider %s was not initialized by sal. Cannot get topology datastore adapter", id); @@ -79,15 +72,12 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding logger.debug("{}: Session with sal established {}", id, session); final DataBroker dataBroker = session.getSALService(DataBroker.class); - datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker); topologyDatastoreAdapter = new NetconfDeviceTopologyAdapter(id, dataBroker); } public void close() throws Exception { mountInstance.close(); - datastoreAdapter.close(); - datastoreAdapter = null; topologyDatastoreAdapter.close(); topologyDatastoreAdapter = null; } @@ -96,7 +86,6 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding private DOMMountPointService mountService; private final RemoteDeviceId id; - private ObjectRegistration registration; private NetconfDeviceNotificationService notificationService; private ObjectRegistration topologyRegistration; @@ -106,44 +95,6 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding this.id = Preconditions.checkNotNull(id); } - @Deprecated - synchronized void onDeviceConnected(final SchemaContext initialCtx, - final DOMDataBroker broker, final DOMRpcService rpc, - final NetconfDeviceNotificationService notificationService) { - - Preconditions.checkNotNull(mountService, "Closed"); - Preconditions.checkState(registration == null, "Already initialized"); - - final DOMMountPointService.DOMMountPointBuilder mountBuilder = mountService.createMountPoint(id.getPath()); - mountBuilder.addInitialSchemaContext(initialCtx); - - mountBuilder.addService(DOMDataBroker.class, broker); - mountBuilder.addService(DOMRpcService.class, rpc); - mountBuilder.addService(DOMNotificationService.class, notificationService); - this.notificationService = notificationService; - - registration = mountBuilder.register(); - logger.debug("{}: Mountpoint exposed into MD-SAL {}", id, registration); - } - - @Deprecated - synchronized void onDeviceDisconnected() { - if(registration == null) { - logger.trace("{}: Not removing mountpoint from MD-SAL, mountpoint was not registered yet", id); - return; - } - - try { - registration.close(); - } catch (final Exception e) { - // Only log and ignore - logger.warn("Unable to unregister mount instance for {}. Ignoring exception", id.getPath(), e); - } finally { - logger.debug("{}: Mountpoint removed from MD-SAL {}", id, registration); - registration = null; - } - } - synchronized void onTopologyDeviceConnected(final SchemaContext initialCtx, final DOMDataBroker broker, final DOMRpcService rpc, final NetconfDeviceNotificationService notificationService) { @@ -157,9 +108,10 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding mountBuilder.addService(DOMDataBroker.class, broker); mountBuilder.addService(DOMRpcService.class, rpc); mountBuilder.addService(DOMNotificationService.class, notificationService); + this.notificationService = notificationService; topologyRegistration = mountBuilder.register(); - logger.debug("{}: TOPOLOGY Mountpoint exposed into MD-SAL {}", id, registration); + logger.debug("{}: TOPOLOGY Mountpoint exposed into MD-SAL {}", id, topologyRegistration); } @@ -175,14 +127,13 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding // Only log and ignore logger.warn("Unable to unregister mount instance for {}. Ignoring exception", id.getTopologyPath(), e); } finally { - logger.debug("{}: TOPOLOGY Mountpoint removed from MD-SAL {}", id, registration); + logger.debug("{}: TOPOLOGY Mountpoint removed from MD-SAL {}", id, topologyRegistration); topologyRegistration = null; } } @Override synchronized public void close() throws Exception { - onDeviceDisconnected(); onTopologyDeviceDisconnected(); mountService = null; }