public class Entity extends java.lang.Object implements java.lang.Comparable<Entity>
Entities are the most basic element of devices; devices consist of one or more entities. Entities are immutable once created, except for the last seen timestamp.
Modifier and Type | Field and Description |
---|---|
protected java.util.Date |
activeSince
The time between
activeSince and
lastSeenTimestamp is a period of activity for this
entity where it was observed repeatedly. |
protected static int |
ACTIVITY_TIMEOUT
Timeout for computing
activeSince |
private int |
hashCode |
protected java.lang.Integer |
ipv4Address
The IP address associated with this entity, or null if no IP learned
from the network observation associated with this entity
|
protected java.util.Date |
lastSeenTimestamp
The last time we observed this entity on the network
|
protected long |
macAddress
The MAC address associated with this entity
|
protected java.lang.Long |
switchDPID
The dpid of the switch for the ingress point for this entity,
or null if not present
|
protected java.lang.Integer |
switchPort
The port number of the switch for the ingress point for this entity,
or null if not present
|
protected java.lang.Short |
vlan
The VLAN tag on this entity, or null if untagged
|
Constructor and Description |
---|
Entity(long macAddress,
java.lang.Short vlan,
java.lang.Integer ipv4Address,
java.lang.Long switchDPID,
java.lang.Integer switchPort,
java.util.Date lastSeenTimestamp)
Creates a new entity.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Entity o) |
boolean |
equals(java.lang.Object obj) |
java.util.Date |
getActiveSince()
Returns timestamp from when this entity is activated.
|
java.lang.Integer |
getIpv4Address()
Returns the IP address.
|
java.util.Date |
getLastSeenTimestamp()
Returns the recent last seen timestamp.
|
long |
getMacAddress()
Returns the MAC address.
|
java.lang.Long |
getSwitchDPID()
Returns the switch dpid.
|
java.lang.Integer |
getSwitchPort()
Returns the switch port.
|
java.lang.Short |
getVlan()
Returns the VLAN ID.
|
int |
hashCode() |
void |
setActiveSince(java.util.Date activeSince)
Sets the activation timestamps
|
void |
setLastSeenTimestamp(java.util.Date lastSeenTimestamp)
Sets the last seen timestamp and also update
activeSince
if appropriate |
java.lang.String |
toString() |
protected static int ACTIVITY_TIMEOUT
activeSince
Entity
protected long macAddress
protected java.lang.Integer ipv4Address
protected java.lang.Short vlan
protected java.lang.Long switchDPID
protected java.lang.Integer switchPort
protected java.util.Date lastSeenTimestamp
protected java.util.Date activeSince
activeSince
and
lastSeenTimestamp
is a period of activity for this
entity where it was observed repeatedly. If, when the entity is
observed, the is longer ago than the activity timeout,
lastSeenTimestamp
and activeSince
will
be set to the current time.private int hashCode
public Entity(long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address, java.lang.Long switchDPID, java.lang.Integer switchPort, java.util.Date lastSeenTimestamp)
macAddress
- the MAC addressvlan
- the VLAN IDipv4Address
- the IP addressswitchDPID
- the switch dpidswitchPort
- the switch portlastSeenTimestamp
- the recent timestamppublic long getMacAddress()
public java.lang.Integer getIpv4Address()
public java.lang.Short getVlan()
public java.lang.Long getSwitchDPID()
public java.lang.Integer getSwitchPort()
public java.util.Date getLastSeenTimestamp()
public void setLastSeenTimestamp(java.util.Date lastSeenTimestamp)
activeSince
if appropriatelastSeenTimestamp
- the new last seen timestampactiveSince
public java.util.Date getActiveSince()
public void setActiveSince(java.util.Date activeSince)
activeSince
- the activation timestamppublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object