use of org.opendaylight.mdsal.binding.util.Datastore in project netvirt by opendaylight.
the class IpMonitorStopTask method call.
@Override
public List<ListenableFuture<Void>> call() {
final List<ListenableFuture<Void>> futures = new ArrayList<>();
java.util.Optional<Uint32> monitorIdOptional = alivenessMonitorUtils.getMonitorIdFromInterface(macEntry);
if (monitorIdOptional.isPresent()) {
alivenessMonitorUtils.stopIpMonitoring(monitorIdOptional.get());
} else {
LOG.warn("MonitorId not available for IP {} interface {}. IpMonitoring not stopped", macEntry.getIpAddress(), macEntry.getInterfaceName());
}
String learntIp = macEntry.getIpAddress().getHostAddress();
if (this.isRemoveMipAdjAndLearntIp) {
String vpnName = macEntry.getVpnName();
LearntVpnVipToPort vpnVipToPort = vpnUtil.getLearntVpnVipToPort(vpnName, learntIp);
if (vpnVipToPort != null && !Objects.equals(vpnVipToPort.getCreationTime(), macEntry.getCreatedTime())) {
LOG.warn("The MIP {} over vpn {} has been learnt again and processed. " + "Ignoring this remove event.", learntIp, vpnName);
return futures;
}
vpnUtil.removeLearntVpnVipToPort(macEntry.getVpnName(), macEntry.getIpAddress().getHostAddress(), null);
vpnUtil.removeVpnPortFixedIpToPort(dataBroker, macEntry.getVpnName(), macEntry.getIpAddress().getHostAddress(), null);
LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.CONFIGURATION, tx -> vpnUtil.removeMipAdjacency(macEntry.getVpnName(), macEntry.getInterfaceName(), macEntry.getIpAddress().getHostAddress(), tx)), LOG, "ArpMonitorStopTask: Error writing to datastore for Vpn {} IP {}", macEntry.getVpnName(), macEntry.getIpAddress().getHostAddress());
} else {
// Delete only MIP adjacency
vpnUtil.removeMipAdjacency(macEntry.getInterfaceName(), learntIp);
}
return futures;
}
use of org.opendaylight.mdsal.binding.util.Datastore in project netvirt by opendaylight.
the class MergeCommandsAggregator method mergeUpdate.
@SuppressWarnings("illegalcatch")
public <D extends Datastore> void mergeUpdate(InstanceIdentifier<Node> dstPath, DataObjectModification mod, Class<D> datastoreType, TypedReadWriteTransaction<D> transaction, ManagedNewTransactionRunner txRunner) {
BatchedTransaction tx = null;
if (mod == null || mod.getModifiedChildren() == null) {
return;
}
if (!(transaction instanceof BatchedTransaction)) {
return;
} else {
tx = (BatchedTransaction) transaction;
}
final BatchedTransaction transaction1 = tx;
String srcNodeId = transaction1.getSrcNodeId().getValue();
String dstNodeId = dstPath.firstKeyOf(Node.class).getNodeId().getValue();
Collection<DataObjectModification> modifications = mod.getModifiedChildren();
modifications.stream().filter(modification -> skipCopy.negate().test(datastoreType, modification.getDataType())).filter(modification -> commands.get(modification.getDataType()) != null).peek(modification -> LOG.debug("Received {} modification {} copy/delete to {}", datastoreType, modification, dstPath)).forEach(modification -> {
try {
copyModification(dstPath, datastoreType, transaction1, srcNodeId, dstNodeId, modification, txRunner);
} catch (Exception e) {
LOG.error("Failed to copy mod from {} to {} {} {} id {}", srcNodeId, dstNodeId, modification.getDataType().getSimpleName(), modification, modification.getIdentifier(), e);
}
});
}
Aggregations