Jonathan Hart
Committed by Gerrit Code Review

Add punt EAPOL rule for OLT

Change-Id: I86287e9eb10bdc30f1b4133324371d98d4da7344
...@@ -98,7 +98,7 @@ public class OLT { ...@@ -98,7 +98,7 @@ public class OLT {
98 public void activate() { 98 public void activate() {
99 appId = coreService.registerApplication("org.onosproject.olt"); 99 appId = coreService.registerApplication("org.onosproject.olt");
100 100
101 - deviceService.addListener(deviceListener); 101 + /*deviceService.addListener(deviceListener);
102 102
103 deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach( 103 deviceService.getPorts(DeviceId.deviceId(oltDevice)).stream().forEach(
104 port -> { 104 port -> {
...@@ -110,7 +110,7 @@ public class OLT { ...@@ -110,7 +110,7 @@ public class OLT {
110 } 110 }
111 } 111 }
112 } 112 }
113 - ); 113 + );*/
114 114
115 115
116 deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach( 116 deviceService.getPorts(DeviceId.deviceId(gfastDevice)).stream().forEach(
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
16 package org.onosproject.driver.pipeline; 16 package org.onosproject.driver.pipeline;
17 17
18 import org.onlab.osgi.ServiceDirectory; 18 import org.onlab.osgi.ServiceDirectory;
19 +import org.onlab.packet.EthType;
20 +import org.onosproject.core.ApplicationId;
21 +import org.onosproject.core.CoreService;
19 import org.onosproject.net.DefaultAnnotations; 22 import org.onosproject.net.DefaultAnnotations;
20 import org.onosproject.net.Device; 23 import org.onosproject.net.Device;
21 import org.onosproject.net.DeviceId; 24 import org.onosproject.net.DeviceId;
...@@ -31,6 +34,7 @@ import org.onosproject.net.device.DeviceProviderService; ...@@ -31,6 +34,7 @@ import org.onosproject.net.device.DeviceProviderService;
31 import org.onosproject.net.device.DeviceService; 34 import org.onosproject.net.device.DeviceService;
32 import org.onosproject.net.driver.AbstractHandlerBehaviour; 35 import org.onosproject.net.driver.AbstractHandlerBehaviour;
33 import org.onosproject.net.flow.DefaultFlowRule; 36 import org.onosproject.net.flow.DefaultFlowRule;
37 +import org.onosproject.net.flow.DefaultTrafficSelector;
34 import org.onosproject.net.flow.DefaultTrafficTreatment; 38 import org.onosproject.net.flow.DefaultTrafficTreatment;
35 import org.onosproject.net.flow.FlowRule; 39 import org.onosproject.net.flow.FlowRule;
36 import org.onosproject.net.flow.FlowRuleOperations; 40 import org.onosproject.net.flow.FlowRuleOperations;
...@@ -43,6 +47,7 @@ import org.onosproject.net.flowobjective.FilteringObjective; ...@@ -43,6 +47,7 @@ import org.onosproject.net.flowobjective.FilteringObjective;
43 import org.onosproject.net.flowobjective.ForwardingObjective; 47 import org.onosproject.net.flowobjective.ForwardingObjective;
44 import org.onosproject.net.flowobjective.NextObjective; 48 import org.onosproject.net.flowobjective.NextObjective;
45 import org.onosproject.net.flowobjective.ObjectiveError; 49 import org.onosproject.net.flowobjective.ObjectiveError;
50 +import org.onosproject.net.packet.PacketPriority;
46 import org.onosproject.net.provider.AbstractProvider; 51 import org.onosproject.net.provider.AbstractProvider;
47 import org.onosproject.net.provider.ProviderId; 52 import org.onosproject.net.provider.ProviderId;
48 import org.slf4j.Logger; 53 import org.slf4j.Logger;
...@@ -65,6 +70,9 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -65,6 +70,9 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
65 private ServiceDirectory serviceDirectory; 70 private ServiceDirectory serviceDirectory;
66 private FlowRuleService flowRuleService; 71 private FlowRuleService flowRuleService;
67 private DeviceId deviceId; 72 private DeviceId deviceId;
73 + private CoreService coreService;
74 +
75 + private ApplicationId appId;
68 76
69 private DeviceProvider provider = new AnnotationProvider(); 77 private DeviceProvider provider = new AnnotationProvider();
70 78
...@@ -76,6 +84,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -76,6 +84,7 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
76 DeviceProviderRegistry registry = 84 DeviceProviderRegistry registry =
77 serviceDirectory.get(DeviceProviderRegistry.class); 85 serviceDirectory.get(DeviceProviderRegistry.class);
78 flowRuleService = serviceDirectory.get(FlowRuleService.class); 86 flowRuleService = serviceDirectory.get(FlowRuleService.class);
87 + coreService = serviceDirectory.get(CoreService.class);
79 88
80 try { 89 try {
81 DeviceProviderService providerService = registry.register(provider); 90 DeviceProviderService providerService = registry.register(provider);
...@@ -85,6 +94,22 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -85,6 +94,22 @@ public class OLTPipeline extends AbstractHandlerBehaviour implements Pipeliner {
85 registry.unregister(provider); 94 registry.unregister(provider);
86 } 95 }
87 96
97 + appId = coreService.registerApplication(
98 + "org.onosproject.driver.OLTPipeline");
99 +
100 + TrafficSelector selector = DefaultTrafficSelector.builder()
101 + .matchEthType(EthType.EtherType.EAPOL.ethType().toShort())
102 + .build();
103 +
104 + TrafficTreatment treatment = DefaultTrafficTreatment.builder()
105 + .punt()
106 + .build();
107 +
108 + FlowRule flowRule = new DefaultFlowRule(deviceId, selector, treatment,
109 + PacketPriority.CONTROL.priorityValue(),
110 + appId, 0, true, null);
111 +
112 + flowRuleService.applyFlowRules(flowRule);
88 } 113 }
89 114
90 @Override 115 @Override
......