Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.CopyOnWriteArrayList<AttachmentPoint> |
attachmentPoints
The current attachment points for the device.
|
protected java.lang.Long |
deviceKey |
protected Entity[] |
entities |
protected IEntityClass |
entityClass |
(package private) static java.util.EnumSet<IDeviceService.DeviceField> |
ipv4Fields |
protected java.lang.String |
macAddressString |
protected java.util.concurrent.CopyOnWriteArrayList<AttachmentPoint> |
oldAPs
The old attachment points for the device that were valid
no more than INACTIVITY_TIME ago.
|
Modifier | Constructor and Description |
---|---|
|
Device(Device device,
Entity newEntity)
Constructs a new device consisting of the entities from the old device
plus an additional entity.
|
|
Device(java.lang.Long deviceKey,
java.util.Collection<AttachmentPoint> oldAPs,
java.util.Collection<AttachmentPoint> attachmentPoints,
java.util.Collection<Entity> entities,
IEntityClass entityClass)
Creates a device from a set of entities.
|
private |
Device(java.lang.Long deviceKey,
Entity entity,
IEntityClass entityClass,
java.util.Collection<AttachmentPoint> attachmentPoints)
Creates a device from an entities.
|
Modifier and Type | Method and Description |
---|---|
static Device |
allocateDevice(java.lang.Long deviceKey,
Entity entity,
IEntityClass entityClass) |
boolean |
deleteAttachmentPoint(long sw)
Deletes attachment points of the given switch from the list of attachment
points and oldAPs.
|
boolean |
deleteAttachmentPoint(long sw,
short port)
Deletes (sw,port) from the list of list of attachment points and oldAPs.
|
protected int |
entityIndex(Entity entity)
Checks whether the device contains the specified entity.
|
boolean |
equals(java.lang.Object obj) |
private java.util.Map<java.lang.Long,AttachmentPoint> |
getAPMap(java.util.List<AttachmentPoint> apList)
Given a list of attachment points, the procedure would return
a map of attachment points for each L2 domain.
|
SwitchPort[] |
getAttachmentPoints()
Gets all unique attachment points associated with the device.
|
SwitchPort[] |
getAttachmentPoints(boolean includeError)
Gets all unique attachment points associated with the device.
|
java.lang.Long |
getDeviceKey()
Gets the primary key for this device.
|
private java.util.List<AttachmentPoint> |
getDuplicateAttachmentPoints(java.util.List<AttachmentPoint> oldAPList,
java.util.Map<java.lang.Long,AttachmentPoint> apMap)
Gets a list of duplicate attachment points, given a list of old attachment
points and one attachment point per L2 domain.
|
Entity[] |
getEntities() |
IEntityClass |
getEntityClass()
Gets the entity class for the device.
|
java.lang.Integer[] |
getIPv4Addresses()
Gets all unique IPv4 addresses associated with the device.
|
java.util.Date |
getLastSeen()
Gets the most recent timestamp for this device.
|
long |
getMACAddress()
Gets the MAC address of the device as a Long value.
|
java.lang.String |
getMACAddressString()
Gets the MAC address of the device as a String value.
|
java.lang.Short[] |
getSwitchPortVlanIds(SwitchPort swp)
Returns all unique VLAN IDs for the device that were observed on
the given switch port.
|
java.lang.Short[] |
getVlanId()
Gets all unique VLAN IDs for the device.
|
int |
hashCode() |
private boolean |
removeExpiredAttachmentPoints(java.util.List<AttachmentPoint> apList)
Removes all attachment points that are older than
AttachmentPoint.INACTIVITY_INTERVAL
from the list. |
java.lang.String |
toString() |
protected boolean |
updateAttachmentPoint()
Updates the known attachment points.
|
boolean |
updateAttachmentPoint(long sw,
short port,
long lastSeen)
Updates the list of attachment points given that a new packetin
was seen from (sw, port) at time (lastSeen).
|
protected final java.lang.Long deviceKey
protected final Entity[] entities
protected final IEntityClass entityClass
protected final java.lang.String macAddressString
protected final java.util.concurrent.CopyOnWriteArrayList<AttachmentPoint> oldAPs
protected final java.util.concurrent.CopyOnWriteArrayList<AttachmentPoint> attachmentPoints
static final java.util.EnumSet<IDeviceService.DeviceField> ipv4Fields
private Device(java.lang.Long deviceKey, Entity entity, IEntityClass entityClass, java.util.Collection<AttachmentPoint> attachmentPoints)
deviceKey
- the unique identifier for this device objectentity
- the initial entity for the deviceentityClass
- the entity classes associated with the entitypublic Device(java.lang.Long deviceKey, java.util.Collection<AttachmentPoint> oldAPs, java.util.Collection<AttachmentPoint> attachmentPoints, java.util.Collection<Entity> entities, IEntityClass entityClass)
deviceKey
- the unique identifier for this device objectoldAPs
- old attachment points for the deviceattachmentPoints
- current attachment points for the deviceentities
- the initial entities for the deviceentityClass
- the entity class associated with the entitiespublic static Device allocateDevice(java.lang.Long deviceKey, Entity entity, IEntityClass entityClass)
private java.util.Map<java.lang.Long,AttachmentPoint> getAPMap(java.util.List<AttachmentPoint> apList)
apList
- a list of attachment pointsprivate boolean removeExpiredAttachmentPoints(java.util.List<AttachmentPoint> apList)
AttachmentPoint.INACTIVITY_INTERVAL
from the list.apList
- the list of attachment pointsprivate java.util.List<AttachmentPoint> getDuplicateAttachmentPoints(java.util.List<AttachmentPoint> oldAPList, java.util.Map<java.lang.Long,AttachmentPoint> apMap)
AttachmentPoint.INACTIVITY_INTERVAL
oldAPList
- a list of old attachment pointsapMap
- a map of attachment points for each L2 domainprotected boolean updateAttachmentPoint()
public boolean updateAttachmentPoint(long sw, short port, long lastSeen)
sw
- the switch that received packetinport
- the switch port that received packetinlastSeen
- the timestamp we observed on the networkpublic boolean deleteAttachmentPoint(long sw, short port)
sw
- a switch to deleteport
- a switch port to deletepublic boolean deleteAttachmentPoint(long sw)
sw
- a switch to deletepublic SwitchPort[] getAttachmentPoints()
IDevice
getAttachmentPoints
in interface IDevice
public SwitchPort[] getAttachmentPoints(boolean includeError)
IDevice
getAttachmentPoints
in interface IDevice
includeError
- whether to include blocked attachment points.
Blocked attachment points should not be used for forwarding,
but could be useful to show to a userpublic java.lang.Long getDeviceKey()
IDevice
getDeviceKey
in interface IDevice
public long getMACAddress()
IDevice
getMACAddress
in interface IDevice
public java.lang.String getMACAddressString()
IDevice
getMACAddressString
in interface IDevice
public java.lang.Short[] getVlanId()
IDevice
public java.lang.Integer[] getIPv4Addresses()
IDevice
getIPv4Addresses
in interface IDevice
public java.lang.Short[] getSwitchPortVlanIds(SwitchPort swp)
IDevice
getSwitchPortVlanIds
in interface IDevice
swp
- the switch port to querypublic java.util.Date getLastSeen()
IDevice
getLastSeen
in interface IDevice
public IEntityClass getEntityClass()
IDevice
getEntityClass
in interface IDevice
IEntityClassifierService
public Entity[] getEntities()
protected int entityIndex(Entity entity)
entity
- the entity to search forpublic 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