Change for device discovery on new-data model.
RcDevice is not implemented completely.
It is temporary implementation until all device archtecture is decicded.
Change-Id: Iea73bddbf859b869312d2590e0f31a18bd31aaf5
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
index 2b8930b..8f46f31 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
@@ -17,38 +17,42 @@
private final MACAddress macAddr;
protected LinkedList<Port> attachmentPoints;
protected Set<InetAddress> ipAddresses;
+ private long lastSeenTime;
public DeviceImpl(NetworkGraph graph, MACAddress mac) {
- super(graph);
- this.macAddr = mac;
- this.attachmentPoints = new LinkedList<>();
- this.ipAddresses = new HashSet<>();
+ super(graph);
+ this.macAddr = mac;
+ this.attachmentPoints = new LinkedList<>();
+ this.ipAddresses = new HashSet<>();
}
@Override
public MACAddress getMacAddress() {
- return this.macAddr;
+ return this.macAddr;
}
@Override
public Collection<InetAddress> getIpAddress() {
- return Collections.unmodifiableSet(ipAddresses);
+ return Collections.unmodifiableSet(ipAddresses);
}
@Override
public Iterable<Port> getAttachmentPoints() {
- return Collections.unmodifiableList(this.attachmentPoints);
+ return Collections.unmodifiableList(this.attachmentPoints);
}
@Override
public long getLastSeenTime() {
- // TODO Auto-generated method stub
- return 0;
+ return lastSeenTime;
}
@Override
public String toString() {
- return macAddr.toString();
+ return macAddr.toString();
+ }
+
+ void setLastSeenTime(long lastSeenTime) {
+ this.lastSeenTime = lastSeenTime;
}
/**
@@ -56,8 +60,8 @@
* @param p
*/
void addAttachmentPoint(Port p) {
- this.attachmentPoints.remove(p);
- this.attachmentPoints.addFirst(p);
+ this.attachmentPoints.remove(p);
+ this.attachmentPoints.addFirst(p);
}
/**
@@ -65,7 +69,7 @@
* @param p
*/
boolean removeAttachmentPoint(Port p) {
- return this.attachmentPoints.remove(p);
+ return this.attachmentPoints.remove(p);
}
/**
@@ -73,7 +77,7 @@
* @param p
*/
boolean addIpAddress(InetAddress addr) {
- return this.ipAddresses.add(addr);
+ return this.ipAddresses.add(addr);
}
/**
@@ -81,6 +85,6 @@
* @param p
*/
boolean removeIpAddress(InetAddress addr) {
- return this.ipAddresses.remove(addr);
+ return this.ipAddresses.remove(addr);
}
}