Search in sources :

Example 1 with GetNodeAggregatedCountersInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeAggregatedCountersInput in project netvirt by opendaylight.

the class StatisticsImpl method getNodeAggregatedCounters.

@Override
@SuppressWarnings("checkstyle:illegalCatch")
public ListenableFuture<RpcResult<GetNodeAggregatedCountersOutput>> getNodeAggregatedCounters(GetNodeAggregatedCountersInput input) {
    BigInteger dpId = input.getNodeId();
    LOG.trace("getting aggregated node counters for node {}", dpId);
    GetNodeAggregatedCountersOutputBuilder gnacob = new GetNodeAggregatedCountersOutputBuilder();
    List<CounterResult> aggregatedCounterResults = new ArrayList<>();
    try {
        if (!getNodeAggregatedResult(aggregatedCounterResults, dpId)) {
            statisticsCounters.failedGettingAggregatedNodeCounters();
            return RpcResultBuilder.<GetNodeAggregatedCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node aggregated counters for node " + dpId).buildFuture();
        }
    } catch (Exception e) {
        LOG.warn("failed to get counter result for node {}", dpId, e);
        return RpcResultBuilder.<GetNodeAggregatedCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node aggregated counters for node " + dpId).buildFuture();
    }
    gnacob.setCounterResult(aggregatedCounterResults);
    return RpcResultBuilder.success(gnacob.build()).buildFuture();
}
Also used : ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) GetNodeAggregatedCountersOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeAggregatedCountersOutputBuilder) CounterResult(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult) ReadFailedException(org.opendaylight.mdsal.common.api.ReadFailedException) ExecutionException(java.util.concurrent.ExecutionException) GetNodeAggregatedCountersOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeAggregatedCountersOutput)

Aggregations

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 ReadFailedException (org.opendaylight.mdsal.common.api.ReadFailedException)1 GetNodeAggregatedCountersOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeAggregatedCountersOutput)1 GetNodeAggregatedCountersOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeAggregatedCountersOutputBuilder)1 CounterResult (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult)1