added default host constructs to API

Change-Id: I3ef3e08559c7c4d73d8e4aee693589ee0830ed85
diff --git a/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java b/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java
new file mode 100644
index 0000000..b6b38db
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/DefaultHost.java
@@ -0,0 +1,83 @@
+package org.onlab.onos.net;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+import org.onlab.onos.net.provider.ProviderId;
+import org.onlab.packet.IPv4;
+import org.onlab.packet.MACAddress;
+
+public class DefaultHost extends AbstractElement implements Host {
+
+    private final MACAddress mac;
+    private final short vlan;
+    private final HostLocation location;
+    private final Set<IPv4> ips;
+
+    protected DefaultHost(ProviderId providerId, ElementId id, MACAddress mac,
+            short vlan, HostLocation loc, Set<IPv4> ips) {
+        super(providerId, id);
+        this.mac = mac;
+        this.vlan = vlan;
+        this.location = loc;
+        this.ips = new HashSet<IPv4>(ips);
+    }
+
+    @Override
+    public HostId id() {
+        return (HostId) super.id();
+    }
+
+    @Override
+    public MACAddress mac() {
+        return mac;
+    }
+
+    @Override
+    public Set<IPv4> ipAddresses() {
+        return Collections.unmodifiableSet(ips);
+    }
+
+    @Override
+    public HostLocation location() {
+        return location;
+    }
+
+    @Override
+    public short vlan() {
+        return vlan;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, mac, vlan, location);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof DefaultHost) {
+            final DefaultHost other = (DefaultHost) obj;
+            return Objects.equals(this.id, other.id) &&
+                    Objects.equals(this.mac, other.mac) &&
+                    Objects.equals(this.vlan, other.vlan) &&
+                    Objects.equals(this.location, other.location);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("id", id)
+                .add("mac", mac)
+                .add("vlan", vlan)
+                .add("location", location)
+                .add("ipAddresses", ips)
+                .toString();
+    }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/Host.java b/core/api/src/main/java/org/onlab/onos/net/Host.java
index d66566d..667bb88 100644
--- a/core/api/src/main/java/org/onlab/onos/net/Host.java
+++ b/core/api/src/main/java/org/onlab/onos/net/Host.java
@@ -25,6 +25,13 @@
     MACAddress mac();
 
     /**
+     * Returns the VLAN ID tied to this host.
+     *
+     * @return VLAN ID value
+     */
+    short vlan();
+
+    /**
      * Returns set of IP addresses currently bound to the host MAC address.
      *
      * @return set of IP addresses; empty if no IP address is bound
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java b/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java
new file mode 100644
index 0000000..2129082
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/host/DefaultHostDescription.java
@@ -0,0 +1,58 @@
+package org.onlab.onos.net.host;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.onlab.onos.net.HostLocation;
+import org.onlab.packet.IPv4;
+import org.onlab.packet.MACAddress;
+
+public class DefaultHostDescription implements HostDescription {
+
+    private final MACAddress mac;
+    private final short vlan;
+    private final HostLocation location;
+    private final Set<IPv4> ips;
+
+    public DefaultHostDescription(MACAddress mac, short vlan,
+            HostLocation loc, Set<IPv4> ips) {
+        this.mac = mac;
+        this.vlan = vlan;
+        this.location = loc;
+        this.ips = new HashSet<IPv4>(ips);
+    }
+
+    @Override
+    public MACAddress hwAddress() {
+        return mac;
+    }
+
+    @Override
+    public short vlan() {
+        return vlan;
+    }
+
+    @Override
+    public HostLocation location() {
+        return location;
+    }
+
+    @Override
+    public Set<IPv4> ipAddresses() {
+        return Collections.unmodifiableSet(ips);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(this)
+                .add("mac", mac)
+                .add("vlan", vlan)
+                .add("location", location)
+                .add("ipAddresses", ips)
+                .toString();
+    }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java b/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
index e3c67b9..62a4c9a 100644
--- a/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
+++ b/core/api/src/main/java/org/onlab/onos/net/host/HostDescription.java
@@ -1,11 +1,43 @@
 package org.onlab.onos.net.host;
 
+import java.util.Set;
+
+import org.onlab.onos.net.Description;
+import org.onlab.onos.net.HostLocation;
+import org.onlab.packet.IPv4;
+import org.onlab.packet.MACAddress;
+
 /**
  * Information describing host and its location.
  */
-public interface HostDescription {
+public interface HostDescription extends Description {
 
-    // IP, MAC, VLAN-ID, HostLocation -> (ConnectionPoint + timestamp)
+    /**
+     * Returns the MAC address associated with this host (NIC).
+     *
+     * @return the MAC address of this host
+     */
+    MACAddress hwAddress();
+
+    /**
+     * Returns the VLAN associated with this host.
+     *
+     * @return the VLAN ID value
+     */
+    short vlan();
+
+    /**
+     * Returns the location of the host on the network edge.
+     *
+     * @return the network location
+     */
+    HostLocation location();
+
+    /**
+     * Returns zero or more IP address(es) associated with this host's MAC.
+     *
+     * @return a set of IP addresses.
+     */
+    Set<IPv4> ipAddresses();
 
 }
-