Search in sources :

Example 11 with MultipartReplyPortStats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStats in project openflowplugin by opendaylight.

the class MultipartReplyPortStatsDeserializerTest method deserialize.

@Test
public void deserialize() throws Exception {
    ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    buffer.writeInt(PORT);
    buffer.writeZero(PADDING_IN_PORT_STATS_HEADER);
    buffer.writeLong(PACKETS_RECEIVED);
    buffer.writeLong(PACKETS_TRANSMITTED);
    buffer.writeLong(BYTES_RECEIVED);
    buffer.writeLong(BYTES_TRANSMITTED);
    buffer.writeLong(RECEIVE_DROPS);
    buffer.writeLong(TRANSMIT_DROPS);
    buffer.writeLong(RECEIVE_ERRORS);
    buffer.writeLong(TRANSMIT_ERRORS);
    buffer.writeLong(RECEIVE_FRAME_ERROR);
    buffer.writeLong(RECEIVE_OVER_RUN_ERROR);
    buffer.writeLong(RECEIVE_CRC_ERROR);
    buffer.writeLong(COLLIESION_COUNT);
    buffer.writeInt(SECOND);
    buffer.writeInt(NANOSECOND);
    final MultipartReplyPortStats reply = (MultipartReplyPortStats) deserializeMultipart(buffer);
    final NodeConnectorStatisticsAndPortNumberMap portStats = reply.getNodeConnectorStatisticsAndPortNumberMap().get(0);
    assertEquals(PACKETS_RECEIVED, portStats.getPackets().getReceived().longValue());
    assertEquals(PACKETS_TRANSMITTED, portStats.getPackets().getTransmitted().longValue());
    assertEquals(BYTES_RECEIVED, portStats.getBytes().getReceived().longValue());
    assertEquals(BYTES_TRANSMITTED, portStats.getBytes().getTransmitted().longValue());
    assertEquals(RECEIVE_DROPS, portStats.getReceiveDrops().longValue());
    assertEquals(TRANSMIT_DROPS, portStats.getTransmitDrops().longValue());
    assertEquals(RECEIVE_ERRORS, portStats.getReceiveErrors().longValue());
    assertEquals(TRANSMIT_ERRORS, portStats.getTransmitErrors().longValue());
    assertEquals(RECEIVE_FRAME_ERROR, portStats.getReceiveFrameError().longValue());
    assertEquals(RECEIVE_OVER_RUN_ERROR, portStats.getReceiveOverRunError().longValue());
    assertEquals(RECEIVE_CRC_ERROR, portStats.getReceiveCrcError().longValue());
    assertEquals(COLLIESION_COUNT, portStats.getCollisionCount().longValue());
    assertEquals(SECOND, portStats.getDuration().getSecond().getValue().intValue());
    assertEquals(NANOSECOND, portStats.getDuration().getNanosecond().getValue().intValue());
    assertEquals(0, buffer.readableBytes());
}
Also used : MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStats) ByteBuf(io.netty.buffer.ByteBuf) NodeConnectorStatisticsAndPortNumberMap(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap) Test(org.junit.Test)

Aggregations

MultipartReplyPortStatsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase)10 MultipartReplyPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats)10 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)8 ByteBuf (io.netty.buffer.ByteBuf)5 Test (org.junit.Test)5 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)4 NodeConnectorStatisticsAndPortNumberMap (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap)4 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)3 NodeConnectorStatisticsAndPortNumberMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder)3 BigInteger (java.math.BigInteger)2 ArrayList (java.util.ArrayList)2 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)2 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)2 BytesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder)2 PacketsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder)2 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)2 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)2 MultipartReplyPortStatsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCaseBuilder)2 MultipartReplyPortStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder)2 NodeConnectorStatisticsAndPortNumberMapKey (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey)2