com.h3c.sdn.misc.net

## Class ARPTableDTO

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

- All Implemented Interfaces:
    ARPTable

      public class ARPTableDTO
      extends Object
      implements ARPTable

  Provides an implementation of `ARPTable`. modified by s03140 for layer2.dstmacaddronly

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `ARPTableDTO(VId vid)` Constructs an ARP table instance, for the given VID.
    `` | `ARPTableDTO(VId vid, boolean layer2DstMacAddrOnly)` Constructs an ARP table type, for a given VID.
    `protected` | `ARPTableDTO(VId vid, long size)` Constructs an ARP table instance specified size, for a given VID.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addARPTableEntry(Entity entity)` Adds the entity to the ARP table.
    `void` | `addNMAlgoListener(NMAlgoListener al)` Attaches the NMAlgoListener instance to the ConcurrentAgingLRUHashMap.
    `Set<ARPEntry>` | `arpEntries()` Returns the set of ARP translations for the VID.
    `ARPEntry` | `arpEntry(IpAddress ipAddress)` Returns the ARP translation for a given IP address.
    `void` | `cleanUp(long age, ConcurrentMap<MacAddress,Set<Object>> conMap)` Cleans up the aged out entries in the aging HashMap.
    `void` | `clearARPTable()` Clears learned ARP translations for the given VID.
    `void` | `clearothersARPTable()` Clears learned From Others Which ARP translations for the given VID.
    `void` | `deleteARPEntry(ARPEntry entry)` Deletes the given entry in the ARP table.
    `void` | `deleteOtherARPEntry(ARPEntry entry)` Deletes the Others given entry in the ARP table.
    `Set<Entity>` | `getEntities()` Returns a set of entity objects from the ARP table.
    `Entity` | `getEntity(IpAddress ipAddress)` Returns an entity object for the given IP address.
    `Entity` | `getEntity(MacAddress mac)` Returns an entity object for the given MAC address.
    `MacAddress` | `getMacAddress(IpAddress ipAddress)` Returns the MAC address for the given IP address.
    `Set<NetworkNode>` | `getNetworkNodes()` Returns the set of end nodes from the ARP table.
    `NetworkNode` | `networkNode(IpAddress ipAddress)` Returns the end host for a given IP address.
    `NetworkNode` | `networkNode(MacAddress mac)` Returns the end host for a given MAC address.
    `void` | `removeNMAlgoListener(NMAlgoListener al)` Removes the NMAlgoListener instance from the ConcurrentAgingLRUHashMap.
    `void` | `replaceARPEntry(Entity oldArpEntry, Entity newArpEntry)` Updates the entity in the ARP table.
    `int` | `size()` Returns the size of the ARP table for the VID.
    `VId` | `vid()` Returns the VID identifier for the ARP table.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ARPTableDTO

          public ARPTableDTO(VId vid)

      Constructs an ARP table instance, for the given VID.

      Every time an entry in the ARP table is read, its last accessed time is reset to the current system time. This ensures that the active ARP entries are not removed.

      Parameters:
        `vid` - the VID

    - #### ARPTableDTO

          protected ARPTableDTO(VId vid,
                     long size)

      Constructs an ARP table instance specified size, for a given VID.

      If the size of the ARP table increases more than the specified size, then the least recently used entry is removed to make room for a new entry.

      Every time an entry in the ARP table is read, its last accessed time is reset to the current system time. This ensures that the active ARP entries are not removed.

      Parameters:
        `vid` - the VID identifier
        `size` - the size of the ARP table per VID

    - #### ARPTableDTO

          public ARPTableDTO(VId vid,
                     boolean layer2DstMacAddrOnly)

      Constructs an ARP table type, for a given VID.

      If type is ONLYMAC, an entry write and read is according to MAC.

      Every time an entry in the ARP table is read, its last accessed time is reset to the current system time. This ensures that the active ARP entries are not removed.

      Parameters:
        `vid` - the VID identifier
        `layer2DstMacAddrOnly` - arp table type is according to MAC

  - ### Method Detail

    - #### vid

          public VId vid()

      Description copied from interface: `ARPTable`
      Returns the VID identifier for the ARP table.
      Specified by:
        `vid` in interface `ARPTable`
      Returns:
        the VID identifier

    - #### size

          public int size()

      Description copied from interface: `ARPTable`
      Returns the size of the ARP table for the VID.
      Specified by:
        `size` in interface `ARPTable`
      Returns:
        the size of the ARP table

    - #### arpEntries

          public Set<ARPEntry> arpEntries()

      Description copied from interface: `ARPTable`
      Returns the set of ARP translations for the VID.
      Specified by:
        `arpEntries` in interface `ARPTable`
      Returns:
        The set of ARP entries

    - #### getEntity

          public Entity getEntity(IpAddress ipAddress)

      Returns an entity object for the given IP address.
      Parameters:
        `ipAddress` - IP address for which entity needs to be retrieved
      Returns:
        Entity for an IP Address
      Throws:
        `NullPointerException` - if IP address is null or entry is not found

    - #### getEntity

          public Entity getEntity(MacAddress mac)

      Returns an entity object for the given MAC address.
      Parameters:
        `mac` - MAC address for which entity needs to be retrieved
      Returns:
        Entity for an MAC Address
      Throws:
        `NullPointerException` - if MAC address is null or entry is not found

    - #### getEntities

          public Set<Entity> getEntities()

      Returns a set of entity objects from the ARP table.
      Returns:
        set of entity objects

    - #### getNetworkNodes

          public Set<NetworkNode> getNetworkNodes()

      Returns the set of end nodes from the ARP table.
      Returns:
        set of network nodes from ARP table

    - #### getMacAddress

          public MacAddress getMacAddress(IpAddress ipAddress)

      Returns the MAC address for the given IP address.
      Parameters:
        `ipAddress` - IP address
      Returns:
        the corresponding MAC Address
      Throws:
        `NullPointerException` - if the parameter is null

    - #### addARPTableEntry

          public void addARPTableEntry(Entity entity)

      Adds the entity to the ARP table.
      Parameters:
        `entity` - entity to be added to the table
      Throws:
        `NullPointerException` - if the parameter is null

    - #### replaceARPEntry

          public void replaceARPEntry(Entity oldArpEntry,
                             Entity newArpEntry)

      Updates the entity in the ARP table.
      Parameters:
        `oldArpEntry` - old entity
        `newArpEntry` - new entity
      Throws:
        `NullPointerException` - if the parameter is null

    - #### clearARPTable

          public void clearARPTable()

      Description copied from interface: `ARPTable`
      Clears learned ARP translations for the given VID.
      Specified by:
        `clearARPTable` in interface `ARPTable`

    - #### clearothersARPTable

          public void clearothersARPTable()

      Description copied from interface: `ARPTable`
      Clears learned From Others Which ARP translations for the given VID.
      Specified by:
        `clearothersARPTable` in interface `ARPTable`

    - #### deleteARPEntry

          public void deleteARPEntry(ARPEntry entry)

      Deletes the given entry in the ARP table.
      Parameters:
        `entry` - the ARP entry to delete from the table
      Throws:
        `NullPointerException` - if the parameter is null

    - #### deleteOtherARPEntry

          public void deleteOtherARPEntry(ARPEntry entry)

      Deletes the Others given entry in the ARP table.
      Parameters:
        `entry` - the ARP entry to delete from the table
      Throws:
        `NullPointerException` - if the parameter is null

    - #### arpEntry

          public ARPEntry arpEntry(IpAddress ipAddress)

      Description copied from interface: `ARPTable`
      Returns the ARP translation for a given IP address.
      Specified by:
        `arpEntry` in interface `ARPTable`
      Parameters:
        `ipAddress` - IP address of the end host
      Returns:
        The ARP entry

    - #### networkNode

          public NetworkNode networkNode(IpAddress ipAddress)

      Description copied from interface: `ARPTable`
      Returns the end host for a given IP address.
      Specified by:
        `networkNode` in interface `ARPTable`
      Parameters:
        `ipAddress` - IP address of the end host
      Returns:
        NetworkNode object

    - #### networkNode

          public NetworkNode networkNode(MacAddress mac)

      Description copied from interface: `ARPTable`
      Returns the end host for a given MAC address. added by s03140 for layer2DstMacAddrOnly
      Specified by:
        `networkNode` in interface `ARPTable`
      Parameters:
        `mac` - MAC address of the end host
      Returns:
        NetworkNode object

    - #### addNMAlgoListener

          public void addNMAlgoListener(NMAlgoListener al)

      Attaches the NMAlgoListener instance to the ConcurrentAgingLRUHashMap.
      Parameters:
        `al` - the NMAlgoListener instance

    - #### removeNMAlgoListener

          public void removeNMAlgoListener(NMAlgoListener al)

      Removes the NMAlgoListener instance from the ConcurrentAgingLRUHashMap.
      Parameters:
        `al` - the NMAlgoListener instance

    - #### cleanUp

          public void cleanUp(long age,
                     ConcurrentMap<MacAddress,Set<Object>> conMap)

      Cleans up the aged out entries in the aging HashMap.

      Every time an entry in the ARP table is read, its last accessed time is reset to the current system time. This ensures that the active ARP entries are not removed. The cleanUp method cleans up the ARPEntires for which the difference in time between current system time and the ARP entries last accessed time exceeds the age provided.

      Parameters:
        `age` - the max ageout interval (in milliseconds) for ARP entries

Copyright © 2014. All Rights Reserved.