Cleaned up some of the host-related abstractions and filled in more of the host manager implementation.
diff --git a/core/api/src/main/java/org/onlab/onos/net/HostId.java b/core/api/src/main/java/org/onlab/onos/net/HostId.java
index 3e274b3..1c1f2d7 100644
--- a/core/api/src/main/java/org/onlab/onos/net/HostId.java
+++ b/core/api/src/main/java/org/onlab/onos/net/HostId.java
@@ -1,5 +1,7 @@
package org.onlab.onos.net;
+import org.onlab.packet.MACAddress;
+
import java.net.URI;
/**
@@ -16,6 +18,7 @@
* Creates a device id using the supplied URI.
*
* @param uri device URI
+ * @return host identifier
*/
public static HostId hostId(URI uri) {
return new HostId(uri);
@@ -25,9 +28,23 @@
* Creates a device id using the supplied URI string.
*
* @param string device URI string
+ * @return host identifier
*/
public static HostId hostId(String string) {
return hostId(URI.create(string));
}
+ /**
+ * Creates a device id using the supplied MAC & VLAN ID.
+ *
+ * @param mac mac address
+ * @param vlanId vlan identifier
+ * @return host identifier
+ */
+ // FIXME: replace vlanId long with a rich data-type, e.g. VLanId or something like that
+ public static HostId hostId(MACAddress mac, long vlanId) {
+ // FIXME: use more efficient means of encoding
+ return hostId("nic" + ":" + mac + "/" + vlanId);
+ }
+
}