Search in sources :

Example 1 with ControlMessageBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.ctrl.msg.stats.ControlMessageBuilder in project lispflowmapping by opendaylight.

the class LispSouthboundRPC method createGetStatsOutput.

private static GetStatsOutput createGetStatsOutput(ConcurrentLispSouthboundStats stats) {
    long[] rxStats = stats.getRx();
    long[] txStats = stats.getTx();
    ControlMessageStatsBuilder cmsb = new ControlMessageStatsBuilder();
    cmsb.setRxUnknown(stats.getRxUnknown());
    cmsb.setTxErrors(stats.getTxErrors());
    List<ControlMessage> messages = new ArrayList<ControlMessage>();
    for (int i = 0; i <= ConcurrentLispSouthboundStats.MAX_LISP_TYPES; i++) {
        if (MessageType.forValue(i) == null) {
            continue;
        }
        ControlMessageBuilder cmb = new ControlMessageBuilder();
        cmb.setMsgType(MessageType.forValue(i));
        cmb.setRxCount(rxStats[i]);
        cmb.setTxCount(txStats[i]);
        messages.add(cmb.build());
    }
    cmsb.setControlMessage(messages);
    MapRegisterCacheStatsBuilder mrcsb = new MapRegisterCacheStatsBuilder();
    mrcsb.setHits(stats.getCacheHits());
    mrcsb.setMisses(stats.getCacheMisses());
    return new GetStatsOutputBuilder().setControlMessageStats(cmsb.build()).setMapRegisterCacheStats(mrcsb.build()).build();
}
Also used : ControlMessageStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.get.stats.output.ControlMessageStatsBuilder) MapRegisterCacheStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.get.stats.output.MapRegisterCacheStatsBuilder) ArrayList(java.util.ArrayList) ControlMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.ctrl.msg.stats.ControlMessageBuilder) ControlMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.ctrl.msg.stats.ControlMessage) GetStatsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.GetStatsOutputBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 GetStatsOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.GetStatsOutputBuilder)1 ControlMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.ctrl.msg.stats.ControlMessage)1 ControlMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.ctrl.msg.stats.ControlMessageBuilder)1 ControlMessageStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.get.stats.output.ControlMessageStatsBuilder)1 MapRegisterCacheStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.get.stats.output.MapRegisterCacheStatsBuilder)1