Search in sources :

Example 26 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMocks.

private MultipartReplyMessage prepareMocks(DeviceContext mockedDeviceContext, MultipartReplyBody multipartReplyBody, final MultipartType multipartType) {
    ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
    FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class);
    when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    when(mockedFeaturesReply.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    DeviceInfo deviceInfo = mock(DeviceInfo.class);
    when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
    when(deviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedDeviceContext.getDeviceInfo()).thenReturn(deviceInfo);
    when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeaturesReply);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
    MultipartReplyMessage multipartReplyMessage = mock(MultipartReplyMessage.class);
    when(multipartReplyMessage.getType()).thenReturn(multipartType);
    when(multipartReplyMessage.getFlags()).thenReturn(new MultipartRequestFlags(true));
    when(multipartReplyMessage.getXid()).thenReturn(DUMMY_XID);
    when(multipartReplyMessage.getMultipartReplyBody()).thenReturn(multipartReplyBody);
    return multipartReplyMessage;
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) FeaturesReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply) DeviceInfo(org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ConnectionContext(org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext)

Example 27 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMultipartReplyPortStats.

private MultipartReplyBody prepareMultipartReplyPortStats() {
    PortStatsBuilder dummyPortStatBuilder = new PortStatsBuilder();
    dummyPortStatBuilder.setPortNo(DUMMY_PORT_NO);
    dummyPortStatBuilder.setRxBytes(DUMMY_RX_BYTES);
    dummyPortStatBuilder.setTxBytes(DUMMY_TX_BYTES);
    dummyPortStatBuilder.setRxPackets(DUMMY_RX_PACKETS);
    dummyPortStatBuilder.setTxPackets(DUMMY_TX_PACKETS);
    dummyPortStatBuilder.setCollisions(DUMMY_COLLISIONS);
    dummyPortStatBuilder.setRxCrcErr(DUMMY_RX_CRC_ERR);
    dummyPortStatBuilder.setRxDropped(DUMMY_RX_DROPPED);
    dummyPortStatBuilder.setRxErrors(DUMMY_RX_ERRORS);
    dummyPortStatBuilder.setRxFrameErr(DUMMY_RX_FRAME_ERR);
    dummyPortStatBuilder.setRxOverErr(DUMMY_OVER_ERR);
    dummyPortStatBuilder.setTxDropped(DUMMY_TX_DROPPED);
    dummyPortStatBuilder.setTxErrors(DUMMY_TX_ERRORS);
    MultipartReplyPortStatsBuilder multipartReplyPortStatsBuilder = new MultipartReplyPortStatsBuilder();
    multipartReplyPortStatsBuilder.setPortStats(Lists.newArrayList(dummyPortStatBuilder.build()));
    MultipartReplyPortStatsCaseBuilder multipartReplyPortStatsCaseBuilder = new MultipartReplyPortStatsCaseBuilder();
    multipartReplyPortStatsCaseBuilder.setMultipartReplyPortStats(multipartReplyPortStatsBuilder.build());
    return multipartReplyPortStatsCaseBuilder.build();
}
Also used : MultipartReplyPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder) PortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder) MultipartReplyPortStatsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCaseBuilder) MultipartReplyPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder)

Example 28 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMultipartReplyGroup.

private MultipartReplyBody prepareMultipartReplyGroup() {
    GroupStatsBuilder groupStatsBuilder = new GroupStatsBuilder();
    groupStatsBuilder.setByteCount(DUMMY_BYTE_COUNT);
    groupStatsBuilder.setBucketStats(Collections.<BucketStats>emptyList());
    groupStatsBuilder.setDurationSec(DUMMY_DURATION_SEC);
    groupStatsBuilder.setDurationNsec(DUMMY_DURATION_NSEC);
    groupStatsBuilder.setGroupId(DUMMY_GROUP_ID);
    groupStatsBuilder.setPacketCount(DUMMY_PACKET_COUNT);
    groupStatsBuilder.setRefCount(DUMMY_REF_COUNT);
    MultipartReplyGroupBuilder multipartReplyGroupBuilder = new MultipartReplyGroupBuilder();
    multipartReplyGroupBuilder.setGroupStats(Lists.newArrayList(groupStatsBuilder.build()));
    MultipartReplyGroupCaseBuilder multipartReplyGroupCaseBuilder = new MultipartReplyGroupCaseBuilder();
    multipartReplyGroupCaseBuilder.setMultipartReplyGroup(multipartReplyGroupBuilder.build());
    return multipartReplyGroupCaseBuilder.build();
}
Also used : MultipartReplyGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCaseBuilder) MultipartReplyGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroupBuilder) GroupStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStatsBuilder)

Example 29 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactory method serializeQueueBody.

private void serializeQueueBody(MultipartReplyBody body, ByteBuf outBuffer) {
    MultipartReplyQueueCase queueCase = (MultipartReplyQueueCase) body;
    MultipartReplyQueue queue = queueCase.getMultipartReplyQueue();
    for (QueueStats queueStats : queue.getQueueStats()) {
        ByteBuf queueStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
        queueStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
        queueStatsBuff.writeZero(QUEUE_PADDING);
        queueStatsBuff.writeInt(queueStats.getQueueId().intValue());
        queueStatsBuff.writeLong(queueStats.getTxBytes().longValue());
        queueStatsBuff.writeLong(queueStats.getTxPackets().longValue());
        queueStatsBuff.writeLong(queueStats.getTxErrors().longValue());
        queueStatsBuff.setShort(QUEUE_STATS_LENGTH_INDEX, queueStatsBuff.readableBytes());
        outBuffer.writeBytes(queueStatsBuff);
    }
}
Also used : MultipartReplyQueueCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase) QueueStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats) MultipartReplyQueue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue) ByteBuf(io.netty.buffer.ByteBuf)

Example 30 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class OF10StatsReplyMessageFactory method serializeAggregateBody.

private void serializeAggregateBody(MultipartReplyBody body, ByteBuf outBuffer) {
    MultipartReplyAggregateCase aggregateCase = (MultipartReplyAggregateCase) body;
    MultipartReplyAggregate aggregate = aggregateCase.getMultipartReplyAggregate();
    outBuffer.writeLong(aggregate.getPacketCount().longValue());
    outBuffer.writeLong(aggregate.getByteCount().longValue());
    outBuffer.writeInt(aggregate.getFlowCount().intValue());
    outBuffer.writeZero(AGGREGATE_PADDING);
}
Also used : MultipartReplyAggregateCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase) MultipartReplyAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)

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