Saurav Das

Bug fixes for the centec and noviflow pipelines.

Change-Id: Id0531e54060ff8e2a2321f6c49c8c16e32be45f8
...@@ -437,6 +437,7 @@ public class FlowRuleManager ...@@ -437,6 +437,7 @@ public class FlowRuleManager
437 for (FlowEntry rule : storedRules) { 437 for (FlowEntry rule : storedRules) {
438 try { 438 try {
439 // there are rules in the store that aren't on the switch 439 // there are rules in the store that aren't on the switch
440 + log.debug("Adding rule in store, but not on switch {}", rule);
440 flowMissing(rule); 441 flowMissing(rule);
441 } catch (Exception e) { 442 } catch (Exception e) {
442 log.debug("Can't add missing flow rule {}", e.getMessage()); 443 log.debug("Can't add missing flow rule {}", e.getMessage());
......
...@@ -329,6 +329,7 @@ public final class KryoNamespaces { ...@@ -329,6 +329,7 @@ public final class KryoNamespaces {
329 L2ModificationInstruction.PushHeaderInstructions.class, 329 L2ModificationInstruction.PushHeaderInstructions.class,
330 L2ModificationInstruction.ModVlanIdInstruction.class, 330 L2ModificationInstruction.ModVlanIdInstruction.class,
331 L2ModificationInstruction.ModVlanPcpInstruction.class, 331 L2ModificationInstruction.ModVlanPcpInstruction.class,
332 + L2ModificationInstruction.PopVlanInstruction.class,
332 L2ModificationInstruction.ModMplsLabelInstruction.class, 333 L2ModificationInstruction.ModMplsLabelInstruction.class,
333 L2ModificationInstruction.ModMplsTtlInstruction.class, 334 L2ModificationInstruction.ModMplsTtlInstruction.class,
334 L3ModificationInstruction.class, 335 L3ModificationInstruction.class,
......
...@@ -14,6 +14,7 @@ import org.onlab.util.KryoNamespace; ...@@ -14,6 +14,7 @@ import org.onlab.util.KryoNamespace;
14 import org.onosproject.core.ApplicationId; 14 import org.onosproject.core.ApplicationId;
15 import org.onosproject.core.CoreService; 15 import org.onosproject.core.CoreService;
16 import org.onosproject.net.DeviceId; 16 import org.onosproject.net.DeviceId;
17 +import org.onosproject.net.PortNumber;
17 import org.onosproject.net.behaviour.NextGroup; 18 import org.onosproject.net.behaviour.NextGroup;
18 import org.onosproject.net.behaviour.Pipeliner; 19 import org.onosproject.net.behaviour.Pipeliner;
19 import org.onosproject.net.behaviour.PipelinerContext; 20 import org.onosproject.net.behaviour.PipelinerContext;
...@@ -78,7 +79,7 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -78,7 +79,7 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
78 protected static final int ROUTE_TABLE = 3; 79 protected static final int ROUTE_TABLE = 3;
79 80
80 private static final long DEFAULT_METADATA = 100; 81 private static final long DEFAULT_METADATA = 100;
81 - private static final long DEFAULT_METADATA_MASK = 0xff; 82 + private static final long DEFAULT_METADATA_MASK = 0xffffffffffffffffL;
82 83
83 // Priority used in PORT_VLAN Table, the only priority accepted is PORT_VLAN_TABLE_PRIORITY. 84 // Priority used in PORT_VLAN Table, the only priority accepted is PORT_VLAN_TABLE_PRIORITY.
84 // The packet passed PORT+VLAN check will goto FILTER Table. 85 // The packet passed PORT+VLAN check will goto FILTER Table.
...@@ -424,8 +425,22 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -424,8 +425,22 @@ public class CentecV350Pipeline extends AbstractHandlerBehaviour implements Pipe
424 .forTable(PORT_VLAN_TABLE).build(); 425 .forTable(PORT_VLAN_TABLE).build();
425 ops = install ? ops.add(rule) : ops.remove(rule); 426 ops = install ? ops.add(rule) : ops.remove(rule);
426 } else if (c.type() == Criterion.Type.IPV4_DST) { 427 } else if (c.type() == Criterion.Type.IPV4_DST) {
427 - // TODO: not needed now? Why not? 428 + IPCriterion ipaddr = (IPCriterion) c;
428 - fail(filt, ObjectiveError.UNSUPPORTED); 429 + log.debug("adding IP filtering rules in FILTER table: {}", ipaddr.ip());
430 + TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
431 + TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
432 + selector.matchEthType(Ethernet.TYPE_IPV4);
433 + selector.matchIPDst(ipaddr.ip()); // router IPs to the controller
434 + treatment.setOutput(PortNumber.CONTROLLER);
435 + FlowRule rule = DefaultFlowRule.builder()
436 + .forDevice(deviceId)
437 + .withSelector(selector.build())
438 + .withTreatment(treatment.build())
439 + .withPriority(FILTER_TABLE_CONTROLLER_PRIORITY)
440 + .fromApp(applicationId)
441 + .makePermanent()
442 + .forTable(FILTER_TABLE).build();
443 + ops = install ? ops.add(rule) : ops.remove(rule);
429 } else { 444 } else {
430 log.warn("Driver does not currently process filtering condition" 445 log.warn("Driver does not currently process filtering condition"
431 + " of type: {}", c.type()); 446 + " of type: {}", c.type());
......
...@@ -260,7 +260,8 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -260,7 +260,8 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
260 selector.matchVlanId(v.vlanId()); 260 selector.matchVlanId(v.vlanId());
261 selector.matchEthDst(e.mac()); 261 selector.matchEthDst(e.mac());
262 selector.matchEthType(Ethernet.TYPE_IPV4); 262 selector.matchEthType(Ethernet.TYPE_IPV4);
263 - treatment.transition(FIB_TABLE); 263 + treatment.popVlan();
264 + treatment.transition(FIB_TABLE); // all other IPs to the FIB table
264 FlowRule rule = DefaultFlowRule.builder() 265 FlowRule rule = DefaultFlowRule.builder()
265 .forDevice(deviceId) 266 .forDevice(deviceId)
266 .withSelector(selector.build()) 267 .withSelector(selector.build())
...@@ -272,11 +273,14 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -272,11 +273,14 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
272 ops = ops.add(rule); 273 ops = ops.add(rule);
273 274
274 for (IPCriterion ipaddr : ips) { 275 for (IPCriterion ipaddr : ips) {
275 - log.debug("adding IP filtering rules in FIB table: {}", ipaddr.ip()); 276 + log.debug("adding IP filtering rules in FILTER table: {}", ipaddr.ip());
276 selector = DefaultTrafficSelector.builder(); 277 selector = DefaultTrafficSelector.builder();
277 treatment = DefaultTrafficTreatment.builder(); 278 treatment = DefaultTrafficTreatment.builder();
279 + selector.matchInPort(p.port());
280 + selector.matchVlanId(v.vlanId());
281 + selector.matchEthDst(e.mac());
278 selector.matchEthType(Ethernet.TYPE_IPV4); 282 selector.matchEthType(Ethernet.TYPE_IPV4);
279 - selector.matchIPDst(ipaddr.ip()); 283 + selector.matchIPDst(ipaddr.ip()); // router IPs to the controller
280 treatment.setOutput(PortNumber.CONTROLLER); 284 treatment.setOutput(PortNumber.CONTROLLER);
281 rule = DefaultFlowRule.builder() 285 rule = DefaultFlowRule.builder()
282 .forDevice(deviceId) 286 .forDevice(deviceId)
...@@ -285,7 +289,7 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -285,7 +289,7 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
285 .withPriority(HIGHEST_PRIORITY) 289 .withPriority(HIGHEST_PRIORITY)
286 .fromApp(applicationId) 290 .fromApp(applicationId)
287 .makePermanent() 291 .makePermanent()
288 - .forTable(FIB_TABLE).build(); 292 + .forTable(FILTER_TABLE).build();
289 ops = ops.add(rule); 293 ops = ops.add(rule);
290 } 294 }
291 295
...@@ -474,8 +478,9 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe ...@@ -474,8 +478,9 @@ public class SoftRouterPipeline extends AbstractHandlerBehaviour implements Pipe
474 */ 478 */
475 private void processSimpleNextObjective(NextObjective nextObj) { 479 private void processSimpleNextObjective(NextObjective nextObj) {
476 // Simple next objective has a single treatment (not a collection) 480 // Simple next objective has a single treatment (not a collection)
481 + TrafficTreatment treatment = nextObj.next().iterator().next();
477 flowObjectiveStore.putNextGroup(nextObj.id(), 482 flowObjectiveStore.putNextGroup(nextObj.id(),
478 - new DummyGroup(nextObj.next().iterator().next())); 483 + new DummyGroup(treatment));
479 } 484 }
480 485
481 private class Filter { 486 private class Filter {
......
...@@ -82,5 +82,8 @@ ...@@ -82,5 +82,8 @@
82 <behaviour api="org.onosproject.net.behaviour.Pipeliner" 82 <behaviour api="org.onosproject.net.behaviour.Pipeliner"
83 impl="org.onosproject.driver.pipeline.PicaPipeline"/> 83 impl="org.onosproject.driver.pipeline.PicaPipeline"/>
84 </driver> 84 </driver>
85 + <driver name="noviflow" extends="softrouter"
86 + manufacturer="NoviFlow Inc" hwVersion="NS1132" swVersion="NW250.4.4">
87 + </driver>
85 </drivers> 88 </drivers>
86 89
......