Abondon the concept of resources under a link

Resources under a link are tied to resources under both ends of the link,
and resources under a port are thought to be first-class objects compared
to concept of link resources. We will deal with only device related
resources from now on.

Change-Id: I6aa418d1bf64b28374f325db0bc7e393f770dcdd
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 2941ddb..e017ac5 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -57,9 +57,9 @@
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static org.onosproject.net.LinkKey.linkKey;
 
 /**
  * An intent compiler for {@link org.onosproject.net.intent.OpticalConnectivityIntent}.
@@ -182,7 +182,10 @@
 
         IndexedLambda minLambda = findFirstLambda(lambdas);
         List<ResourcePath> lambdaResources = path.links().stream()
-                .map(x -> ResourcePath.discrete(linkKey(x.src(), x.dst())))
+                .flatMap(x -> Stream.of(
+                        ResourcePath.discrete(x.src().deviceId(), x.src().port()),
+                        ResourcePath.discrete(x.dst().deviceId(), x.dst().port())
+                ))
                 .map(x -> x.child(minLambda))
                 .collect(Collectors.toList());
 
@@ -197,7 +200,10 @@
 
     private Set<IndexedLambda> findCommonLambdasOverLinks(List<Link> links) {
         return links.stream()
-                .map(x -> ResourcePath.discrete(linkKey(x.src(), x.dst())))
+                .flatMap(x -> Stream.of(
+                        ResourcePath.discrete(x.src().deviceId(), x.src().port()),
+                        ResourcePath.discrete(x.dst().deviceId(), x.dst().port())
+                ))
                 .map(resourceService::getAvailableResources)
                 .map(x -> Iterables.filter(x, r -> r.last() instanceof IndexedLambda))
                 .map(x -> Iterables.transform(x, r -> (IndexedLambda) r.last()))