LOG.trace("Received data changes :{}", requireNonNull(changes, "Changes may not be null!"));
for (DataTreeModification<T> change : changes) {
- final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
+ final InstanceIdentifier<T> key = change.getRootPath().path();
final DataObjectModification<T> mod = change.getRootNode();
final InstanceIdentifier<FlowCapableNode> nodeIdent =
key.firstIdentifierOf(FlowCapableNode.class);
try {
if (preConfigurationCheck(nodeIdent)) {
- switch (mod.getModificationType()) {
+ switch (mod.modificationType()) {
case DELETE:
- remove(key, mod.getDataBefore(), nodeIdent);
+ remove(key, mod.dataBefore(), nodeIdent);
break;
case SUBTREE_MODIFIED:
- update(key, mod.getDataBefore(), mod.getDataAfter(), nodeIdent);
+ update(key, mod.dataBefore(), mod.dataAfter(), nodeIdent);
break;
case WRITE:
- if (mod.getDataBefore() == null) {
- add(key, mod.getDataAfter(), nodeIdent);
+ final var dataBefore = mod.dataBefore();
+ if (dataBefore == null) {
+ add(key, mod.dataAfter(), nodeIdent);
} else {
- update(key, mod.getDataBefore(), mod.getDataAfter(), nodeIdent);
+ update(key, dataBefore, mod.dataAfter(), nodeIdent);
}
break;
default:
- throw new IllegalArgumentException(
- "Unhandled modification type " + mod.getModificationType());
+ throw new IllegalArgumentException("Unhandled modification type " + mod.modificationType());
}
} else if (provider.isStaleMarkingEnabled()) {
LOG.info("Stale-Marking ENABLED and switch {} is NOT connected, storing stale entities", nodeIdent);
// Switch is NOT connected
- switch (mod.getModificationType()) {
+ switch (mod.modificationType()) {
case DELETE:
- createStaleMarkEntity(key, mod.getDataBefore(), nodeIdent);
+ createStaleMarkEntity(key, mod.dataBefore(), nodeIdent);
break;
case SUBTREE_MODIFIED:
case WRITE:
break;
default:
- throw new IllegalArgumentException(
- "Unhandled modification type " + mod.getModificationType());
+ throw new IllegalArgumentException("Unhandled modification type " + mod.modificationType());
}
}
} catch (RuntimeException e) {
- LOG.error("Failed to handle event {} key {} due to error ", mod.getModificationType(), key, e);
+ LOG.error("Failed to handle event {} key {} due to error ", mod.modificationType(), key, e);
}
}
}
requireNonNull(changes, "Changes may not be null!");
for (DataTreeModification<T> change : changes) {
- final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
+ final InstanceIdentifier<T> key = change.getRootPath().path();
final DataObjectModification<T> mod = change.getRootNode();
final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent = key
.firstIdentifierOf(FlowCapableNodeConnector.class);
if (preConfigurationCheck(nodeConnIdent)) {
- switch (mod.getModificationType()) {
+ switch (mod.modificationType()) {
case DELETE:
- remove(key, mod.getDataBefore(), nodeConnIdent);
+ remove(key, mod.dataBefore(), nodeConnIdent);
break;
case SUBTREE_MODIFIED:
- update(key, mod.getDataBefore(), mod.getDataAfter(), nodeConnIdent);
+ update(key, mod.dataBefore(), mod.dataAfter(), nodeConnIdent);
break;
case WRITE:
- if (mod.getDataBefore() == null) {
- add(key, mod.getDataAfter(), nodeConnIdent);
+ final var dataBefore = mod.dataBefore();
+ if (dataBefore == null) {
+ add(key, mod.dataAfter(), nodeConnIdent);
} else {
- update(key, mod.getDataBefore(), mod.getDataAfter(), nodeConnIdent);
+ update(key, dataBefore, mod.dataAfter(), nodeConnIdent);
}
break;
default:
- throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
+ throw new IllegalArgumentException("Unhandled modification type " + mod.modificationType());
}
}
}
import java.util.concurrent.locks.ReentrantLock;
import org.checkerframework.checker.lock.qual.Holding;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
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.binding.api.RpcProviderService;
/**
* Manager for clustering service registrations of {@link DeviceMastership}.
*/
-public class DeviceMastershipManager implements ClusteredDataTreeChangeListener<FlowCapableNode>, AutoCloseable,
+public class DeviceMastershipManager implements DataTreeChangeListener<FlowCapableNode>, AutoCloseable,
MastershipChangeService {
private static final Logger LOG = LoggerFactory.getLogger(DeviceMastershipManager.class);
private static final InstanceIdentifier<FlowCapableNode> II_TO_FLOW_CAPABLE_NODE = InstanceIdentifier
final RpcProviderService rpcProviderService) {
this.reconcliationAgent = reconcliationAgent;
this.rpcProviderService = rpcProviderService;
- listenerRegistration = dataBroker.registerDataTreeChangeListener(
- DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
+ listenerRegistration = dataBroker.registerTreeChangeListener(
+ DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class)), this);
mastershipChangeServiceRegistration = mastershipChangeServiceManager.register(this);
}
@Override
public void onDataTreeChanged(final List<DataTreeModification<FlowCapableNode>> changes) {
for (DataTreeModification<FlowCapableNode> change : changes) {
- final InstanceIdentifier<FlowCapableNode> key = change.getRootPath().getRootIdentifier();
+ final InstanceIdentifier<FlowCapableNode> key = change.getRootPath().path();
final DataObjectModification<FlowCapableNode> mod = change.getRootNode();
final InstanceIdentifier<FlowCapableNode> nodeIdent = key.firstIdentifierOf(FlowCapableNode.class);
- switch (mod.getModificationType()) {
+ switch (mod.modificationType()) {
case DELETE:
- if (mod.getDataAfter() == null) {
- remove(key, mod.getDataBefore(), nodeIdent);
+ if (mod.dataAfter() == null) {
+ remove(key, mod.dataBefore(), nodeIdent);
}
break;
case SUBTREE_MODIFIED:
// NO-OP since we do not need to reconcile on Node-updated
break;
case WRITE:
- if (mod.getDataBefore() == null) {
- add(key, mod.getDataAfter(), nodeIdent);
+ if (mod.dataBefore() == null) {
+ add(key, mod.dataAfter(), nodeIdent);
}
break;
default:
- throw new IllegalArgumentException("Unhandled modification type " + mod.getModificationType());
+ throw new IllegalArgumentException("Unhandled modification type " + mod.modificationType());
}
}
}
public FlowNodeConnectorInventoryTranslatorImpl(final DataBroker dataBroker) {
requireNonNull(dataBroker, "DataBroker can not be null!");
listenerRegistration = dataBroker.registerDataTreeChangeListener(
- DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, getWildCardPath()), this);
+ DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL, getWildCardPath()), this);
}
@Override