Java Code Examples for org.onosproject.net.flow.FlowRule#Builder
The following examples show how to use
org.onosproject.net.flow.FlowRule#Builder .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenVSwitchPipeline.java From onos with Apache License 2.0 | 6 votes |
private Collection<FlowRule> reassemblyFlowRule(FlowRule.Builder ruleBuilder, TrafficTreatment tb, Integer transition, Integer forTable) { if (transition != null) { TrafficTreatment.Builder newTraffic = DefaultTrafficTreatment .builder(); tb.allInstructions().forEach(t -> newTraffic.add(t)); newTraffic.transition(transition); ruleBuilder.withTreatment(newTraffic.build()); } else { ruleBuilder.withTreatment(tb); } if (forTable != null) { ruleBuilder.forTable(forTable); } return Collections.singletonList(ruleBuilder.build()); }
Example 2
Source File: OvsCorsaPipeline.java From onos with Apache License 2.0 | 6 votes |
@Override protected FlowRule.Builder processVlanFiler(FilteringObjective filt, VlanIdCriterion vlan, PortCriterion port) { log.debug("adding rule for VLAN: {}", vlan.vlanId()); TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); selector.matchVlanId(vlan.vlanId()); selector.matchInPort(port.port()); treatment.transition(ETHER_TABLE); treatment.deferred().popVlan(); return DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector.build()) .withTreatment(treatment.build()) .withPriority(CONTROLLER_PRIORITY) .makePermanent() .forTable(VLAN_TABLE); }
Example 3
Source File: FlowEntryBuilder.java From onos with Apache License 2.0 | 6 votes |
private FlowEntry createFlowEntryForFlowMod(FlowEntryState...state) { FlowEntryState flowState = state.length > 0 ? state[0] : FlowEntryState.FAILED; FlowRule.Builder builder = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(buildSelector()) .withTreatment(buildTreatment()) .withPriority(flowMod.getPriority()) .withIdleTimeout(flowMod.getIdleTimeout()) .withCookie(flowMod.getCookie().getValue()); if (flowMod.getVersion() != OFVersion.OF_10) { builder.forTable(flowMod.getTableId().getValue()); } if (afsc != null) { FlowEntry.FlowLiveType liveType = FlowEntry.FlowLiveType.IMMEDIATE; return new DefaultFlowEntry(builder.build(), flowState, 0, liveType, 0, 0); } else { return new DefaultFlowEntry(builder.build(), flowState, 0, 0, 0); } }
Example 4
Source File: JuniperQfx5100Pipeliner.java From onos with Apache License 2.0 | 6 votes |
private FlowRule processForward(ForwardingObjective fwd) { FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(fwd.selector()) .withTreatment(fwd.treatment()) .withPriority(fwd.priority()) .fromApp(fwd.appId()) .forTable(DEFAULT_TABLE); if (fwd.permanent()) { ruleBuilder.makePermanent(); } else { ruleBuilder.makeTemporary(fwd.timeout()); } return ruleBuilder.build(); }
Example 5
Source File: Ofdpa2Pipeline.java From onos with Apache License 2.0 | 6 votes |
FlowRule defaultRoute(ForwardingObjective fwd, TrafficSelector.Builder complementarySelector, int forTableId, TrafficTreatment.Builder tb) { FlowRule.Builder rule = DefaultFlowRule.builder() .fromApp(fwd.appId()) .withPriority(fwd.priority()) .forDevice(deviceId) .withSelector(complementarySelector.build()) .withTreatment(tb.build()) .forTable(forTableId); if (fwd.permanent()) { rule.makePermanent(); } else { rule.makeTemporary(fwd.timeout()); } return rule.build(); }
Example 6
Source File: OpenstackFlowRuleManagerTest.java From onos with Apache License 2.0 | 6 votes |
/** * Tests whether the set rule method installs the flow rules properly. */ @Test public void testSetRule() { int testPriority = 10; int testTableType = 10; fros = Sets.newConcurrentHashSet(); TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder(); FlowRule.Builder flowRuleBuilder = DefaultFlowRule.builder() .forDevice(DEVICE_ID) .withSelector(selectorBuilder.build()) .withTreatment(treatmentBuilder.build()) .withPriority(testPriority) .fromApp(TEST_APP_ID) .forTable(testTableType) .makePermanent(); target.setRule(TEST_APP_ID, DEVICE_ID, selectorBuilder.build(), treatmentBuilder.build(), testPriority, testTableType, true); validateFlowRule(flowRuleBuilder.build()); }
Example 7
Source File: OltPipeline.java From onos with Apache License 2.0 | 5 votes |
private void installUpstreamRulesForAnyVlan(ForwardingObjective fwd, Instruction output, Pair<Instruction, Instruction> outerPair) { log.debug("Installing upstream rules for any value vlan"); //match: in port and any-vlan (coming from OLT app.) //action: write metadata, go to table 1 and meter FlowRule.Builder inner = DefaultFlowRule.builder() .fromApp(fwd.appId()) .forDevice(deviceId) .makePermanent() .withPriority(fwd.priority()) .withSelector(fwd.selector()) .withTreatment(buildTreatment(Instructions.transition(QQ_TABLE), fetchMeter(fwd), fetchWriteMetadata(fwd))); //match: in port and any-vlan (coming from OLT app.) //action: immediate: push:QinQ, vlanId (s-tag), write metadata, meter and output FlowRule.Builder outer = DefaultFlowRule.builder() .fromApp(fwd.appId()) .forDevice(deviceId) .forTable(QQ_TABLE) .makePermanent() .withPriority(fwd.priority()) .withSelector(fwd.selector()) .withTreatment(buildTreatment(outerPair.getLeft(), outerPair.getRight(), fetchMeter(fwd), writeMetadataIncludingOnlyTp(fwd), output)); applyRules(fwd, inner, outer); }
Example 8
Source File: RoadmManager.java From onos with Apache License 2.0 | 5 votes |
@Override public FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent, int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal) { checkNotNull(deviceId); checkNotNull(inPort); checkNotNull(outPort); //Creation of selector. TrafficSelector selector = DefaultTrafficSelector.builder() .add(Criteria.matchInPort(inPort)) .add(Criteria.matchOchSignalType(OchSignalType.FIXED_GRID)) .add(Criteria.matchLambda(ochSignal)) .build(); //Creation of treatment TrafficTreatment treatment = DefaultTrafficTreatment.builder() .add(Instructions.modL0Lambda(ochSignal)) .add(Instructions.createOutput(outPort)) .build(); FlowRule.Builder flowBuilder = DefaultFlowRule.builder() .forDevice(deviceId) .fromApp(appId) .withPriority(priority) .withSelector(selector) .withTreatment(treatment); if (isPermanent) { flowBuilder.makePermanent(); } else { flowBuilder.makeTemporary(timeout); } FlowRule flowRule = flowBuilder.build(); flowRuleService.applyFlowRules(flowRule); log.info("Created connection from input port {} to output port {}", inPort.toLong(), outPort.toLong()); return flowRule.id(); }
Example 9
Source File: HPPipelineV3500.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder setDefaultTableIdForFlowObjective(FlowRule.Builder ruleBuilder) { log.debug("HP V3500 Driver - Setting default table id to software table {}", HP_SOFTWARE_TABLE); return ruleBuilder.forTable(HP_SOFTWARE_TABLE); }
Example 10
Source File: Ofdpa3Pipeline.java From onos with Apache License 2.0 | 4 votes |
private Collection<FlowRule> processTermPwVersatile(ForwardingObjective forwardingObjective, ModTunnelIdInstruction modTunnelIdInstruction, OutputInstruction outputInstruction) { TrafficTreatment.Builder flowTreatment; TrafficSelector.Builder flowSelector; // We divide the mpls actions from the tunnel actions. We need // this to order the actions in the final treatment. TrafficTreatment.Builder mplsTreatment = DefaultTrafficTreatment.builder(); createMplsTreatment(forwardingObjective.treatment(), mplsTreatment); // The match of the forwarding objective is ready to go. flowSelector = DefaultTrafficSelector.builder(forwardingObjective.selector()); // We verify the tunnel id and mpls port are correct. long tunnelId = MPLS_TUNNEL_ID_BASE | modTunnelIdInstruction.tunnelId(); if (tunnelId > MPLS_TUNNEL_ID_MAX) { log.error("Pw Versatile Forwarding Objective must include tunnel id < {}", MPLS_TUNNEL_ID_MAX); fail(forwardingObjective, ObjectiveError.BADPARAMS); return Collections.emptySet(); } // 0x0002XXXX is NNI interface. int mplsLogicalPort = ((int) outputInstruction.port().toLong()) | MPLS_NNI_PORT_BASE; if (mplsLogicalPort > MPLS_NNI_PORT_MAX) { log.error("Pw Versatile Forwarding Objective invalid logical port {}", mplsLogicalPort); fail(forwardingObjective, ObjectiveError.BADPARAMS); return Collections.emptySet(); } // Next id cannot be null. if (forwardingObjective.nextId() == null) { log.error("Pw Versatile Forwarding Objective must contain nextId ", forwardingObjective.nextId()); fail(forwardingObjective, ObjectiveError.BADPARAMS); return Collections.emptySet(); } // We retrieve the l2 interface group and point the mpls // flow to this. NextGroup next = getGroupForNextObjective(forwardingObjective.nextId()); if (next == null) { log.warn("next-id:{} not found in dev:{}", forwardingObjective.nextId(), deviceId); fail(forwardingObjective, ObjectiveError.GROUPMISSING); return Collections.emptySet(); } List<Deque<GroupKey>> gkeys = appKryo.deserialize(next.data()); Group group = groupService.getGroup(deviceId, gkeys.get(0).peekFirst()); if (group == null) { log.warn("Group with key:{} for next-id:{} not found in dev:{}", gkeys.get(0).peekFirst(), forwardingObjective.nextId(), deviceId); fail(forwardingObjective, ObjectiveError.GROUPMISSING); return Collections.emptySet(); } // We prepare the treatment for the mpls flow table. // The order of the actions has to be strictly this // according to the OFDPA 2.0 specification. flowTreatment = DefaultTrafficTreatment.builder(mplsTreatment.build()); flowTreatment.extension(new Ofdpa3PopCw(), deviceId); // Even though the specification and the xml/json files // specify is allowed, the switch rejects the flow. In the // OFDPA 3.0 EA0 version was necessary //flowTreatment.popVlan(); flowTreatment.extension(new Ofdpa3PopL2Header(), deviceId); flowTreatment.setTunnelId(tunnelId); flowTreatment.extension(new Ofdpa3SetMplsL2Port(mplsLogicalPort), deviceId); flowTreatment.extension(new Ofdpa3SetMplsType(VPWS), deviceId); flowTreatment.transition(MPLS_TYPE_TABLE); flowTreatment.deferred().group(group.id()); // We prepare the flow rule for the mpls table. FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .fromApp(forwardingObjective.appId()) .withPriority(forwardingObjective.priority()) .forDevice(deviceId) .withSelector(flowSelector.build()) .withTreatment(flowTreatment.build()) .makePermanent() .forTable(MPLS_TABLE_1); return Collections.singletonList(ruleBuilder.build()); }
Example 11
Source File: HPPipelineV3800.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder processEthFilter(FilteringObjective filt, EthCriterion eth, PortCriterion port) { log.error("Unsupported FilteringObjective: processEthFilter invoked"); return null; }
Example 12
Source File: HPPipelineV1.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder processEthFilter(FilteringObjective filt, EthCriterion eth, PortCriterion port) { log.error("HP V1 Driver - Unsupported FilteringObjective: processEthFilter invoked"); return null; }
Example 13
Source File: OltPipeline.java From onos with Apache License 2.0 | 4 votes |
private void installDownstreamRulesForVlans(ForwardingObjective fwd, Instruction output, TrafficSelector outerSelector, TrafficSelector innerSelector) { List<Pair<Instruction, Instruction>> vlanOps = vlanOps(fwd, L2ModificationInstruction.L2SubType.VLAN_POP); if (vlanOps == null || vlanOps.isEmpty()) { return; } Pair<Instruction, Instruction> popAndRewrite = vlanOps.remove(0); TrafficTreatment innerTreatment; VlanId setVlanId = ((L2ModificationInstruction.ModVlanIdInstruction) popAndRewrite.getRight()).vlanId(); if (VlanId.NONE.equals(setVlanId)) { innerTreatment = (buildTreatment(popAndRewrite.getLeft(), fetchMeter(fwd), writeMetadataIncludingOnlyTp(fwd), output)); } else { innerTreatment = (buildTreatment(popAndRewrite.getRight(), fetchMeter(fwd), writeMetadataIncludingOnlyTp(fwd), output)); } List<Instruction> setVlanPcps = findL2Instructions(L2ModificationInstruction.L2SubType.VLAN_PCP, fwd.treatment().allInstructions()); Instruction innerPbitSet = null; if (setVlanPcps != null && !setVlanPcps.isEmpty()) { innerPbitSet = setVlanPcps.get(0); } VlanId remarkInnerVlan = null; Optional<Criterion> vlanIdCriterion = readFromSelector(innerSelector, Criterion.Type.VLAN_VID); if (vlanIdCriterion.isPresent()) { remarkInnerVlan = ((VlanIdCriterion) vlanIdCriterion.get()).vlanId(); } Instruction modVlanId = null; if (innerPbitSet != null) { modVlanId = Instructions.modVlanId(remarkInnerVlan); } //match: in port (nni), s-tag //action: pop vlan (s-tag), write metadata, go to table 1, meter FlowRule.Builder outer = DefaultFlowRule.builder() .fromApp(fwd.appId()) .forDevice(deviceId) .makePermanent() .withPriority(fwd.priority()) .withSelector(outerSelector) .withTreatment(buildTreatment(popAndRewrite.getLeft(), modVlanId, innerPbitSet, fetchMeter(fwd), fetchWriteMetadata(fwd), Instructions.transition(QQ_TABLE))); //match: in port (nni), c-tag //action: immediate: write metadata and pop, meter, output FlowRule.Builder inner = DefaultFlowRule.builder() .fromApp(fwd.appId()) .forDevice(deviceId) .forTable(QQ_TABLE) .makePermanent() .withPriority(fwd.priority()) .withSelector(innerSelector) .withTreatment(innerTreatment); applyRules(fwd, inner, outer); }
Example 14
Source File: HPPipelineV3.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder processEthFilter(FilteringObjective filt, EthCriterion eth, PortCriterion port) { log.error("Unsupported FilteringObjective: processEthFilter invoked"); return null; }
Example 15
Source File: HPPipelineV3.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder processVlanFilter(FilteringObjective filt, VlanIdCriterion vlan, PortCriterion port) { log.error("Unsupported FilteringObjective: processVlanFilter invoked"); return null; }
Example 16
Source File: NokiaOltPipeline.java From onos with Apache License 2.0 | 4 votes |
@Override public void forward(ForwardingObjective fwd) { if (checkForMulticast(fwd)) { processMulticastRule(fwd); return; } if (checkForEAPOL(fwd)) { log.warn("Discarding EAPOL flow which is not supported on this pipeline"); return; } TrafficTreatment treatment = fwd.treatment(); List<Instruction> instructions = treatment.allInstructions(); Optional<Instruction> vlanIntruction = instructions.stream() .filter(i -> i.type() == Instruction.Type.L2MODIFICATION) .filter(i -> ((L2ModificationInstruction) i).subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH || ((L2ModificationInstruction) i).subtype() == L2ModificationInstruction.L2SubType.VLAN_POP) .findAny(); if (vlanIntruction.isPresent()) { L2ModificationInstruction vlanIns = (L2ModificationInstruction) vlanIntruction.get(); if (vlanIns.subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) { installUpstreamRules(fwd); } else if (vlanIns.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP) { installDownstreamRules(fwd); } else { log.error("Unknown OLT operation: {}", fwd); fail(fwd, ObjectiveError.UNSUPPORTED); return; } pass(fwd); } else { TrafficSelector selector = fwd.selector(); if (fwd.treatment() != null) { // Deal with SPECIFIC and VERSATILE in the same manner. FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .forDevice(deviceId) .withSelector(selector) .fromApp(fwd.appId()) .withPriority(fwd.priority()) .withTreatment(fwd.treatment()); if (fwd.permanent()) { ruleBuilder.makePermanent(); } else { ruleBuilder.makeTemporary(fwd.timeout()); } installObjective(ruleBuilder, fwd); } else { log.error("No treatment error: {}", fwd); fail(fwd, ObjectiveError.UNSUPPORTED); } } }
Example 17
Source File: PipelinerImpl.java From onos-p4-tutorial with Apache License 2.0 | 4 votes |
@Override public void forward(ForwardingObjective obj) { if (obj.treatment() == null) { obj.context().ifPresent(c -> c.onError(obj, ObjectiveError.UNSUPPORTED)); } // Whether this objective specifies an OUTPUT:CONTROLLER instruction. final boolean hasCloneToCpuAction = obj.treatment() .allInstructions().stream() .filter(i -> i.type().equals(OUTPUT)) .map(i -> (Instructions.OutputInstruction) i) .anyMatch(i -> i.port().equals(PortNumber.CONTROLLER)); if (!hasCloneToCpuAction) { // We support only objectives for clone to CPU behaviours (e.g. for // host and link discovery) obj.context().ifPresent(c -> c.onError(obj, ObjectiveError.UNSUPPORTED)); } // Create an equivalent FlowRule with same selector and clone_to_cpu action. final PiAction cloneToCpuAction = PiAction.builder() .withId(PiActionId.of(CLONE_TO_CPU)) .build(); final FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .forTable(PiTableId.of(ACL_TABLE)) .forDevice(deviceId) .withSelector(obj.selector()) .fromApp(obj.appId()) .withPriority(obj.priority()) .withTreatment(DefaultTrafficTreatment.builder() .piTableAction(cloneToCpuAction).build()); if (obj.permanent()) { ruleBuilder.makePermanent(); } else { ruleBuilder.makeTemporary(obj.timeout()); } final GroupDescription cloneGroup = Utils.buildCloneGroup( obj.appId(), deviceId, CPU_CLONE_SESSION_ID, // Ports where to clone the packet. // Just controller in this case. Collections.singleton(PortNumber.CONTROLLER)); switch (obj.op()) { case ADD: flowRuleService.applyFlowRules(ruleBuilder.build()); groupService.addGroup(cloneGroup); break; case REMOVE: flowRuleService.removeFlowRules(ruleBuilder.build()); groupService.removeGroup(deviceId, cloneGroup.appCookie(), obj.appId()); break; default: log.warn("Unknown operation {}", obj.op()); } obj.context().ifPresent(c -> c.onSuccess(obj)); }
Example 18
Source File: PicaPipeline.java From onos with Apache License 2.0 | 4 votes |
private Collection<FlowRule> processSpecific(ForwardingObjective fwd) { log.debug("Processing specific forwarding objective"); TrafficSelector selector = fwd.selector(); EthTypeCriterion ethType = (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); if (ethType == null || ethType.ethType().toShort() != Ethernet.TYPE_IPV4) { fail(fwd, ObjectiveError.UNSUPPORTED); return Collections.emptySet(); } List<FlowRule> ipflows = new ArrayList<FlowRule>(); for (Filter f: filters) { TrafficSelector filteredSelector = DefaultTrafficSelector.builder() .matchEthType(Ethernet.TYPE_IPV4) .matchIPDst( ((IPCriterion) selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) .matchEthDst(f.mac()) .matchVlanId(f.vlanId()) .build(); TrafficTreatment tt = null; if (fwd.nextId() != null) { NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId()); if (next == null) { log.error("next-id {} does not exist in store", fwd.nextId()); return Collections.emptySet(); } tt = appKryo.deserialize(next.data()); if (tt == null) { log.error("Error in deserializing next-id {}", fwd.nextId()); return Collections.emptySet(); } } FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() .fromApp(fwd.appId()) .withPriority(fwd.priority()) .forDevice(deviceId) .withSelector(filteredSelector) .withTreatment(tt); if (fwd.permanent()) { ruleBuilder.makePermanent(); } else { ruleBuilder.makeTemporary(fwd.timeout()); } ruleBuilder.forTable(IP_UNICAST_TABLE); ipflows.add(ruleBuilder.build()); } return ipflows; }
Example 19
Source File: OvsOfdpaPipeline.java From onos with Apache License 2.0 | 4 votes |
/** * Handles forwarding rules to the IP Unicast Routing. * * @param fwd the forwarding objective * @return A collection of flow rules, or an empty set */ protected Collection<FlowRule> processDoubleTaggedFwd(ForwardingObjective fwd) { // inner for UNICAST_ROUTING_TABLE_1, outer for UNICAST_ROUTING_TABLE TrafficSelector selector = fwd.selector(); TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder(); TrafficTreatment.Builder innerTtb = DefaultTrafficTreatment.builder(); TrafficTreatment.Builder outerTtb = DefaultTrafficTreatment.builder(); EthTypeCriterion ethType = (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) { sBuilder.matchEthType(Ethernet.TYPE_IPV4); sBuilder.matchVlanId(VlanId.ANY); IpPrefix ipv4Dst = ((IPCriterion) selector.getCriterion(Criterion.Type.IPV4_DST)).ip(); if (!ipv4Dst.isMulticast() && ipv4Dst.prefixLength() == 32) { sBuilder.matchIPDst(ipv4Dst); if (fwd.nextId() != null) { NextGroup next = getGroupForNextObjective(fwd.nextId()); if (next != null) { List<Deque<GroupKey>> gkeys = appKryo.deserialize(next.data()); // we only need the top level group's key to point the flow to it Group group = groupService.getGroup(deviceId, gkeys.get(0).peekFirst()); if (group == null) { log.warn("Group with key:{} for next-id:{} not found in dev:{}", gkeys.get(0).peekFirst(), fwd.nextId(), deviceId); fail(fwd, ObjectiveError.GROUPMISSING); return Collections.emptySet(); } outerTtb.immediate().setVlanId(extractDummyVlanIdFromGroupId(group.id().id())); //ACTSET_OUTPUT in OVS will match output action in write_action() set. outerTtb.deferred().setOutput(extractOutputPortFromGroupId(group.id().id())); outerTtb.transition(EGRESS_VLAN_FLOW_TABLE_IN_INGRESS); innerTtb.deferred().group(group.id()); innerTtb.transition(ACL_TABLE); FlowRule.Builder innerRuleBuilder = DefaultFlowRule.builder() .fromApp(fwd.appId()) .withPriority(fwd.priority()) .forDevice(deviceId) .withSelector(sBuilder.build()) .withTreatment(innerTtb.build()) .forTable(UNICAST_ROUTING_TABLE_1); if (fwd.permanent()) { innerRuleBuilder.makePermanent(); } else { innerRuleBuilder.makeTemporary(fwd.timeout()); } Collection<FlowRule> flowRuleCollection = new HashSet<>(); flowRuleCollection.add(innerRuleBuilder.build()); FlowRule.Builder outerRuleBuilder = DefaultFlowRule.builder() .fromApp(fwd.appId()) .withPriority(fwd.priority()) .forDevice(deviceId) .withSelector(sBuilder.build()) .withTreatment(outerTtb.build()) .forTable(UNICAST_ROUTING_TABLE); if (fwd.permanent()) { outerRuleBuilder.makePermanent(); } else { outerRuleBuilder.makeTemporary(fwd.timeout()); } flowRuleCollection.add(innerRuleBuilder.build()); flowRuleCollection.add(outerRuleBuilder.build()); return flowRuleCollection; } else { log.warn("Cannot find group for nextId:{} in dev:{}. Aborting fwd:{}", fwd.nextId(), deviceId, fwd.id()); fail(fwd, ObjectiveError.FLOWINSTALLATIONFAILED); return Collections.emptySet(); } } else { log.warn("NextId is not specified in fwd:{}", fwd.id()); fail(fwd, ObjectiveError.FLOWINSTALLATIONFAILED); return Collections.emptySet(); } } } return Collections.emptySet(); }
Example 20
Source File: HPPipelineV1.java From onos with Apache License 2.0 | 4 votes |
@Override protected FlowRule.Builder setDefaultTableIdForFlowObjective(FlowRule.Builder ruleBuilder) { log.debug("HP V1 Driver - Setting default table id to software table {}", HP_SOFTWARE_TABLE); return ruleBuilder.forTable(HP_SOFTWARE_TABLE); }