use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput in project openflowplugin by opendaylight.
the class OF10FeaturesReplyMessageFactoryTest method testWithTwoPortsSet.
/**
* Testing {@link OF10FeaturesReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testWithTwoPortsSet() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 02 03 04 05 06 07 00 01 02 03 01 00 00 00 " + "00 00 00 8B 00 00 03 B5 " + "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 01 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88 " + "00 10 01 01 05 01 04 02 41 4C 4F 48 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 00 00 00 00 " + "00 00 00 31 00 00 04 42 00 00 03 0C 00 00 08 88");
GetFeaturesOutput builtByFactory = BufferHelper.deserialize(featuresFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong ports size", 2, builtByFactory.getPhyPort().size());
PhyPort port = builtByFactory.getPhyPort().get(0);
Assert.assertEquals("Wrong port - port-no", 16, port.getPortNo().intValue());
Assert.assertEquals("Wrong port - hw-addr", new MacAddress("01:01:05:01:04:02"), port.getHwAddr());
Assert.assertEquals("Wrong port - name", new String("ALOHA"), port.getName());
Assert.assertEquals("Wrong port - config", new PortConfigV10(false, false, false, false, false, false, false), port.getConfigV10());
Assert.assertEquals("Wrong port - state", new PortStateV10(false, true, false, true, true, true, false, true), port.getStateV10());
port = builtByFactory.getPhyPort().get(1);
Assert.assertEquals("Wrong port - state", new PortStateV10(false, false, false, false, false, false, true, false), port.getStateV10());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput in project openflowplugin by opendaylight.
the class GetFeaturesOutputFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setDatapathId(BigInteger.valueOf(1234L));
builder.setBuffers(1234L);
builder.setTables((short) 12);
builder.setAuxiliaryId((short) 12);
builder.setCapabilities(new Capabilities(true, false, true, false, true, false, true));
builder.setReserved(1234L);
GetFeaturesOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 32);
Assert.assertEquals("Wrong DatapathId", message.getDatapathId().longValue(), serializedBuffer.readLong());
Assert.assertEquals("Wrong Buffer ID", message.getBuffers().longValue(), serializedBuffer.readInt());
Assert.assertEquals("Wrong tables", message.getTables().shortValue(), serializedBuffer.readUnsignedByte());
Assert.assertEquals("Wrong auxiliary ID", message.getAuxiliaryId().shortValue(), serializedBuffer.readUnsignedByte());
serializedBuffer.skipBytes(PADDING);
Assert.assertEquals("Wrong Capabilities", message.getCapabilities(), createCapabilities(serializedBuffer.readInt()));
Assert.assertEquals("Wrong reserved", message.getReserved().longValue(), serializedBuffer.readInt());
}
Aggregations