Search in sources :

Example 1 with GetNodeCountersOutputBuilder

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

the class StatisticsImpl method getNodeCounters.

@Override
@SuppressWarnings("checkstyle:illegalCatch")
public Future<RpcResult<GetNodeCountersOutput>> getNodeCounters(GetNodeCountersInput input) {
    BigInteger dpId = input.getNodeId();
    LOG.trace("getting node counters for node {}", dpId);
    GetNodeCountersOutputBuilder gncob = new GetNodeCountersOutputBuilder();
    List<CounterResult> counterResults = new ArrayList<>();
    try {
        if (!getNodeResult(counterResults, dpId)) {
            StatisticsPluginImplCounters.failed_getting_node_counters.inc();
            return RpcResultBuilder.<GetNodeCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node counters for node: " + dpId).buildFuture();
        }
    } catch (RuntimeException e) {
        LOG.warn("failed to get counter result for node {}", dpId, e);
        return RpcResultBuilder.<GetNodeCountersOutput>failed().withError(ErrorType.APPLICATION, "failed to get node counters for node: " + dpId).buildFuture();
    }
    gncob.setCounterResult(counterResults);
    return RpcResultBuilder.success(gncob.build()).buildFuture();
}
Also used : GetNodeCountersOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutput) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) GetNodeCountersOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutputBuilder) CounterResult(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult)

Aggregations

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 GetNodeCountersOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutput)1 GetNodeCountersOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.GetNodeCountersOutputBuilder)1 CounterResult (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.statistics.rev170120.result.CounterResult)1