public static <T extends DataObject> CheckedFuture<Void, TransactionCommitFailedException> delete(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> obj) { WriteTransaction tx = broker.newWriteOnlyTransaction(); tx.delete(datastoreType, obj); CheckedFuture<Void, TransactionCommitFailedException> futures = tx.submit(); return futures; }
public static <T extends DataObject> CheckedFuture<Void, TransactionCommitFailedException> update(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data) { WriteTransaction tx = broker.newWriteOnlyTransaction(); tx.merge(datastoreType, path, data, true); CheckedFuture<Void, TransactionCommitFailedException> futures = tx.submit(); return futures; }
@Override public <T extends DataObject> void put(LogicalDatastoreType store, InstanceIdentifier<T> path, T data, boolean createMissingParents) { delegate.put(store, path, data, createMissingParents); }
public static void deleteResource(Uuid cid, ResourceId rid, final WriteTransaction wx) { InstanceIdentifier<Resource> iid = getResourceIID(cid, rid); /* DO NOT submit because this might be just one step in a sequence of write operations */ wx.delete(LogicalDatastoreType.OPERATIONAL, iid); }
@Override public <T extends DataObject> void merge(LogicalDatastoreType store, InstanceIdentifier<T> path, T data, boolean createMissingParents) { delegate.merge(store, path, data, createMissingParents); }
public void updateDeviceData(boolean up, NetconfDeviceCapabilities capabilities) { final Node data = buildDataForNetconfNode(up, capabilities); final WriteTransaction writeTx = txChain.newWriteOnlyTransaction(); logger.trace("{}: Update device state transaction {} merging operational data started.", id, writeTx.getIdentifier()); writeTx.put(LogicalDatastoreType.OPERATIONAL, id.getTopologyBindingPath(), data); logger.trace("{}: Update device state transaction {} merging operational data ended.", id, writeTx.getIdentifier()); commitTransaction(writeTx, "update"); }
public void delData(String secKey) { LowwatermarkKey seclwmKey = new LowwatermarkKey(secKey); InstanceIdentifier<Lowwatermark> secLwmId = InstanceIdentifier.builder(LWM.class).child(Lowwatermark.class, seclwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.OPERATIONAL, secLwmId); writeTransaction.commit(); LOG.debug("Data Store Entry is deleted for key ", secKey); }
private void createNetworkTopologyIfNotPresent(final WriteTransaction writeTx) { final NetworkTopology networkTopology = new NetworkTopologyBuilder().build(); logger.trace("{}: Merging {} container to ensure its presence", id, networkTopology.QNAME, writeTx.getIdentifier()); writeTx.merge(LogicalDatastoreType.CONFIGURATION, networkTopologyPath, networkTopology); writeTx.merge(LogicalDatastoreType.OPERATIONAL, networkTopologyPath, networkTopology); final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(TopologyNetconf.QNAME.getLocalName())).build(); logger.trace("{}: Merging {} container to ensure its presence", id, topology.QNAME, writeTx.getIdentifier()); writeTx.merge(LogicalDatastoreType.CONFIGURATION, topologyListPath, topology); writeTx.merge(LogicalDatastoreType.OPERATIONAL, topologyListPath, topology); }
/** * Create/Write * @param addIID iid * @param data new data * @param logicalDatastoreType op vs config * @param <U> return value */ public <U extends org.opendaylight.yangtools.yang.binding.DataObject> void create // writePut (InstanceIdentifier<U> addIID, U data, LogicalDatastoreType logicalDatastoreType) { writeTx.put(logicalDatastoreType, addIID, data, true); }
/** * Remove LSP from the database. * * @param ctx Message Context * @param id Revision-specific LSP identifier */ protected final synchronized void removeLsp(final MessageContext ctx, final L id) { final String name = this.lsps.remove(id); LOG.debug("LSP {} removed", name); ctx.trans.delete(LogicalDatastoreType.OPERATIONAL, lspIdentifier(name)); this.lspData.remove(name); }
/** * Update * @param addIID iid * @param data new value * @param logicalDatastoreType op vs config * @param <U> return value */ public <U extends org.opendaylight.yangtools.yang.binding.DataObject> void update // writeMerge (InstanceIdentifier<U> addIID, U data, LogicalDatastoreType logicalDatastoreType) { writeTx.merge(logicalDatastoreType, addIID, data, true); }
public void setDeviceAsFailed(Throwable throwable) { String reason = (throwable != null && throwable.getMessage() != null) ? throwable.getMessage() : UNKNOWN_REASON; final NetconfNode netconfNode = new NetconfNodeBuilder().setConnectionStatus(ConnectionStatus.UnableToConnect).setConnectedMessage(reason).build(); final Node data = getNodeIdBuilder(id).addAugmentation(NetconfNode.class, netconfNode).build(); final WriteTransaction writeTx = txChain.newWriteOnlyTransaction(); logger.trace("{}: Setting device state as failed {} putting operational data started.", id, writeTx.getIdentifier()); writeTx.put(LogicalDatastoreType.OPERATIONAL, id.getTopologyBindingPath(), data); logger.trace("{}: Setting device state as failed {} putting operational data ended.", id, writeTx.getIdentifier()); commitTransaction(writeTx, "update-failed-device"); }
public void delHwmData(String secKey) { HighwatermarkKey sechwmKey = new HighwatermarkKey(secKey); InstanceIdentifier<Highwatermark> secHwmId = InstanceIdentifier.builder(HWM.class).child(Highwatermark.class, sechwmKey).toInstance(); WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); writeTransaction.delete(LogicalDatastoreType.OPERATIONAL, secHwmId); writeTransaction.commit(); LOG.debug("Data Store Entry is deleted for key ", secKey); }
private void createNodesListIfNotPresent(final WriteTransaction writeTx) { final Nodes nodes = new NodesBuilder().build(); final InstanceIdentifier<Nodes> path = InstanceIdentifier.builder(Nodes.class).build(); logger.trace("{}: Merging {} container to ensure its presence", id, Nodes.QNAME, writeTx.getIdentifier()); writeTx.merge(LogicalDatastoreType.CONFIGURATION, path, nodes); writeTx.merge(LogicalDatastoreType.OPERATIONAL, path, nodes); }
public static <T extends DataObject> CheckedFuture<Void, TransactionCommitFailedException> write(DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path, T data) { WriteTransaction tx = broker.newWriteOnlyTransaction(); tx.put(datastoreType, path, data, true); CheckedFuture<Void, TransactionCommitFailedException> futures = tx.submit(); return futures; }
@Override public void update(@Nonnull final NodeId id, @Nonnull final Node operationalDataNode) { // merge final WriteTransaction wTx = transactionChain.newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.OPERATIONAL, TopologyUtil.createTopologyNodeListPath(new NodeKey(id), topologyId), operationalDataNode); commitTransaction(wTx, id, "update"); }
@Override public void close() throws Exception { // When we close this service we need to shutdown our executor! executor.shutdown(); if (dataProvider != null) { WriteTransaction tx = dataProvider.newWriteOnlyTransaction(); LOG.info(" Transaction written"); tx.delete(LogicalDatastoreType.CONFIGURATION, alertMessageCountRuleRecordId); } }