com.h3c.sdn.misc.net

## Class Entity

- java.lang.Object
- - com.h3c.sdn.misc.net.Entity

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    NodeMessage

      public class Entity
      extends Object
      implements Serializable

  Represents all the data required for ARP and Node objects.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Entity(MacAddress mac, VId vid, IpAddress ip, DataPathId dpid, BigPortNumber port, boolean shared, int contollerId)` Constructs a new entity using MAC, VID, IP, data path id, port and shared.
    `Entity(MacAddress mac, VId vid, IpAddress ip, DataPathId dpid, BigPortNumber port, int contollerId)` Constructs a new entity using MAC, VID, IP, data path id and port.
    `Entity(MacAddress mac, VId vid, IpAddress ip, DataPathId dpid, BigPortNumber port, long age, boolean shared, int contollerId)`
    `Entity(MacAddress mac, VId vid, IpAddress ip, DataPathId dpid, BigPortNumber port, long age, int contollerId)` Constructs a new entity using MAC, VID, IP, data path id and port.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `controllerId()` Returns the Controller id.
    `DataPathId` | `dpid()` Returns the datapath ID of the switch to which the host is connected.
    `boolean` | `equals(Object obj)`
    `long` | `getAge()` Returns the staitc state for the entity.
    `ARPEntry` | `getARPTableEntry()` Returns the arp entry from entity object.
    `NetworkNode` | `getNetworkNode()` Returns the network node from entity object.
    `int` | `hashCode()`
    `IpAddress` | `ip()` Returns the IP address of the host.
    `long` | `lastAccessed()` Returns the last accessed time of the entity object.
    `MacAddress` | `mac()` Returns the MAC address of the host.
    `void` | `resetLastAccessed()` Sets the last time the entity object was accessed as 0.
    `void` | `setAge(long age)` Set the staitc state for the entity.
    `void` | `setControllerId(int id)` Sets the controller id.
    `void` | `setLastAccessed()` Sets the last time the entity object was accessed.
    `BigPortNumber` | `switchPort()` Returns the port to which the host is connected.
    `String` | `toString()`
    `VId` | `vid()` Returns the VID on which the host is connected.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Entity

          public Entity(MacAddress mac,
                VId vid,
                IpAddress ip,
                DataPathId dpid,
                BigPortNumber port,
                int contollerId)

      Constructs a new entity using MAC, VID, IP, data path id and port.
      Parameters:
        `mac` - the MAC address
        `vid` - the VID
        `ip` - the IP address
        `dpid` - the Switch DPID
        `port` - the port
        `contollerId` - the hash of the controller instance id

    - #### Entity

          public Entity(MacAddress mac,
                VId vid,
                IpAddress ip,
                DataPathId dpid,
                BigPortNumber port,
                boolean shared,
                int contollerId)

      Constructs a new entity using MAC, VID, IP, data path id, port and shared.

      Constructor has been added to help create an entity object with timestamp 0.

      A shared flag is added to indicate that the entity has been received from another controller in the cluster. A shared flag value of true will cause the lastAccessed time to be set to 0 indicating that the entity has been learned from another controller in the cluster.

      Parameters:
        `mac` - the MAC address
        `vid` - the VID
        `ip` - the IP address
        `dpid` - the Switch DPID
        `port` - the port
        `shared` - flag indicating shared entity
        `contollerId` - the hash of the controller instance id

    - #### Entity

          public Entity(MacAddress mac,
                VId vid,
                IpAddress ip,
                DataPathId dpid,
                BigPortNumber port,
                long age,
                boolean shared,
                int contollerId)

    - #### Entity

          public Entity(MacAddress mac,
                VId vid,
                IpAddress ip,
                DataPathId dpid,
                BigPortNumber port,
                long age,
                int contollerId)

      Constructs a new entity using MAC, VID, IP, data path id and port.
      Parameters:
        `mac` - the MAC address
        `vid` - the VID
        `ip` - the IP address
        `dpid` - the Switch DPID
        `port` - the port
        `age` - age flag
        `contollerId` - the hash of the controller instance id

  - ### Method Detail

    - #### mac

          public MacAddress mac()

      Returns the MAC address of the host.
      Returns:
        the MAC address

    - #### ip

          public IpAddress ip()

      Returns the IP address of the host.
      Returns:
        the IP address

    - #### vid

          public VId vid()

      Returns the VID on which the host is connected.
      Returns:
        the VID

    - #### dpid

          public DataPathId dpid()

      Returns the datapath ID of the switch to which the host is connected.
      Returns:
        the switch datapath ID

    - #### switchPort

          public BigPortNumber switchPort()

      Returns the port to which the host is connected.
      Returns:
        the switch port

    - #### lastAccessed

          public long lastAccessed()

      Returns the last accessed time of the entity object.
      Returns:
        the last accessed time (in milliseconds)

    - #### setLastAccessed

          public void setLastAccessed()

      Sets the last time the entity object was accessed.

    - #### controllerId

          public int controllerId()

      Returns the Controller id.
      Returns:
        the int

    - #### setControllerId

          public void setControllerId(int id)

      Sets the controller id.
      Parameters:
        `id` - the new controller id

    - #### resetLastAccessed

          public void resetLastAccessed()

      Sets the last time the entity object was accessed as 0.

    - #### getNetworkNode

          public NetworkNode getNetworkNode()

      Returns the network node from entity object.
      Returns:
        the NetworkNode

    - #### getARPTableEntry

          public ARPEntry getARPTableEntry()

      Returns the arp entry from entity object.
      Returns:
        the ARPEntry

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getAge

          public long getAge()

      Returns the staitc state for the entity.
      Returns:
        false or true

    - #### setAge

          public void setAge(long age)

      Set the staitc state for the entity.

Copyright © 2014. All Rights Reserved.