Search in sources :

Example 1 with GetConfigOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder 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 2 with GetConfigOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder 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

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