use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class GetAsyncReplyMessageFactoryTest method testGetAsyncReplyMessage.
/**
* Testing {@link GetAsyncReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testGetAsyncReplyMessage() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 07 " + "00 00 00 00 " + "00 00 00 07 " + "00 00 00 00 " + "00 00 00 0F " + "00 00 00 00");
GetAsyncOutput builtByFactory = BufferHelper.deserialize(asyncFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong packetInMask", createPacketInMask(), builtByFactory.getPacketInMask());
Assert.assertEquals("Wrong portStatusMask", createPortStatusMask(), builtByFactory.getPortStatusMask());
Assert.assertEquals("Wrong flowRemovedMask", createFlowRemovedMask(), builtByFactory.getFlowRemovedMask());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class MultipartReplyExperimenterTest method testMultipartReplyExperimenter.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyExperimenter() {
Mockito.when(registry.getDeserializer(Matchers.<MessageCodeKey>any())).thenReturn(vendorDeserializer);
factory.injectDeserializerRegistry(registry);
ByteBuf bb = BufferHelper.buildBuffer("FF FF 00 01 00 00 00 00 " + // expID, expType
"00 00 00 01 00 00 00 02");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 65535, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
Mockito.verify(vendorDeserializer).deserialize(bb);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class MultipartReplyGroupFeaturesTest method testMultipartReplyGroupFeatures2.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO
* (with different group types and capabilities).
*/
@Test
public void testMultipartReplyGroupFeatures2() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 08 00 01 00 00 00 00 " + // types
"00 00 00 00 " + // capabilities
"00 00 00 00 " + // max groups
"00 00 00 01 " + // max groups
"00 00 00 02 " + // max groups
"00 00 00 03 " + // max groups
"00 00 00 04 " + // actions bitmap (all actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00 " + // actions bitmap (no actions included)
"00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyGroupFeaturesCase messageCase = (MultipartReplyGroupFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyGroupFeatures message = messageCase.getMultipartReplyGroupFeatures();
Assert.assertEquals("Wrong group types", new GroupTypes(false, false, false, false), message.getTypes());
Assert.assertEquals("Wrong capabilities", new GroupCapabilities(false, false, false, false), message.getCapabilities());
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class BarrierReplyMessageFactoryTest method testVersions.
/**
* Testing of {@link BarrierReplyMessageFactory} for correct header version.
*/
@Test
public void testVersions() {
List<Byte> versions = new ArrayList<>(Arrays.asList(EncodeConstants.OF13_VERSION_ID, EncodeConstants.OF14_VERSION_ID, EncodeConstants.OF15_VERSION_ID));
ByteBuf bb = BufferHelper.buildBuffer();
testHeaderVersions(versions, bb);
// OFP v1.0 need to be tested separately cause of different message type value
messageCodeKey = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, 19, BarrierOutput.class);
testHeaderVersions(Collections.singletonList(EncodeConstants.OF10_VERSION_ID), bb);
}
use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link in project openflowplugin by opendaylight.
the class ErrorMessageFactoryTest method testWithoutData2.
/**
* Test of {@link ErrorMessageFactory} for correct translation into POJO
* - not existing code used.
*/
@Test
public void testWithoutData2() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 FF FF");
ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "HELLOFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 01 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 1, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADREQUEST", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 02 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 2, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADACTION", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 03 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 04 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 4, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADMATCH", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 05 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 5, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "FLOWMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 06 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 6, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "GROUPMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 07 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "PORTMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 08 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "TABLEMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 09 FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 9, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "QUEUEOPFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0A FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "SWITCHCONFIGFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0B FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 11, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "ROLEREQUESTFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0C FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 12, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "METERMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0D FF FF");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 13, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "TABLEFEATURESFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
}
Aggregations