Log some context when Intent failed.
Change-Id: Ib30f78f970680144f920ca4754825f78eedb658b
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 5183a3e..5593233 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -125,6 +125,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)) {
+ log.error("Ports for the intent are not available. Intent: {}", intent);
throw new OpticalIntentCompilationException("Ports for the intent are not available. Intent: " + intent);
}
@@ -147,7 +148,7 @@
OchSignal lambda = new OchSignal(Frequency.ofHz(Long.parseLong(staticLambda)),
srcOchPort.lambda().channelSpacing(),
srcOchPort.lambda().slotGranularity());
- log.debug("Using staticalluy assigned lambda : {}", lambda);
+ log.debug("Using statically assigned lambda : {}", lambda);
List<Resource> res = new ArrayList<>();
@@ -192,6 +193,7 @@
if (!srcOchPort.isTunable() || !dstOchPort.isTunable()) {
Path firstPath = paths.findAny().orElse(null);
if (firstPath == null) {
+ log.error("Unable to find suitable lightpath for intent {}", intent);
throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
}
OchSignal lambda = srcOchPort.lambda();
@@ -220,6 +222,7 @@
OchSignal ochSignal = OchSignal.toFixedGrid(found.get().getValue(), ChannelSpacing.CHL_50GHZ);
return ImmutableList.of(createIntent(intent, found.get().getKey(), ochSignal));
} else {
+ log.error("Unable to find suitable lightpath for intent {}", intent);
throw new OpticalIntentCompilationException("Unable to find suitable lightpath for intent " + intent);
}
}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
index 3ce320d..d0928ce 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
@@ -137,6 +137,9 @@
log.debug("Completed withdrawing: {}", uninstallData.key());
switch (uninstallData.request()) {
case INSTALL_REQ:
+ // illegal state?
+ log.warn("{} was requested to withdraw during installation?",
+ uninstallData.intent());
uninstallData.setState(FAILED);
break;
case WITHDRAW_REQ:
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
index ee62ea3..bb82dfc 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/Compiling.java
@@ -59,7 +59,7 @@
stored.map(IntentData::installables).orElse(null));
return Optional.of(new Installing(processor, new IntentData(data, compiled), stored));
} catch (IntentException e) {
- log.debug("Unable to compile intent {} due to: {}", data.intent(), e);
+ log.warn("Unable to compile intent {} due to:", data.intent(), e);
if (stored.filter(x -> !x.installables().isEmpty()).isPresent()) {
// removing orphaned flows and deallocating resources
return Optional.of(new Withdrawing(processor, new IntentData(data, stored.get().installables())));
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
index 4062fc62..db7509d 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/WithdrawRequest.java
@@ -17,6 +17,8 @@
import org.onosproject.net.intent.IntentData;
import org.onosproject.net.intent.impl.IntentProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Optional;
@@ -28,6 +30,8 @@
*/
final class WithdrawRequest implements IntentProcessPhase {
+ private static final Logger log = LoggerFactory.getLogger(WithdrawRequest.class);
+
private final IntentProcessor processor;
private final IntentData data;
private final Optional<IntentData> stored;
@@ -57,6 +61,8 @@
if (!stored.isPresent() || stored.get().installables().isEmpty()) {
switch (data.request()) {
case INSTALL_REQ:
+ // illegal state?
+ log.warn("{} was requested to withdraw during installation?", data.intent());
return Optional.of(new Failed(data));
case WITHDRAW_REQ:
default: //TODO "default" case should not happen