Search in sources :

Example 1 with SetNwTtlActionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder in project openflowplugin by opendaylight.

the class SalToOfSetNwTtlActionCase method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetNwTtlActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    SetNwTtlCaseBuilder nwTtlCaseBuilder = new SetNwTtlCaseBuilder();
    SetNwTtlActionBuilder nwTtlBuilder = new SetNwTtlActionBuilder();
    nwTtlBuilder.setNwTtl(source.getSetNwTtlAction().getNwTtl());
    nwTtlCaseBuilder.setSetNwTtlAction(nwTtlBuilder.build());
    return Optional.of(new ActionBuilder().setActionChoice(nwTtlCaseBuilder.build()).build());
}
Also used : SetNwTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder) Nonnull(javax.annotation.Nonnull)

Example 2 with SetNwTtlActionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setActionTableFeatureProperty.

private static void setActionTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> salActions) {
    List<Action> actionList = new ArrayList<>();
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action currAction : salActions) {
        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionType = currAction.getAction();
        ActionBuilder actionBuilder = new ActionBuilder();
        if (actionType instanceof OutputActionCase) {
            OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
            actionBuilder.setActionChoice(outputActionCaseBuilder.build());
        } else if (actionType instanceof GroupActionCase) {
            GroupCaseBuilder groupActionBuilder = new GroupCaseBuilder();
            actionBuilder.setActionChoice(groupActionBuilder.build());
        } else if (actionType instanceof CopyTtlOutCase) {
            CopyTtlOutCaseBuilder copyTtlOutCaseBuilder = new CopyTtlOutCaseBuilder();
            actionBuilder.setActionChoice(copyTtlOutCaseBuilder.build());
        } else if (actionType instanceof CopyTtlInCase) {
            CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
            actionBuilder.setActionChoice(copyTtlInCaseBuilder.build());
        } else if (actionType instanceof SetMplsTtlActionCase) {
            SetMplsTtlCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlCaseBuilder();
            actionBuilder.setActionChoice(setMplsTtlActionBuilder.build());
        } else if (actionType instanceof DecMplsTtlCase) {
            DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
            actionBuilder.setActionChoice(decMplsTtlCaseBuilder.build());
        } else if (actionType instanceof PushVlanActionCase) {
            PushVlanCaseBuilder pushVlanActionBuilder = new PushVlanCaseBuilder();
            actionBuilder.setActionChoice(pushVlanActionBuilder.build());
        } else if (actionType instanceof PopVlanActionCase) {
            PopVlanCaseBuilder popVlanCaseBuilder = new PopVlanCaseBuilder();
            actionBuilder.setActionChoice(popVlanCaseBuilder.build());
        } else if (actionType instanceof PushMplsActionCase) {
            PushMplsCaseBuilder pushMplsActionBuilder = new PushMplsCaseBuilder();
            actionBuilder.setActionChoice(pushMplsActionBuilder.build());
        } else if (actionType instanceof PopMplsActionCase) {
            PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
            actionBuilder.setActionChoice(popMplsCaseBuilder.build());
        } else if (actionType instanceof SetQueueActionCase) {
            SetQueueCaseBuilder setQueueActionBuilder = new SetQueueCaseBuilder();
            actionBuilder.setActionChoice(setQueueActionBuilder.build());
        } else if (actionType instanceof SetNwTtlActionCase) {
            SetNwTtlCaseBuilder setNwTtlActionBuilder = new SetNwTtlCaseBuilder();
            actionBuilder.setActionChoice(setNwTtlActionBuilder.build());
        } else if (actionType instanceof DecNwTtlCase) {
            DecNwTtlCaseBuilder decNwTtlCaseBuilder = new DecNwTtlCaseBuilder();
            actionBuilder.setActionChoice(decNwTtlCaseBuilder.build());
        } else if (actionType instanceof SetFieldCase) {
            SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
            actionBuilder.setActionChoice(setFieldCaseBuilder.build());
        } else if (actionType instanceof PushPbbActionCase) {
            PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
            actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
        } else if (actionType instanceof PopPbbActionCase) {
            PopPbbCaseBuilder popPbbCaseBuilder = new PopPbbCaseBuilder();
            actionBuilder.setActionChoice(popPbbCaseBuilder.build());
        }
        // Experimenter action is unhandled
        actionList.add(actionBuilder.build());
    }
    ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
    propBuilder.setAction(actionList);
    builder.setType(type);
    builder.addAugmentation(ActionRelatedTableFeatureProperty.class, propBuilder.build());
}
Also used : PopVlanActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase) PopPbbCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder) ArrayList(java.util.ArrayList) PopMplsActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase) DecNwTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase) OutputActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase) GroupActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase) CopyTtlInCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase) SetNwTtlActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase) PushPbbActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase) CopyTtlInCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder) SetMplsTtlActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase) DecNwTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder) PushMplsActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase) SetQueueActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase) PushMplsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCaseBuilder) PushVlanCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder) SetQueueCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCaseBuilder) CopyTtlOutCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder) OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) SetNwTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) GroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder) SetFieldCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase) PushVlanActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase) DecMplsTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder) PushPbbCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder) PopPbbActionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase) ActionRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder) SetMplsTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder) PopVlanCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder) PopMplsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCaseBuilder) CopyTtlOutCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase) DecMplsTtlCase(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase)

