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;
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;
* 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")
}
@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;
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) {
}
@SuppressWarnings("ConstantConditions")
- final NetconfNode netconfNodeAfter = rootNode.getDataAfter().augmentation(NetconfNode.class);
+ final NetconfNode netconfNodeAfter = rootNode.dataAfter().augmentation(NetconfNode.class);
if (ConnectionStatus.Connected == netconfNodeAfter.getConnectionStatus()) {
lastUpdateCount++;