Saurav Das
Committed by Thomas Vachuska

Adding a corsa pipeliner which extends the ovs-corsa pipeliner

Change-Id: Iea0b1949232de20abd60717a8dc150b5c133bd7a
1 +package org.onosproject.driver.pipeline;
2 +
3 +import static org.slf4j.LoggerFactory.getLogger;
4 +
5 +import org.onlab.packet.Ethernet;
6 +import org.onosproject.net.flow.DefaultFlowRule;
7 +import org.onosproject.net.flow.DefaultTrafficSelector;
8 +import org.onosproject.net.flow.DefaultTrafficTreatment;
9 +import org.onosproject.net.flow.FlowRule;
10 +import org.onosproject.net.flow.FlowRuleOperations;
11 +import org.onosproject.net.flow.FlowRuleOperationsContext;
12 +import org.onosproject.net.flow.TrafficSelector;
13 +import org.onosproject.net.flow.TrafficTreatment;
14 +import org.slf4j.Logger;
15 +
16 +public class CorsaPipeline extends OVSCorsaPipeline {
17 +
18 + private final Logger log = getLogger(getClass());
19 +
20 + @Override
21 + protected void processVlanMplsTable(boolean install) {
22 + TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
23 + TrafficTreatment.Builder treatment = DefaultTrafficTreatment
24 + .builder();
25 + FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
26 + FlowRule rule;
27 + // corsa uses non-OF-standard way to match on presence of VLAN tags
28 + selector.matchEthType(Ethernet.TYPE_VLAN);
29 + treatment.transition(VLAN_TABLE);
30 +
31 + rule = DefaultFlowRule.builder()
32 + .forDevice(deviceId)
33 + .withSelector(selector.build())
34 + .withTreatment(treatment.build())
35 + .withPriority(CONTROLLER_PRIORITY)
36 + .fromApp(appId)
37 + .makePermanent()
38 + .forTable(VLAN_MPLS_TABLE).build();
39 +
40 +
41 + ops = install ? ops.add(rule) : ops.remove(rule);
42 +
43 + flowRuleService.apply(ops.build(new FlowRuleOperationsContext() {
44 + @Override
45 + public void onSuccess(FlowRuleOperations ops) {
46 + log.info("Provisioned vlan/mpls table");
47 + }
48 +
49 + @Override
50 + public void onError(FlowRuleOperations ops) {
51 + log.info(
52 + "Failed to provision vlan/mpls table");
53 + }
54 + }));
55 +
56 + }
57 +
58 +}
...@@ -95,19 +95,19 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli ...@@ -95,19 +95,19 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli
95 protected static final int LOCAL_TABLE = 9; 95 protected static final int LOCAL_TABLE = 9;
96 96
97 97
98 - private static final int CONTROLLER_PRIORITY = 255; 98 + protected static final int CONTROLLER_PRIORITY = 255;
99 private static final int DROP_PRIORITY = 0; 99 private static final int DROP_PRIORITY = 0;
100 private static final int HIGHEST_PRIORITY = 0xffff; 100 private static final int HIGHEST_PRIORITY = 0xffff;
101 101
102 private final Logger log = getLogger(getClass()); 102 private final Logger log = getLogger(getClass());
103 103
104 private ServiceDirectory serviceDirectory; 104 private ServiceDirectory serviceDirectory;
105 - private FlowRuleService flowRuleService; 105 + protected FlowRuleService flowRuleService;
106 private CoreService coreService; 106 private CoreService coreService;
107 private GroupService groupService; 107 private GroupService groupService;
108 private FlowObjectiveStore flowObjectiveStore; 108 private FlowObjectiveStore flowObjectiveStore;
109 - private DeviceId deviceId; 109 + protected DeviceId deviceId;
110 - private ApplicationId appId; 110 + protected ApplicationId appId;
111 111
112 private KryoNamespace appKryo = new KryoNamespace.Builder() 112 private KryoNamespace appKryo = new KryoNamespace.Builder()
113 .register(GroupKey.class) 113 .register(GroupKey.class)
...@@ -521,7 +521,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli ...@@ -521,7 +521,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli
521 521
522 } 522 }
523 523
524 - private void processVlanMplsTable(boolean install) { 524 + protected void processVlanMplsTable(boolean install) {
525 TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); 525 TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
526 TrafficTreatment.Builder treatment = DefaultTrafficTreatment 526 TrafficTreatment.Builder treatment = DefaultTrafficTreatment
527 .builder(); 527 .builder();
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
43 </driver> 43 </driver>
44 <driver name="corsa" manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1"> 44 <driver name="corsa" manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1">
45 <behaviour api="org.onosproject.net.behaviour.Pipeliner" 45 <behaviour api="org.onosproject.net.behaviour.Pipeliner"
46 - impl="org.onosproject.driver.pipeline.OVSCorsaPipeline"/> 46 + impl="org.onosproject.driver.pipeline.CorsaPipeline"/>
47 <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver" 47 <behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
48 impl="org.onosproject.driver.handshaker.OFCorsaSwitchDriver"/> 48 impl="org.onosproject.driver.handshaker.OFCorsaSwitchDriver"/>
49 </driver> 49 </driver>
......