use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder in project openflowplugin by opendaylight.
the class WriteMetadataInstructionDeserializer method deserializeHeader.
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
builder.setInstructionChoice(new WriteMetadataCaseBuilder().build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder in project openflowplugin by opendaylight.
the class FlowInstructionResponseConvertor method convert.
@Override
public Instructions convert(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction> source, VersionConvertorData data) {
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
List<Instruction> salInstructionList = new ArrayList<>();
int instructionTreeNodekey = 0;
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction salInstruction;
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction switchInst : source) {
if (switchInst.getInstructionChoice() instanceof ApplyActionsCase) {
ApplyActionsCase actionsInstruction = (ApplyActionsCase) switchInst.getInstructionChoice();
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
final Optional<List<Action>> actions = getConvertorExecutor().convert(actionsInstruction.getApplyActions().getAction(), actionResponseConvertorData);
applyActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
salInstruction = applyActionsCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
salInstruction = clearActionsCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof GotoTableCase) {
GotoTableCase gotoTableCase = (GotoTableCase) switchInst.getInstructionChoice();
GoToTableCaseBuilder goToTableCaseBuilder = new GoToTableCaseBuilder();
GoToTableBuilder goToTableBuilder = new GoToTableBuilder();
goToTableBuilder.setTableId(gotoTableCase.getGotoTable().getTableId());
goToTableCaseBuilder.setGoToTable(goToTableBuilder.build());
salInstruction = goToTableCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof MeterCase) {
MeterCase meterIdInstruction = (MeterCase) switchInst.getInstructionChoice();
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
meterBuilder.setMeterId(new MeterId(meterIdInstruction.getMeter().getMeterId()));
meterCaseBuilder.setMeter(meterBuilder.build());
salInstruction = meterCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof WriteActionsCase) {
WriteActionsCase writeActionsCase = (WriteActionsCase) switchInst.getInstructionChoice();
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
actionResponseConvertorData.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_WRITE_ACTIONS);
final Optional<List<Action>> actions = getConvertorExecutor().convert(writeActionsCase.getWriteActions().getAction(), actionResponseConvertorData);
writeActionsBuilder.setAction(FlowConvertorUtil.wrapActionList(actions.orElse(Collections.emptyList())));
writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
salInstruction = writeActionsCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase writeMetadataCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase) switchInst.getInstructionChoice();
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder writeMetadataBuilder = new WriteMetadataBuilder();
writeMetadataBuilder.setMetadata(new BigInteger(OFConstants.SIGNUM_UNSIGNED, writeMetadataCase.getWriteMetadata().getMetadata()));
writeMetadataBuilder.setMetadataMask(new BigInteger(OFConstants.SIGNUM_UNSIGNED, writeMetadataCase.getWriteMetadata().getMetadataMask()));
writeMetadataCaseBuilder.setWriteMetadata(writeMetadataBuilder.build());
salInstruction = writeMetadataCaseBuilder.build();
} else {
continue;
}
InstructionBuilder instBuilder = new InstructionBuilder();
instBuilder.setInstruction(salInstruction);
instBuilder.setKey(new InstructionKey(instructionTreeNodekey));
instBuilder.setOrder(instructionTreeNodekey);
instructionTreeNodekey++;
salInstructionList.add(instBuilder.build());
}
instructionsBuilder.setInstruction(salInstructionList);
return instructionsBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder in project openflowplugin by opendaylight.
the class ApplyActionsInstructionDeserializer method deserialize.
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
int instructionLength = input.readUnsignedShort();
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
ApplyActionsCaseBuilder caseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder actionsBuilder = new ApplyActionsBuilder();
actionsBuilder.setAction(deserializeActions(input, instructionLength));
caseBuilder.setApplyActions(actionsBuilder.build());
builder.setInstructionChoice(caseBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder in project openflowplugin by opendaylight.
the class ApplyActionsInstructionDeserializer method deserializeHeader.
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
builder.setInstructionChoice(new ApplyActionsCaseBuilder().build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder in project openflowplugin by opendaylight.
the class WriteActionsInstructionDeserializer method deserialize.
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
int instructionLength = input.readUnsignedShort();
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
WriteActionsCaseBuilder caseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder actionsBuilder = new WriteActionsBuilder();
actionsBuilder.setAction(deserializeActions(input, instructionLength));
caseBuilder.setWriteActions(actionsBuilder.build());
builder.setInstructionChoice(caseBuilder.build());
return builder.build();
}
Aggregations