package org.opendaylight.controller.hosttracker;
+import java.net.InetAddress;
import java.util.Date;
+import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.NetUtils;
/**
* An entity on the network is a visible trace of a device that corresponds to a
return true;
}
+ public HostNodeConnector toHostNodeConnector() {
+ try {
+ NodeConnector n = this.getPort();
+ InetAddress ip = InetAddress.getByAddress(NetUtils.intToByteArray4(this.getIpv4Address()));
+ byte[] macAddr = NetUtils.longToByteArray6(this.getMacAddress());
+ HostNodeConnector nc = new HostNodeConnector(macAddr, ip, n,
+ (short) 0);
+ return nc;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
@Override
public String toString() {
return "Entity [macAddress=" + macAddress + ", ipv4Address="
@Override
public int compareTo(Entity o) {
int r;
- if (port == null)
+ if (port == null) {
r = o.port == null ? 0 : -1;
- else if (o.port == null)
+ }
+ else if (o.port == null) {
r = 1;
+ }
else {
// XXX - the node id is only defined as an object rather
// than something useful. We're just going to have to