Mechanism to add Port annotation via netcfg
- intended to be used for driver to support ONOS-5895
Change-Id: Iddcf6f1b99273e8f8670b5f64fc9831e5f4ce3cd
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultAnnotations.java b/core/api/src/main/java/org/onosproject/net/DefaultAnnotations.java
index 242b0e8..f86df5e 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultAnnotations.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultAnnotations.java
@@ -24,6 +24,7 @@
import com.google.common.collect.Maps;
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Maps.transformValues;
/**
* Represents a set of simple annotations that can be used to add arbitrary
@@ -246,6 +247,18 @@
}
/**
+ * Adds all entries in specified map.
+ * Any previous entries with same key will be overwritten.
+ *
+ * @param entries annotation key and value entries
+ * @return self
+ */
+ public Builder putAll(Map<String, String> entries) {
+ builder.putAll(transformValues(entries, v -> (v == null) ? REMOVED : v));
+ return this;
+ }
+
+ /**
* Adds the specified annotation. Any previous value associated with
* the given annotation key will be overwritten.
*