Search in sources :

Example 1 with GetConfigOutput

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());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) GetConfigOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput) DefaultDeserializerFactoryTest(org.opendaylight.openflowjava.protocol.impl.util.DefaultDeserializerFactoryTest) Test(org.junit.Test)

Example 2 with GetConfigOutput

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());
}
Also used : GetConfigOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder) ByteBuf(io.netty.buffer.ByteBuf) GetConfigOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput) Test(org.junit.Test)

Example 3 with GetConfigOutput

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();
}
Also used : GetConfigOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 Test (org.junit.Test)2 GetConfigOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput)2 GetConfigOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder)2 DefaultDeserializerFactoryTest (org.opendaylight.openflowjava.protocol.impl.util.DefaultDeserializerFactoryTest)1