Saurav Das
Committed by Thomas Vachuska

Adding a corsa pipeliner which extends the ovs-corsa pipeliner

Change-Id: Iea0b1949232de20abd60717a8dc150b5c133bd7a
package org.onosproject.driver.pipeline;
import static org.slf4j.LoggerFactory.getLogger;
import org.onlab.packet.Ethernet;
import org.onosproject.net.flow.DefaultFlowRule;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.flow.FlowRuleOperationsContext;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.slf4j.Logger;
public class CorsaPipeline extends OVSCorsaPipeline {
private final Logger log = getLogger(getClass());
@Override
protected void processVlanMplsTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder();
FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
FlowRule rule;
// corsa uses non-OF-standard way to match on presence of VLAN tags
selector.matchEthType(Ethernet.TYPE_VLAN);
treatment.transition(VLAN_TABLE);
rule = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector.build())
.withTreatment(treatment.build())
.withPriority(CONTROLLER_PRIORITY)
.fromApp(appId)
.makePermanent()
.forTable(VLAN_MPLS_TABLE).build();
ops = install ? ops.add(rule) : ops.remove(rule);
flowRuleService.apply(ops.build(new FlowRuleOperationsContext() {
@Override
public void onSuccess(FlowRuleOperations ops) {
log.info("Provisioned vlan/mpls table");
}
@Override
public void onError(FlowRuleOperations ops) {
log.info(
"Failed to provision vlan/mpls table");
}
}));
}
}
......@@ -95,19 +95,19 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli
protected static final int LOCAL_TABLE = 9;
private static final int CONTROLLER_PRIORITY = 255;
protected static final int CONTROLLER_PRIORITY = 255;
private static final int DROP_PRIORITY = 0;
private static final int HIGHEST_PRIORITY = 0xffff;
private final Logger log = getLogger(getClass());
private ServiceDirectory serviceDirectory;
private FlowRuleService flowRuleService;
protected FlowRuleService flowRuleService;
private CoreService coreService;
private GroupService groupService;
private FlowObjectiveStore flowObjectiveStore;
private DeviceId deviceId;
private ApplicationId appId;
protected DeviceId deviceId;
protected ApplicationId appId;
private KryoNamespace appKryo = new KryoNamespace.Builder()
.register(GroupKey.class)
......@@ -521,7 +521,7 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli
}
private void processVlanMplsTable(boolean install) {
protected void processVlanMplsTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment
.builder();
......
......@@ -43,7 +43,7 @@
</driver>
<driver name="corsa" manufacturer="Corsa" hwVersion="Corsa Element" swVersion="2.3.1">
<behaviour api="org.onosproject.net.behaviour.Pipeliner"
impl="org.onosproject.driver.pipeline.OVSCorsaPipeline"/>
impl="org.onosproject.driver.pipeline.CorsaPipeline"/>
<behaviour api="org.onosproject.openflow.controller.driver.OpenFlowSwitchDriver"
impl="org.onosproject.driver.handshaker.OFCorsaSwitchDriver"/>
</driver>
......