aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/drivers
diff options
context:
space:
mode:
authorAshlee Young <ashlee@onosfw.com>2015-10-23 08:31:31 -0700
committerAshlee Young <ashlee@onosfw.com>2015-10-23 08:31:31 -0700
commite52e67767076b29cb01939aa7bdd8fee9d205cc1 (patch)
treeb8c2d28231bccc2a280fea429a9af7297c62f58f /framework/src/onos/drivers
parenta912c5ce9968da5936a695064f22083898e7b93d (diff)
Update ONOS src to commit id 69b36d5d11e81e28e56b46ba44e4b8cd701c5867
Change-Id: I9c13045711dbf9c0181106b66a6bf22c72bcf330 Signed-off-by: Ashlee Young <ashlee@onosfw.com>
Diffstat (limited to 'framework/src/onos/drivers')
-rw-r--r--framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/CpqdOFDPA1Pipeline.java2
-rw-r--r--framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java25
-rw-r--r--framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OpenVSwitchPipeline.java68
3 files changed, 71 insertions, 24 deletions
diff --git a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/CpqdOFDPA1Pipeline.java b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/CpqdOFDPA1Pipeline.java
index f72bde09..c9ef451e 100644
--- a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/CpqdOFDPA1Pipeline.java
+++ b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/CpqdOFDPA1Pipeline.java
@@ -169,7 +169,7 @@ public class CpqdOFDPA1Pipeline extends OFDPA1Pipeline {
}));
}
- private void processAclTable() {
+ protected void processAclTable() {
//table miss entry - catch all to executed action-set
FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
diff --git a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
index eebb2e22..c735af3f 100644
--- a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
+++ b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
@@ -30,7 +30,6 @@ import org.onosproject.net.device.DefaultDeviceDescription;
import org.onosproject.net.device.DeviceDescription;
import org.onosproject.net.device.DeviceProvider;
import org.onosproject.net.device.DeviceProviderRegistry;
-import org.onosproject.net.device.DeviceProviderService;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.flow.DefaultFlowRule;
@@ -86,13 +85,13 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
flowRuleService = serviceDirectory.get(FlowRuleService.class);
coreService = serviceDirectory.get(CoreService.class);
- try {
+ /*try {
DeviceProviderService providerService = registry.register(provider);
providerService.deviceConnected(deviceId,
description(deviceId, DEVICE, OLT));
} finally {
registry.unregister(provider);
- }
+ }*/
appId = coreService.registerApplication(
"org.onosproject.driver.OLTPipeline");
@@ -109,12 +108,12 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
PacketPriority.CONTROL.priorityValue(),
appId, 0, true, null);
- flowRuleService.applyFlowRules(flowRule);
+ //flowRuleService.applyFlowRules(flowRule);
}
@Override
public void filter(FilteringObjective filter) {
- throw new UnsupportedOperationException("Single table does not filter.");
+ throw new UnsupportedOperationException("OLT does not filter.");
}
@Override
@@ -140,19 +139,11 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
TrafficSelector selector = fwd.selector();
TrafficTreatment treatment = fwd.treatment();
- if ((fwd.treatment().deferred().size() == 0) &&
- (fwd.treatment().immediate().size() == 0) &&
- (fwd.treatment().tableTransition() == null) &&
- (!fwd.treatment().clearedDeferred())) {
- TrafficTreatment.Builder flowTreatment = DefaultTrafficTreatment.builder();
- flowTreatment.add(Instructions.createDrop());
- treatment = flowTreatment.build();
- }
FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
.forDevice(deviceId)
.withSelector(selector)
- .withTreatment(fwd.treatment())
+ .withTreatment(treatment)
.fromApp(fwd.appId())
.withPriority(fwd.priority());
@@ -162,9 +153,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
ruleBuilder.makeTemporary(fwd.timeout());
}
-
switch (fwd.op()) {
-
case ADD:
flowBuilder.add(ruleBuilder.build());
break;
@@ -190,16 +179,16 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
}
}
}));
-
}
@Override
public void next(NextObjective nextObjective) {
- throw new UnsupportedOperationException("Single table does not next hop.");
+ throw new UnsupportedOperationException("OLT does not next hop.");
}
/**
* Build a device description.
+ *
* @param deviceId a deviceId
* @param key the key of the annotation
* @param value the value for the annotation
diff --git a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OpenVSwitchPipeline.java b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OpenVSwitchPipeline.java
index 270e76a2..5d098390 100644
--- a/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OpenVSwitchPipeline.java
+++ b/framework/src/onos/drivers/src/main/java/org/onosproject/driver/pipeline/OpenVSwitchPipeline.java
@@ -21,12 +21,14 @@ import java.util.Collection;
import java.util.Collections;
import org.onlab.osgi.ServiceDirectory;
+import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.Pipeliner;
import org.onosproject.net.behaviour.PipelinerContext;
import org.onosproject.net.device.DeviceService;
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;
@@ -56,11 +58,13 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline
private ServiceDirectory serviceDirectory;
protected FlowObjectiveStore flowObjectiveStore;
protected DeviceId deviceId;
+ protected ApplicationId appId;
protected FlowRuleService flowRuleService;
protected DeviceService deviceService;
private static final int TIME_OUT = 0;
- private static final int MAC_TABLE = 40;
- private static final int PORT_TABLE = 0;
+ private static final int CLASSIFIER_TABLE = 0;
+ private static final int MAC_TABLE = 50;
+ private static final int TABLE_MISS_PRIORITY = 0;
@Override
public void init(DeviceId deviceId, PipelinerContext context) {
@@ -71,9 +75,9 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline
coreService = serviceDirectory.get(CoreService.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
flowObjectiveStore = context.store();
- coreService
+ appId = coreService
.registerApplication("org.onosproject.driver.OpenVSwitchPipeline");
-
+ initializePipeline();
}
@Override
@@ -125,6 +129,60 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline
super.next(nextObjective);
}
+ private void initializePipeline() {
+ processClassifierTable(true);
+ processMacTable(true);
+ }
+
+ private void processClassifierTable(boolean install) {
+ TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+ treatment.transition(MAC_TABLE);
+
+ FlowRule rule;
+ rule = DefaultFlowRule.builder().forDevice(deviceId)
+ .withSelector(selector.build())
+ .withTreatment(treatment.build())
+ .withPriority(TABLE_MISS_PRIORITY).fromApp(appId)
+ .makePermanent().forTable(CLASSIFIER_TABLE).build();
+
+ applyRules(install, rule);
+ }
+
+ private void processMacTable(boolean install) {
+ TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
+ TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
+
+ treatment.drop();
+
+ FlowRule rule;
+ rule = DefaultFlowRule.builder().forDevice(deviceId)
+ .withSelector(selector.build())
+ .withTreatment(treatment.build())
+ .withPriority(TABLE_MISS_PRIORITY).fromApp(appId)
+ .makePermanent().forTable(MAC_TABLE).build();
+
+ applyRules(install, rule);
+ }
+
+ private void applyRules(boolean install, FlowRule rule) {
+ FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
+
+ ops = install ? ops.add(rule) : ops.remove(rule);
+ flowRuleService.apply(ops.build(new FlowRuleOperationsContext() {
+ @Override
+ public void onSuccess(FlowRuleOperations ops) {
+ log.info("ONOSW provisioned " + rule.tableId() + " table");
+ }
+
+ @Override
+ public void onError(FlowRuleOperations ops) {
+ log.info("ONOSW failed to provision " + rule.tableId() + " table");
+ }
+ }));
+ }
+
private Collection<FlowRule> processForward(ForwardingObjective fwd) {
switch (fwd.flag()) {
case SPECIFIC:
@@ -164,7 +222,7 @@ public class OpenVSwitchPipeline extends DefaultSingleTablePipeline
tb.allInstructions().forEach(t -> newTraffic.add(t));
newTraffic.transition(MAC_TABLE);
ruleBuilder.withTreatment(newTraffic.build());
- ruleBuilder.forTable(PORT_TABLE);
+ ruleBuilder.forTable(CLASSIFIER_TABLE);
}
return Collections.singletonList(ruleBuilder.build());
}