Committed by
Gerrit Code Review
Proposing to undeprecate the non-device-specific packet request APIs.
There doesn't seem to be any reason to require users to specify an empty Optional when they want to request from all devices. Change-Id: I2394bfa3ed07cae5c5f514dd24faea74409a33f4
Showing
2 changed files
with
20 additions
and
26 deletions
... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.packet; | 16 | package org.onosproject.net.packet; |
17 | 17 | ||
18 | -import com.google.common.annotations.Beta; | ||
19 | import org.onosproject.core.ApplicationId; | 18 | import org.onosproject.core.ApplicationId; |
20 | import org.onosproject.net.DeviceId; | 19 | import org.onosproject.net.DeviceId; |
21 | import org.onosproject.net.flow.TrafficSelector; | 20 | import org.onosproject.net.flow.TrafficSelector; |
... | @@ -57,7 +56,6 @@ public interface PacketService { | ... | @@ -57,7 +56,6 @@ public interface PacketService { |
57 | * | 56 | * |
58 | * @return list of existing packet processor entries | 57 | * @return list of existing packet processor entries |
59 | */ | 58 | */ |
60 | - @Beta | ||
61 | List<PacketProcessorEntry> getProcessors(); | 59 | List<PacketProcessorEntry> getProcessors(); |
62 | 60 | ||
63 | /** | 61 | /** |
... | @@ -67,9 +65,7 @@ public interface PacketService { | ... | @@ -67,9 +65,7 @@ public interface PacketService { |
67 | * @param selector the traffic selector used to match packets | 65 | * @param selector the traffic selector used to match packets |
68 | * @param priority the priority of the rule | 66 | * @param priority the priority of the rule |
69 | * @param appId the application ID of the requester | 67 | * @param appId the application ID of the requester |
70 | - * @deprecated 1.5.0 Falcon Release | ||
71 | */ | 68 | */ |
72 | - @Deprecated | ||
73 | void requestPackets(TrafficSelector selector, PacketPriority priority, | 69 | void requestPackets(TrafficSelector selector, PacketPriority priority, |
74 | ApplicationId appId); | 70 | ApplicationId appId); |
75 | 71 | ||
... | @@ -95,9 +91,7 @@ public interface PacketService { | ... | @@ -95,9 +91,7 @@ public interface PacketService { |
95 | * @param selector the traffic selector used to match packets | 91 | * @param selector the traffic selector used to match packets |
96 | * @param priority the priority of the rule | 92 | * @param priority the priority of the rule |
97 | * @param appId the application ID of the requester | 93 | * @param appId the application ID of the requester |
98 | - * @deprecated 1.5.0 Falcon Release | ||
99 | */ | 94 | */ |
100 | - @Deprecated | ||
101 | void cancelPackets(TrafficSelector selector, PacketPriority priority, | 95 | void cancelPackets(TrafficSelector selector, PacketPriority priority, |
102 | ApplicationId appId); | 96 | ApplicationId appId); |
103 | 97 | ... | ... |
... | @@ -17,7 +17,6 @@ package org.onosproject.net.packet.impl; | ... | @@ -17,7 +17,6 @@ package org.onosproject.net.packet.impl; |
17 | 17 | ||
18 | import com.google.common.collect.ImmutableList; | 18 | import com.google.common.collect.ImmutableList; |
19 | import com.google.common.collect.Lists; | 19 | import com.google.common.collect.Lists; |
20 | - | ||
21 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
22 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
23 | import org.apache.felix.scr.annotations.Deactivate; | 22 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -34,7 +33,6 @@ import org.onosproject.net.device.DeviceEvent; | ... | @@ -34,7 +33,6 @@ import org.onosproject.net.device.DeviceEvent; |
34 | import org.onosproject.net.device.DeviceListener; | 33 | import org.onosproject.net.device.DeviceListener; |
35 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
36 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 35 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
37 | -import org.onosproject.net.flow.FlowRuleService; | ||
38 | import org.onosproject.net.flow.TrafficSelector; | 36 | import org.onosproject.net.flow.TrafficSelector; |
39 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; | 37 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
40 | import org.onosproject.net.flowobjective.FlowObjectiveService; | 38 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
... | @@ -68,7 +66,9 @@ import java.util.concurrent.Executors; | ... | @@ -68,7 +66,9 @@ import java.util.concurrent.Executors; |
68 | import static com.google.common.base.Preconditions.checkNotNull; | 66 | import static com.google.common.base.Preconditions.checkNotNull; |
69 | import static org.onlab.util.Tools.groupedThreads; | 67 | import static org.onlab.util.Tools.groupedThreads; |
70 | import static org.onosproject.security.AppGuard.checkPermission; | 68 | import static org.onosproject.security.AppGuard.checkPermission; |
71 | -import static org.onosproject.security.AppPermission.Type.*; | 69 | +import static org.onosproject.security.AppPermission.Type.PACKET_EVENT; |
70 | +import static org.onosproject.security.AppPermission.Type.PACKET_READ; | ||
71 | +import static org.onosproject.security.AppPermission.Type.PACKET_WRITE; | ||
72 | import static org.slf4j.LoggerFactory.getLogger; | 72 | import static org.slf4j.LoggerFactory.getLogger; |
73 | 73 | ||
74 | /** | 74 | /** |
... | @@ -82,9 +82,10 @@ public class PacketManager | ... | @@ -82,9 +82,10 @@ public class PacketManager |
82 | 82 | ||
83 | private final Logger log = getLogger(getClass()); | 83 | private final Logger log = getLogger(getClass()); |
84 | 84 | ||
85 | - private static final String TABLE_TYPE_MSG = | 85 | + private static final String ERROR_NULL_PROCESSOR = "Processor cannot be null"; |
86 | - "Table Type cannot be null. For requesting packets without " + | 86 | + private static final String ERROR_NULL_SELECTOR = "Selector cannot be null"; |
87 | - "table hints, use other methods in the packetService API"; | 87 | + private static final String ERROR_NULL_APP_ID = "Application ID cannot be null"; |
88 | + private static final String ERROR_NULL_DEVICE_ID = "Device ID cannot be null"; | ||
88 | 89 | ||
89 | private final PacketStoreDelegate delegate = new InternalStoreDelegate(); | 90 | private final PacketStoreDelegate delegate = new InternalStoreDelegate(); |
90 | 91 | ||
... | @@ -98,13 +99,10 @@ public class PacketManager | ... | @@ -98,13 +99,10 @@ public class PacketManager |
98 | protected DeviceService deviceService; | 99 | protected DeviceService deviceService; |
99 | 100 | ||
100 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 101 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
101 | - protected FlowRuleService flowService; | ||
102 | - | ||
103 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
104 | protected PacketStore store; | 102 | protected PacketStore store; |
105 | 103 | ||
106 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 104 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
107 | - private FlowObjectiveService objectiveService; | 105 | + protected FlowObjectiveService objectiveService; |
108 | 106 | ||
109 | private ExecutorService eventHandlingExecutor; | 107 | private ExecutorService eventHandlingExecutor; |
110 | 108 | ||
... | @@ -146,7 +144,7 @@ public class PacketManager | ... | @@ -146,7 +144,7 @@ public class PacketManager |
146 | @Override | 144 | @Override |
147 | public void addProcessor(PacketProcessor processor, int priority) { | 145 | public void addProcessor(PacketProcessor processor, int priority) { |
148 | checkPermission(PACKET_EVENT); | 146 | checkPermission(PACKET_EVENT); |
149 | - checkNotNull(processor, "Processor cannot be null"); | 147 | + checkNotNull(processor, ERROR_NULL_PROCESSOR); |
150 | ProcessorEntry entry = new ProcessorEntry(processor, priority); | 148 | ProcessorEntry entry = new ProcessorEntry(processor, priority); |
151 | 149 | ||
152 | // Insert the new processor according to its priority. | 150 | // Insert the new processor according to its priority. |
... | @@ -162,7 +160,7 @@ public class PacketManager | ... | @@ -162,7 +160,7 @@ public class PacketManager |
162 | @Override | 160 | @Override |
163 | public void removeProcessor(PacketProcessor processor) { | 161 | public void removeProcessor(PacketProcessor processor) { |
164 | checkPermission(PACKET_EVENT); | 162 | checkPermission(PACKET_EVENT); |
165 | - checkNotNull(processor, "Processor cannot be null"); | 163 | + checkNotNull(processor, ERROR_NULL_PROCESSOR); |
166 | 164 | ||
167 | // Remove the processor entry. | 165 | // Remove the processor entry. |
168 | for (int i = 0; i < processors.size(); i++) { | 166 | for (int i = 0; i < processors.size(); i++) { |
... | @@ -183,8 +181,8 @@ public class PacketManager | ... | @@ -183,8 +181,8 @@ public class PacketManager |
183 | public void requestPackets(TrafficSelector selector, PacketPriority priority, | 181 | public void requestPackets(TrafficSelector selector, PacketPriority priority, |
184 | ApplicationId appId) { | 182 | ApplicationId appId) { |
185 | checkPermission(PACKET_READ); | 183 | checkPermission(PACKET_READ); |
186 | - checkNotNull(selector, "Selector cannot be null"); | 184 | + checkNotNull(selector, ERROR_NULL_SELECTOR); |
187 | - checkNotNull(appId, "Application ID cannot be null"); | 185 | + checkNotNull(appId, ERROR_NULL_APP_ID); |
188 | 186 | ||
189 | PacketRequest request = new DefaultPacketRequest(selector, priority, appId, | 187 | PacketRequest request = new DefaultPacketRequest(selector, priority, appId, |
190 | localNodeId, Optional.empty()); | 188 | localNodeId, Optional.empty()); |
... | @@ -195,8 +193,9 @@ public class PacketManager | ... | @@ -195,8 +193,9 @@ public class PacketManager |
195 | public void requestPackets(TrafficSelector selector, PacketPriority priority, | 193 | public void requestPackets(TrafficSelector selector, PacketPriority priority, |
196 | ApplicationId appId, Optional<DeviceId> deviceId) { | 194 | ApplicationId appId, Optional<DeviceId> deviceId) { |
197 | checkPermission(PACKET_READ); | 195 | checkPermission(PACKET_READ); |
198 | - checkNotNull(selector, "Selector cannot be null"); | 196 | + checkNotNull(selector, ERROR_NULL_SELECTOR); |
199 | - checkNotNull(appId, "Application ID cannot be null"); | 197 | + checkNotNull(appId, ERROR_NULL_APP_ID); |
198 | + checkNotNull(deviceId, ERROR_NULL_DEVICE_ID); | ||
200 | 199 | ||
201 | PacketRequest request = | 200 | PacketRequest request = |
202 | new DefaultPacketRequest(selector, priority, appId, | 201 | new DefaultPacketRequest(selector, priority, appId, |
... | @@ -210,8 +209,8 @@ public class PacketManager | ... | @@ -210,8 +209,8 @@ public class PacketManager |
210 | public void cancelPackets(TrafficSelector selector, PacketPriority priority, | 209 | public void cancelPackets(TrafficSelector selector, PacketPriority priority, |
211 | ApplicationId appId) { | 210 | ApplicationId appId) { |
212 | checkPermission(PACKET_READ); | 211 | checkPermission(PACKET_READ); |
213 | - checkNotNull(selector, "Selector cannot be null"); | 212 | + checkNotNull(selector, ERROR_NULL_SELECTOR); |
214 | - checkNotNull(appId, "Application ID cannot be null"); | 213 | + checkNotNull(appId, ERROR_NULL_APP_ID); |
215 | 214 | ||
216 | 215 | ||
217 | PacketRequest request = new DefaultPacketRequest(selector, priority, appId, | 216 | PacketRequest request = new DefaultPacketRequest(selector, priority, appId, |
... | @@ -223,8 +222,9 @@ public class PacketManager | ... | @@ -223,8 +222,9 @@ public class PacketManager |
223 | public void cancelPackets(TrafficSelector selector, PacketPriority priority, | 222 | public void cancelPackets(TrafficSelector selector, PacketPriority priority, |
224 | ApplicationId appId, Optional<DeviceId> deviceId) { | 223 | ApplicationId appId, Optional<DeviceId> deviceId) { |
225 | checkPermission(PACKET_READ); | 224 | checkPermission(PACKET_READ); |
226 | - checkNotNull(selector, "Selector cannot be null"); | 225 | + checkNotNull(selector, ERROR_NULL_SELECTOR); |
227 | - checkNotNull(appId, "Application ID cannot be null"); | 226 | + checkNotNull(appId, ERROR_NULL_APP_ID); |
227 | + checkNotNull(deviceId, ERROR_NULL_DEVICE_ID); | ||
228 | 228 | ||
229 | PacketRequest request = new DefaultPacketRequest(selector, priority, | 229 | PacketRequest request = new DefaultPacketRequest(selector, priority, |
230 | appId, localNodeId, | 230 | appId, localNodeId, | ... | ... |
-
Please register or login to post a comment