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 testWithIncorrectCodeEnum.
/**
* Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectCodeEnum() {
ByteBuf bb = BufferHelper.buildBuffer("00 03 00 10 00 01 02 03");
ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 16, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertArrayEquals("Wrong data", new byte[] { 0x00, 0x01, 0x02, 0x03 }, builtByFactory.getData());
}
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 testWithoutData.
/**
* Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithoutData() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 0, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "HELLOFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "INCOMPATIBLE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 01 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 1, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADREQUEST", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADVERSION", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 02 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 2, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADACTION", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADTYPE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 03 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWNINST", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 04 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 4, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "BADMATCH", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADTYPE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 05 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 5, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "FLOWMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 06 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 6, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "GROUPMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "GROUPEXISTS", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 07 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 7, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "PORTMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADPORT", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 08 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 8, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "TABLEMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADTABLE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 09 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 9, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "QUEUEOPFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADPORT", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0A 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "SWITCHCONFIGFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADFLAGS", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0B 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 11, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "ROLEREQUESTFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "STALE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0C 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 12, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "METERMODFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
bb = BufferHelper.buildBuffer("00 0D 00 00");
builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 13, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "TABLEFEATURESFAILED", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "BADTABLE", builtByFactory.getCodeString());
Assert.assertNull("Data is not null", builtByFactory.getData());
}
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 testWithIncorrectTypeEnum.
/**
* Test of {@link ErrorMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithIncorrectTypeEnum() {
ByteBuf bb = BufferHelper.buildBuffer("00 20 00 05 00 01 02 03");
ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 32, builtByFactory.getType().intValue());
Assert.assertEquals("Wrong code", 5, builtByFactory.getCode().intValue());
Assert.assertEquals("Wrong type string", "UNKNOWN_TYPE", builtByFactory.getTypeString());
Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
Assert.assertArrayEquals("Wrong data", new byte[] { 0x00, 0x01, 0x02, 0x03 }, builtByFactory.getData());
}
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 FeaturesReplyMessageFactoryTest method test.
/**
* Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 01 00 00 00" + " 00 00 00 00 01 02 03");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong datapathId", 0x0001020304050607L, builtByFactory.getDatapathId().longValue());
Assert.assertEquals("Wrong buffers", 0x00010203L, builtByFactory.getBuffers().longValue());
Assert.assertEquals("Wrong number of tables", 0x01, builtByFactory.getTables().shortValue());
Assert.assertEquals("Wrong auxiliaryId", 0x01, builtByFactory.getAuxiliaryId().shortValue());
Assert.assertEquals("Wrong capabilities", new Capabilities(false, false, false, false, false, false, false), builtByFactory.getCapabilities());
Assert.assertEquals("Wrong reserved", 0x00010203L, builtByFactory.getReserved().longValue());
}
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 FeaturesReplyMessageFactoryTest method testCapabilities.
/**
* Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO
* (capabilities set).
*/
@Test
public void testCapabilities() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 01 00 00 00" + " 00 01 6F 00 01 02 03");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong capabilities", new Capabilities(true, true, true, true, true, true, true), builtByFactory.getCapabilities());
}
Aggregations