Search in sources :

Example 1 with SwitchConfigFlag

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag 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 SwitchConfigFlag

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag in project openflowplugin by opendaylight.

the class NodeConfigServiceImpl method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final SetConfigInput input) throws ServiceException {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    SwitchConfigFlag flag = SwitchConfigFlag.valueOf(input.getFlag());
    builder.setXid(xid.getValue());
    builder.setFlags(flag);
    builder.setMissSendLen(input.getMissSearchLength());
    builder.setVersion(getVersion());
    return builder.build();
}
Also used : SwitchConfigFlag(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag) SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder)

Example 3 with SwitchConfigFlag

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag in project openflowplugin by opendaylight.

the class SetConfigMessageFactoryTest method testSetConfigMessageV10.

/**
 * Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
 */
@Test
public void testSetConfigMessageV10() throws Exception {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    SwitchConfigFlag flag = SwitchConfigFlag.OFPCFRAGDROP;
    builder.setFlags(flag);
    builder.setMissSendLen(85);
    SetConfigInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    setConfigFactory.serialize(message, out);
    BufferHelper.checkHeaderV10(out, MESSAGE_TYPE, MESSAGE_LENGTH);
    Assert.assertEquals("Wrong flags", SwitchConfigFlag.OFPCFRAGDROP.getIntValue(), out.readUnsignedShort());
    Assert.assertEquals("Wrong missSendLen", 85, out.readUnsignedShort());
}
Also used : SetConfigInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput) SwitchConfigFlag(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag) SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 4 with SwitchConfigFlag

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag in project openflowplugin by opendaylight.

the class SetConfigMessageFactoryTest method testSetConfigMessageV13.

/**
 * Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
 */
@Test
public void testSetConfigMessageV13() throws Exception {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    SwitchConfigFlag flag = SwitchConfigFlag.FRAGNORMAL;
    builder.setFlags(flag);
    builder.setMissSendLen(10);
    SetConfigInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    setConfigFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);
    Assert.assertEquals("Wrong flags", SwitchConfigFlag.FRAGNORMAL.getIntValue(), out.readUnsignedShort());
    Assert.assertEquals("Wrong missSendLen", 10, out.readUnsignedShort());
}
Also used : SetConfigInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput) SwitchConfigFlag(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag) SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 SwitchConfigFlag (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag)3 SetConfigInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder)3 SetConfigInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput)2 DefaultDeserializerFactoryTest (org.opendaylight.openflowjava.protocol.impl.util.DefaultDeserializerFactoryTest)1 GetConfigOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput)1