public ApplyActions build() { return new ApplyActionsImpl(this); }
public ApplyActionsBuilder(ApplyActions base) { this._action = base.getAction(); if (base instanceof ApplyActionsImpl) { ApplyActionsImpl _impl = (ApplyActionsImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction applyActionIns(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action... actions) { return new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder() .setAction(actionList(actions)) .build()) .build(); }
/** * Builds the apply action builder for the action * @param action the conntrack action. * @return the apply action builder. */ public static ApplyActionsBuilder conntrackActionBuilder(Action action) { ActionBuilder ab = new ActionBuilder(); ab.setAction(action); ab.setOrder(0); ab.setKey(new ActionKey(0)); List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists.newArrayList(); actionList.add(ab.build()); ApplyActionsBuilder aab = new ApplyActionsBuilder(); aab.setAction(actionList); return aab; } /**
/** * Create InstructionBuilder with apply action. * * @param aab the apply action Builder. * @param order the position of the instruction in the instruction list. * @param drop indicates whether it is a drop instruction. * @return the instruction builder. */ public static InstructionBuilder createInstructionBuilder(ApplyActionsBuilder aab, int order, boolean drop) { InstructionBuilder ib = new InstructionBuilder(); ib.setOrder(order); ib.setKey(new InstructionKey(order)); ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); if (drop) { InstructionUtils.createDropInstructions(ib); } return ib; } }
private ApplyActionsImpl(ApplyActionsBuilder base) { this._action = base.getAction(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActions>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction applyActionIns(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action... actions) { return new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder() .setAction(actionList(actions)) .build()) .build(); }
private void applyActionsCase(ApplyActionsCase applyActionCase) { List<Action> applyActions = applyActionCase.getApplyActions().getAction(); sortActionsByOrder(applyActions); this.applyActions.addAll(applyActions); }
public static Instruction applyActionIns(Action... actions) { return new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder().setAction(actionList(actions)).build()).build(); }
public static List<Action> getAction( org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) { if (source.getInstructions() != null) { for (Instruction instruction : source.getInstructions().getInstruction()) { if (instruction.getInstruction() instanceof ApplyActionsCase) { return (((ApplyActionsCase) instruction.getInstruction()).getApplyActions().getAction()); } } } // TODO Auto-generated method stub return Collections.emptyList(); }
public static Instruction applyActionIns(List<ActionBuilder> actions) { return new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder().setAction(actionList(actions)).build()).build(); }
@Override public Optional<Instruction> process(final @Nonnull org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) { ApplyActions applyActions = source.getApplyActions(); ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder(); ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder(); final Optional<List<Action>> actionList = convertorExecutor.convert(applyActions.getAction(), data); applyActionsBuilder.setAction(actionList.orElse(Collections.emptyList())); applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build()); InstructionBuilder instructionBuilder = new InstructionBuilder(); instructionBuilder.setInstructionChoice(applyActionsCaseBuilder.build()); return Optional.of(instructionBuilder.build()); } }
public static InstructionBuilder createActionsInstructionBuilder(Action... actions) { InstructionBuilder actionsIb = new InstructionBuilder(); ArrayList<Action> alist = new ArrayList<>(); ApplyActionsBuilder aab = new ApplyActionsBuilder(); for (Action action : actions) { alist.add(action); } aab.setAction(alist); actionsIb.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); actionsIb.setKey(new InstructionKey(0)); actionsIb.setOrder(0); return actionsIb; }
private static boolean isSetVlanIdActionCasePresent(Flow flow) { // we are trying to find if there is a set-vlan-id action (OF1.0) action present in the flow. // If yes,then we would need to two flows if (flow.getInstructions() != null && flow.getInstructions().getInstruction() != null) { for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : flow.getInstructions().getInstruction()) { org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction.getInstruction(); if (curInstruction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) { org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase applyActionscase = (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase) curInstruction; ApplyActions applyActions = applyActionscase.getApplyActions(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : applyActions.getAction()) { if (action.getAction() instanceof SetVlanIdActionCase) { return true; } } } } } return false; }
public static Instructions toApplyInstruction(final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) { return new InstructionsBuilder() .setInstruction( Collections.singletonList( new InstructionBuilder() .setOrder(0) .setInstruction( new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder().setAction(actions).build()) .build() ).build()) ).build(); }
/** * Create a new apply action that contains the specified MD-SAL action * list. * * @param actions A list of MD-SAL actions. * @return An {@link Instructions} instance. */ public static Instructions newInstructions(List<Action> actions) { ApplyActionsCase apply = new ApplyActionsCaseBuilder(). setApplyActions(new ApplyActionsBuilder(). setAction(actions).build()). build(); Instruction inst = new InstructionBuilder(). setOrder(MiscUtils.ORDER_MIN).setInstruction(apply).build(); return new InstructionsBuilder(). setInstruction(Collections.singletonList(inst)).build(); }
public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction popVlanInstruction( int order) { List<ActionBuilder> actionBuilders = new ArrayList<>(); actionBuilders.add(new ActionBuilder().setAction(popVlanAction()).setOrder(0)); return new InstructionBuilder() .setInstruction(new ApplyActionsCaseBuilder() .setApplyActions(new ApplyActionsBuilder().setAction(actionList(actionBuilders)).build()).build()) .setOrder(order) .build(); }
/** * Creates a set of redirect Instruction based on the port values * received. * @param outputPort OVS port to output the packet to * @return OpenFlow Flow Instructions */ protected Instructions createRedirectIntentInstructions(String outputPort) { List<Action> actionList = Lists.newArrayList(); int order = 0; actionList.add(FlowUtils.createOutputToPort(order++, outputPort)); ApplyActions applyRedirectActions = new ApplyActionsBuilder().setAction(actionList).build(); Instruction redirectInstruction = new InstructionBuilder().setOrder(0) .setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyRedirectActions).build()).build(); Instructions instructions = new InstructionsBuilder().setInstruction(ImmutableList.of(redirectInstruction)).build(); return instructions; }
private static Instructions makeStaticDropActionInstructions() { // Create an DropAction final DropActionCase dropAction = new DropActionCaseBuilder().setDropAction(new DropActionBuilder().build()).build(); // Create an Action final Action ab = new ActionBuilder().setOrder(0).setAction(dropAction).build(); // Create an Apply Action final ApplyActions aab = new ApplyActionsBuilder().setAction(Collections.singletonList(ab)).build(); // Wrap our Apply Action in an Instruction final Instruction ib = new InstructionBuilder() .setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab).build()).setOrder(0).build(); // Put our Instruction in a list of Instructions return new InstructionsBuilder().setInstruction(Collections.singletonList(ib)).build(); }
private Instruction createApplyActionsInstruction(Uri dstPortUri, int order) { Action outputToControllerAction = new ActionBuilder() .setOrder(0) .setAction(new OutputActionCaseBuilder() .setOutputAction(new OutputActionBuilder() .setMaxLength(0xffff) .setOutputNodeConnector(dstPortUri) .build()) .build()) .build(); ApplyActions applyActions = new ApplyActionsBuilder().setAction(ImmutableList.of(outputToControllerAction)) .build(); return new InstructionBuilder() .setOrder(order) .setInstruction(new ApplyActionsCaseBuilder() .setApplyActions(applyActions) .build()) .build(); }