use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput in project openflowplugin by opendaylight.
the class GetConfigReplyMessageFactoryTest method test.
/**
* Testing {@link GetConfigReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 00 03");
GetConfigOutput builtByFactory = BufferHelper.deserialize(factory, bb);
Assert.assertEquals("Wrong switchConfigFlag", 0x01, builtByFactory.getFlags().getIntValue());
Assert.assertEquals("Wrong missSendLen", 0x03, builtByFactory.getMissSendLen().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput in project openflowplugin by opendaylight.
the class GetConfigReplyMessageFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
GetConfigOutputBuilder builder = new GetConfigOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(SwitchConfigFlag.forValue(2));
builder.setMissSendLen(20);
GetConfigOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 12);
Assert.assertEquals("Wrong Type", message.getFlags().getIntValue(), serializedBuffer.readShort());
Assert.assertEquals("Wrong Code", message.getMissSendLen().intValue(), serializedBuffer.readShort());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput in project openflowplugin by opendaylight.
the class GetConfigReplyMessageFactory method deserialize.
@Override
public GetConfigOutput deserialize(ByteBuf rawMessage) {
GetConfigOutputBuilder builder = new GetConfigOutputBuilder();
builder.setVersion(getVersion());
builder.setXid(rawMessage.readUnsignedInt());
builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
builder.setMissSendLen(rawMessage.readUnsignedShort());
return builder.build();
}
Aggregations