use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class OpenflowPluginBulkTransactionProvider method createAppyActionInstruction3.
private static InstructionsBuilder createAppyActionInstruction3() {
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushPbbActionBuilder pbb = new PushPbbActionBuilder();
pbb.setEthernetType(0x88E7);
ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
actionList.add(ab.build());
// Create an Apply Action
ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
// Wrap our Apply Action in an Instruction
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
InstructionsBuilder isb = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class Activator method createGroupInstructions.
private static InstructionsBuilder createGroupInstructions(long groupId) {
ActionBuilder actionBuilder = new ActionBuilder();
GroupActionBuilder groupActionBuilder = new GroupActionBuilder();
groupActionBuilder.setGroupId(groupId);
actionBuilder.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionBuilder.build()).build());
actionBuilder.setOrder(1);
actionBuilder.setKey(new ActionKey(0));
List<Action> actionList = new ArrayList<>();
actionList.add(actionBuilder.build());
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
applyActionsBuilder.setAction(actionList);
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActionsBuilder.build()).build());
instructionBuilder.setOrder(0);
instructionBuilder.setKey(new InstructionKey(0));
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
instructions.add(instructionBuilder.build());
instructionsBuilder.setInstruction(instructions);
return instructionsBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class FlowStatsResponseConvertor method wrapOF10ActionsToInstruction.
/**
* Method wraps openflow 1.0 actions list to Apply Action Instructions.
*
* @param actionsList list of action
* @param ipProtocol ip protocol
* @return OF10 actions as an instructions
*/
private Instructions wrapOF10ActionsToInstruction(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actionsList, final short version, final Short ipProtocol) {
ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(version);
actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
actionResponseConvertorData.setIpProtocol(ipProtocol);
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> actions = getConvertorExecutor().convert(actionsList, actionResponseConvertorData);
applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
InstructionBuilder instBuilder = new InstructionBuilder();
instBuilder.setInstruction(applyActionsCaseBuilder.build());
instBuilder.setKey(new InstructionKey(0));
instBuilder.setOrder(0);
List<Instruction> salInstructionList = new ArrayList<>();
salInstructionList.add(instBuilder.build());
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
instructionsBuilder.setInstruction(salInstructionList);
return instructionsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class ClearActionsCase method process.
@Override
public Optional<Instruction> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstructionChoice(clearActionsCaseBuilder.build());
return Optional.of(instructionBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class WriteMetadataCase method process.
@Override
public Optional<Instruction> process(@Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
WriteMetadata writeMetadata = source.getWriteMetadata();
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
writeMetadataBuilder.setMetadata(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadata(), OFConstants.SIZE_OF_LONG_IN_BYTES));
writeMetadataBuilder.setMetadataMask(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadataMask(), OFConstants.SIZE_OF_LONG_IN_BYTES));
writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build());
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstructionChoice(writeMetadataCaseBuilder.build());
return Optional.of(instructionBuilder.build());
}
Aggregations