use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class PolicyRouteGroupProgrammer method programPolicyClassifierGroups.
public void programPolicyClassifierGroups(String policyClassifier, BigInteger dpId, List<TunnelInterface> tunnelInterfaces, int addOrRemove) {
if (tunnelInterfaces == null) {
LOG.debug("No tunnel interfaces found for policy classifier {} DPN {}", policyClassifier, dpId);
return;
}
coordinator.enqueueJob(policyClassifier, () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tunnelInterfaces.forEach(tunnelInterface -> {
BigInteger remoteDpId = tunnelInterface.getRemoteDpId();
programPolicyClassifierGroups(policyClassifier, Collections.singletonList(dpId), remoteDpId, tx, addOrRemove);
});
return Collections.singletonList(tx.submit());
});
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class PolicyNodeListener method add.
@Override
protected void add(InstanceIdentifier<FlowCapableNode> key, FlowCapableNode flowCapableNode) {
BigInteger dpId = MDSALUtil.getDpnIdFromNodeName(key.firstKeyOf(Node.class).getId());
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
createTableMissFlow(dpId, NwConstants.EGRESS_POLICY_CLASSIFIER_TABLE, NwConstants.EGRESS_POLICY_CLASSIFIER_COOKIE, tx);
createTableMissFlow(dpId, NwConstants.EGRESS_POLICY_ROUTING_TABLE, NwConstants.EGRESS_POLICY_ROUTING_COOKIE, tx);
tx.submit();
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project controller by opendaylight.
the class EventSourceTopology method deleteData.
private <T extends DataObject> void deleteData(final LogicalDatastoreType store, final InstanceIdentifier<T> path) {
final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
tx.delete(OPERATIONAL, path);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
LOG.trace("Data has deleted from datastore {} {}", store, path);
}
@Override
public void onFailure(final Throwable ex) {
LOG.error("Can not delete data from datastore [store: {}] [path: {}] [exception: {}]", store, path, ex);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project controller by opendaylight.
the class EventSourceTopology method putData.
private <T extends DataObject> void putData(final LogicalDatastoreType store, final InstanceIdentifier<T> path, final T data) {
final WriteTransaction tx = getDataBroker().newWriteOnlyTransaction();
tx.put(store, path, data, true);
Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
LOG.trace("Data has put into datastore {} {}", store, path);
}
@Override
public void onFailure(final Throwable ex) {
LOG.error("Can not put data into datastore [store: {}] [path: {}] [exception: {}]", store, path, ex);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project controller by opendaylight.
the class DsbenchmarkProvider method setTestOperData.
private void setTestOperData(final ExecStatus sts, final long tstCompl) {
TestStatus status = new TestStatusBuilder().setExecStatus(sts).setTestsCompleted(tstCompl).build();
WriteTransaction tx = simpleTxDataBroker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, TEST_STATUS_IID, status);
try {
tx.submit().checkedGet();
} catch (final TransactionCommitFailedException e) {
throw new IllegalStateException(e);
}
LOG.debug("DataStore test oper status populated: {}", status);
}
Aggregations