net.floodlightcontroller.devicemanager.internal
Class Entity

java.lang.Object
  extended by net.floodlightcontroller.devicemanager.internal.Entity
All Implemented Interfaces:
java.lang.Comparable<Entity>

public class Entity
extends java.lang.Object
implements java.lang.Comparable<Entity>

An entity on the network is a visible trace of a device that corresponds to a packet received from a particular interface on the edge of a network, with a particular VLAN tag, and a particular MAC address, along with any other packet characteristics we might want to consider as helpful for disambiguating devices. 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.

Author:
readams

Field Summary
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.
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 Summary
Entity(long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address, java.lang.Long switchDPID, java.lang.Integer switchPort, java.util.Date lastSeenTimestamp)
          Create a new entity
 
Method Summary
 int compareTo(Entity o)
           
 boolean equals(java.lang.Object obj)
           
 java.util.Date getActiveSince()
           
 java.lang.Integer getIpv4Address()
           
 java.util.Date getLastSeenTimestamp()
           
 long getMacAddress()
           
 java.lang.Long getSwitchDPID()
           
 java.lang.Integer getSwitchPort()
           
 java.lang.Short getVlan()
           
 int hashCode()
           
 boolean hasSwitchPort()
           
 void setActiveSince(java.util.Date activeSince)
           
 void setLastSeenTimestamp(java.util.Date lastSeenTimestamp)
          Set the last seen timestamp and also update activeSince if appropriate
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVITY_TIMEOUT

protected static int ACTIVITY_TIMEOUT
Timeout for computing activeSince.

See Also:
Entity#activeSince}

macAddress

protected long macAddress
The MAC address associated with this entity


ipv4Address

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


vlan

protected java.lang.Short vlan
The VLAN tag on this entity, or null if untagged


switchDPID

protected java.lang.Long switchDPID
The DPID of the switch for the ingress point for this entity, or null if not present


switchPort

protected java.lang.Integer switchPort
The port number of the switch for the ingress point for this entity, or null if not present


lastSeenTimestamp

protected java.util.Date lastSeenTimestamp
The last time we observed this entity on the network


activeSince

protected java.util.Date activeSince
The time between 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.

Constructor Detail

Entity

public Entity(long macAddress,
              java.lang.Short vlan,
              java.lang.Integer ipv4Address,
              java.lang.Long switchDPID,
              java.lang.Integer switchPort,
              java.util.Date lastSeenTimestamp)
Create a new entity

Parameters:
macAddress -
vlan -
ipv4Address -
switchDPID -
switchPort -
lastSeenTimestamp -
Method Detail

getMacAddress

public long getMacAddress()

getIpv4Address

public java.lang.Integer getIpv4Address()

getVlan

public java.lang.Short getVlan()

getSwitchDPID

public java.lang.Long getSwitchDPID()

getSwitchPort

public java.lang.Integer getSwitchPort()

hasSwitchPort

public boolean hasSwitchPort()

getLastSeenTimestamp

public java.util.Date getLastSeenTimestamp()

setLastSeenTimestamp

public void setLastSeenTimestamp(java.util.Date lastSeenTimestamp)
Set the last seen timestamp and also update activeSince if appropriate

Parameters:
lastSeenTimestamp - the new last seen timestamp
See Also:
Entity#activeSince}

getActiveSince

public java.util.Date getActiveSince()

setActiveSince

public void setActiveSince(java.util.Date activeSince)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(Entity o)
Specified by:
compareTo in interface java.lang.Comparable<Entity>