Cherry-pick from https://gerrit.onos.onlab.us/#/c/336/
Fix a bug when deleting all flows. (ONOS-981)
Conflicts:
src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
NOTE: The above conflict has been resolved by hand.
Also, the code related to the Titan-specific exception has been removed,
because it doesn't apply anymore.
Change-Id: Ib20db5a1f919e1d5d20468451fb22d151644080e
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
index aee2ecb..514e389 100755
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -676,14 +676,20 @@
* @return true on success, otherwise false.
*/
static boolean deleteAllFlows(DBOperation dbHandler) {
- Iterable<IFlowPath> allFlowPaths = dbHandler.getAllFlowPaths();
- for (IFlowPath flowPathObj : allFlowPaths) {
- if (flowPathObj == null)
- continue;
+ try {
+ // Get all Flow IDs
+ Iterable<IFlowPath> allFlowPaths = dbHandler.getAllFlowPaths();
+ for (IFlowPath flowPathObj : allFlowPaths) {
+ if (flowPathObj == null)
+ continue;
- deleteIFlowPath(dbHandler, flowPathObj);
+ deleteIFlowPath(dbHandler, flowPathObj);
+ }
+ dbHandler.commit();
+ } catch (Exception e) {
+ log.error("Exception deleting all Flow Paths from Network MAP: ", e);
+ return false;
}
- dbHandler.commit();
return true;
}