org.onosproject.net.flowobjective.ObjectiveError Java Examples
The following examples show how to use
org.onosproject.net.flowobjective.ObjectiveError.
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: FabricPipeliner.java From onos with Apache License 2.0 | 6 votes |
@Override public void next(NextObjective obj) { if (obj.op() == Objective.Operation.VERIFY) { // TODO: support VERIFY operation log.debug("VERIFY operation not yet supported for NextObjective, will return success"); success(obj); return; } if (obj.op() == Objective.Operation.MODIFY) { // TODO: support MODIFY operation log.warn("MODIFY operation not yet supported for NextObjective, will return failure :("); fail(obj, ObjectiveError.UNSUPPORTED); return; } final ObjectiveTranslation result = nextTranslator.translate(obj); handleResult(obj, result); }
Example #2
Source File: Ofdpa2GroupHandler.java From onos with Apache License 2.0 | 6 votes |
/** * Creates a simple L2 Interface Group. * @param nextObj the next Objective */ private void createL2InterfaceGroup(NextObjective nextObj) { VlanId assignedVlan = readVlanFromSelector(nextObj.meta()); if (assignedVlan == null) { log.warn("VLAN ID required by simple next obj is missing. Abort."); fail(nextObj, ObjectiveError.BADPARAMS); return; } List<GroupInfo> groupInfos = prepareL2InterfaceGroup(nextObj, assignedVlan); // There is only one L2 interface group in this case GroupDescription l2InterfaceGroupDesc = groupInfos.get(0).innerMostGroupDesc(); // Put all dependency information into allGroupKeys List<Deque<GroupKey>> allGroupKeys = Lists.newArrayList(); Deque<GroupKey> gkeyChain = new ArrayDeque<>(); gkeyChain.addFirst(l2InterfaceGroupDesc.appCookie()); allGroupKeys.add(gkeyChain); // Point the next objective to this group OfdpaNextGroup ofdpaGrp = new OfdpaNextGroup(allGroupKeys, nextObj); updatePendingNextObjective(l2InterfaceGroupDesc.appCookie(), ofdpaGrp); // Start installing the inner-most group groupService.addGroup(l2InterfaceGroupDesc); }
Example #3
Source File: Ofdpa2GroupHandler.java From onos with Apache License 2.0 | 6 votes |
private void addBucketToBroadcastGroup(NextObjective nextObj, List<Deque<GroupKey>> allActiveKeys) { VlanId assignedVlan = readVlanFromSelector(nextObj.meta()); if (assignedVlan == null) { log.warn("VLAN ID required by broadcast next obj is missing. " + "Aborting add bucket to broadcast group for next:{} in dev:{}", nextObj.id(), deviceId); fail(nextObj, ObjectiveError.BADPARAMS); return; } List<GroupInfo> groupInfos = prepareL2InterfaceGroup(nextObj, assignedVlan); IpPrefix ipDst = readIpDstFromSelector(nextObj.meta()); if (ipDst != null) { if (ipDst.isMulticast()) { addBucketToL3MulticastGroup(nextObj, allActiveKeys, groupInfos, assignedVlan); } else { log.warn("Broadcast NextObj with non-multicast IP address {}", nextObj); fail(nextObj, ObjectiveError.BADPARAMS); } } else { addBucketToL2FloodGroup(nextObj, allActiveKeys, groupInfos, assignedVlan); } }
Example #4
Source File: SoftRouterPipeline.java From onos with Apache License 2.0 | 6 votes |
@Override public void next(NextObjective nextObjective) { switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() != 1) { log.error("Next Objectives of type Simple should only have a " + "single Traffic Treatment. Next Objective Id:{}", nextObjective.id()); fail(nextObjective, ObjectiveError.BADPARAMS); return; } processSimpleNextObjective(nextObjective); break; case HASHED: case BROADCAST: case FAILOVER: fail(nextObjective, ObjectiveError.UNSUPPORTED); log.warn("Unsupported next objective type {}", nextObjective.type()); break; default: fail(nextObjective, ObjectiveError.UNKNOWN); log.warn("Unknown next objective type {}", nextObjective.type()); } }
Example #5
Source File: Ofdpa2GroupHandler.java From onos with Apache License 2.0 | 6 votes |
/** * modifies group with next objective. * * @param nextObjective the NextObjective * @param nextGroup the NextGroup */ protected void modifyBucketFromGroup(NextObjective nextObjective, NextGroup nextGroup) { switch (nextObjective.type()) { case SIMPLE: Collection<TrafficTreatment> treatments = nextObjective.next(); if (treatments.size() != 1) { log.error("Next Objectives of type Simple should only have a " + "single Traffic Treatment. Next Objective Id:{}", nextObjective.id()); fail(nextObjective, ObjectiveError.BADPARAMS); return; } modifySimpleNextObjective(nextObjective, nextGroup); break; default: fail(nextObjective, ObjectiveError.UNKNOWN); log.warn("Unknown next objective type {}", nextObjective.type()); } }
Example #6
Source File: SpringOpenTTP.java From onos with Apache License 2.0 | 6 votes |
protected Collection<FlowRule> processSpecific(ForwardingObjective fwd) { log.debug("Processing specific fwd objective:{} in dev:{} with next:{}", fwd.id(), deviceId, fwd.nextId()); boolean isEthTypeObj = isSupportedEthTypeObjective(fwd); boolean isEthDstObj = isSupportedEthDstObjective(fwd); if (isEthTypeObj) { return processEthTypeSpecificObjective(fwd); } else if (isEthDstObj) { return processEthDstSpecificObjective(fwd); } else { log.warn("processSpecific: Unsupported " + "forwarding objective criteria"); fail(fwd, ObjectiveError.UNSUPPORTED); return Collections.emptySet(); } }
Example #7
Source File: AbstractObjectiveTranslator.java From onos with Apache License 2.0 | 6 votes |
TrafficTreatment mapTreatmentToPiIfNeeded(TrafficTreatment treatment, PiTableId tableId) throws FabricPipelinerException { if (isTreatmentPi(treatment)) { return treatment; } final PiAction piAction; try { piAction = interpreter.mapTreatment(treatment, tableId); } catch (PiPipelineInterpreter.PiInterpreterException ex) { throw new FabricPipelinerException( format("Unable to map treatment for table '%s': %s", tableId, ex.getMessage()), ObjectiveError.UNSUPPORTED); } return DefaultTrafficTreatment.builder() .piTableAction(piAction) .build(); }
Example #8
Source File: PacketManager.java From onos with Apache License 2.0 | 6 votes |
/** * Pushes packet intercept flow rules to the device. * * @param device the device to push the rules to * @param request the packet request */ private void pushRule(Device device, PacketRequest request) { if (!device.type().equals(Device.Type.SWITCH)) { return; } if (!deviceService.isAvailable(device.id())) { return; } ForwardingObjective forwarding = createBuilder(request) .add(new ObjectiveContext() { @Override public void onError(Objective objective, ObjectiveError error) { log.warn("Failed to install packet request {} to {}: {}", request, device.id(), error); } }); objectiveService.forward(device.id(), forwarding); }
Example #9
Source File: ForwardingObjectiveTranslator.java From onos with Apache License 2.0 | 6 votes |
@Override public ObjectiveTranslation doTranslate(ForwardingObjective obj) throws FabricPipelinerException { final ObjectiveTranslation.Builder resultBuilder = ObjectiveTranslation.builder(); switch (obj.flag()) { case SPECIFIC: processSpecificFwd(obj, resultBuilder); break; case VERSATILE: processVersatileFwd(obj, resultBuilder); break; case EGRESS: default: log.warn("Unsupported ForwardingObjective type '{}'", obj.flag()); return ObjectiveTranslation.ofError(ObjectiveError.UNSUPPORTED); } return resultBuilder.build(); }
Example #10
Source File: SoftRouterPipeline.java From onos with Apache License 2.0 | 5 votes |
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
Example #11
Source File: AbstractHPPipeline.java From onos with Apache License 2.0 | 5 votes |
@Override public void filter(FilteringObjective filteringObjective) { if (filteringObjective.type() == FilteringObjective.Type.PERMIT) { processFilter(filteringObjective, filteringObjective.op() == Objective.Operation.ADD, filteringObjective.appId()); } else { fail(filteringObjective, ObjectiveError.UNSUPPORTED); } }
Example #12
Source File: Ofdpa2Pipeline.java From onos with Apache License 2.0 | 5 votes |
/** * Helper method to build Ipv6 selector using the selector provided by * a forwarding objective. * * @param builderToUpdate the builder to update * @param fwd the selector to read * @return 0 if the update ends correctly. -1 if the matches * are not yet supported */ int buildIpv6Selector(TrafficSelector.Builder builderToUpdate, ForwardingObjective fwd) { TrafficSelector selector = fwd.selector(); IpPrefix ipv6Dst = ((IPCriterion) selector.getCriterion(Criterion.Type.IPV6_DST)).ip(); if (ipv6Dst.isMulticast()) { if (ipv6Dst.prefixLength() != IpAddress.INET6_BIT_LENGTH) { log.warn("Multicast specific forwarding objective can only be /128"); fail(fwd, ObjectiveError.BADPARAMS); return -1; } VlanId assignedVlan = readVlanFromSelector(fwd.meta()); if (assignedVlan == null) { log.warn("VLAN ID required by multicast specific fwd obj is missing. Abort."); fail(fwd, ObjectiveError.BADPARAMS); return -1; } if (requireVlanExtensions()) { OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(assignedVlan); builderToUpdate.extension(ofdpaMatchVlanVid, deviceId); } else { builderToUpdate.matchVlanId(assignedVlan); } builderToUpdate.matchEthType(Ethernet.TYPE_IPV6).matchIPv6Dst(ipv6Dst); log.debug("processing IPv6 multicast specific forwarding objective {} -> next:{}" + " in dev:{}", fwd.id(), fwd.nextId(), deviceId); } else { if (ipv6Dst.prefixLength() != 0) { builderToUpdate.matchIPv6Dst(ipv6Dst); } builderToUpdate.matchEthType(Ethernet.TYPE_IPV6); log.debug("processing IPv6 unicast specific forwarding objective {} -> next:{}" + " in dev:{}", fwd.id(), fwd.nextId(), deviceId); } return 0; }
Example #13
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public void run() { try { Pipeliner pipeliner = getDevicePipeliner(deviceId); if (pipeliner != null) { if (objective instanceof NextObjective) { nextToDevice.put(objective.id(), deviceId); pipeliner.next((NextObjective) objective); } else if (objective instanceof ForwardingObjective) { pipeliner.forward((ForwardingObjective) objective); } else { pipeliner.filter((FilteringObjective) objective); } //Attempts to check if pipeliner is null for retry attempts } else if (numAttempts < INSTALL_RETRY_ATTEMPTS) { Thread.sleep(INSTALL_RETRY_INTERVAL); executorService.execute(new ObjectiveInstaller(deviceId, objective, numAttempts + 1)); } else { // Otherwise we've tried a few times and failed, report an // error back to the user. objective.context().ifPresent( c -> c.onError(objective, ObjectiveError.NOPIPELINER)); } //Exception thrown } catch (Exception e) { log.warn("Exception while installing flow objective", e); } }
Example #14
Source File: SpringOpenTTP.java From onos with Apache License 2.0 | 5 votes |
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
Example #15
Source File: VirtualNetworkFlowObjectiveManager.java From onos with Apache License 2.0 | 5 votes |
@Override public void init(DeviceId deviceId, PipelinerContext context) { this.deviceId = deviceId; pendingNext = CacheBuilder.newBuilder() .expireAfterWrite(20, TimeUnit.SECONDS) .removalListener((RemovalNotification<Integer, NextObjective> notification) -> { if (notification.getCause() == RemovalCause.EXPIRED) { notification.getValue().context() .ifPresent(c -> c.onError(notification.getValue(), ObjectiveError.FLOWINSTALLATIONFAILED)); } }).build(); }
Example #16
Source File: OltPipeline.java From onos with Apache License 2.0 | 5 votes |
private Instructions.MetadataInstruction fetchWriteMetadata(ForwardingObjective fwd) { Instructions.MetadataInstruction writeMetadata = fwd.treatment().writeMetadata(); if (writeMetadata == null) { log.warn("Write metadata is not found for the forwarding obj"); fail(fwd, ObjectiveError.BADPARAMS); return null; } log.debug("Write metadata is found {}", writeMetadata); return writeMetadata; }
Example #17
Source File: Ofdpa2GroupHandler.java From onos with Apache License 2.0 | 5 votes |
/** * Similar to processBroadcastNextObjective but handles L2 Multicast Next Objectives. * * @param nextObj NextObjective of L2_MULTICAST with chained NextObjectives for single homed access ports */ private void processL2MulticastNextObjective(NextObjective nextObj) { VlanId assignedVlan = readVlanFromSelector(nextObj.meta()); if (assignedVlan == null) { log.warn("VLAN ID required by L2 multicast next objective is missing. Aborting group creation."); fail(nextObj, ObjectiveError.BADPARAMS); return; } // Group info should contain only single homed hosts for a given vlanId List<GroupInfo> groupInfos = prepareL2InterfaceGroup(nextObj, assignedVlan); createL2MulticastGroup(nextObj, assignedVlan, groupInfos); }
Example #18
Source File: CentecV350Pipeline.java From onos with Apache License 2.0 | 5 votes |
@Override public void init(DeviceId deviceId, PipelinerContext context) { this.serviceDirectory = context.directory(); this.deviceId = deviceId; pendingGroups = CacheBuilder.newBuilder() .expireAfterWrite(20, TimeUnit.SECONDS) .removalListener((RemovalNotification<GroupKey, NextObjective> notification) -> { if (notification.getCause() == RemovalCause.EXPIRED) { fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED); } }).build(); groupChecker.scheduleAtFixedRate(new GroupChecker(), 0, 500, TimeUnit.MILLISECONDS); coreService = serviceDirectory.get(CoreService.class); flowRuleService = serviceDirectory.get(FlowRuleService.class); groupService = serviceDirectory.get(GroupService.class); flowObjectiveStore = context.store(); groupService.addListener(new InnerGroupListener()); appId = coreService.registerApplication( "org.onosproject.driver.CentecV350Pipeline"); initializePipeline(); }
Example #19
Source File: SpringOpenTTP.java From onos with Apache License 2.0 | 5 votes |
@Override public void filter(FilteringObjective filteringObjective) { if (filteringObjective.type() == FilteringObjective.Type.PERMIT) { log.debug("processing PERMIT filter objective"); processFilter(filteringObjective, filteringObjective.op() == Objective.Operation.ADD, filteringObjective.appId()); } else { log.debug("filter objective other than PERMIT not supported"); fail(filteringObjective, ObjectiveError.UNSUPPORTED); } }
Example #20
Source File: NextObjectiveTranslator.java From onos with Apache License 2.0 | 5 votes |
private void egressVlanPop(PortNumber outPort, NextObjective obj, ObjectiveTranslation.Builder resultBuilder) throws FabricPipelinerException { if (obj.meta() == null) { throw new FabricPipelinerException( "Cannot process egress pop VLAN rule, NextObjective has null meta", ObjectiveError.BADPARAMS); } final VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) criterion( obj.meta(), Criterion.Type.VLAN_VID); if (vlanIdCriterion == null) { throw new FabricPipelinerException( "Cannot process egress pop VLAN rule, missing VLAN_VID criterion " + "in NextObjective meta", ObjectiveError.BADPARAMS); } final PiCriterion egressVlanTableMatch = PiCriterion.builder() .matchExact(FabricConstants.HDR_EG_PORT, outPort.toLong()) .build(); final TrafficSelector selector = DefaultTrafficSelector.builder() .matchPi(egressVlanTableMatch) .matchVlanId(vlanIdCriterion.vlanId()) .build(); final TrafficTreatment treatment = DefaultTrafficTreatment.builder() .popVlan() .build(); resultBuilder.addFlowRule(flowRule( obj, FabricConstants.FABRIC_EGRESS_EGRESS_NEXT_EGRESS_VLAN, selector, treatment)); }
Example #21
Source File: SpringOpenTTP.java From onos with Apache License 2.0 | 5 votes |
@Override public void init(DeviceId deviceId, PipelinerContext context) { this.serviceDirectory = context.directory(); this.deviceId = deviceId; pendingGroups = CacheBuilder .newBuilder() .expireAfterWrite(20, TimeUnit.SECONDS) .removalListener((RemovalNotification<GroupKey, NextObjective> notification) -> { if (notification.getCause() == RemovalCause.EXPIRED) { fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED); } }).build(); coreService = serviceDirectory.get(CoreService.class); flowRuleService = serviceDirectory.get(FlowRuleService.class); groupService = serviceDirectory.get(GroupService.class); flowObjectiveStore = context.store(); groupService.addListener(new InnerGroupListener()); appId = coreService .registerApplication("org.onosproject.driver.SpringOpenTTP"); setTableMissEntries(); log.info("Spring Open TTP driver initialized"); }
Example #22
Source File: OpenVSwitchPipeline.java From onos with Apache License 2.0 | 5 votes |
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
Example #23
Source File: Ofdpa2GroupHandler.java From onos with Apache License 2.0 | 5 votes |
/** * Removes buckets in the top level group of a possible group-chain. Does * not remove the groups in the group-chain pointed to by this bucket, as they * may be in use (referenced by other groups) elsewhere. * * @param nextObjective a next objective that contains information for the * buckets to be removed from the group * @param next the representation of the existing group-chains for this next * objective, from which the top-level buckets to remove are determined */ protected void removeBucketFromGroup(NextObjective nextObjective, NextGroup next) { if (nextObjective.type() != NextObjective.Type.HASHED && nextObjective.type() != NextObjective.Type.BROADCAST) { log.warn("RemoveBuckets not applied to nextType:{} in dev:{} for next:{}", nextObjective.type(), deviceId, nextObjective.id()); fail(nextObjective, ObjectiveError.UNSUPPORTED); return; } List<Deque<GroupKey>> allActiveKeys = appKryo.deserialize(next.data()); List<Integer> indicesToRemove = Lists.newArrayList(); for (TrafficTreatment treatment : nextObjective.next()) { // find the top-level bucket in the group-chain by matching the // outport and label from different groups in the chain PortNumber portToRemove = readOutPortFromTreatment(treatment); int labelToRemove = readLabelFromTreatment(treatment); if (portToRemove == null) { log.warn("treatment {} of next objective {} has no outport.. " + "cannot remove bucket from group in dev: {}", treatment, nextObjective.id(), deviceId); continue; } List<Integer> existing = existingPortAndLabel(allActiveKeys, groupService, deviceId, portToRemove, labelToRemove); indicesToRemove.addAll(existing); } List<Deque<GroupKey>> chainsToRemove = Lists.newArrayList(); indicesToRemove.forEach(index -> chainsToRemove .add(allActiveKeys.get(index))); if (chainsToRemove.isEmpty()) { log.warn("Could not find appropriate group-chain for removing bucket" + " for next id {} in dev:{}", nextObjective.id(), deviceId); fail(nextObjective, ObjectiveError.BADPARAMS); return; } removeBucket(chainsToRemove, nextObjective); }
Example #24
Source File: MockFlowObjectiveService.java From onos with Apache License 2.0 | 5 votes |
@Override public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) { TrafficSelector selector = forwardingObjective.selector(); TrafficTreatment treatment = nextTable.get(forwardingObjective.nextId()); MacAddress macAddress = ((EthCriterion) selector.getCriterion(Criterion.Type.ETH_DST)).mac(); VlanId vlanId = ((VlanIdCriterion) selector.getCriterion(Criterion.Type.VLAN_VID)).vlanId(); boolean popVlan = treatment.allInstructions().stream() .filter(instruction -> instruction.type().equals(Instruction.Type.L2MODIFICATION)) .anyMatch(instruction -> ((L2ModificationInstruction) instruction).subtype() .equals(L2ModificationInstruction.L2SubType.VLAN_POP)); PortNumber portNumber = treatment.allInstructions().stream() .filter(instruction -> instruction.type().equals(Instruction.Type.OUTPUT)) .map(instruction -> ((Instructions.OutputInstruction) instruction).port()).findFirst().orElse(null); if (portNumber == null) { throw new IllegalArgumentException(); } Objective.Operation op = forwardingObjective.op(); MockBridgingTableKey btKey = new MockBridgingTableKey(deviceId, macAddress, vlanId); MockBridgingTableValue btValue = new MockBridgingTableValue(popVlan, portNumber); if (op.equals(Objective.Operation.ADD)) { bridgingTable.put(btKey, btValue); forwardingObjective.context().ifPresent(context -> context.onSuccess(forwardingObjective)); } else if (op.equals(Objective.Operation.REMOVE)) { bridgingTable.remove(btKey, btValue); forwardingObjective.context().ifPresent(context -> context.onSuccess(forwardingObjective)); } else { forwardingObjective.context().ifPresent(context -> context.onError(forwardingObjective, ObjectiveError.UNKNOWN)); throw new IllegalArgumentException(); } }
Example #25
Source File: NokiaOltPipeline.java From onos with Apache License 2.0 | 5 votes |
@Override public void init(DeviceId deviceId, PipelinerContext context) { log.debug("Initiate OLT pipeline"); this.serviceDirectory = context.directory(); this.deviceId = deviceId; flowRuleService = serviceDirectory.get(FlowRuleService.class); coreService = serviceDirectory.get(CoreService.class); groupService = serviceDirectory.get(GroupService.class); flowObjectiveStore = context.store(); storageService = serviceDirectory.get(StorageService.class); appId = coreService.registerApplication( "org.onosproject.driver.OLTPipeline"); pendingGroups = CacheBuilder.newBuilder() .expireAfterWrite(20, TimeUnit.SECONDS) .removalListener((RemovalNotification<GroupKey, NextObjective> notification) -> { if (notification.getCause() == RemovalCause.EXPIRED) { fail(notification.getValue(), ObjectiveError.GROUPINSTALLATIONFAILED); } }).build(); groupService.addListener(new InnerGroupListener()); }
Example #26
Source File: OvsCorsaPipeline.java From onos with Apache License 2.0 | 5 votes |
@Override protected Collection<FlowRule> processIpTraffic(ForwardingObjective fwd, FlowRule.Builder rule) { IPCriterion ipSrc = (IPCriterion) fwd.selector() .getCriterion(Criterion.Type.IPV4_SRC); if (ipSrc != null) { log.warn("Driver does not currently handle matching Src IP"); fail(fwd, ObjectiveError.UNSUPPORTED); return Collections.emptySet(); } IPCriterion ipDst = (IPCriterion) fwd.selector() .getCriterion(Criterion.Type.IPV4_DST); if (ipDst != null) { log.error("Driver handles Dst IP matching as specific forwarding " + "objective, not versatile"); fail(fwd, ObjectiveError.UNSUPPORTED); return Collections.emptySet(); } IPProtocolCriterion ipProto = (IPProtocolCriterion) fwd.selector() .getCriterion(Criterion.Type.IP_PROTO); if (ipProto != null && ipProto.protocol() == IPv4.PROTOCOL_TCP) { log.warn("Driver automatically punts all packets reaching the " + "LOCAL table to the controller"); pass(fwd); return Collections.emptySet(); } return Collections.emptySet(); }
Example #27
Source File: CentecV350Pipeline.java From onos with Apache License 2.0 | 5 votes |
private Collection<FlowRule> processForward(ForwardingObjective fwd) { switch (fwd.flag()) { case SPECIFIC: return processSpecific(fwd); case VERSATILE: return processVersatile(fwd); default: fail(fwd, ObjectiveError.UNKNOWN); log.warn("Unknown forwarding flag {}", fwd.flag()); } return Collections.emptySet(); }
Example #28
Source File: NokiaOltPipeline.java From onos with Apache License 2.0 | 5 votes |
private Instruction fetchOutput(ForwardingObjective fwd, String direction) { Instruction output = fwd.treatment().allInstructions().stream() .filter(i -> i.type() == Instruction.Type.OUTPUT) .findFirst().orElse(null); if (output == null) { log.error("OLT {} rule has no output", direction); fail(fwd, ObjectiveError.BADPARAMS); return null; } return output; }
Example #29
Source File: NokiaOltPipeline.java From onos with Apache License 2.0 | 5 votes |
private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector, TrafficTreatment treatment, int priority) { FlowRule rule = DefaultFlowRule.builder() .fromApp(filter.appId()) .forDevice(deviceId) .forTable(0) .makePermanent() .withSelector(selector) .withTreatment(treatment) .withPriority(priority) .build(); FlowRuleOperations.Builder opsBuilder = FlowRuleOperations.builder(); switch (filter.type()) { case PERMIT: opsBuilder.add(rule); break; case DENY: opsBuilder.remove(rule); break; default: log.warn("Unknown filter type : {}", filter.type()); fail(filter, ObjectiveError.UNSUPPORTED); } applyFlowRules(opsBuilder, filter); }
Example #30
Source File: CentecV350Pipeline.java From onos with Apache License 2.0 | 5 votes |
@Override public void filter(FilteringObjective filteringObjective) { if (filteringObjective.type() == FilteringObjective.Type.PERMIT) { processFilter(filteringObjective, filteringObjective.op() == Objective.Operation.ADD, filteringObjective.appId()); } else { fail(filteringObjective, ObjectiveError.UNSUPPORTED); } }