Search in sources :

Example 31 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactory method serializeTableBody.

private void serializeTableBody(MultipartReplyBody body, ByteBuf outBuffer) {
    MultipartReplyTableCase tableCase = (MultipartReplyTableCase) body;
    MultipartReplyTable table = tableCase.getMultipartReplyTable();
    for (TableStats tableStats : table.getTableStats()) {
        outBuffer.writeByte(tableStats.getTableId());
        outBuffer.writeZero(TABLE_PADDING);
        write16String(tableStats.getName(), outBuffer);
        writeFlowWildcardsV10(tableStats.getWildcards(), outBuffer);
        outBuffer.writeInt(tableStats.getMaxEntries().intValue());
        outBuffer.writeInt(tableStats.getActiveCount().intValue());
        outBuffer.writeLong(tableStats.getLookupCount().longValue());
        outBuffer.writeLong(tableStats.getMatchedCount().longValue());
    }
}
Also used : MultipartReplyTableCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase) MultipartReplyTable(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable) TableStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStats)

Example 32 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactory method serializePortStatsBody.

private void serializePortStatsBody(MultipartReplyBody body, ByteBuf outBuffer) {
    MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
    MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
    for (PortStats portStat : portStats.getPortStats()) {
        outBuffer.writeInt(portStat.getPortNo().intValue());
        outBuffer.writeZero(PORT_STATS_PADDING);
        outBuffer.writeLong(portStat.getRxPackets().longValue());
        outBuffer.writeLong(portStat.getTxPackets().longValue());
        outBuffer.writeLong(portStat.getRxBytes().longValue());
        outBuffer.writeLong(portStat.getTxBytes().longValue());
        outBuffer.writeLong(portStat.getRxDropped().longValue());
        outBuffer.writeLong(portStat.getTxDropped().longValue());
        outBuffer.writeLong(portStat.getRxErrors().longValue());
        outBuffer.writeLong(portStat.getTxErrors().longValue());
        outBuffer.writeLong(portStat.getRxFrameErr().longValue());
        outBuffer.writeLong(portStat.getRxOverErr().longValue());
        outBuffer.writeLong(portStat.getRxCrcErr().longValue());
        outBuffer.writeLong(portStat.getCollisions().longValue());
    }
}
Also used : MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) MultipartReplyPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase) MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) PortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStats)

Example 33 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactory method serializeFlowBody.

private void serializeFlowBody(MultipartReplyBody body, ByteBuf outBuffer, MultipartReplyMessage message) {
    MultipartReplyFlowCase flowCase = (MultipartReplyFlowCase) body;
    MultipartReplyFlow flow = flowCase.getMultipartReplyFlow();
    for (FlowStats flowStats : flow.getFlowStats()) {
        ByteBuf flowStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
        flowStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
        flowStatsBuff.writeByte((byte) flowStats.getTableId().longValue());
        flowStatsBuff.writeZero(FLOW_STATS_PADDING_1);
        OFSerializer<MatchV10> matchSerializer = registry.getSerializer(new MessageTypeKey<>(message.getVersion(), MatchV10.class));
        matchSerializer.serialize(flowStats.getMatchV10(), flowStatsBuff);
        flowStatsBuff.writeInt(flowStats.getDurationSec().intValue());
        flowStatsBuff.writeInt(flowStats.getDurationNsec().intValue());
        flowStatsBuff.writeShort(flowStats.getPriority());
        flowStatsBuff.writeShort(flowStats.getIdleTimeout());
        flowStatsBuff.writeShort(flowStats.getHardTimeout());
        flowStatsBuff.writeZero(FLOW_STATS_PADDING_2);
        flowStatsBuff.writeLong(flowStats.getCookie().longValue());
        flowStatsBuff.writeLong(flowStats.getPacketCount().longValue());
        flowStatsBuff.writeLong(flowStats.getByteCount().longValue());
        ListSerializer.serializeList(flowStats.getAction(), ACTION_KEY_MAKER, registry, flowStatsBuff);
        flowStatsBuff.setShort(FLOW_STATS_LENGTH_INDEX, flowStatsBuff.readableBytes());
        outBuffer.writeBytes(flowStatsBuff);
    }
}
Also used : FlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats) MultipartReplyFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow) MultipartReplyFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase) ByteBuf(io.netty.buffer.ByteBuf) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)

Example 34 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method serializeGroupFeaturesBody.

private void serializeGroupFeaturesBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
    MultipartReplyGroupFeaturesCase groupFeaturesCase = (MultipartReplyGroupFeaturesCase) body;
    MultipartReplyGroupFeatures groupFeatures = groupFeaturesCase.getMultipartReplyGroupFeatures();
    writeGroupTypes(groupFeatures.getTypes(), outBuffer);
    writeGroupCapabilities(groupFeatures.getCapabilities(), outBuffer);
    for (Long maxGroups : groupFeatures.getMaxGroups()) {
        outBuffer.writeInt(maxGroups.intValue());
    }
    for (ActionType action : groupFeatures.getActionsBitmap()) {
        writeActionType(action, outBuffer);
    }
}
Also used : MultipartReplyGroupFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase) ActionType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType) MultipartReplyGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)

Example 35 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method serializeGroupBody.

private void serializeGroupBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
    MultipartReplyGroupCase groupCase = (MultipartReplyGroupCase) body;
    MultipartReplyGroup group = groupCase.getMultipartReplyGroup();
    for (GroupStats groupStats : group.getGroupStats()) {
        ByteBuf groupStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
        groupStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
        groupStatsBuff.writeZero(GROUP_STATS_PADDING_1);
        groupStatsBuff.writeInt(groupStats.getGroupId().getValue().intValue());
        groupStatsBuff.writeInt(groupStats.getRefCount().intValue());
        groupStatsBuff.writeZero(GROUP_STATS_PADDING_2);
        groupStatsBuff.writeLong(groupStats.getPacketCount().longValue());
        groupStatsBuff.writeLong(groupStats.getByteCount().longValue());
        groupStatsBuff.writeInt(groupStats.getDurationSec().intValue());
        groupStatsBuff.writeInt(groupStats.getDurationNsec().intValue());
        for (BucketStats bucketStats : groupStats.getBucketStats()) {
            groupStatsBuff.writeLong(bucketStats.getPacketCount().longValue());
            groupStatsBuff.writeLong(bucketStats.getByteCount().longValue());
        }
        groupStatsBuff.setShort(GROUP_STATS_LENGTH_INDEX, groupStatsBuff.readableBytes());
        outBuffer.writeBytes(groupStatsBuff);
    }
}
Also used : MultipartReplyGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCase) MultipartReplyGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroup) GroupStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats) ByteBuf(io.netty.buffer.ByteBuf) BucketStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.group.stats.BucketStats)

Aggregations

ArrayList (java.util.ArrayList)11 ByteBuf (io.netty.buffer.ByteBuf)9 BigInteger (java.math.BigInteger)8 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)7 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)6 BucketId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId)2 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)2 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)2 MultipartReplyAggregateCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase)2 MultipartReplyFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase)2 MultipartReplyTableCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase)2 MultipartReplyAggregate (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)2 MultipartReplyFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow)2 FlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats)2 MultipartReplyTable (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable)2 TableStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStats)2 List (java.util.List)1 OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)1