use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRouterPeerImpl method onRouteMirror.
private synchronized void onRouteMirror(final RouteMirroringMessage mirror) {
final DOMDataTreeWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
wTx.merge(LogicalDatastoreType.OPERATIONAL, this.peerYangIId.node(Mirrors.QNAME), createMirrors(mirror, mirror.getPeerHeader().getTimestampSec()));
wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRouterPeerImpl method onStatsReports.
private synchronized void onStatsReports(final StatsReportsMessage statsReports) {
if (this.up) {
final DOMDataTreeWriteTransaction wTx = this.domTxChain.newWriteOnlyTransaction();
wTx.merge(LogicalDatastoreType.OPERATIONAL, this.peerYangIId.node(Stats.QNAME), createStats(statsReports, statsReports.getPeerHeader().getTimestampSec()));
wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRibInWriter method markTableUptodated.
private synchronized void markTableUptodated(final TablesKey tableTypes) {
final DOMDataTreeWriteTransaction tx = this.chain.newWriteOnlyTransaction();
final TableContext ctxPre = this.tables.get(tableTypes);
tx.merge(LogicalDatastoreType.OPERATIONAL, ctxPre.getTableId().node(BMP_ATTRIBUTES_QNAME).node(ATTRIBUTES_UPTODATE_TRUE.getIdentifier()), ATTRIBUTES_UPTODATE_TRUE);
tx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class BmpRibInWriter method addRoutes.
private synchronized void addRoutes(final MpReachNlri nlri, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes attributes) {
final TablesKey key = new TablesKey(nlri.getAfi(), nlri.getSafi());
final TableContext ctx = this.tables.get(key);
if (ctx == null) {
LOG.debug("No table for {}, not accepting NLRI {}", key, nlri);
return;
}
final DOMDataTreeWriteTransaction tx = this.chain.newWriteOnlyTransaction();
ctx.writeRoutes(tx, nlri, attributes);
LOG.trace("Write routes {}", nlri);
tx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.trace("Successful commit");
}
@Override
public void onFailure(final Throwable trw) {
LOG.error("Failed commit", trw);
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.mdsal.common.api.CommitInfo in project bgpcep by opendaylight.
the class ConnectedGraphServer method addToDataStore.
/**
* Add Graph or Graph components to the Data Store.
*
* @param <T> As a generic method, T must be a Graph, Vertex, Edge or Prefix.
* @param id Instance Identifier of the Data Object
* @param data Data Object (Graph, Vertex, Edge or Prefix)
* @param info Information to be logged
*/
private synchronized <T extends DataObject> void addToDataStore(final InstanceIdentifier<T> id, final T data, final String info) {
final ReadWriteTransaction trans = this.chain.newReadWriteTransaction();
trans.put(LogicalDatastoreType.OPERATIONAL, id, data);
trans.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.info("GraphModel: {} has been published in operational datastore ", info);
}
@Override
public void onFailure(final Throwable throwable) {
LOG.error("GrahModel: Cannot write {} to the operational datastore (transaction: {})", info, trans.getIdentifier());
}
}, MoreExecutors.directExecutor());
}
Aggregations