Fix for ONOS-5033 hosts - dynamic or static
Change-Id: I3791370db0037968003abc23c918c63119d2dba2
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultHost.java b/core/api/src/main/java/org/onosproject/net/DefaultHost.java
index 38a8e0d..7fc77c3 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultHost.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultHost.java
@@ -36,6 +36,7 @@
private final VlanId vlan;
private final HostLocation location;
private final Set<IpAddress> ips;
+ private final boolean configured;
/**
* Creates an end-station host using the supplied information.
@@ -51,11 +52,30 @@
public DefaultHost(ProviderId providerId, HostId id, MacAddress mac,
VlanId vlan, HostLocation location, Set<IpAddress> ips,
Annotations... annotations) {
+ this(providerId, id, mac, vlan, location, ips, false, annotations);
+ }
+
+ /**
+ * Creates an end-station host using the supplied information.
+ *
+ * @param providerId provider identity
+ * @param id host identifier
+ * @param mac host MAC address
+ * @param vlan host VLAN identifier
+ * @param location host location
+ * @param ips host IP addresses
+ * @param configured true if configured via NetworkConfiguration
+ * @param annotations optional key/value annotations
+ */
+ public DefaultHost(ProviderId providerId, HostId id, MacAddress mac,
+ VlanId vlan, HostLocation location, Set<IpAddress> ips,
+ boolean configured, Annotations... annotations) {
super(providerId, id, annotations);
this.mac = mac;
this.vlan = vlan;
this.location = location;
this.ips = new HashSet<>(ips);
+ this.configured = configured;
}
@Override
@@ -84,6 +104,11 @@
}
@Override
+ public boolean configured() {
+ return configured;
+ }
+
+ @Override
public int hashCode() {
return Objects.hash(id, mac, vlan, location);
}
@@ -114,6 +139,7 @@
.add("location", location())
.add("ipAddresses", ipAddresses())
.add("annotations", annotations())
+ .add("configured", configured())
.toString();
}