Example 3 with SetNwTtlActionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginGroupTestCommandProvider method createSetNwTtlAction.

private List<Action> createSetNwTtlAction() {
    SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
    setNwTtlActionBuilder.setNwTtl((short) 1);
    ActionBuilder action = new ActionBuilder();
    action.setAction(new SetNwTtlActionCaseBuilder().setSetNwTtlAction(setNwTtlActionBuilder.build()).build());
    List<Action> actions = new ArrayList<>();
    actions.add(action.build());
    return actions;
}
Also used : SetNwTtlActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) PushVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder) PopPbbActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder) GroupActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder) PushMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder) PopVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) PushPbbActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder) SetQueueActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder) SetMplsTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder) PopMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) ArrayList(java.util.ArrayList) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder)

Example 4 with SetNwTtlActionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder in project openflowplugin by opendaylight.

the class OF13InstructionsSerializerTest method test.

/**
 * Testing instructions translation.
 */
@Test
public void test() {
    final List<Instruction> instructions = new ArrayList<>();
    // Goto_table instruction
    InstructionBuilder builder = new InstructionBuilder();
    GotoTableCaseBuilder gotoCaseBuilder = new GotoTableCaseBuilder();
    GotoTableBuilder instructionBuilder = new GotoTableBuilder();
    instructionBuilder.setTableId((short) 5);
    gotoCaseBuilder.setGotoTable(instructionBuilder.build());
    builder.setInstructionChoice(gotoCaseBuilder.build());
    instructions.add(builder.build());
    // Write_metadata instruction
    builder = new InstructionBuilder();
    WriteMetadataCaseBuilder metadataCaseBuilder = new WriteMetadataCaseBuilder();
    WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
    metadataBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));
    metadataBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));
    metadataCaseBuilder.setWriteMetadata(metadataBuilder.build());
    builder.setInstructionChoice(metadataCaseBuilder.build());
    instructions.add(builder.build());
    // Clear_actions instruction
    builder = new InstructionBuilder();
    builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
    instructions.add(builder.build());
    // Meter instruction
    builder = new InstructionBuilder();
    MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
    MeterBuilder meterBuilder = new MeterBuilder();
    meterBuilder.setMeterId(42L);
    meterCaseBuilder.setMeter(meterBuilder.build());
    builder.setInstructionChoice(meterCaseBuilder.build());
    instructions.add(builder.build());
    // Write_actions instruction
    builder = new InstructionBuilder();
    final WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
    final WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
    OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
    OutputActionBuilder outputBuilder = new OutputActionBuilder();
    outputBuilder.setPort(new PortNumber(45L));
    outputBuilder.setMaxLength(55);
    caseBuilder.setOutputAction(outputBuilder.build());
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setActionChoice(caseBuilder.build());
    List<Action> actions = new ArrayList<>();
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    SetNwTtlCaseBuilder ttlCaseBuilder = new SetNwTtlCaseBuilder();
    SetNwTtlActionBuilder ttlActionBuilder = new SetNwTtlActionBuilder();
    ttlActionBuilder.setNwTtl((short) 64);
    ttlCaseBuilder.setSetNwTtlAction(ttlActionBuilder.build());
    actionBuilder.setActionChoice(ttlCaseBuilder.build());
    actions.add(actionBuilder.build());
    writeActionsBuilder.setAction(actions);
    writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
    builder.setInstructionChoice(writeActionsCaseBuilder.build());
    instructions.add(builder.build());
    // Apply_actions instruction
    builder = new InstructionBuilder();
    final ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
    final ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
    actions = new ArrayList<>();
    actionBuilder = new ActionBuilder();
    PushVlanCaseBuilder vlanCaseBuilder = new PushVlanCaseBuilder();
    PushVlanActionBuilder vlanBuilder = new PushVlanActionBuilder();
    vlanBuilder.setEthertype(new EtherType(new EtherType(14)));
    vlanCaseBuilder.setPushVlanAction(vlanBuilder.build());
    actionBuilder.setActionChoice(vlanCaseBuilder.build());
    actions.add(actionBuilder.build());
    actionBuilder = new ActionBuilder();
    actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());
    actions.add(actionBuilder.build());
    applyActionsBuilder.setAction(actions);
    applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
    builder.setInstructionChoice(applyActionsCaseBuilder.build());
    instructions.add(builder.build());
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    ListSerializer.serializeList(instructions, TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
    Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());
    out.skipBytes(3);
    Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
    out.skipBytes(4);
    byte[] actual = new byte[8];
    out.readBytes(actual);
    Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07", ByteBufUtils.bytesToHexString(actual));
    actual = new byte[8];
    out.readBytes(actual);
    Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00", ByteBufUtils.bytesToHexString(actual));
    Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
    out.skipBytes(4);
    Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());
    Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());
    out.skipBytes(4);
    Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
    Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());
    Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());
    out.skipBytes(6);
    Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());
    out.skipBytes(3);
    Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
    Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
    out.skipBytes(4);
    Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    Assert.assertEquals("Wrong action ethertype", 14, out.readUnsignedShort());
    out.skipBytes(2);
    Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
    Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
    out.skipBytes(4);
    Assert.assertTrue("Not all data were read", out.readableBytes() == 0);
}
Also used : MeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder) InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) SetNwTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) PushVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder) WriteMetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder) PopPbbCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder) ArrayList(java.util.ArrayList) GotoTableCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction) ByteBuf(io.netty.buffer.ByteBuf) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder) WriteMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.metadata._case.WriteMetadataBuilder) ApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder) ClearActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder) ApplyActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.apply.actions._case.ApplyActionsBuilder) MeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder) WriteActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.actions._case.WriteActionsBuilder) WriteActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder) PushVlanCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder) PushVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder) GotoTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice._goto.table._case.GotoTableBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) Test(org.junit.Test)

Example 5 with SetNwTtlActionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder in project openflowplugin by opendaylight.

the class SetNwTtlActionSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final short ttl = 10;
    final Action action = new SetNwTtlActionCaseBuilder().setSetNwTtlAction(new SetNwTtlActionBuilder().setNwTtl(ttl).build()).build();
    assertAction(action, out -> {
        assertEquals(out.readUnsignedByte(), ttl);
        out.skipBytes(ActionConstants.SET_NW_TTL_PADDING);
    });
}
Also used : SetNwTtlActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)8 SetNwTtlCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder)7 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)7 SetNwTtlActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder)6 SetNwTtlActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder)5 SetNwTtlActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder)5 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder)5 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)5 PopPbbCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder)4 PushVlanCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder)4 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder)4 PushVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder)4 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)4 Test (org.junit.Test)3 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType)3 ByteBuf (io.netty.buffer.ByteBuf)2 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)2 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)2 PopMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder)2 PopPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder)2