Saurav Das

Bug fixes for the centec and noviflow pipelines.

Change-Id: Id0531e54060ff8e2a2321f6c49c8c16e32be45f8
......@@ -437,6 +437,7 @@ public class FlowRuleManager
for (FlowEntry rule : storedRules) {
try {
// there are rules in the store that aren't on the switch
log.debug("Adding rule in store, but not on switch {}", rule);
flowMissing(rule);
} catch (Exception e) {
log.debug("Can't add missing flow rule {}", e.getMessage());
......
......@@ -329,6 +329,7 @@ public final class KryoNamespaces {
L2ModificationInstruction.PushHeaderInstructions.class,
L2ModificationInstruction.ModVlanIdInstruction.class,
L2ModificationInstruction.ModVlanPcpInstruction.class,
L2ModificationInstruction.PopVlanInstruction.class,
L2ModificationInstruction.ModMplsLabelInstruction.class,
L2ModificationInstruction.ModMplsTtlInstruction.class,
L3ModificationInstruction.class,
......
......@@ -14,6 +14,7 @@ import org.onlab.util.KryoNamespace;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.behaviour.NextGroup;
import org.onosproject.net.behaviour.Pipeliner;
import org.onosproject.net.behaviour.PipelinerContext;
......@@ -78,7 +79,7 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
protected static final int ROUTE_TABLE = 3;
private static final long DEFAULT_METADATA = 100;
private static final long DEFAULT_METADATA_MASK = 0xff;
private static final long DEFAULT_METADATA_MASK = 0xffffffffffffffffL;
// Priority used in PORT_VLAN Table, the only priority accepted is PORT_VLAN_TABLE_PRIORITY.
// The packet passed PORT+VLAN check will goto FILTER Table.
......@@ -424,8 +425,22 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
.forTable(PORT_VLAN_TABLE).build();
ops = install ? ops.add(rule) : ops.remove(rule);
} else if (c.type() == Criterion.Type.IPV4_DST) {
// TODO: not needed now? Why not?
fail(filt, ObjectiveError.UNSUPPORTED);
IPCriterion ipaddr = (IPCriterion) c;
log.debug("adding IP filtering rules in FILTER table: {}", ipaddr.ip());
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchEthType(Ethernet.TYPE_IPV4);
selector.matchIPDst(ipaddr.ip()); // router IPs to the controller
treatment.setOutput(PortNumber.CONTROLLER);
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(FILTER_TABLE_CONTROLLER_PRIORITY)
.fromApp(applicationId)
.makePermanent()
.forTable(FILTER_TABLE).build();
ops = install ? ops.add(rule) : ops.remove(rule);
} else {
log.warn("Driver does not currently process filtering condition"
+ " of type: {}", c.type());
......
......@@ -260,7 +260,8 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
selector.matchVlanId(v.vlanId());
selector.matchEthDst(e.mac());
selector.matchEthType(Ethernet.TYPE_IPV4);
treatment.transition(FIB_TABLE);
treatment.popVlan();
treatment.transition(FIB_TABLE); // all other IPs to the FIB table
FlowRule rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
......@@ -272,11 +273,14 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
ops = ops.add(rule);
for (IPCriterion ipaddr : ips) {
log.debug("adding IP filtering rules in FIB table: {}", ipaddr.ip());
log.debug("adding IP filtering rules in FILTER table: {}", ipaddr.ip());
selector = DefaultTrafficSelector.builder();
treatment = DefaultTrafficTreatment.builder();
selector.matchInPort(p.port());
selector.matchVlanId(v.vlanId());
selector.matchEthDst(e.mac());
selector.matchEthType(Ethernet.TYPE_IPV4);
selector.matchIPDst(ipaddr.ip());
selector.matchIPDst(ipaddr.ip()); // router IPs to the controller
treatment.setOutput(PortNumber.CONTROLLER);
rule = DefaultFlowRule.builder()
.forDevice(deviceId)
......@@ -285,7 +289,7 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
.withPriority(HIGHEST_PRIORITY)
.fromApp(applicationId)
.makePermanent()
.forTable(FIB_TABLE).build();
.forTable(FILTER_TABLE).build();
ops = ops.add(rule);
}
......@@ -474,8 +478,9 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
*/
private void processSimpleNextObjective(NextObjective nextObj) {
// Simple next objective has a single treatment (not a collection)
TrafficTreatment treatment = nextObj.next().iterator().next();
flowObjectiveStore.putNextGroup(nextObj.id(),
new DummyGroup(nextObj.next().iterator().next()));
new DummyGroup(treatment));
}
private class Filter {
......
......@@ -82,5 +82,8 @@
<behaviour api="org.onosproject.net.behaviour.Pipeliner"
impl="org.onosproject.driver.pipeline.PicaPipeline"/>
</driver>
<driver name="noviflow" extends="softrouter"
manufacturer="NoviFlow Inc" hwVersion="NS1132" swVersion="NW250.4.4">
</driver>
</drivers>
......