X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fhosttracker_new%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fhosttracker%2FEntity.java;h=924d0717e966aa4731aa340e67a54efe18cbf991;hb=2f14a41bbd09010114116aef1499641f7251bf83;hp=7c98e9505b28b1b51098a9d9c9c3e29ab9af6a2c;hpb=c12131df07f248f2e2192b200bf9b6149163d484;p=controller.git diff --git a/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java b/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java index 7c98e9505b..924d0717e9 100644 --- a/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java +++ b/opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java @@ -33,9 +33,12 @@ 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 @@ -218,6 +221,19 @@ public class Entity implements Comparable { 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="