[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
diff --git a/apps/optical-model/pom.xml b/apps/optical-model/pom.xml
index a76d0d7..c5bb627 100644
--- a/apps/optical-model/pom.xml
+++ b/apps/optical-model/pom.xml
@@ -46,6 +46,11 @@
         </dependency>
 
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>onos-api</artifactId>
             <classifier>tests</classifier>
@@ -64,5 +69,10 @@
             <scope>test</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
similarity index 97%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
rename to apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index b598b73..dbe1ec5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import com.google.common.base.Strings;
 
@@ -57,11 +57,9 @@
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.OpticalCircuitIntent;
 import org.onosproject.net.intent.OpticalConnectivityIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.optical.OchPort;
 import org.onosproject.net.optical.OduCltPort;
 import org.onosproject.net.intent.IntentSetMultimap;
-import org.onosproject.net.intent.impl.ResourceHelper;
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.Resource;
 import org.onosproject.net.resource.ResourceService;
@@ -193,7 +191,7 @@
         Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
         // If ports are not available, compilation fails
         if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
-            throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent);
+            throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
         }
         List<Resource> ports = ImmutableList.of(srcPortResource, dstPortResource);
 
@@ -237,7 +235,7 @@
             Pair<OchPort, OchPort> ochPorts = findPorts(intent.getSrc(), intent.getDst(), intent.getSignalType());
 
             if (ochPorts == null) {
-                throw new IntentCompilationException("Unable to find suitable OCH ports for intent " + intent);
+                throw new OpticalIntentCompilationException("Unable to find suitable OCH ports for intent " + intent);
             }
 
             ConnectPoint srcCP = new ConnectPoint(src.elementId(), ochPorts.getLeft().number());
@@ -257,14 +255,14 @@
             } else {
                 List<Resource> slots = availableSlotResources(srcCP, dstCP, intent.getSignalType());
                 if (slots.isEmpty()) {
-                    throw new IntentCompilationException("Unable to find Tributary Slots for intent " + intent);
+                    throw new OpticalIntentCompilationException("Unable to find Tributary Slots for intent " + intent);
                 }
                 required = ImmutableList.<Resource>builder().addAll(resources).addAll(slots).build();
             }
         }
 
         if (resourceService.allocate(intent.id(), required).isEmpty()) {
-            throw new IntentCompilationException("Unable to allocate resources for intent " + intent
+            throw new OpticalIntentCompilationException("Unable to allocate resources for intent " + intent
                     + ": resources=" + required);
         }
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
similarity index 87%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
rename to apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index b1ca006..3de7aa0 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
@@ -41,7 +41,6 @@
 import org.onosproject.net.intent.IntentExtensionService;
 import org.onosproject.net.intent.OpticalConnectivityIntent;
 import org.onosproject.net.intent.OpticalPathIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.optical.OchPort;
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.Resource;
@@ -49,6 +48,7 @@
 import org.onosproject.net.resource.Resources;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.Topology;
+import org.onosproject.net.topology.TopologyEdge;
 import org.onosproject.net.topology.TopologyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -121,7 +121,7 @@
         Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
         // If ports are not available, compilation fails
         if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
-            throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent);
+            throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
         }
 
         List<Resource> resources = new ArrayList<>();
@@ -132,7 +132,7 @@
         Set<Path> paths = getOpticalPaths(intent);
 
         if (paths.isEmpty()) {
-            throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent);
+            throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
         }
 
         // Static or dynamic lambda allocation
@@ -178,7 +178,7 @@
             OchSignal ochSignal = OchSignal.toFixedGrid(found.get().getValue(), ChannelSpacing.CHL_50GHZ);
             return ImmutableList.of(createIntent(intent, found.get().getKey(), ochSignal));
         } else {
-            throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent);
+            throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
         }
     }
 
@@ -204,7 +204,7 @@
         List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources);
         if (allocations.isEmpty()) {
             log.info("Resource allocation for {} failed (resource request: {})", intent, resources);
-            throw new IntentCompilationException("Unable to allocate resources: " + resources);
+            throw new OpticalIntentCompilationException("Unable to allocate resources: " + resources);
         }
     }
 
