import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * Converts Openflow 1.3+ specific instructions to MD-SAL format flow instruction
+ * Converts Openflow 1.3+ specific instructions to MD-SAL format flow instruction.
*
+ * <p>
* Example usage:
* <pre>
* {@code
* </pre>
*/
public final class FlowInstructionResponseConvertor extends Convertor<
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction>,
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions
+ .grouping.Instruction>,
Instructions,
VersionConvertorData> {
- private static final Set<Class<?>> TYPES = Collections.singleton(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction.class);
+ private static final Set<Class<?>> TYPES = Collections.singleton(org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflow.common.instruction.rev130731.instructions.grouping.Instruction.class);
@Override
public Collection<Class<?>> getTypes() {
}
@Override
- public Instructions convert(List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction> source, VersionConvertorData data) {
+ 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) {
+ 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());
+ ApplyActionsCase actionsInstruction = (ApplyActionsCase) switchInst.getInstructionChoice();
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
- final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
- actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+ 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())));
+ 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) {
+ } 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());
+ GotoTableCase gotoTableCase = (GotoTableCase) switchInst.getInstructionChoice();
GoToTableCaseBuilder goToTableCaseBuilder = new GoToTableCaseBuilder();
GoToTableBuilder goToTableBuilder = new GoToTableBuilder();
salInstruction = goToTableCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof MeterCase) {
- MeterCase meterIdInstruction = ((MeterCase) switchInst.getInstructionChoice());
+ MeterCase meterIdInstruction = (MeterCase) switchInst.getInstructionChoice();
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
MeterBuilder meterBuilder = new MeterBuilder();
salInstruction = meterCaseBuilder.build();
} else if (switchInst.getInstructionChoice() instanceof WriteActionsCase) {
- WriteActionsCase writeActionsCase = ((WriteActionsCase) switchInst.getInstructionChoice());
+ WriteActionsCase writeActionsCase = (WriteActionsCase) switchInst.getInstructionChoice();
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
- final ActionResponseConvertorData actionResponseConvertorData = new ActionResponseConvertorData(data.getVersion());
- actionResponseConvertorData.setActionPath(ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+ 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())));
+ 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());
+ } 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()));
+ 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 {
InstructionBuilder instBuilder = new InstructionBuilder();
instBuilder.setInstruction(salInstruction);
- instBuilder.setKey(new InstructionKey(instructionTreeNodekey));
+ instBuilder.withKey(new InstructionKey(instructionTreeNodekey));
instBuilder.setOrder(instructionTreeNodekey);
instructionTreeNodekey++;
salInstructionList.add(instBuilder.build());