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());
}
Aggregations