/** * {@inheritDoc} */ @Override public ReadWriteTransaction newReadWriteTransaction() { return dataBroker.newReadWriteTransaction(); }
/** * {@inheritDoc} */ @Override public final ReadWriteTransaction newReadWriteTransaction() { return dataBroker.newReadWriteTransaction(); } }
/** * {@inheritDoc} */ @Override public ReadWriteTransaction getReadWriteTransaction() { ReadWriteTransaction tx = transaction; if (tx == null) { tx = vtnProvider.getDataBroker().newReadWriteTransaction(); transaction = tx; } return tx; }
@Override public ReadWriteTransaction newReadWriteTransaction() { return delegate().newReadWriteTransaction(); }
@Override public DataModificationTransaction beginTransaction() { return new ForwardedBackwardsCompatibleTransacion(delegate.newReadWriteTransaction()); }
private Optional<TerminationPoint> readTp() throws Exception { if (lportIid != null) { ReadWriteTransaction trans = databroker.newReadWriteTransaction(); return trans.read(LogicalDatastoreType.OPERATIONAL, lportIid).get(); } else { return Optional.absent(); } } }
private Optional<TerminationPoint> readTp() throws Exception { if (lportIid != null) { ReadWriteTransaction trans = databroker.newReadWriteTransaction(); return trans.read(LogicalDatastoreType.OPERATIONAL, lportIid).get(); } else { return Optional.absent(); } }
protected boolean removeMd(T item) { final ReadWriteTransaction tx = getDataBroker().newReadWriteTransaction(); try { removeMd(item, tx); return true; } catch (InterruptedException | ExecutionException e) { LOGGER.warn("Transaction failed", e); } return false; }
private ListenableFuture<Void> deleteIfaceOnVpp(ConfigCommand deleteIfaceWithoutBdCommand, DataBroker vppDataBroker, VppEndpoint vppEndpoint, InstanceIdentifier<?> vppNodeIid) { ReadWriteTransaction rwTx = vppDataBroker.newReadWriteTransaction(); deleteIfaceWithoutBdCommand.execute(rwTx); return Futures.transform(rwTx.submit(), new AsyncFunction<Void, Void>() { @Override public ListenableFuture<Void> apply(Void input) { LOG.debug("Delete interface on VPP command was successful:\nVPP: {}\nCommand: {}", vppNodeIid, deleteIfaceWithoutBdCommand); return vppEndpointLocationProvider.deleteLocationForVppEndpoint(vppEndpoint); } }, netconfWorker); }
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) { final ReadWriteTransaction rwx = m_dataBroker.newReadWriteTransaction(); try { Map<String, CostType> costTypes = onEntryChanged(rwx); List<CostType> costTypeList = new LinkedList<>(costTypes.values()); setCostTypes(m_instance, costTypeList, rwx); rwx.submit(); } catch (Exception e) { LOG.error("Failed to update cost-types {}", m_instance); e.printStackTrace(); } }
@Override public <T extends DataObject> ListenableFuture<Void> writeConfiguration(final T data, final InstanceIdentifier<T> identifier) { final ReadWriteTransaction wTx = this.dataBroker.newReadWriteTransaction(); wTx.put(LogicalDatastoreType.CONFIGURATION, identifier, data); return wTx.submit(); }
public static <T extends DataObject> Optional<T> removeIfExists(InstanceIdentifier<T> path) { ReadWriteTransaction rwTx = UlnMapperDatastoreDependency.getDataProvider().newReadWriteTransaction(); Optional<T> potentialResult = readFromDs(path, rwTx); if (potentialResult.isPresent()) { rwTx.delete(logicalDatastoreType, path); submitToDs(rwTx); LOG.debug("Removed present path {}", path); } else { LOG.debug("No need to remove Path {} -- it is NOT present", path); } return potentialResult; }
@Override public void onCreated(SecurityGroup createdSecGroup, Neutron neutron) { LOG.trace("created securityGroup - {}", createdSecGroup); ReadWriteTransaction rwTx = dataProvider.newReadWriteTransaction(); boolean isSecGroupCreated = addNeutronSecurityGroup(createdSecGroup, rwTx); if (isSecGroupCreated) { DataStoreHelper.submitToDs(rwTx); } else { rwTx.cancel(); } }
@Override public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) { ResourceId defaultNetworkmap = null; try { ReadWriteTransaction rwx = m_dataBroker.newReadWriteTransaction(); defaultNetworkmap = onConfigurationChanged(change, rwx); setDefaultNetworkMap(m_instance, defaultNetworkmap, rwx); rwx.submit(); } catch (Exception e) { LOG.error("Failed to update the default-network-map"); } }
@Override public void onCreated(SecurityRule secRule, Neutron neutron) { LOG.trace("created securityRule - {}", secRule); ReadWriteTransaction rwTx = dataProvider.newReadWriteTransaction(); boolean isNeutronSecurityRuleAdded = addNeutronSecurityRule(secRule, neutron, rwTx); if (isNeutronSecurityRuleAdded) { DataStoreHelper.submitToDs(rwTx); } else { rwTx.cancel(); } }
@Override public void onDeleted(SecurityRule deletedSecRule, Neutron oldNeutron, Neutron newNeutron) { LOG.trace("deleted securityRule - {}", deletedSecRule); ReadWriteTransaction rwTx = dataProvider.newReadWriteTransaction(); boolean isNeutronSecurityRuleDeleted = deleteNeutronSecurityRule(deletedSecRule, oldNeutron, rwTx); if (isNeutronSecurityRuleDeleted) { DataStoreHelper.submitToDs(rwTx); } else { rwTx.cancel(); } }
@Override public Future<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) { LOG.debug("Calling the updateFlow RPC method on MessageDispatchService"); // use primary connection SwitchConnectionDistinguisher cookie = null; final ReadWriteTransaction rwTx = OFSessionUtil.getSessionManager().getDataBroker().newReadWriteTransaction(); OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task = OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie, rwTx, convertorExecutor); ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit(); return result; }
private InstanceIdentifier<?> getManagedByIidFromOperDS(InstanceIdentifier<?> bridgeIid) { // Get the InstanceIdentifier of the containing node InstanceIdentifier<Node> nodeEntryIid = bridgeIid.firstIdentifierOf(Node.class); Optional<?> bridgeNode = SouthboundUtil.readNode(db.newReadWriteTransaction(),nodeEntryIid); if (bridgeNode.isPresent() && bridgeNode.get() instanceof Node) { Node node = (Node)bridgeNode.get(); OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge != null && bridge.getManagedBy() != null) { return bridge.getManagedBy().getValue(); } } return null; }
private MappedEndpoint getMappedEndpoint(Endpoint endpoint) { MappedEndpointKey mappedEndpointKey = new MappedEndpointKey(endpoint.getL2Context(), endpoint.getMacAddress()); Optional<MappedEndpoint> endpointOp = DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL, FaasIidFactory.mappedEndpointIid(endpoint.getTenant(), mappedEndpointKey), dataProvider.newReadWriteTransaction()); if (endpointOp.isPresent()) { return endpointOp.get(); } return null; } }
@SuppressWarnings("squid:S2095") private TransactionWriteContext getTransactionWriteContext() { // Before Tx must use modification final DOMDataReadOnlyTransaction beforeTx = ReadOnlyTransaction.create(untouchedModification, EMPTY_OPERATIONAL); // After Tx must use current modification final DOMDataReadOnlyTransaction afterTx = ReadOnlyTransaction.create(this, EMPTY_OPERATIONAL); final TransactionMappingContext mappingContext = new TransactionMappingContext( contextBroker.newReadWriteTransaction()); return new TransactionWriteContext(serializer, beforeTx, afterTx, mappingContext); }