Committed by
Ray Milkey
Changes to the Pica8 pipeline to accomodate single-table operation.
Change-Id: Ic221b091be24036f6bceea97190119dfa5b7e579
Showing
1 changed file
with
20 additions
and
42 deletions
... | @@ -17,7 +17,6 @@ package org.onosproject.driver.pipeline; | ... | @@ -17,7 +17,6 @@ package org.onosproject.driver.pipeline; |
17 | 17 | ||
18 | import org.onlab.osgi.ServiceDirectory; | 18 | import org.onlab.osgi.ServiceDirectory; |
19 | import org.onlab.packet.Ethernet; | 19 | import org.onlab.packet.Ethernet; |
20 | -import org.onlab.packet.IPv4; | ||
21 | import org.onlab.packet.MacAddress; | 20 | import org.onlab.packet.MacAddress; |
22 | import org.onlab.packet.VlanId; | 21 | import org.onlab.packet.VlanId; |
23 | import org.onlab.util.KryoNamespace; | 22 | import org.onlab.util.KryoNamespace; |
... | @@ -43,7 +42,6 @@ import org.onosproject.net.flow.criteria.Criterion; | ... | @@ -43,7 +42,6 @@ import org.onosproject.net.flow.criteria.Criterion; |
43 | import org.onosproject.net.flow.criteria.EthCriterion; | 42 | import org.onosproject.net.flow.criteria.EthCriterion; |
44 | import org.onosproject.net.flow.criteria.EthTypeCriterion; | 43 | import org.onosproject.net.flow.criteria.EthTypeCriterion; |
45 | import org.onosproject.net.flow.criteria.IPCriterion; | 44 | import org.onosproject.net.flow.criteria.IPCriterion; |
46 | -import org.onosproject.net.flow.criteria.IPProtocolCriterion; | ||
47 | import org.onosproject.net.flow.criteria.PortCriterion; | 45 | import org.onosproject.net.flow.criteria.PortCriterion; |
48 | import org.onosproject.net.flow.criteria.VlanIdCriterion; | 46 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
49 | import org.onosproject.net.flow.instructions.Instruction; | 47 | import org.onosproject.net.flow.instructions.Instruction; |
... | @@ -234,59 +232,40 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner | ... | @@ -234,59 +232,40 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner |
234 | private Collection<FlowRule> processVersatile(ForwardingObjective fwd) { | 232 | private Collection<FlowRule> processVersatile(ForwardingObjective fwd) { |
235 | log.debug("Processing versatile forwarding objective"); | 233 | log.debug("Processing versatile forwarding objective"); |
236 | TrafficSelector selector = fwd.selector(); | 234 | TrafficSelector selector = fwd.selector(); |
235 | + TrafficTreatment treatment = fwd.treatment(); | ||
236 | + Collection<FlowRule> flowrules = new ArrayList<FlowRule>(); | ||
237 | + | ||
238 | + // first add this rule for basic single-table operation | ||
239 | + // or non-ARP related multi-table operation | ||
240 | + FlowRule rule = DefaultFlowRule.builder() | ||
241 | + .forDevice(deviceId) | ||
242 | + .withSelector(selector) | ||
243 | + .withTreatment(treatment) | ||
244 | + .withPriority(fwd.priority()) | ||
245 | + .fromApp(fwd.appId()) | ||
246 | + .makePermanent() | ||
247 | + .forTable(ACL_TABLE).build(); | ||
248 | + flowrules.add(rule); | ||
237 | 249 | ||
238 | EthTypeCriterion ethType = | 250 | EthTypeCriterion ethType = |
239 | (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); | 251 | (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE); |
240 | if (ethType == null) { | 252 | if (ethType == null) { |
241 | - log.error("Versatile forwarding objective must include ethType"); | 253 | + log.warn("No ethType in versatile forwarding obj. Not processing further."); |
242 | - fail(fwd, ObjectiveError.UNKNOWN); | 254 | + return flowrules; |
243 | - return Collections.emptySet(); | ||
244 | } | 255 | } |
245 | 256 | ||
257 | + // now deal with possible mix of ARP with filtering objectives | ||
258 | + // in multi-table scenarios | ||
246 | if (ethType.ethType().toShort() == Ethernet.TYPE_ARP) { | 259 | if (ethType.ethType().toShort() == Ethernet.TYPE_ARP) { |
247 | if (filters.isEmpty()) { | 260 | if (filters.isEmpty()) { |
248 | pendingVersatiles.add(fwd); | 261 | pendingVersatiles.add(fwd); |
249 | - return Collections.emptySet(); | 262 | + return flowrules; |
250 | } | 263 | } |
251 | - Collection<FlowRule> flowrules = new ArrayList<FlowRule>(); | ||
252 | for (Filter filter : filters) { | 264 | for (Filter filter : filters) { |
253 | flowrules.addAll(processVersatilesWithFilters(filter, fwd)); | 265 | flowrules.addAll(processVersatilesWithFilters(filter, fwd)); |
254 | } | 266 | } |
255 | - return flowrules; | ||
256 | - } else if (ethType.ethType().toShort() == Ethernet.TYPE_LLDP || | ||
257 | - ethType.ethType().toShort() == Ethernet.TYPE_BSN) { | ||
258 | - log.warn("Driver currently does not currently handle LLDP packets"); | ||
259 | - fail(fwd, ObjectiveError.UNSUPPORTED); | ||
260 | - return Collections.emptySet(); | ||
261 | - } else if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) { | ||
262 | - IPCriterion ipSrc = (IPCriterion) selector | ||
263 | - .getCriterion(Criterion.Type.IPV4_SRC); | ||
264 | - IPCriterion ipDst = (IPCriterion) selector | ||
265 | - .getCriterion(Criterion.Type.IPV4_DST); | ||
266 | - IPProtocolCriterion ipProto = (IPProtocolCriterion) selector | ||
267 | - .getCriterion(Criterion.Type.IP_PROTO); | ||
268 | - if (ipSrc != null) { | ||
269 | - log.warn("Driver does not currently handle matching Src IP"); | ||
270 | - fail(fwd, ObjectiveError.UNSUPPORTED); | ||
271 | - return Collections.emptySet(); | ||
272 | - } | ||
273 | - if (ipDst != null) { | ||
274 | - log.error("Driver handles Dst IP matching as specific forwarding " | ||
275 | - + "objective, not versatile"); | ||
276 | - fail(fwd, ObjectiveError.UNSUPPORTED); | ||
277 | - return Collections.emptySet(); | ||
278 | - } | ||
279 | - if (ipProto != null && ipProto.protocol() == IPv4.PROTOCOL_TCP) { | ||
280 | - log.warn("Driver automatically punts all packets reaching the " | ||
281 | - + "ACL table to the controller"); | ||
282 | - pass(fwd); | ||
283 | - return Collections.emptySet(); | ||
284 | - } | ||
285 | } | 267 | } |
286 | - | 268 | + return flowrules; |
287 | - log.warn("Driver does not support given versatile forwarding objective"); | ||
288 | - fail(fwd, ObjectiveError.UNSUPPORTED); | ||
289 | - return Collections.emptySet(); | ||
290 | } | 269 | } |
291 | 270 | ||
292 | private Collection<FlowRule> processVersatilesWithFilters( | 271 | private Collection<FlowRule> processVersatilesWithFilters( |
... | @@ -560,6 +539,5 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner | ... | @@ -560,6 +539,5 @@ public class PicaPipeline extends AbstractHandlerBehaviour implements Pipeliner |
560 | public byte[] data() { | 539 | public byte[] data() { |
561 | return appKryo.serialize(nextActions); | 540 | return appKryo.serialize(nextActions); |
562 | } | 541 | } |
563 | - | ||
564 | } | 542 | } |
565 | } | 543 | } | ... | ... |
-
Please register or login to post a comment