CORD-48 First checkin for enabling OF-DPA driver to support the SR app.
Filtering Objective support added. Driver renamed from OFDPA1 to OFDPA2.
Code refactored within driver to reflect test-code which will be used by
static flow-pusher app in the future.
Change-Id: I7132d8b8eaf28df7c11646c5a35035f258c65af4
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
index c02ba3c..7ef72fa 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/SpringOpenTTP.java
@@ -53,6 +53,7 @@
import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.VlanIdCriterion;
import org.onosproject.net.flow.instructions.Instruction;
+import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
import org.onosproject.net.flowobjective.FilteringObjective;
import org.onosproject.net.flowobjective.FlowObjectiveStore;
import org.onosproject.net.flowobjective.ForwardingObjective;
@@ -383,7 +384,7 @@
private Collection<FlowRule> processVersatile(ForwardingObjective fwd) {
log.debug("Processing versatile forwarding objective");
TrafficSelector selector = fwd.selector();
-
+ TrafficTreatment treatment = null;
EthTypeCriterion ethType =
(EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
if (ethType == null) {
@@ -410,15 +411,26 @@
return Collections.emptySet();
}
treatmentBuilder.deferred().group(group.id());
+ treatment = treatmentBuilder.build();
log.debug("Adding OUTGROUP action");
}
+ } else if (fwd.treatment() != null) {
+ if (fwd.treatment().allInstructions().size() == 1 &&
+ fwd.treatment().allInstructions().get(0).type() == Instruction.Type.OUTPUT) {
+ OutputInstruction o = (OutputInstruction) fwd.treatment().allInstructions().get(0);
+ if (o.port() == PortNumber.CONTROLLER) {
+ log.warn("Punts to the controller are handled by misses in"
+ + " the TMAC, IP and MPLS tables.");
+ return Collections.emptySet();
+ }
+ }
+ treatment = fwd.treatment();
} else {
- log.warn("VERSATILE forwarding objective need next objective ID.");
+ log.warn("VERSATILE forwarding objective needs next objective ID "
+ + "or treatment.");
return Collections.emptySet();
}
- TrafficTreatment treatment = treatmentBuilder.build();
-
FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
.fromApp(fwd.appId()).withPriority(fwd.priority())
.forDevice(deviceId).withSelector(fwd.selector())
@@ -616,21 +628,8 @@
ops = install ? ops.add(rule) : ops.remove(rule);
}
} else if (c.type() == Criterion.Type.IPV4_DST) {
- IPCriterion ip = (IPCriterion) c;
- log.debug("adding rule for IP: {}", ip.ip());
- TrafficSelector.Builder selector = DefaultTrafficSelector
- .builder();
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment
- .builder();
- selector.matchEthType(Ethernet.TYPE_IPV4);
- selector.matchIPDst(ip.ip());
- treatment.transition(aclTableId);
- FlowRule rule = DefaultFlowRule.builder().forDevice(deviceId)
- .withSelector(selector.build())
- .withTreatment(treatment.build())
- .withPriority(filt.priority()).fromApp(applicationId)
- .makePermanent().forTable(ipv4UnicastTableId).build();
- ops = install ? ops.add(rule) : ops.remove(rule);
+ log.debug("driver does not process IP filtering rules as it " +
+ "sends all misses in the IP table to the controller");
} else {
log.warn("Driver does not currently process filtering condition"
+ " of type: {}", c.type());
@@ -762,6 +761,7 @@
this.key = key;
}
+ @SuppressWarnings("unused")
public GroupKey key() {
return key;
}