use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice in project openflowplugin by opendaylight.
the class TableFeaturesResponseConvertor method setInstructionTableFeatureProperty.
private static List<Instruction> setInstructionTableFeatureProperty(final TableFeatureProperties properties) {
List<Instruction> instructionList = new ArrayList<>();
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder();
int index = 0;
for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction currInstruction : properties.getAugmentation(InstructionRelatedTableFeatureProperty.class).getInstruction()) {
InstructionChoice currInstructionType = currInstruction.getInstructionChoice();
if (currInstructionType instanceof GotoTableCase) {
builder.setInstruction(new GoToTableCaseBuilder().setGoToTable(new GoToTableBuilder().build()).build());
} else if (currInstructionType instanceof WriteMetadataCase) {
builder.setInstruction(new WriteMetadataCaseBuilder().setWriteMetadata(new WriteMetadataBuilder().build()).build());
} else if (currInstructionType instanceof WriteActionsCase) {
builder.setInstruction(new WriteActionsCaseBuilder().setWriteActions(new WriteActionsBuilder().build()).build());
} else if (currInstructionType instanceof ApplyActionsCase) {
builder.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().build()).build());
} else if (currInstructionType instanceof ClearActionsCase) {
builder.setInstruction(new ClearActionsCaseBuilder().setClearActions(new ClearActionsBuilder().build()).build());
} else if (currInstructionType instanceof MeterCase) {
builder.setInstruction(new MeterCaseBuilder().setMeter(new MeterBuilder().build()).build());
}
// TODO: Experimenter instructions are unhandled
builder.setOrder(index);
index += 1;
instructionList.add(builder.build());
}
return instructionList;
}
Aggregations