Search in sources :

Example 1 with SetConfigInputBuilder

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

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

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder in project openflowplugin by opendaylight.

the class DefaultConfigPusher method onDataTreeChanged.

@Override
public void onDataTreeChanged(@Nonnull final Collection<DataTreeModification<FlowCapableNode>> modifications) {
    for (DataTreeModification<FlowCapableNode> modification : modifications) {
        if (modification.getRootNode().getModificationType() == ModificationType.WRITE) {
            SetConfigInputBuilder setConfigInputBuilder = new SetConfigInputBuilder();
            setConfigInputBuilder.setFlag(SwitchConfigFlag.FRAGNORMAL.toString());
            setConfigInputBuilder.setMissSearchLength(OFConstants.OFPCML_NO_BUFFER);
            setConfigInputBuilder.setNode(new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class)));
            final Future<RpcResult<SetConfigOutput>> resultFuture = nodeConfigService.setConfig(setConfigInputBuilder.build());
            JdkFutures.addErrorLogging(resultFuture, LOG, "addFlow");
        }
    }
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult)

Example 4 with SetConfigInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder in project openflowplugin by opendaylight.

the class SetConfigInputMessageFactory method deserialize.

@Override
public SetConfigInput deserialize(ByteBuf rawMessage) {
    SetConfigInputBuilder builder = new SetConfigInputBuilder();
    builder.setVersion(getVersion());
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
    builder.setMissSendLen(rawMessage.readUnsignedShort());
    return builder.build();
}
Also used : SetConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder)

Example 5 with SetConfigInputBuilder

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

SetConfigInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder)4 SwitchConfigFlag (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag)3 ByteBuf (io.netty.buffer.ByteBuf)2 Test (org.junit.Test)2 SetConfigInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInputBuilder)2 SetConfigInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput)2 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1