@@ -300,31 +300,35 @@
     private Set<Path> getOpticalPaths(OpticalConnectivityIntent intent) {
         // Route in WDM topology
         Topology topology = topologyService.currentTopology();
-        LinkWeight weight = edge -> {
-            // Disregard inactive or non-optical links
-            if (edge.link().state() == Link.State.INACTIVE) {
-                return -1;
-            }
-            if (edge.link().type() != Link.Type.OPTICAL) {
-                return -1;
-            }
-            // Adhere to static port mappings
-            DeviceId srcDeviceId = edge.link().src().deviceId();
-            if (srcDeviceId.equals(intent.getSrc().deviceId())) {
-                ConnectPoint srcStaticPort = staticPort(intent.getSrc());
-                if (srcStaticPort != null) {
-                    return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
-                }
-            }
-            DeviceId dstDeviceId = edge.link().dst().deviceId();
-            if (dstDeviceId.equals(intent.getDst().deviceId())) {
-                ConnectPoint dstStaticPort = staticPort(intent.getDst());
-                if (dstStaticPort != null) {
-                    return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
-                }
-            }
+        LinkWeight weight = new LinkWeight() {
 
-            return 1;
+            @Override
+            public double weight(TopologyEdge edge) {
+                // Disregard inactive or non-optical links
+                if (edge.link().state() == Link.State.INACTIVE) {
+                    return -1;
+                }
+                if (edge.link().type() != Link.Type.OPTICAL) {
+                    return -1;
+                }
+                // Adhere to static port mappings
+                DeviceId srcDeviceId = edge.link().src().deviceId();
+                if (srcDeviceId.equals(intent.getSrc().deviceId())) {
+                    ConnectPoint srcStaticPort = staticPort(intent.getSrc());
+                    if (srcStaticPort != null) {
+                        return srcStaticPort.equals(edge.link().src()) ? 1 : -1;
+                    }
+                }
+                DeviceId dstDeviceId = edge.link().dst().deviceId();
+                if (dstDeviceId.equals(intent.getDst().deviceId())) {
+                    ConnectPoint dstStaticPort = staticPort(intent.getDst());
+                    if (dstStaticPort != null) {
+                        return dstStaticPort.equals(edge.link().dst()) ? 1 : -1;
+                    }
+                }
+
+                return 1;
+            }
         };
 
         ConnectPoint start = intent.getSrc();
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalIntentCompilationException.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalIntentCompilationException.java
new file mode 100644
index 0000000..9070b25
--- /dev/null
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalIntentCompilationException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.optical.intent.impl.compiler;
+
+import org.onosproject.net.intent.IntentCompilationException;
+
+/**
+ * An exception thrown when an optical intent compilation fails.
+ */
+public class OpticalIntentCompilationException extends IntentCompilationException {
+
+    private static final long serialVersionUID = 2538096696847181373L;
+
+    public OpticalIntentCompilationException() {
+        super();
+    }
+
+    public OpticalIntentCompilationException(String message) {
+        super(message);
+    }
+
+    public OpticalIntentCompilationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
similarity index 96%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompiler.java
rename to apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
index d89cf1e..2da9a40 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompiler.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 
 import org.apache.felix.scr.annotations.Activate;
@@ -47,7 +47,6 @@
 import org.onosproject.net.intent.IntentCompiler;
 import org.onosproject.net.intent.IntentExtensionService;
 import org.onosproject.net.intent.OpticalOduIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.optical.OduCltPort;
 import org.onosproject.net.optical.OtuPort;
 import org.onosproject.net.resource.Resource;
@@ -138,7 +137,7 @@
         Resource dstPortResource = Resources.discrete(dst.deviceId(), dst.port()).resource();
         // If ports are not available, compilation fails
         if (!Stream.of(srcPortResource, dstPortResource).allMatch(resourceService::isAvailable)) {
-            throw new IntentCompilationException("Ports for the intent are not available. Intent: " + intent);
+            throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
         }
         List<Resource> intentResources = new ArrayList<>();
         intentResources.add(srcPortResource);
@@ -148,7 +147,7 @@
         Set<Path> paths = getOpticalPaths(intent);
 
         if (paths.isEmpty()) {
-            throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent);
+            throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
         }
 
         // Use first path that can be successfully reserved
@@ -180,7 +179,7 @@
                     rules, ImmutableSet.copyOf(path.links())));
         }
 
-        throw new IntentCompilationException("Unable to find suitable lightpath for intent " + intent);
+        throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
     }
 
     /**
@@ -219,7 +218,7 @@
         List<ResourceAllocation> allocations = resourceService.allocate(intent.id(), resources);
         if (allocations.isEmpty()) {
             log.info("Resource allocation for {} failed (resource request: {})", intent, resources);
-            throw new IntentCompilationException("Unable to allocate resources: " + resources);
+            throw new OpticalIntentCompilationException("Unable to allocate resources: " + resources);
         }
     }
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompiler.java
similarity index 98%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
rename to apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompiler.java
index afb6e1e..3136204 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompiler.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import com.google.common.collect.Lists;
 import org.apache.felix.scr.annotations.Activate;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ResourceHelper.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/ResourceHelper.java
similarity index 93%
rename from core/net/src/main/java/org/onosproject/net/intent/impl/ResourceHelper.java
rename to apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/ResourceHelper.java
index 525d09e..4d1a8d1 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ResourceHelper.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/ResourceHelper.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.onosproject.net.intent.impl;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import com.google.common.annotations.Beta;
 import org.onosproject.net.intent.IntentId;
@@ -24,6 +24,7 @@
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+// TODO consider moving this to api bundle.
 /**
  * Helper class for ResourceService related processes.
  */
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/package-info.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/package-info.java
new file mode 100644
index 0000000..7f3011b
--- /dev/null
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implementations of optical intent compilers.
+ */
+package org.onosproject.net.optical.intent.impl.compiler;
\ No newline at end of file
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
similarity index 99%
rename from core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
rename to apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
index 1ec1192..353925e 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
+++ b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompilerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import org.easymock.EasyMock;
 import org.junit.After;
