Search in sources :

Example 1 with CounterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.CounterBuilder in project bgpcep by opendaylight.

the class TopologyDataChangeCounter method putCount.

private void putCount(final long totalCount) {
    final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
    final Counter counter = new CounterBuilder().setId(this.counterId).setCount(Uint32.valueOf(totalCount)).build();
    wTx.put(LogicalDatastoreType.OPERATIONAL, this.counterInstanceId, counter);
    wTx.commit().addCallback(new FutureCallback<CommitInfo>() {

        @Override
        public void onSuccess(final CommitInfo result) {
            LOG.debug("Data change count update stored");
        }

        @Override
        public void onFailure(final Throwable trw) {
            LOG.error("Failed to store Data change count");
        }
    }, MoreExecutors.directExecutor());
}
Also used : WriteTransaction(org.opendaylight.mdsal.binding.api.WriteTransaction) Counter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter) DataChangeCounter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.DataChangeCounter) CounterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.CounterBuilder) CommitInfo(org.opendaylight.mdsal.common.api.CommitInfo)

Aggregations

WriteTransaction (org.opendaylight.mdsal.binding.api.WriteTransaction)1 CommitInfo (org.opendaylight.mdsal.common.api.CommitInfo)1 DataChangeCounter (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.DataChangeCounter)1 Counter (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.Counter)1 CounterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.data.change.counter.rev160315.data.change.counter.CounterBuilder)1