Jonathan Hart
Committed by Gerrit Code Review

Periodically retry failed intents.

Fixes ONOS-2433.

Ported from onos-1.2 branch.

Change-Id: I6ebd640398efe5db39fc855c406e52ce7dc539b9
(cherry picked from commit f72a631d)
...@@ -181,7 +181,7 @@ public class IntentCleanup implements Runnable, IntentListener { ...@@ -181,7 +181,7 @@ public class IntentCleanup implements Runnable, IntentListener {
181 service.withdraw(intentData.intent()); 181 service.withdraw(intentData.intent());
182 break; 182 break;
183 default: 183 default:
184 - log.warn("Trying to resubmit corrupt intent {} in state {} with request {}", 184 + log.warn("Trying to resubmit corrupt/failed intent {} in state {} with request {}",
185 intentData.key(), intentData.state(), intentData.request()); 185 intentData.key(), intentData.state(), intentData.request());
186 break; 186 break;
187 } 187 }
...@@ -203,14 +203,18 @@ public class IntentCleanup implements Runnable, IntentListener { ...@@ -203,14 +203,18 @@ public class IntentCleanup implements Runnable, IntentListener {
203 } 203 }
204 204
205 /** 205 /**
206 - * Iterate through CORRUPT intents and re-submit/withdraw appropriately. 206 + * Iterates through corrupt, failed and pending intents and
207 - * 207 + * re-submit/withdraw appropriately.
208 */ 208 */
209 private void cleanup() { 209 private void cleanup() {
210 - int corruptCount = 0, stuckCount = 0, pendingCount = 0; 210 + int corruptCount = 0, failedCount = 0, stuckCount = 0, pendingCount = 0;
211 - store.getIntentData(true, periodMs); 211 +
212 for (IntentData intentData : store.getIntentData(true, periodMs)) { 212 for (IntentData intentData : store.getIntentData(true, periodMs)) {
213 switch (intentData.state()) { 213 switch (intentData.state()) {
214 + case FAILED:
215 + resubmitCorrupt(intentData, false);
216 + failedCount++;
217 + break;
214 case CORRUPT: 218 case CORRUPT:
215 resubmitCorrupt(intentData, false); 219 resubmitCorrupt(intentData, false);
216 corruptCount++; 220 corruptCount++;
...@@ -231,8 +235,8 @@ public class IntentCleanup implements Runnable, IntentListener { ...@@ -231,8 +235,8 @@ public class IntentCleanup implements Runnable, IntentListener {
231 stuckCount++; 235 stuckCount++;
232 } 236 }
233 237
234 - log.debug("Intent cleanup ran and resubmitted {} corrupt, {} stuck, and {} pending intents", 238 + log.debug("Intent cleanup ran and resubmitted {} corrupt, {} failed, {} stuck, and {} pending intents",
235 - corruptCount, stuckCount, pendingCount); 239 + corruptCount, failedCount, stuckCount, pendingCount);
236 } 240 }
237 241
238 @Override 242 @Override
......