@@ -63,6 +63,7 @@
 import org.onosproject.net.optical.impl.DefaultOchPort;
 import org.onosproject.net.optical.impl.DefaultOduCltPort;
 import org.onosproject.net.provider.ProviderId;
+import org.onosproject.net.resource.MockResourceService;
 import org.onosproject.net.intent.IntentSetMultimap;
 import org.onosproject.net.behaviour.TributarySlotQuery;
 import org.onosproject.net.device.DeviceServiceAdapter;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompilerTest.java b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompilerTest.java
similarity index 98%
rename from core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompilerTest.java
rename to apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompilerTest.java
index a6ba3fe..810e897 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalOduIntentCompilerTest.java
+++ b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalOduIntentCompilerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import org.junit.After;
 import org.junit.Before;
@@ -61,6 +61,7 @@
 import org.onosproject.net.optical.impl.DefaultOduCltPort;
 import org.onosproject.net.optical.impl.DefaultOtuPort;
 import org.onosproject.net.provider.ProviderId;
+import org.onosproject.net.resource.MockResourceService;
 import org.onosproject.net.topology.LinkWeight;
 import org.onosproject.net.topology.Topology;
 import org.onosproject.net.topology.TopologyServiceAdapter;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompilerTest.java
similarity index 98%
rename from core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java
rename to apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompilerTest.java
index d2a388f..0a7d8f8 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/OpticalPathIntentCompilerTest.java
+++ b/apps/optical-model/src/test/java/org/onosproject/net/optical/intent/impl/compiler/OpticalPathIntentCompilerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.optical.intent.impl.compiler;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentCompilationException.java b/core/api/src/main/java/org/onosproject/net/intent/IntentCompilationException.java
new file mode 100644
index 0000000..bca5739
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentCompilationException.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.intent;
+
+/**
+ * An exception thrown when a intent compilation fails.
+ */
+public class IntentCompilationException extends IntentException {
+
+    private static final long serialVersionUID = 2439094479018639853L;
+
+    public IntentCompilationException() {
+        super();
+    }
+
+    public IntentCompilationException(String message) {
+        super(message);
+    }
+
+    public IntentCompilationException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MockResourceService.java b/core/api/src/test/java/org/onosproject/net/resource/MockResourceService.java
similarity index 90%
rename from core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MockResourceService.java
rename to core/api/src/test/java/org/onosproject/net/resource/MockResourceService.java
index 9da412e..f5f884b 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MockResourceService.java
+++ b/core/api/src/test/java/org/onosproject/net/resource/MockResourceService.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.onosproject.net.intent.impl.compiler;
+package org.onosproject.net.resource;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
@@ -22,16 +22,6 @@
 import org.onlab.packet.VlanId;
 import org.onlab.util.Tools;
 import org.onosproject.net.TributarySlot;
-import org.onosproject.net.resource.ContinuousResourceId;
-import org.onosproject.net.resource.DiscreteResource;
-import org.onosproject.net.resource.DiscreteResourceId;
-import org.onosproject.net.resource.ResourceAllocation;
-import org.onosproject.net.resource.ResourceConsumer;
-import org.onosproject.net.resource.ResourceId;
-import org.onosproject.net.resource.ResourceListener;
-import org.onosproject.net.resource.Resource;
-import org.onosproject.net.resource.ResourceService;
-import org.onosproject.net.resource.Resources;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -43,7 +33,7 @@
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
-class MockResourceService implements ResourceService {
+public class MockResourceService implements ResourceService {
 
     private final Map<Resource, ResourceConsumer> assignment = new HashMap<>();
 
diff --git a/core/net/BUCK b/core/net/BUCK
index 25db0df..73bbe7d 100644
--- a/core/net/BUCK
+++ b/core/net/BUCK
@@ -4,8 +4,6 @@
     '//utils/rest:onlab-rest',
     '//incubator/net:onos-incubator-net',
     '//incubator/store:onos-incubator-store',
-    # TODO Remove after decoupling optical
-    '//apps/optical-model:onos-apps-optical-model',
 ]
 
 TEST_DEPS = [
diff --git a/core/net/pom.xml b/core/net/pom.xml
index 32b4ab5..1d3650b 100644
--- a/core/net/pom.xml
+++ b/core/net/pom.xml
@@ -104,14 +104,6 @@
             <artifactId>onos-incubator-api</artifactId>
         </dependency>
 
-        <!-- TODO Remove after decoupling optical -->
-        <!-- - OpticalCompilers x4 -->
-        <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-optical-model</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
         <dependency>
             <groupId>org.apache.karaf.features</groupId>
             <artifactId>org.apache.karaf.features.core</artifactId>
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCompilationException.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCompilationException.java
index d5d1bce..0fdface 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCompilationException.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCompilationException.java
@@ -19,7 +19,10 @@
 
 /**
  * An exception thrown when a intent compilation fails.
+ *
+ * @deprecated in in Hummingbird (1.6.0) use {@link org.onosproject.net.intent.IntentCompilationException} instead.
  */
+@Deprecated
 public class IntentCompilationException extends IntentException {
     private static final long serialVersionUID = 235237603018210810L;
 
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
index 9fd7b12..5dda4ee 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/LinkCollectionIntentCompiler.java
@@ -52,9 +52,9 @@
 import org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction;
 import org.onosproject.net.intent.FlowRuleIntent;
 import org.onosproject.net.intent.Intent;
+import org.onosproject.net.intent.IntentCompilationException;
 import org.onosproject.net.intent.IntentCompiler;
 import org.onosproject.net.intent.LinkCollectionIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 
 import java.util.ArrayList;
 import java.util.Collections;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
index 69faaae..b831fef 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
@@ -37,9 +37,9 @@
 import org.onosproject.net.flow.criteria.VlanIdCriterion;
 import org.onosproject.net.flow.instructions.Instruction;
 import org.onosproject.net.flow.instructions.L2ModificationInstruction;
+import org.onosproject.net.intent.IntentCompilationException;
 import org.onosproject.net.intent.PathIntent;
 import org.onosproject.net.intent.constraint.EncapsulationConstraint;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.resource.Resource;
 import org.onosproject.net.resource.ResourceAllocation;
 import org.onosproject.net.resource.ResourceService;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/VirtualNetworkIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/VirtualNetworkIntentCompiler.java
index 1fdebe1..8c04c6a 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/VirtualNetworkIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/VirtualNetworkIntentCompiler.java
@@ -34,10 +34,10 @@
 import org.onosproject.net.Link;
 import org.onosproject.net.Path;
 import org.onosproject.net.intent.Intent;
+import org.onosproject.net.intent.IntentCompilationException;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.topology.TopologyService;
 import org.slf4j.Logger;
 
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
index b1e6376..585d3a0 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
@@ -35,6 +35,7 @@
 import org.onosproject.net.NetworkResource;
 import org.onosproject.net.intent.FlowRuleIntent;
 import org.onosproject.net.intent.Intent;
+import org.onosproject.net.intent.IntentCompilationException;
 import org.onosproject.net.intent.IntentCompiler;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.IntentEvent;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompilerTest.java
index 4bba232..939cab0 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/HostToHostIntentCompilerTest.java
@@ -30,6 +30,7 @@
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentTestsMocks;
 import org.onosproject.net.intent.PathIntent;
+import org.onosproject.net.resource.MockResourceService;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompilerTest.java
index 1317edc..fa0a0df 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/MplsPathIntentCompilerTest.java
@@ -43,6 +43,7 @@
 import org.onosproject.net.intent.IntentExtensionService;
 import org.onosproject.net.intent.MockIdGenerator;
 import org.onosproject.net.intent.MplsPathIntent;
+import org.onosproject.net.resource.MockResourceService;
 
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PathIntentCompilerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PathIntentCompilerTest.java
index c880823..b3efb24 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PathIntentCompilerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/compiler/PathIntentCompilerTest.java
@@ -47,6 +47,7 @@
 import org.onosproject.net.intent.PathIntent;
 import org.onosproject.net.intent.constraint.EncapsulationConstraint;
 import org.onosproject.net.provider.ProviderId;
+import org.onosproject.net.resource.MockResourceService;
 
 import java.util.Arrays;
 import java.util.Collection;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
index e188ccd..2a55931 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/phase/CompilingTest.java
@@ -31,11 +31,11 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.Intent;
+import org.onosproject.net.intent.IntentCompilationException;
 import org.onosproject.net.intent.IntentData;
 import org.onosproject.net.intent.MockIdGenerator;
 import org.onosproject.net.intent.PathIntent;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.net.intent.impl.IntentCompilationException;
 import org.onosproject.net.intent.impl.IntentProcessor;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.store.Timestamp;