Add punt EAPOL rule for OLT
Change-Id: I86287e9eb10bdc30f1b4133324371d98d4da7344
diff --git a/apps/olt/src/main/java/org/onosproject/olt/OLT.java b/apps/olt/src/main/java/org/onosproject/olt/OLT.java
index 4569cc0..fb0d523 100644
--- a/apps/olt/src/main/java/org/onosproject/olt/OLT.java
+++ b/apps/olt/src/main/java/org/onosproject/olt/OLT.java
@@ -98,7 +98,7 @@
public void activate() {
appId = coreService.registerApplication("org.onosproject.olt");
- deviceService.addListener(deviceListener);
+ /*deviceService.addListener(deviceListener);
deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach(
port -> {
@@ -110,7 +110,7 @@
}
}
}
- );
+ );*/
deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach(
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
index c158511..50888fb 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/OLTPipeline.java
@@ -16,6 +16,9 @@
package org.onosproject.driver.pipeline;
import org.onlab.osgi.ServiceDirectory;
+import org.onlab.packet.EthType;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
@@ -31,6 +34,7 @@
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
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;
@@ -43,6 +47,7 @@
import org.onosproject.net.flowobjective.ForwardingObjective;
import org.onosproject.net.flowobjective.NextObjective;
import org.onosproject.net.flowobjective.ObjectiveError;
+import org.onosproject.net.packet.PacketPriority;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
import org.slf4j.Logger;
@@ -65,6 +70,9 @@
private ServiceDirectory serviceDirectory;
private FlowRuleService flowRuleService;
private DeviceId deviceId;
+ private CoreService coreService;
+
+ private ApplicationId appId;
private DeviceProvider provider = new AnnotationProvider();
@@ -76,6 +84,7 @@
DeviceProviderRegistry registry =
serviceDirectory.get(DeviceProviderRegistry.class);
flowRuleService = serviceDirectory.get(FlowRuleService.class);
+ coreService = serviceDirectory.get(CoreService.class);
try {
DeviceProviderService providerService = registry.register(provider);
@@ -85,6 +94,22 @@
registry.unregister(provider);
}
+ appId = coreService.registerApplication(
+ "org.onosproject.driver.OLTPipeline");
+
+ TrafficSelector selector = DefaultTrafficSelector.builder()
+ .matchEthType(EthType.EtherType.EAPOL.ethType().toShort())
+ .build();
+
+ TrafficTreatment treatment = DefaultTrafficTreatment.builder()
+ .punt()
+ .build();
+
+ FlowRule flowRule = new DefaultFlowRule(deviceId, selector, treatment,
+ PacketPriority.CONTROL.priorityValue(),
+ appId, 0, true, null);
+
+ flowRuleService.applyFlowRules(flowRule);
}
@Override