Implement DeviceImpl and Path class, and minor change
Change-Id: I666d6d7e00620220048c5f8031a7c7c149ec89cd
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
new file mode 100644
index 0000000..09597a1
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/DeviceImpl.java
@@ -0,0 +1,58 @@
+package net.onrc.onos.ofcontroller.networkgraph;
+
+import java.net.InetAddress;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import net.floodlightcontroller.util.MACAddress;
+
+/**
+ * @author Toshio Koide (t-koide@onlab.us)
+ */
+public class DeviceImpl implements Device {
+ LinkedList<Port> attachmentPoints = new LinkedList<Port>();
+ MACAddress macAddr;
+
+ public DeviceImpl(NetworkGraph graph, MACAddress macAddr) {
+ this.macAddr = macAddr;
+ }
+
+ @Override
+ public MACAddress getMacAddress() {
+ return macAddr;
+ }
+
+ @Override
+ public Collection<InetAddress> getIpAddress() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @return ports attached to the device.
+ * The last added port is stored as the first element.
+ */
+ @Override
+ public Iterable<Port> getAttachmentPoints() {
+ return attachmentPoints;
+ }
+
+ @Override
+ public long getLastSeenTime() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public void addAttachmentPoint(Port port) {
+ attachmentPoints.add(0, port);
+ }
+
+ public void removeAttachmentPoint(Port port) {
+ attachmentPoints.remove(port);
+ }
+
+ @Override
+ public String toString() {
+ return macAddr.toString();
+ }
+}