[ONOS-7842] Implement host annotation using netcfg
Change-Id: I2c5c516d642b34f11cae994b3fea31ebd7d76219
diff --git a/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java b/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java
index 1992283..c83c2c1 100644
--- a/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/host/DefaultHostDescription.java
@@ -167,6 +167,28 @@
this.configured = configured;
}
+ /**
+ * Creates a host description using the supplied information.
+ * @param base HostDescription to basic information
+ * @param annotations Annotations to use.
+ */
+ public DefaultHostDescription(HostDescription base, SparseAnnotations annotations) {
+ this(base.hwAddress(), base.vlan(), base.locations(), base.ipAddress(), base.innerVlan(), base.tpid(),
+ base.configured(), annotations);
+ }
+
+ /**
+ * Creates a host description using the supplied information.
+ *
+ * @param base base
+ * @param annotations annotations
+ * @return host description
+ */
+ public static DefaultHostDescription copyReplacingAnnotation(HostDescription base,
+ SparseAnnotations annotations) {
+ return new DefaultHostDescription(base, annotations);
+ }
+
@Override
public MacAddress hwAddress() {
return mac;