Yuta HIGUCHI
Committed by Gerrit Code Review

[ONOS-4513] Move optical Intent compilers out to optical-model (3/3)

- core/net is now optical clean
- reverting part of Change-Id: Ib8ddac6e93327ade9d42984d8eba66be7047d051
 which lead to loss of package import information, causing OSGi issue

Change-Id: Ie6b16abd3ecc872f0920d29c7577a10c44091af6
Showing 24 changed files with 167 additions and 72 deletions
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
46 </dependency> 46 </dependency>
47 47
48 <dependency> 48 <dependency>
49 + <groupId>org.osgi</groupId>
50 + <artifactId>org.osgi.compendium</artifactId>
51 + </dependency>
52 +
53 + <dependency>
49 <groupId>org.onosproject</groupId> 54 <groupId>org.onosproject</groupId>
50 <artifactId>onos-api</artifactId> 55 <artifactId>onos-api</artifactId>
51 <classifier>tests</classifier> 56 <classifier>tests</classifier>
...@@ -64,5 +69,10 @@ ...@@ -64,5 +69,10 @@
64 <scope>test</scope> 69 <scope>test</scope>
65 </dependency> 70 </dependency>
66 71
72 + <dependency>
73 + <groupId>org.easymock</groupId>
74 + <artifactId>easymock</artifactId>
75 + <scope>test</scope>
76 + </dependency>
67 </dependencies> 77 </dependencies>
68 </project> 78 </project>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import com.google.common.base.Strings; 18 import com.google.common.base.Strings;
19 19
...@@ -57,11 +57,9 @@ import org.onosproject.net.intent.IntentId; ...@@ -57,11 +57,9 @@ import org.onosproject.net.intent.IntentId;
57 import org.onosproject.net.intent.IntentService; 57 import org.onosproject.net.intent.IntentService;
58 import org.onosproject.net.intent.OpticalCircuitIntent; 58 import org.onosproject.net.intent.OpticalCircuitIntent;
59 import org.onosproject.net.intent.OpticalConnectivityIntent; 59 import org.onosproject.net.intent.OpticalConnectivityIntent;
60 -import org.onosproject.net.intent.impl.IntentCompilationException;
61 import org.onosproject.net.optical.OchPort; 60 import org.onosproject.net.optical.OchPort;
62 import org.onosproject.net.optical.OduCltPort; 61 import org.onosproject.net.optical.OduCltPort;
63 import org.onosproject.net.intent.IntentSetMultimap; 62 import org.onosproject.net.intent.IntentSetMultimap;
64 -import org.onosproject.net.intent.impl.ResourceHelper;
65 import org.onosproject.net.resource.ResourceAllocation; 63 import org.onosproject.net.resource.ResourceAllocation;
66 import org.onosproject.net.resource.Resource; 64 import org.onosproject.net.resource.Resource;
67 import org.onosproject.net.resource.ResourceService; 65 import org.onosproject.net.resource.ResourceService;
...@@ -193,7 +191,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu ...@@ -193,7 +191,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
193 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource(); 191 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
194 // If ports are not available, compilation fails 192 // If ports are not available, compilation fails
195 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) { 193 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
196 - throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent); 194 + throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
197 } 195 }
198 List<Resource> ports = ImmutableList.of(srcPortResource, dstPortResource); 196 List<Resource> ports = ImmutableList.of(srcPortResource, dstPortResource);
199 197
...@@ -237,7 +235,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu ...@@ -237,7 +235,7 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
237 Pair<OchPort, OchPort> ochPorts = findPorts(intent.getSrc(), intent.getDst(), intent.getSignalType()); 235 Pair<OchPort, OchPort> ochPorts = findPorts(intent.getSrc(), intent.getDst(), intent.getSignalType());
238 236
239 if (ochPorts == null) { 237 if (ochPorts == null) {
240 - throw new IntentCompilationException("Unable to find suitable OCH ports for intent " + intent); 238 + throw new OpticalIntentCompilationException("Unable to find suitable OCH ports for intent " + intent);
241 } 239 }
242 240
243 ConnectPoint srcCP = new ConnectPoint(src.elementId(), ochPorts.getLeft().number()); 241 ConnectPoint srcCP = new ConnectPoint(src.elementId(), ochPorts.getLeft().number());
...@@ -257,14 +255,14 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu ...@@ -257,14 +255,14 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu
257 } else { 255 } else {
258 List<Resource> slots = availableSlotResources(srcCP, dstCP, intent.getSignalType()); 256 List<Resource> slots = availableSlotResources(srcCP, dstCP, intent.getSignalType());
259 if (slots.isEmpty()) { 257 if (slots.isEmpty()) {
260 - throw new IntentCompilationException("Unable to find Tributary Slots for intent " + intent); 258 + throw new OpticalIntentCompilationException("Unable to find Tributary Slots for intent " + intent);
261 } 259 }
262 required = ImmutableList.<Resource>builder().addAll(resources).addAll(slots).build(); 260 required = ImmutableList.<Resource>builder().addAll(resources).addAll(slots).build();
263 } 261 }
264 } 262 }
265 263
266 if (resourceService.allocate(intent.id(), required).isEmpty()) { 264 if (resourceService.allocate(intent.id(), required).isEmpty()) {
267 - throw new IntentCompilationException("Unable to allocate resources for intent " + intent 265 + throw new OpticalIntentCompilationException("Unable to allocate resources for intent " + intent
268 + ": resources=" + required); 266 + ": resources=" + required);
269 } 267 }
270 268
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import com.google.common.collect.ImmutableList; 18 import com.google.common.collect.ImmutableList;
19 import com.google.common.collect.ImmutableSet; 19 import com.google.common.collect.ImmutableSet;
...@@ -41,7 +41,6 @@ import org.onosproject.net.intent.IntentCompiler; ...@@ -41,7 +41,6 @@ import org.onosproject.net.intent.IntentCompiler;
41 import org.onosproject.net.intent.IntentExtensionService; 41 import org.onosproject.net.intent.IntentExtensionService;
42 import org.onosproject.net.intent.OpticalConnectivityIntent; 42 import org.onosproject.net.intent.OpticalConnectivityIntent;
43 import org.onosproject.net.intent.OpticalPathIntent; 43 import org.onosproject.net.intent.OpticalPathIntent;
44 -import org.onosproject.net.intent.impl.IntentCompilationException;
45 import org.onosproject.net.optical.OchPort; 44 import org.onosproject.net.optical.OchPort;
46 import org.onosproject.net.resource.ResourceAllocation; 45 import org.onosproject.net.resource.ResourceAllocation;
47 import org.onosproject.net.resource.Resource; 46 import org.onosproject.net.resource.Resource;
...@@ -49,6 +48,7 @@ import org.onosproject.net.resource.ResourceService; ...@@ -49,6 +48,7 @@ import org.onosproject.net.resource.ResourceService;
49 import org.onosproject.net.resource.Resources; 48 import org.onosproject.net.resource.Resources;
50 import org.onosproject.net.topology.LinkWeight; 49 import org.onosproject.net.topology.LinkWeight;
51 import org.onosproject.net.topology.Topology; 50 import org.onosproject.net.topology.Topology;
51 +import org.onosproject.net.topology.TopologyEdge;
52 import org.onosproject.net.topology.TopologyService; 52 import org.onosproject.net.topology.TopologyService;
53 import org.slf4j.Logger; 53 import org.slf4j.Logger;
54 import org.slf4j.LoggerFactory; 54 import org.slf4j.LoggerFactory;
...@@ -121,7 +121,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -121,7 +121,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
121 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource(); 121 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
122 // If ports are not available, compilation fails 122 // If ports are not available, compilation fails
123 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) { 123 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
124 - throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent); 124 + throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
125 } 125 }
126 126
127 List<Resource> resources = new ArrayList<>(); 127 List<Resource> resources = new ArrayList<>();
...@@ -132,7 +132,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -132,7 +132,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
132 Set<Path> paths = getOpticalPaths(intent); 132 Set<Path> paths = getOpticalPaths(intent);
133 133
134 if (paths.isEmpty()) { 134 if (paths.isEmpty()) {
135 - throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent); 135 + throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
136 } 136 }
137 137
138 // Static or dynamic lambda allocation 138 // Static or dynamic lambda allocation
...@@ -178,7 +178,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -178,7 +178,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
178 OchSignal ochSignal = OchSignal.toFixedGrid(found.get().getValue(), ChannelSpacing.CHL_50GHZ); 178 OchSignal ochSignal = OchSignal.toFixedGrid(found.get().getValue(), ChannelSpacing.CHL_50GHZ);
179 return ImmutableList.of(createIntent(intent, found.get().getKey(), ochSignal)); 179 return ImmutableList.of(createIntent(intent, found.get().getKey(), ochSignal));
180 } else { 180 } else {
181 - throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent); 181 + throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
182 } 182 }
183 } 183 }
184 184
...@@ -204,7 +204,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -204,7 +204,7 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
204 List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources); 204 List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources);
205 if (allocations.isEmpty()) { 205 if (allocations.isEmpty()) {
206 log.info("Resource allocation for {} failed (resource request: {})", intent, resources); 206 log.info("Resource allocation for {} failed (resource request: {})", intent, resources);
207 - throw new IntentCompilationException("Unable to allocate resources: " + resources); 207 + throw new OpticalIntentCompilationException("Unable to allocate resources: " + resources);
208 } 208 }
209 } 209 }
210 210
...@@ -300,31 +300,35 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical ...@@ -300,31 +300,35 @@ public class OpticalConnectivityIntentCompiler implements IntentCompiler<Optical
300 private Set<Path> getOpticalPaths(OpticalConnectivityIntent intent) { 300 private Set<Path> getOpticalPaths(OpticalConnectivityIntent intent) {
301 // Route in WDM topology 301 // Route in WDM topology
302 Topology topology = topologyService.currentTopology(); 302 Topology topology = topologyService.currentTopology();
303 - LinkWeight weight = edge -> { 303 + LinkWeight weight = new LinkWeight() {
304 - // Disregard inactive or non-optical links 304 +
305 - if (edge.link().state() == Link.State.INACTIVE) { 305 + @Override
306 - return -1; 306 + public double weight(TopologyEdge edge) {
307 - } 307 + // Disregard inactive or non-optical links
308 - if (edge.link().type() != Link.Type.OPTICAL) { 308 + if (edge.link().state() == Link.State.INACTIVE) {
309 - return -1; 309 + return -1;
310 - }
311 - // Adhere to static port mappings
312 - DeviceId srcDeviceId = edge.link().src().deviceId();
313 - if (srcDeviceId.equals(intent.getSrc().deviceId())) {
314 - ConnectPoint srcStaticPort = staticPort(intent.getSrc());
315 - if (srcStaticPort != null) {
316 - return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
317 } 310 }
318 - } 311 + if (edge.link().type() != Link.Type.OPTICAL) {
319 - DeviceId dstDeviceId = edge.link().dst().deviceId(); 312 + return -1;
320 - if (dstDeviceId.equals(intent.getDst().deviceId())) { 313 + }
321 - ConnectPoint dstStaticPort = staticPort(intent.getDst()); 314 + // Adhere to static port mappings
322 - if (dstStaticPort != null) { 315 + DeviceId srcDeviceId = edge.link().src().deviceId();
323 - return dstStaticPort.equals(edge.link().dst()) ? 1 : -1; 316 + if (srcDeviceId.equals(intent.getSrc().deviceId())) {
317 + ConnectPoint srcStaticPort = staticPort(intent.getSrc());
318 + if (srcStaticPort != null) {
319 + return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
320 + }
321 + }
322 + DeviceId dstDeviceId = edge.link().dst().deviceId();
323 + if (dstDeviceId.equals(intent.getDst().deviceId())) {
324 + ConnectPoint dstStaticPort = staticPort(intent.getDst());
325 + if (dstStaticPort != null) {
326 + return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
327 + }
324 } 328 }
325 - }
326 329
327 - return 1; 330 + return 1;
331 + }
328 }; 332 };
329 333
330 ConnectPoint start = intent.getSrc(); 334 ConnectPoint start = intent.getSrc();
......
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.net.optical.intent.impl.compiler;
17 +
18 +import org.onosproject.net.intent.IntentCompilationException;
19 +
20 +/**
21 + * An exception thrown when an optical intent compilation fails.
22 + */
23 +public class OpticalIntentCompilationException extends IntentCompilationException {
24 +
25 + private static final long serialVersionUID = 2538096696847181373L;
26 +
27 + public OpticalIntentCompilationException() {
28 + super();
29 + }
30 +
31 + public OpticalIntentCompilationException(String message) {
32 + super(message);
33 + }
34 +
35 + public OpticalIntentCompilationException(String message, Throwable cause) {
36 + super(message, cause);
37 + }
38 +}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 18
19 import org.apache.felix.scr.annotations.Activate; 19 import org.apache.felix.scr.annotations.Activate;
...@@ -47,7 +47,6 @@ import org.onosproject.net.intent.Intent; ...@@ -47,7 +47,6 @@ import org.onosproject.net.intent.Intent;
47 import org.onosproject.net.intent.IntentCompiler; 47 import org.onosproject.net.intent.IntentCompiler;
48 import org.onosproject.net.intent.IntentExtensionService; 48 import org.onosproject.net.intent.IntentExtensionService;
49 import org.onosproject.net.intent.OpticalOduIntent; 49 import org.onosproject.net.intent.OpticalOduIntent;
50 -import org.onosproject.net.intent.impl.IntentCompilationException;
51 import org.onosproject.net.optical.OduCltPort; 50 import org.onosproject.net.optical.OduCltPort;
52 import org.onosproject.net.optical.OtuPort; 51 import org.onosproject.net.optical.OtuPort;
53 import org.onosproject.net.resource.Resource; 52 import org.onosproject.net.resource.Resource;
...@@ -138,7 +137,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent ...@@ -138,7 +137,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent
138 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource(); 137 Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
139 // If ports are not available, compilation fails 138 // If ports are not available, compilation fails
140 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) { 139 if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
141 - throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent); 140 + throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
142 } 141 }
143 List<Resource> intentResources = new ArrayList<>(); 142 List<Resource> intentResources = new ArrayList<>();
144 intentResources.add(srcPortResource); 143 intentResources.add(srcPortResource);
...@@ -148,7 +147,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent ...@@ -148,7 +147,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent
148 Set<Path> paths = getOpticalPaths(intent); 147 Set<Path> paths = getOpticalPaths(intent);
149 148
150 if (paths.isEmpty()) { 149 if (paths.isEmpty()) {
151 - throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent); 150 + throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
152 } 151 }
153 152
154 // Use first path that can be successfully reserved 153 // Use first path that can be successfully reserved
...@@ -180,7 +179,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent ...@@ -180,7 +179,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent
180 rules, ImmutableSet.copyOf(path.links()))); 179 rules, ImmutableSet.copyOf(path.links())));
181 } 180 }
182 181
183 - throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent); 182 + throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
184 } 183 }
185 184
186 /** 185 /**
...@@ -219,7 +218,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent ...@@ -219,7 +218,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent
219 List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources); 218 List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources);
220 if (allocations.isEmpty()) { 219 if (allocations.isEmpty()) {
221 log.info("Resource allocation for {} failed (resource request: {})", intent, resources); 220 log.info("Resource allocation for {} failed (resource request: {})", intent, resources);
222 - throw new IntentCompilationException("Unable to allocate resources: " + resources); 221 + throw new OpticalIntentCompilationException("Unable to allocate resources: " + resources);
223 } 222 }
224 } 223 }
225 224
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import com.google.common.collect.Lists; 18 import com.google.common.collect.Lists;
19 import org.apache.felix.scr.annotations.Activate; 19 import org.apache.felix.scr.annotations.Activate;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package org.onosproject.net.intent.impl; 17 +package org.onosproject.net.optical.intent.impl.compiler;
18 18
19 import com.google.common.annotations.Beta; 19 import com.google.common.annotations.Beta;
20 import org.onosproject.net.intent.IntentId; 20 import org.onosproject.net.intent.IntentId;
...@@ -24,6 +24,7 @@ import java.util.Optional; ...@@ -24,6 +24,7 @@ import java.util.Optional;
24 24
25 import static com.google.common.base.Preconditions.checkNotNull; 25 import static com.google.common.base.Preconditions.checkNotNull;
26 26
27 +// TODO consider moving this to api bundle.
27 /** 28 /**
28 * Helper class for ResourceService related processes. 29 * Helper class for ResourceService related processes.
29 */ 30 */
......
1 +/*
2 + * Copyright 2016-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/**
18 + * Implementations of optical intent compilers.
19 + */
20 +package org.onosproject.net.optical.intent.impl.compiler;
...\ No newline at end of file ...\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import org.easymock.EasyMock; 18 import org.easymock.EasyMock;
19 import org.junit.After; 19 import org.junit.After;
...@@ -63,6 +63,7 @@ import org.onosproject.net.optical.OduCltPort; ...@@ -63,6 +63,7 @@ import org.onosproject.net.optical.OduCltPort;
63 import org.onosproject.net.optical.impl.DefaultOchPort; 63 import org.onosproject.net.optical.impl.DefaultOchPort;
64 import org.onosproject.net.optical.impl.DefaultOduCltPort; 64 import org.onosproject.net.optical.impl.DefaultOduCltPort;
65 import org.onosproject.net.provider.ProviderId; 65 import org.onosproject.net.provider.ProviderId;
66 +import org.onosproject.net.resource.MockResourceService;
66 import org.onosproject.net.intent.IntentSetMultimap; 67 import org.onosproject.net.intent.IntentSetMultimap;
67 import org.onosproject.net.behaviour.TributarySlotQuery; 68 import org.onosproject.net.behaviour.TributarySlotQuery;
68 import org.onosproject.net.device.DeviceServiceAdapter; 69 import org.onosproject.net.device.DeviceServiceAdapter;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import org.junit.After; 18 import org.junit.After;
19 import org.junit.Before; 19 import org.junit.Before;
...@@ -61,6 +61,7 @@ import org.onosproject.net.optical.OtuPort; ...@@ -61,6 +61,7 @@ import org.onosproject.net.optical.OtuPort;
61 import org.onosproject.net.optical.impl.DefaultOduCltPort; 61 import org.onosproject.net.optical.impl.DefaultOduCltPort;
62 import org.onosproject.net.optical.impl.DefaultOtuPort; 62 import org.onosproject.net.optical.impl.DefaultOtuPort;
63 import org.onosproject.net.provider.ProviderId; 63 import org.onosproject.net.provider.ProviderId;
64 +import org.onosproject.net.resource.MockResourceService;
64 import org.onosproject.net.topology.LinkWeight; 65 import org.onosproject.net.topology.LinkWeight;
65 import org.onosproject.net.topology.Topology; 66 import org.onosproject.net.topology.Topology;
66 import org.onosproject.net.topology.TopologyServiceAdapter; 67 import org.onosproject.net.topology.TopologyServiceAdapter;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.optical.intent.impl.compiler;
17 17
18 import org.junit.After; 18 import org.junit.After;
19 import org.junit.Before; 19 import org.junit.Before;
......
1 +/*
2 + * Copyright 2014-present Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.net.intent;
17 +
18 +/**
19 + * An exception thrown when a intent compilation fails.
20 + */
21 +public class IntentCompilationException extends IntentException {
22 +
23 + private static final long serialVersionUID = 2439094479018639853L;
24 +
25 + public IntentCompilationException() {
26 + super();
27 + }
28 +
29 + public IntentCompilationException(String message) {
30 + super(message);
31 + }
32 +
33 + public IntentCompilationException(String message, Throwable cause) {
34 + super(message, cause);
35 + }
36 +}
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.net.intent.impl.compiler; 16 +package org.onosproject.net.resource;
17 17
18 import com.google.common.collect.ImmutableList; 18 import com.google.common.collect.ImmutableList;
19 import com.google.common.collect.ImmutableSet; 19 import com.google.common.collect.ImmutableSet;
...@@ -22,16 +22,6 @@ import org.onlab.packet.MplsLabel; ...@@ -22,16 +22,6 @@ import org.onlab.packet.MplsLabel;
22 import org.onlab.packet.VlanId; 22 import org.onlab.packet.VlanId;
23 import org.onlab.util.Tools; 23 import org.onlab.util.Tools;
24 import org.onosproject.net.TributarySlot; 24 import org.onosproject.net.TributarySlot;
25 -import org.onosproject.net.resource.ContinuousResourceId;
26 -import org.onosproject.net.resource.DiscreteResource;
27 -import org.onosproject.net.resource.DiscreteResourceId;
28 -import org.onosproject.net.resource.ResourceAllocation;
29 -import org.onosproject.net.resource.ResourceConsumer;
30 -import org.onosproject.net.resource.ResourceId;
31 -import org.onosproject.net.resource.ResourceListener;
32 -import org.onosproject.net.resource.Resource;
33 -import org.onosproject.net.resource.ResourceService;
34 -import org.onosproject.net.resource.Resources;
35 25
36 import java.util.Collection; 26 import java.util.Collection;
37 import java.util.HashMap; 27 import java.util.HashMap;
...@@ -43,7 +33,7 @@ import java.util.Set; ...@@ -43,7 +33,7 @@ import java.util.Set;
43 import java.util.function.Function; 33 import java.util.function.Function;
44 import java.util.stream.Collectors; 34 import java.util.stream.Collectors;
45 35
46 -class MockResourceService implements ResourceService { 36 +public class MockResourceService implements ResourceService {
47 37
48 private final Map<Resource, ResourceConsumer> assignment = new HashMap<>(); 38 private final Map<Resource, ResourceConsumer> assignment = new HashMap<>();
49 39
......
...@@ -4,8 +4,6 @@ COMPILE_DEPS = [ ...@@ -4,8 +4,6 @@ COMPILE_DEPS = [
4 '//utils/rest:onlab-rest', 4 '//utils/rest:onlab-rest',
5 '//incubator/net:onos-incubator-net', 5 '//incubator/net:onos-incubator-net',
6 '//incubator/store:onos-incubator-store', 6 '//incubator/store:onos-incubator-store',
7 - # TODO Remove after decoupling optical
8 - '//apps/optical-model:onos-apps-optical-model',
9 ] 7 ]
10 8
11 TEST_DEPS = [ 9 TEST_DEPS = [
......
...@@ -104,14 +104,6 @@ ...@@ -104,14 +104,6 @@
104 <artifactId>onos-incubator-api</artifactId> 104 <artifactId>onos-incubator-api</artifactId>
105 </dependency> 105 </dependency>
106 106
107 - <!-- TODO Remove after decoupling optical -->
108 - <!-- - OpticalCompilers x4 -->
109 - <dependency>
110 - <groupId>org.onosproject</groupId>
111 - <artifactId>onos-optical-model</artifactId>
112 - <version>${project.version}</version>
113 - </dependency>
114 -
115 <dependency> 107 <dependency>
116 <groupId>org.apache.karaf.features</groupId> 108 <groupId>org.apache.karaf.features</groupId>
117 <artifactId>org.apache.karaf.features.core</artifactId> 109 <artifactId>org.apache.karaf.features.core</artifactId>
......
...@@ -19,7 +19,10 @@ import org.onosproject.net.intent.IntentException; ...@@ -19,7 +19,10 @@ import org.onosproject.net.intent.IntentException;
19 19
20 /** 20 /**
21 * An exception thrown when a intent compilation fails. 21 * An exception thrown when a intent compilation fails.
22 + *
23 + * @deprecated in in Hummingbird (1.6.0) use {@link org.onosproject.net.intent.IntentCompilationException} instead.
22 */ 24 */
25 +@Deprecated
23 public class IntentCompilationException extends IntentException { 26 public class IntentCompilationException extends IntentException {
24 private static final long serialVersionUID = 235237603018210810L; 27 private static final long serialVersionUID = 235237603018210810L;
25 28
......
...@@ -52,9 +52,9 @@ import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6Fl ...@@ -52,9 +52,9 @@ import org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6Fl
52 import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction; 52 import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
53 import org.onosproject.net.intent.FlowRuleIntent; 53 import org.onosproject.net.intent.FlowRuleIntent;
54 import org.onosproject.net.intent.Intent; 54 import org.onosproject.net.intent.Intent;
55 +import org.onosproject.net.intent.IntentCompilationException;
55 import org.onosproject.net.intent.IntentCompiler; 56 import org.onosproject.net.intent.IntentCompiler;
56 import org.onosproject.net.intent.LinkCollectionIntent; 57 import org.onosproject.net.intent.LinkCollectionIntent;
57 -import org.onosproject.net.intent.impl.IntentCompilationException;
58 58
59 import java.util.ArrayList; 59 import java.util.ArrayList;
60 import java.util.Collections; 60 import java.util.Collections;
......
...@@ -37,9 +37,9 @@ import org.onosproject.net.flow.criteria.MplsCriterion; ...@@ -37,9 +37,9 @@ import org.onosproject.net.flow.criteria.MplsCriterion;
37 import org.onosproject.net.flow.criteria.VlanIdCriterion; 37 import org.onosproject.net.flow.criteria.VlanIdCriterion;
38 import org.onosproject.net.flow.instructions.Instruction; 38 import org.onosproject.net.flow.instructions.Instruction;
39 import org.onosproject.net.flow.instructions.L2ModificationInstruction; 39 import org.onosproject.net.flow.instructions.L2ModificationInstruction;
40 +import org.onosproject.net.intent.IntentCompilationException;
40 import org.onosproject.net.intent.PathIntent; 41 import org.onosproject.net.intent.PathIntent;
41 import org.onosproject.net.intent.constraint.EncapsulationConstraint; 42 import org.onosproject.net.intent.constraint.EncapsulationConstraint;
42 -import org.onosproject.net.intent.impl.IntentCompilationException;
43 import org.onosproject.net.resource.Resource; 43 import org.onosproject.net.resource.Resource;
44 import org.onosproject.net.resource.ResourceAllocation; 44 import org.onosproject.net.resource.ResourceAllocation;
45 import org.onosproject.net.resource.ResourceService; 45 import org.onosproject.net.resource.ResourceService;
......
...@@ -34,10 +34,10 @@ import org.onosproject.net.ConnectPoint; ...@@ -34,10 +34,10 @@ import org.onosproject.net.ConnectPoint;
34 import org.onosproject.net.Link; 34 import org.onosproject.net.Link;
35 import org.onosproject.net.Path; 35 import org.onosproject.net.Path;
36 import org.onosproject.net.intent.Intent; 36 import org.onosproject.net.intent.Intent;
37 +import org.onosproject.net.intent.IntentCompilationException;
37 import org.onosproject.net.intent.IntentService; 38 import org.onosproject.net.intent.IntentService;
38 import org.onosproject.net.intent.Key; 39 import org.onosproject.net.intent.Key;
39 import org.onosproject.net.intent.PointToPointIntent; 40 import org.onosproject.net.intent.PointToPointIntent;
40 -import org.onosproject.net.intent.impl.IntentCompilationException;
41 import org.onosproject.net.topology.TopologyService; 41 import org.onosproject.net.topology.TopologyService;
42 import org.slf4j.Logger; 42 import org.slf4j.Logger;
43 43
......
...@@ -35,6 +35,7 @@ import org.onosproject.core.impl.TestCoreManager; ...@@ -35,6 +35,7 @@ import org.onosproject.core.impl.TestCoreManager;
35 import org.onosproject.net.NetworkResource; 35 import org.onosproject.net.NetworkResource;
36 import org.onosproject.net.intent.FlowRuleIntent; 36 import org.onosproject.net.intent.FlowRuleIntent;
37 import org.onosproject.net.intent.Intent; 37 import org.onosproject.net.intent.Intent;
38 +import org.onosproject.net.intent.IntentCompilationException;
38 import org.onosproject.net.intent.IntentCompiler; 39 import org.onosproject.net.intent.IntentCompiler;
39 import org.onosproject.net.intent.IntentData; 40 import org.onosproject.net.intent.IntentData;
40 import org.onosproject.net.intent.IntentEvent; 41 import org.onosproject.net.intent.IntentEvent;
......
...@@ -30,6 +30,7 @@ import org.onosproject.net.intent.HostToHostIntent; ...@@ -30,6 +30,7 @@ import org.onosproject.net.intent.HostToHostIntent;
30 import org.onosproject.net.intent.Intent; 30 import org.onosproject.net.intent.Intent;
31 import org.onosproject.net.intent.IntentTestsMocks; 31 import org.onosproject.net.intent.IntentTestsMocks;
32 import org.onosproject.net.intent.PathIntent; 32 import org.onosproject.net.intent.PathIntent;
33 +import org.onosproject.net.resource.MockResourceService;
33 import org.onlab.packet.MacAddress; 34 import org.onlab.packet.MacAddress;
34 import org.onlab.packet.VlanId; 35 import org.onlab.packet.VlanId;
35 36
......
...@@ -43,6 +43,7 @@ import org.onosproject.net.intent.Intent; ...@@ -43,6 +43,7 @@ import org.onosproject.net.intent.Intent;
43 import org.onosproject.net.intent.IntentExtensionService; 43 import org.onosproject.net.intent.IntentExtensionService;
44 import org.onosproject.net.intent.MockIdGenerator; 44 import org.onosproject.net.intent.MockIdGenerator;
45 import org.onosproject.net.intent.MplsPathIntent; 45 import org.onosproject.net.intent.MplsPathIntent;
46 +import org.onosproject.net.resource.MockResourceService;
46 47
47 import static org.easymock.EasyMock.createMock; 48 import static org.easymock.EasyMock.createMock;
48 import static org.easymock.EasyMock.expect; 49 import static org.easymock.EasyMock.expect;
......
...@@ -47,6 +47,7 @@ import org.onosproject.net.intent.MockIdGenerator; ...@@ -47,6 +47,7 @@ import org.onosproject.net.intent.MockIdGenerator;
47 import org.onosproject.net.intent.PathIntent; 47 import org.onosproject.net.intent.PathIntent;
48 import org.onosproject.net.intent.constraint.EncapsulationConstraint; 48 import org.onosproject.net.intent.constraint.EncapsulationConstraint;
49 import org.onosproject.net.provider.ProviderId; 49 import org.onosproject.net.provider.ProviderId;
50 +import org.onosproject.net.resource.MockResourceService;
50 51
51 import java.util.Arrays; 52 import java.util.Arrays;
52 import java.util.Collection; 53 import java.util.Collection;
......
...@@ -31,11 +31,11 @@ import org.onosproject.net.flow.DefaultTrafficTreatment; ...@@ -31,11 +31,11 @@ import org.onosproject.net.flow.DefaultTrafficTreatment;
31 import org.onosproject.net.flow.TrafficSelector; 31 import org.onosproject.net.flow.TrafficSelector;
32 import org.onosproject.net.flow.TrafficTreatment; 32 import org.onosproject.net.flow.TrafficTreatment;
33 import org.onosproject.net.intent.Intent; 33 import org.onosproject.net.intent.Intent;
34 +import org.onosproject.net.intent.IntentCompilationException;
34 import org.onosproject.net.intent.IntentData; 35 import org.onosproject.net.intent.IntentData;
35 import org.onosproject.net.intent.MockIdGenerator; 36 import org.onosproject.net.intent.MockIdGenerator;
36 import org.onosproject.net.intent.PathIntent; 37 import org.onosproject.net.intent.PathIntent;
37 import org.onosproject.net.intent.PointToPointIntent; 38 import org.onosproject.net.intent.PointToPointIntent;
38 -import org.onosproject.net.intent.impl.IntentCompilationException;
39 import org.onosproject.net.intent.impl.IntentProcessor; 39 import org.onosproject.net.intent.impl.IntentProcessor;
40 import org.onosproject.net.provider.ProviderId; 40 import org.onosproject.net.provider.ProviderId;
41 import org.onosproject.store.Timestamp; 41 import org.onosproject.store.Timestamp;
......