blob: 09597a1ea3cf9db2fee1c31df0ae7482e62edb05 [file] [log] [blame]
Toshio Koide5799b602014-02-10 15:29:06 -08001package net.onrc.onos.ofcontroller.networkgraph;
2
3import java.net.InetAddress;
4import java.util.Collection;
5import java.util.LinkedList;
6
7import net.floodlightcontroller.util.MACAddress;
8
9/**
10 * @author Toshio Koide (t-koide@onlab.us)
11 */
12public class DeviceImpl implements Device {
13 LinkedList<Port> attachmentPoints = new LinkedList<Port>();
14 MACAddress macAddr;
15
16 public DeviceImpl(NetworkGraph graph, MACAddress macAddr) {
17 this.macAddr = macAddr;
18 }
19
20 @Override
21 public MACAddress getMacAddress() {
22 return macAddr;
23 }
24
25 @Override
26 public Collection<InetAddress> getIpAddress() {
27 // TODO Auto-generated method stub
28 return null;
29 }
30
31 /**
32 * @return ports attached to the device.
33 * The last added port is stored as the first element.
34 */
35 @Override
36 public Iterable<Port> getAttachmentPoints() {
37 return attachmentPoints;
38 }
39
40 @Override
41 public long getLastSeenTime() {
42 // TODO Auto-generated method stub
43 return 0;
44 }
45
46 public void addAttachmentPoint(Port port) {
47 attachmentPoints.add(0, port);
48 }
49
50 public void removeAttachmentPoint(Port port) {
51 attachmentPoints.remove(port);
52 }
53
54 @Override
55 public String toString() {
56 return macAddr.toString();
57 }
58}