use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class EvpnVrfEntryHandler method checkDeleteLocalEvpnFLows.
private List<BigInteger> checkDeleteLocalEvpnFLows(long vpnId, String rd, VrfEntry vrfEntry, VpnNexthop localNextHopInfo) {
List<BigInteger> returnLocalDpnId = new ArrayList<>();
if (localNextHopInfo == null) {
// Handle extra routes and imported routes
} else {
final BigInteger dpnId = localNextHopInfo.getDpnId();
jobCoordinator.enqueueJob("FIB-" + rd + "-" + vrfEntry.getDestPrefix(), () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
makeConnectedRoute(dpnId, vpnId, vrfEntry, rd, null, NwConstants.DEL_FLOW, tx, null);
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(tx.submit());
return futures;
});
// TODO: verify below adjacency call need to be optimized (?)
deleteLocalAdjacency(dpnId, vpnId, vrfEntry.getDestPrefix(), vrfEntry.getDestPrefix());
returnLocalDpnId.add(dpnId);
}
return returnLocalDpnId;
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class TestUtil method updateNode.
static void updateNode(LogicalDatastoreType datastoreType, InstanceIdentifier<Node> id, Node node, DataBroker dataBroker) throws Exception {
WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
transaction.merge(datastoreType, id, node, WriteTransaction.CREATE_MISSING_PARENTS);
transaction.submit();
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class VpnUtil method syncWrite.
public static <T extends DataObject> void syncWrite(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data) {
WriteTransaction tx = broker.newWriteOnlyTransaction();
tx.put(datastoreType, path, data, WriteTransaction.CREATE_MISSING_PARENTS);
try {
tx.submit().get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("syncWrite: Error writing to datastore (path, data) : ({}, {})", path, data);
throw new RuntimeException(e.getMessage(), e);
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class VpnUtil method removeVrfEntries.
public static void removeVrfEntries(DataBroker broker, String rd, List<VrfEntry> vrfEntries) {
InstanceIdentifier<VrfTables> vpnVrfTableIid = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).build();
WriteTransaction tx = broker.newWriteOnlyTransaction();
for (VrfEntry vrfEntry : vrfEntries) {
tx.delete(LogicalDatastoreType.CONFIGURATION, vpnVrfTableIid.child(VrfEntry.class, vrfEntry.getKey()));
}
tx.submit();
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class VpnUtil method asyncUpdate.
public static <T extends DataObject> void asyncUpdate(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data, FutureCallback<Void> callback) {
WriteTransaction tx = broker.newWriteOnlyTransaction();
tx.merge(datastoreType, path, data, true);
Futures.addCallback(tx.submit(), callback, MoreExecutors.directExecutor());
}
Aggregations