OpticalCircuitIntent is extended to receive path and ochSignal (e.g., from REST optical-rest app).
If the compilation of the OpticalCirsuitIntent trigger the creation of a new OpticalConnectivityIntent
the specified path and ochSignal are used.
Patch 2: Checkstyle
Change-Id: I41aaf6f914738a57634eef0680d73ff64291c696
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index 7e873d1..4f8fcbe 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -250,6 +250,8 @@
ConnectPoint dstCP = new ConnectPoint(dst.elementId(), ochPorts.getRight().number());
// Create optical connectivity intent
+ // In this case the channel and path optionally specified in this circuit intent
+ // are used to create the connectivity intent
connectivityIntent = OpticalConnectivityIntent.builder()
.appId(appId)
// TODO New top-level Intent created and submitted
@@ -261,6 +263,8 @@
.priority(OPTICAL_CONNECTIVITY_INTENT_PRIORITY)
.signalType(ochPorts.getLeft().signalType())
.bidirectional(intent.isBidirectional())
+ .ochSignal(intent.ochSignal())
+ .suggestedPath(intent.suggestedPath())
.resourceGroup(intent.resourceGroup())
.build();
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/util/OpticalIntentUtility.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/util/OpticalIntentUtility.java
index 53c6cec..7956f57 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/util/OpticalIntentUtility.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/util/OpticalIntentUtility.java
@@ -38,6 +38,9 @@
import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
import org.slf4j.Logger;
+
+import java.util.Optional;
+
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -103,6 +106,8 @@
.dst(egress)
.signalType(signalType)
.bidirectional(bidirectional)
+ .ochSignal(Optional.ofNullable(signal))
+ .suggestedPath(Optional.ofNullable(suggestedPath))
.build();
} else if (Type.OTN.equals(srcDevice.type())) {
intent = OpticalOduIntent.builder()
@@ -125,8 +130,8 @@
.dst(egress)
.signalType(signalType)
.bidirectional(bidirectional)
- .ochSignal(signal)
- .suggestedPath(suggestedPath)
+ .ochSignal(Optional.ofNullable(signal))
+ .suggestedPath(Optional.ofNullable(suggestedPath))
.build();
} else {
log.debug("Unable to create optical intent between connect points {} and {}", ingress, egress);
@@ -146,13 +151,13 @@
* @param bidirectional if this argument is true, the optical link created
* will be bidirectional, otherwise the link will be unidirectional.
* @param signal optical signal
- * @param path suggested path for the intent
+ * @param suggestedPath suggested path for the intent
*
* @return created intent
*/
public static Intent createExplicitOpticalIntent(ConnectPoint ingress, ConnectPoint
egress, DeviceService deviceService, Key key, ApplicationId appId, boolean
- bidirectional, OchSignal signal, Path path) {
+ bidirectional, OchSignal signal, Path suggestedPath) {
Intent intent = null;
@@ -188,6 +193,8 @@
.dst(egress)
.signalType(signalType)
.bidirectional(bidirectional)
+ .ochSignal(Optional.ofNullable(signal))
+ .suggestedPath(Optional.ofNullable(suggestedPath))
.build();
} else if (Type.OTN.equals(srcDevice.type())) {
intent = OpticalOduIntent.builder()
@@ -212,8 +219,8 @@
.dst(egress)
.signalType(signalType)
.bidirectional(bidirectional)
- .ochSignal(signal)
- .suggestedPath(path)
+ .ochSignal(Optional.ofNullable(signal))
+ .suggestedPath(Optional.ofNullable(suggestedPath))
.build();
} else {
log.error("Unable to create explicit optical intent between connect points {} and {}", ingress, egress);