use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyAggregateBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyAggregateBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 " + // packetCount
"FF 01 01 01 01 01 01 01 " + // byteCount
"0F 01 01 01 01 01 01 01 " + // flowCount
"00 00 00 08 " + // pad
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0x02, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();
MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();
Assert.assertEquals("Wrong packetCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getPacketCount());
Assert.assertEquals("Wrong byteCount", new BigInteger(1, new byte[] { (byte) 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getByteCount());
Assert.assertEquals("Wrong flowCount", 8, message.getFlowCount().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupDescBody03.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
* Test covers bodies of actions Pop VLAN, Pop PBB, Pop MPLS, Group, Dec NW TTL.
*/
@Test
public void testMultipartReplyGroupDescBody03() {
ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 " + // len
"00 48 " + // type
"01 " + // pad
"00 " + // groupId
"00 00 00 08 " + // bucketLen
"00 40 " + // bucketWeight
"00 06 " + // bucketWatchPort
"00 00 00 05 " + // bucketWatchGroup
"00 00 00 04 " + // bucketPad
"00 00 00 00 " + // popVlanType
"00 12 " + // popVlanLen
"00 08 " + // popVlanPad
"00 00 00 00 " + // popPbbType
"00 1B " + // popPbbLen
"00 08 " + // popPbbPad
"00 00 00 00 " + // popMplsType
"00 14 " + // popMplsLen
"00 08 " + // popMplsEthertype
"00 CF " + // popMplsPad
"00 00 " + // setQueueType
"00 15 " + // setQueueLen
"00 08 " + // setQueueQueueId
"00 CF 00 00 " + // groupType
"00 16 " + // groupLen
"00 08 " + // groupGroupId
"00 CF 00 00 " + // decNwTtlType
"00 18 " + // decNwTtlLen
"00 08 " + // decNwTtlPad
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupDescCase messageCase = (MultipartReplyGroupDescCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupDesc message = messageCase.getMultipartReplyGroupDesc();
Assert.assertEquals("Wrong type", 1, message.getGroupDesc().get(0).getType().getIntValue());
Assert.assertEquals("Wrong groupId", 8, message.getGroupDesc().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong bucketWeight", 6, message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertTrue("Wrong popVlanType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice() instanceof PopVlanCase);
Assert.assertTrue("Wrong popPbbType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice() instanceof PopPbbCase);
Assert.assertTrue("Wrong popMplsType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice() instanceof PopMplsCase);
Assert.assertEquals("Wrong popMplsEthertype", 207, ((PopMplsCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice()).getPopMplsAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong setQueueType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice() instanceof SetQueueCase);
Assert.assertEquals("Wrong setQueueQueueId", 13565952, ((SetQueueCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice()).getSetQueueAction().getQueueId().intValue());
Assert.assertTrue("Wrong groupType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice() instanceof GroupCase);
Assert.assertEquals("Wrong groupGroupId", 13565952, ((GroupCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice()).getGroupAction().getGroupId().intValue());
Assert.assertTrue("Wrong decNwTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(5).getActionChoice() instanceof DecNwTtlCase);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyTableBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyTableBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 00 00 00 00 " + // tableId
"08 " + // pad
"00 00 00 " + // activeCount
"00 00 00 10 " + // lookupCount
"FF 01 01 01 01 01 01 01 " + // matchedCount
"AF 01 01 01 01 01 01 01");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0x03, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyTableCase messageCase = (MultipartReplyTableCase) builtByFactory.getMultipartReplyBody();
MultipartReplyTable message = messageCase.getMultipartReplyTable();
Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
Assert.assertEquals("Wrong lookupCount", new BigInteger(1, new byte[] { (byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getTableStats().get(0).getLookupCount());
Assert.assertEquals("Wrong matchedCount", new BigInteger(1, new byte[] { (byte) 0xAF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }), message.getTableStats().get(0).getMatchedCount());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyMeterConfigBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyMeterConfigBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 " + // len
"00 28 " + // flags
"00 0A " + // meterId
"00 00 00 09 " + // meterBandDrop.type
"00 01 " + // meterBandDrop.len
"00 10 " + // meterBandDrop.rate
"00 00 00 11 " + // meterBandDrop.burstSize
"00 00 00 20 " + // meterBandDrop.pad
"00 00 00 00 " + // meterBandDscp.type
"00 02 " + // meterBandDscp.len
"00 10 " + // meterBandDscp.rate
"00 00 00 11 " + // meterBandDscp.burstSize
"00 00 00 20 " + // meterBandDscp.precLevel
"04 " + // meterBandDscp.pad
"00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyMeterConfigCase messageCase = (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeterConfig message = messageCase.getMultipartReplyMeterConfig();
Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true), message.getMeterConfig().get(0).getFlags());
Assert.assertEquals("Wrong meterId", 9, message.getMeterConfig().get(0).getMeterId().getValue().intValue());
MeterBandDropCase dropCase = (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
MeterBandDrop meterBandDrop = dropCase.getMeterBandDrop();
Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
MeterBandDscpRemarkCase dscpCase = (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
MeterBandDscpRemark meterBandDscp = dscpCase.getMeterBandDscpRemark();
Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyGroupDescBody02.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
* Test covers bodies of actions Set MPLS TTL , Dec MPLS TTL, Push VLAN. Push MPLS, Push PBB.
*/
@Test
public void testMultipartReplyGroupDescBody02() {
ByteBuf bb = BufferHelper.buildBuffer("00 07 00 01 00 00 00 00 " + // len
"00 40 " + // type
"01 " + // pad
"00 " + // groupId
"00 00 00 08 " + // bucketLen
"00 38 " + // bucketWeight
"00 06 " + // bucketWatchPort
"00 00 00 05 " + // bucketWatchGroup
"00 00 00 04 " + // bucketPad
"00 00 00 00 " + // setMplsTtlType
"00 0F " + // setMplsTtlLen
"00 08 " + // setMplsTtlMPLS_TTL
"09 " + // setMplsTtlPad
"00 00 00 " + // decMplsTtlType
"00 10 " + // decMplsTtlLen
"00 08 " + // decMplsTtlPad
"00 00 00 00 " + // pushVlanType
"00 11 " + // pushVlanLen
"00 08 " + // pushVlanEthertype
"00 20 " + // pushVlanPad
"00 00 " + // pushMplsType
"00 13 " + // pushMplsLen
"00 08 " + // pushMplsEthertype
"00 FF " + // pushMplsPad
"00 00 " + // pushPbbType
"00 1A " + // pushPbbLen
"00 08 " + // pushPbbEthertype
"0F FF " + // pushPbbPad
"00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupDescCase messageCase = (MultipartReplyGroupDescCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupDesc message = messageCase.getMultipartReplyGroupDesc();
Assert.assertEquals("Wrong type", 1, message.getGroupDesc().get(0).getType().getIntValue());
Assert.assertEquals("Wrong groupId", 8, message.getGroupDesc().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong bucketWeight", 6, message.getGroupDesc().get(0).getBucketsList().get(0).getWeight().intValue());
Assert.assertEquals("Wrong bucketWatchPort", 5, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchPort().getValue().intValue());
Assert.assertEquals("Wrong bucketWatchGroup", 4, message.getGroupDesc().get(0).getBucketsList().get(0).getWatchGroup().intValue());
Assert.assertTrue("Wrong setMplsTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice() instanceof SetMplsTtlCase);
Assert.assertEquals("Wrong setMplsTtlMPLS_TTL", 9, ((SetMplsTtlCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(0).getActionChoice()).getSetMplsTtlAction().getMplsTtl().intValue());
Assert.assertTrue("Wrong decMplsTtlType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(1).getActionChoice() instanceof DecMplsTtlCase);
Assert.assertTrue("Wrong pushVlanType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice() instanceof PushVlanCase);
Assert.assertEquals("Wrong pushVlanEthertype", 32, ((PushVlanCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(2).getActionChoice()).getPushVlanAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong pushMplsType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice() instanceof PushMplsCase);
Assert.assertEquals("Wrong pushMplsEthertype", 255, ((PushMplsCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(3).getActionChoice()).getPushMplsAction().getEthertype().getValue().intValue());
Assert.assertTrue("Wrong pushPbbType", message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice() instanceof PushPbbCase);
Assert.assertEquals("Wrong pushPbbEthertype", 4095, ((PushPbbCase) message.getGroupDesc().get(0).getBucketsList().get(0).getAction().get(4).getActionChoice()).getPushPbbAction().getEthertype().getValue().intValue());
}
Aggregations