Search in sources :

Example 51 with InstructionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder in project openflowplugin by opendaylight.

the class InstructionsMissTablePropertySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final InstructionsMiss property = new InstructionsMissBuilder().setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(Collections.singletonList(new InstructionBuilder().setOrder(0).setInstruction(new ApplyActionsCaseBuilder().build()).build())).build()).build();
    assertProperty(property, out -> {
        assertEquals(out.readUnsignedShort(), InstructionConstants.APPLY_ACTIONS_TYPE);
        // Skip length of set field action
        out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    });
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder) InstructionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder) ApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder) InstructionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss) Test(org.junit.Test)

Example 52 with InstructionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder in project openflowplugin by opendaylight.

the class ClearActionsInstructionDeserializer method deserialize.

@Override
public Instruction deserialize(ByteBuf input) {
    InstructionBuilder builder = new InstructionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
    builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
    return builder.build();
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) ClearActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder)

Example 53 with InstructionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder in project openflowplugin by opendaylight.

the class MeterInstructionDeserializer method deserialize.

@Override
public Instruction deserialize(ByteBuf input) {
    final InstructionBuilder builder = new InstructionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    MeterCaseBuilder caseBuilder = new MeterCaseBuilder();
    MeterBuilder instructionBuilder = new MeterBuilder();
    instructionBuilder.setMeterId(input.readUnsignedInt());
    caseBuilder.setMeter(instructionBuilder.build());
    builder.setInstructionChoice(caseBuilder.build());
    return builder.build();
}
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) MeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder)

Example 54 with InstructionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder in project openflowplugin by opendaylight.

the class MeterInstructionDeserializer method deserializeHeader.

@Override
public Instruction deserializeHeader(ByteBuf input) {
    InstructionBuilder builder = new InstructionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    builder.setInstructionChoice(new MeterCaseBuilder().build());
    return builder.build();
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) MeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder)

Example 55 with InstructionBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder in project openflowplugin by opendaylight.

the class WriteMetadataInstructionDeserializer method deserialize.

@Override
public Instruction deserialize(ByteBuf input) {
    final InstructionBuilder builder = new InstructionBuilder();
    input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
    final WriteMetadataCaseBuilder caseBuilder = new WriteMetadataCaseBuilder();
    WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
    byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    input.readBytes(metadata);
    metadataBuilder.setMetadata(metadata);
    byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    input.readBytes(metadataMask);
    metadataBuilder.setMetadataMask(metadataMask);
    caseBuilder.setWriteMetadata(metadataBuilder.build());
    builder.setInstructionChoice(caseBuilder.build());
    return builder.build();
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) WriteMetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder) WriteMetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.metadata._case.WriteMetadataBuilder)

Aggregations

ArrayList (java.util.ArrayList)114 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)112 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)104 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)104 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)98 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)96 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)90 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)90 DropActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder)82 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)82 ControllerActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder)81 DropAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction)81 PushMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder)81 PushPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder)81 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)81 InstructionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey)79 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)77 FloodAllActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder)74 SetDlSrcActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder)74 SetNwDstActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder)74