public InstructionsBuilder(Instructions base) { this._instruction = base.getInstruction(); if (base instanceof InstructionsImpl) { InstructionsImpl _impl = (InstructionsImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
if (other.getInstruction() != null) { return false; } else if(!_instruction.equals(other.getInstruction())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
/** * Extracts the existing instructions (if any) from the flow. * * @param flow The flow. * @return The instructions in the flow (empty if none). */ public static List<Instruction> extractExistingInstructions(Flow flow) { if (flow != null) { Instructions ins = flow.getInstructions(); if (ins != null) { return ins.getInstruction(); } } return Collections.emptyList(); }
/** * Determine whether the given instruction list contains only one apply * output action that transmits packets to the given port or not. * * @param insts A flow instructions. * @param pid The target port identifier. * @return {@code true} if the given instruction list contains only one * apply output action that specifies the given port. * Otherwise {@code false}. */ public static boolean isOutput(Instructions insts, String pid) { boolean result = false; if (insts != null) { List<Instruction> instList = insts.getInstruction(); if (instList != null && instList.size() == 1) { Instruction i = instList.get(0); org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types. rev131026.instruction.Instruction ic = i.getInstruction(); if (ic instanceof ApplyActionsCase) { ApplyActionsCase apCase = (ApplyActionsCase)ic; ActionList al = apCase.getApplyActions(); result = (al != null && isOutput(al.getAction(), pid)); } } } return result; }
private List<Instruction> toInstructions(Flow flow, short version, BigInteger datapathid) { final List<Instruction> instructionsList = new ArrayList<>(); final ActionConvertorData data = new ActionConvertorData(version); data.setDatapathId(datapathid); data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow)); Instructions instructions = flow.getInstructions(); for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : instructions .getInstruction()) { org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction .getInstruction(); Optional<Instruction> result = PROCESSOR.process(curInstruction, data, getConvertorExecutor()); if (result.isPresent()) { instructionsList.add(result.get()); } } return instructionsList; }
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(); }
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; }
private short lookUpFlowTable(short tableId, MatchFields matchFields) { List<Flow> flows = indexTables.get(tableId).getFlow(); sortFlowByPriority(flows); for (Flow flow : flows) { if (flowEntryMatcher.match(flow.getMatch(), matchFields)) { log.info("Priority: " + flow.getPriority()); Instructions inss = flow.getInstructions(); if (inss == null) { return tableId; } short nextTableId = lookUpInstructions(inss.getInstruction()); return (nextTableId != -1) ? nextTableId : tableId; } } return tableId; }
private boolean isFlowSupported(List<TableFeatureProperties> tableFeaturePropertiesList, FlowBuilder flowBuilder) { Instructions flowBuilderInstructions = flowBuilder.getInstructions(); if (flowBuilderInstructions == null) { return false; } List<SetFieldMatch> matchList = getMatchList(tableFeaturePropertiesList); return isMatchSupported(matchList, flowBuilder.getMatch()) && isInstructionsSupported(tableFeaturePropertiesList, flowBuilderInstructions.getInstruction()); }
private List<Action> getActions(short version, BigInteger datapathid, Flow flow) { Instructions instructions = flow.getInstructions(); List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> sortedInstructions = INSTRUCTION_ORDERING.sortedCopy(instructions.getInstruction()); for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction instruction : sortedInstructions) { 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(); final ActionConvertorData data = new ActionConvertorData(version); data.setDatapathId(datapathid); data.setIpProtocol(FlowConvertorUtil.getIpProtocolFromFlow(flow)); Optional<List<Action>> result = getConvertorExecutor().convert(applyActions.getAction(), data); return result.orElse(Collections.emptyList()); } } return null; }
listA = a.getInstructions().getInstruction(); listB = b.getInstructions().getInstruction();
&& flow.getInstructions().getInstruction() != null && !flow.getInstructions().getInstruction().isEmpty()) { Set<Instruction> instructions = new HashSet<>(flow.getInstructions().getInstruction()); result = prime * result + instructions.hashCode();
List<Instruction> instList = insts.getInstruction(); if (instList == null) { return false;
sourceFlow.getInstructions().getInstruction();