ONOS-3503 Remove OchPort out of core.
- Implementation of a Behavior OpticalDevice has the knowledge of
translating annotations into optical specific port.
- OpticalDeviceServiceView checks if the Device is a OpticalDevice
and translate all the Ports to optical specific port before returning.
- This commit contains feedbacks, issues, and fixes by Michele Santuari.
- Note: 3 more Port types to go (OduClt, Oms, Otu)
Change-Id: I4cbda8bc1922fbdd4dac8de8d02294bad74b8058
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index 9e31234..bf8152e 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -32,7 +32,6 @@
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.CltSignalType;
import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.OchPort;
import org.onosproject.net.OduCltPort;
import org.onosproject.net.OduSignalId;
import org.onosproject.net.OduSignalType;
@@ -60,6 +59,7 @@
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.intent.IntentSetMultimap;
import org.onosproject.net.resource.ResourceAllocation;
import org.onosproject.net.resource.Resource;
@@ -82,6 +82,7 @@
import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkArgument;
+import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
/**
* An intent compiler for {@link org.onosproject.net.intent.OpticalCircuitIntent}.
@@ -156,6 +157,7 @@
@Activate
public void activate(ComponentContext context) {
+ deviceService = opticalView(deviceService);
appId = coreService.registerApplication("org.onosproject.net.intent");
intentManager.registerCompiler(OpticalCircuitIntent.class, this);
cfgService.registerProperties(getClass());
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 d1b5925..b1ca006 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
@@ -31,7 +31,6 @@
import org.onosproject.net.DefaultOchSignalComparator;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
-import org.onosproject.net.OchPort;
import org.onosproject.net.OchSignal;
import org.onosproject.net.OchSignalType;
import org.onosproject.net.Path;
@@ -43,6 +42,7 @@
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;
import org.onosproject.net.resource.ResourceService;
@@ -63,6 +63,7 @@
import java.util.stream.Stream;
import static com.google.common.base.Preconditions.checkArgument;
+import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
/**
* An intent compiler for {@link org.onosproject.net.intent.OpticalConnectivityIntent}.
@@ -88,6 +89,7 @@
@Activate
public void activate() {
+ deviceService = opticalView(deviceService);
intentManager.registerCompiler(OpticalConnectivityIntent.class, this);
}