use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyQueueBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyQueueBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 " + // portNo
"00 00 00 FF " + // queueId
"00 00 00 10 " + // txBytes
"FF 02 03 02 03 02 03 02 " + // txPackets
"FF 02 02 02 02 02 02 02 " + // txErrors
"FF 02 03 02 03 02 03 02 " + // durationSec
"00 00 00 02 " + // durationNsec
"00 00 00 04");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0x05, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyQueueCase messageCase = (MultipartReplyQueueCase) builtByFactory.getMultipartReplyBody();
MultipartReplyQueue message = messageCase.getMultipartReplyQueue();
Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
Assert.assertEquals("Wrong txBytes", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02 }), message.getQueueStats().get(0).getTxBytes());
Assert.assertEquals("Wrong txPackets", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 }), message.getQueueStats().get(0).getTxPackets());
Assert.assertEquals("Wrong txErrors", new BigInteger(1, new byte[] { (byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02 }), message.getQueueStats().get(0).getTxErrors());
Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultiMsgCollectorImplTest method testAddMultipartMsgNotExpectedXid.
/**
* Test of ${link MultiMsgCollector#addMultipartMsg}
* xid not registered before message.
*/
@Test(expected = IllegalArgumentException.class)
public void testAddMultipartMsgNotExpectedXid() {
final Long dif_xid = 5L;
final MultipartReplyMessage mrMsg = MsgGeneratorTestUtils.makeMultipartDescReply(dif_xid, hwTestValue, true).build();
collector.addMultipartMsg(mrMsg, true, null);
}
Aggregations