blob: a69b57af367be8de21502b8db41c613d414e5841 [file] [log] [blame]
Yuta HIGUCHI54ab8cd2014-02-11 09:43:34 -08001package net.onrc.onos.ofcontroller.networkgraph;
2
3import java.net.InetAddress;
4import java.util.HashSet;
5import java.util.LinkedList;
6import java.util.List;
7import java.util.Set;
8
9import net.floodlightcontroller.util.MACAddress;
10import net.onrc.onos.ofcontroller.networkgraph.PortEvent.SwitchPort;
11
12/**
13 * Self-contained Device object for event
14 *
15 * TODO: We probably want common base class/interface for Self-Contained Event Object
16 *
17 */
18public class DeviceEvent {
19 private final MACAddress mac;
20 protected List<SwitchPort> attachmentPoints;
21 protected Set<InetAddress> ipAddresses;
22
23 public DeviceEvent(MACAddress mac) {
24 this.mac = mac;
25 this.attachmentPoints = new LinkedList<>();
26 this.ipAddresses = new HashSet<>();
27 }
28
29 public MACAddress getMac() {
30 return mac;
31 }
32
33 public List<SwitchPort> getAttachmentPoints() {
34 return attachmentPoints;
35 }
36
37 public void setAttachmentPoints(List<SwitchPort> attachmentPoints) {
38 this.attachmentPoints = attachmentPoints;
39 }
40
41 boolean addIpAddress(InetAddress addr) {
42 return this.ipAddresses.add(addr);
43 }
44
45 boolean removeIpAddress(InetAddress addr) {
46 return this.ipAddresses.remove(addr);
47 }
48
49 @Override
50 public String toString() {
51 return "[DeviceEvent " + mac + " attachmentPoints:" + attachmentPoints + " ipAddr:" + ipAddresses + "]";
52 }
53
54
55}