Bump upstreams
[netconf.git] / apps / netconf-topology-singleton / src / main / java / org / opendaylight / netconf / topology / singleton / impl / NetconfNodeManager.java
index 04fbd3204e4d243343875a54a1dbdf4278721866..d22952a014b3c345b4b2bcfff764dc5baf67dda9 100644 (file)
@@ -14,11 +14,11 @@ import akka.dispatch.OnComplete;
 import akka.pattern.AskTimeoutException;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
-import java.util.Collection;
+import java.util.List;
 import org.checkerframework.checker.lock.qual.GuardedBy;
 import org.checkerframework.checker.lock.qual.Holding;
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
+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;
@@ -35,7 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev23
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,14 +44,14 @@ import org.slf4j.LoggerFactory;
  * Managing and reacting on data tree changes in specific netconf node when master writes status to the operational
  * data store (e.g. handling lifecycle of slave mount point).
  */
-class NetconfNodeManager implements ClusteredDataTreeChangeListener<Node>, AutoCloseable {
+class NetconfNodeManager implements DataTreeChangeListener<Node>, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(NetconfNodeManager.class);
 
     private final Timeout actorResponseWaitTime;
     private final DOMMountPointService mountPointService;
 
     private volatile NetconfTopologySetup setup;
-    private volatile ListenerRegistration<NetconfNodeManager> dataChangeListenerRegistration;
+    private volatile Registration dataChangeListenerRegistration;
     private volatile RemoteDeviceId id;
 
     @GuardedBy("this")
@@ -72,23 +72,22 @@ class NetconfNodeManager implements ClusteredDataTreeChangeListener<Node>, AutoC
     }
 
     @Override
-    public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) {
-        for (final DataTreeModification<Node> change : changes) {
-            final DataObjectModification<Node> rootNode = change.getRootNode();
-            final NodeId nodeId = NetconfTopologyUtils.getNodeId(rootNode.getIdentifier());
-            switch (rootNode.getModificationType()) {
+    public void onDataTreeChanged(final List<DataTreeModification<Node>> changes) {
+        for (var change : changes) {
+            final var rootNode = change.getRootNode();
+            final NodeId nodeId = NetconfTopologyUtils.getNodeId(rootNode.step());
+            switch (rootNode.modificationType()) {
                 case SUBTREE_MODIFIED:
-                    LOG.debug("{}: Operational state for node {} - subtree modified from {} to {}",
-                            id, nodeId, rootNode.getDataBefore(), rootNode.getDataAfter());
+                    LOG.debug("{}: Operational state for node {} - subtree modified from {} to {}", id, nodeId,
+                        rootNode.dataBefore(), rootNode.dataAfter());
                     handleSlaveMountPoint(rootNode);
                     break;
                 case WRITE:
-                    if (rootNode.getDataBefore() != null) {
-                        LOG.debug("{}: Operational state for node {} updated from {} to {}",
-                                id, nodeId, rootNode.getDataBefore(), rootNode.getDataAfter());
+                    if (rootNode.dataBefore() != null) {
+                        LOG.debug("{}: Operational state for node {} updated from {} to {}", id, nodeId,
+                            rootNode.dataBefore(), rootNode.dataAfter());
                     } else {
-                        LOG.debug("{}: Operational state for node {} created: {}",
-                                id, nodeId, rootNode.getDataAfter());
+                        LOG.debug("{}: Operational state for node {} created: {}", id, nodeId, rootNode.dataAfter());
                     }
                     handleSlaveMountPoint(rootNode);
                     break;
@@ -136,8 +135,8 @@ class NetconfNodeManager implements ClusteredDataTreeChangeListener<Node>, AutoC
     void registerDataTreeChangeListener(final String topologyId, final NodeKey key) {
         final InstanceIdentifier<Node> path = NetconfTopologyUtils.createTopologyNodeListPath(key, topologyId);
         LOG.debug("{}: Registering data tree change listener on path {}", id, path);
-        dataChangeListenerRegistration = setup.getDataBroker().registerDataTreeChangeListener(
-                DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, path), this);
+        dataChangeListenerRegistration = setup.getDataBroker().registerTreeChangeListener(
+                DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL, path), this);
     }
 
     private synchronized void handleSlaveMountPoint(final DataObjectModification<Node> rootNode) {
@@ -146,7 +145,7 @@ class NetconfNodeManager implements ClusteredDataTreeChangeListener<Node>, AutoC
         }
 
         @SuppressWarnings("ConstantConditions")
-        final NetconfNode netconfNodeAfter = rootNode.getDataAfter().augmentation(NetconfNode.class);
+        final NetconfNode netconfNodeAfter = rootNode.dataAfter().augmentation(NetconfNode.class);
 
         if (ConnectionStatus.Connected == netconfNodeAfter.getConnectionStatus()) {
             lastUpdateCount++;