Using replace instead install when there is already an intent
Fixes the problem of flows being left on the data plane
Change-Id: Iec3db8b460123f2744a57d8c08d14c8effe9ec34
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index c8b2b74..5e28fcd 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -34,6 +34,7 @@
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.concurrent.ThreadFactory;
@@ -84,6 +85,16 @@
}
/**
+ * Returns true if the collection is null or is empty.
+ *
+ * @param collection collection to test
+ * @return true if null or empty; false otherwise
+ */
+ public static boolean isNullOrEmpty(Collection collection) {
+ return collection == null || collection.isEmpty();
+ }
+
+ /**
* Converts a string from hex to long.
*
* @param string hex number in string form; sans 0x