use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project openflowplugin by opendaylight.
the class TableFeaturesConvertor method setInstructionTableFeatureProperty.
private static void setInstructionTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<Instruction> instructionList) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction> instructionTypeList = new ArrayList<>();
for (Instruction currInstruction : instructionList) {
InstructionBuilder instructionType = new InstructionBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction instruction = currInstruction.getInstruction();
if (instruction instanceof GoToTableCase) {
GotoTableCaseBuilder goToTableCaseBuilder = new GotoTableCaseBuilder();
instructionType.setInstructionChoice(goToTableCaseBuilder.build());
} else if (instruction instanceof WriteMetadataCase) {
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
instructionType.setInstructionChoice(writeMetadataCaseBuilder.build());
} else if (instruction instanceof WriteActionsCase) {
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
instructionType.setInstructionChoice(writeActionsCaseBuilder.build());
} else if (instruction instanceof ApplyActionsCase) {
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
instructionType.setInstructionChoice(applyActionsCaseBuilder.build());
} else if (instruction instanceof ClearActionsCase) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
instructionType.setInstructionChoice(clearActionsCaseBuilder.build());
} else if (instruction instanceof MeterCase) {
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
instructionType.setInstructionChoice(meterCaseBuilder.build());
}
// TODO: Experimenter instructions are unhandled
instructionTypeList.add(instructionType.build());
}
InstructionRelatedTableFeaturePropertyBuilder propBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
propBuilder.setInstruction(instructionTypeList);
builder.setType(type);
builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, propBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project openflowplugin by opendaylight.
the class DropTestRpcSender method processPacket.
@Override
protected void processPacket(final InstanceIdentifier<Node> node, final Match match, final Instructions instructions) {
final AddFlowInputBuilder fb = BUILDER.get();
// Finally build our flow
fb.setMatch(match);
fb.setInstructions(instructions);
// Construct the flow instance id
fb.setNode(new NodeRef(node));
// Add flow
final AddFlowInput flow = fb.build();
if (LOG.isDebugEnabled()) {
LOG.debug("onPacketReceived - About to write flow (via SalFlowService) {}", flow);
}
ListenableFuture<RpcResult<AddFlowOutput>> result = JdkFutureAdapters.listenInPoolThread(flowService.addFlow(flow));
Futures.addCallback(result, new FutureCallback<RpcResult<AddFlowOutput>>() {
@Override
public void onSuccess(final RpcResult<AddFlowOutput> result) {
countFutureSuccess();
}
@Override
public void onFailure(final Throwable throwable) {
countFutureError();
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method createDecNwTtlInstructions.
private static InstructionsBuilder createDecNwTtlInstructions() {
DecNwTtlBuilder ta = new DecNwTtlBuilder();
DecNwTtl decNwTtl = ta.build();
ActionBuilder ab = new ActionBuilder();
ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
// Add our drop action to a list
List<Action> actionList = new ArrayList<>();
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());
ib.setKey(new InstructionKey(0));
ib.setOrder(0);
// 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.flow.Instructions in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method createMeterInstructions.
private static InstructionsBuilder createMeterInstructions() {
MeterBuilder aab = new MeterBuilder();
aab.setMeterId(new MeterId(1L));
InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new MeterCaseBuilder().setMeter(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.flow.Instructions in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method createAppyActionInstruction2.
private static InstructionsBuilder createAppyActionInstruction2() {
List<Action> actionList = new ArrayList<>();
ActionBuilder ab = new ActionBuilder();
PushMplsActionBuilder push = new PushMplsActionBuilder();
push.setEthernetType(0x8847);
ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.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;
}
Aggregations