Skip to content
Snippets Groups Projects
Commit d2ac3172 authored by Gregor Maier's avatar Gregor Maier
Browse files

Add IDevice.getEntities().

parent d848660f
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,9 @@ package net.floodlightcontroller.devicemanager;
import java.util.Date;
import net.floodlightcontroller.devicemanager.internal.Entity;
/**
* Represents an independent device on the network. A device consists of a
* set of entities, and all the information known about a given device comes
......@@ -83,7 +86,12 @@ public interface IDevice {
* Get the entity class for the device.
* @return the entity class
* @see IEntityClassifierService
* @see IDeviceService#setEntityClassifier(IEntityClassifierService)
*/
public IEntityClass getEntityClass();
/**
* Get the list of entities for this device
* @return
*/
public Entity[] getEntities();
}
......@@ -183,11 +183,11 @@ public class Device implements IDevice {
while (devices.hasNext()) {
Device d = devices.next();
for (Entity se : d.entities) {
if (se.ipv4Address != null &&
se.ipv4Address.equals(e.ipv4Address) &&
se.lastSeenTimestamp != null &&
0 < se.lastSeenTimestamp.
compareTo(e.lastSeenTimestamp)) {
if (se.getIpv4Address() != null &&
se.getIpv4Address().equals(e.getIpv4Address()) &&
se.getLastSeenTimestamp() != null &&
0 < se.getLastSeenTimestamp().
compareTo(e.getLastSeenTimestamp())) {
validIP = false;
break;
}
......@@ -256,7 +256,7 @@ public class Device implements IDevice {
)
continue;
long curCluster =
topology.getL2DomainId(cur.switchDPID);
topology.getL2DomainId(cur.getSwitchDPID());
if (prevCluster != curCluster) {
prev = null;
latestLastSeen = 0;
......@@ -367,10 +367,12 @@ public class Device implements IDevice {
// Getters/Setters
// ***************
@Override
public IEntityClass getEntityClass() {
return entityClass;
}
@Override
public Entity[] getEntities() {
return entities;
}
......
......@@ -171,7 +171,7 @@ public class Entity implements Comparable<Entity> {
public void setActiveSince(Date activeSince) {
this.activeSince = activeSince;
}
@Override
public int hashCode() {
if (hashCode != 0) return hashCode;
......
......@@ -5,6 +5,7 @@ import java.util.EnumSet;
import net.floodlightcontroller.devicemanager.IDeviceService;
import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField;
/**
* This is a thin wrapper around {@link Entity} that allows overriding
* the behavior of {@link Object#hashCode()} and {@link Object#equals(Object)}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment