Periodically retry failed intents.
Fixes ONOS-2433.
Change-Id: I6ebd640398efe5db39fc855c406e52ce7dc539b9
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
index 44a2d65..d7fa322 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentCleanup.java
@@ -181,7 +181,7 @@
service.withdraw(intentData.intent());
break;
default:
- log.warn("Trying to resubmit corrupt intent {} in state {} with request {}",
+ log.warn("Trying to resubmit corrupt/failed intent {} in state {} with request {}",
intentData.key(), intentData.state(), intentData.request());
break;
}
@@ -203,14 +203,18 @@
}
/**
- * Iterate through CORRUPT intents and re-submit/withdraw appropriately.
- *
+ * Iterates through corrupt, failed and pending intents and
+ * re-submit/withdraw appropriately.
*/
private void cleanup() {
- int corruptCount = 0, stuckCount = 0, pendingCount = 0;
- store.getIntentData(true, periodMs);
+ int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0;
+
for (IntentData intentData : store.getIntentData(true, periodMs)) {
switch (intentData.state()) {
+ case FAILED:
+ resubmitCorrupt(intentData, false);
+ failedCount++;
+ break;
case CORRUPT:
resubmitCorrupt(intentData, false);
corruptCount++;
@@ -231,8 +235,8 @@
stuckCount++;
}
- log.debug("Intent cleanup ran and resubmitted {} corrupt, {} stuck, and {} pending intents",
- corruptCount, stuckCount, pendingCount);
+ log.debug("Intent cleanup ran and resubmitted {} corrupt, {} failed, {} stuck, and {} pending intents",
+ corruptCount, failedCount, stuckCount, pendingCount);
}
@Override