blob: 984f575e7d6a27d392b842509ac9dcd83bd9a28c [file] [log] [blame]
tome33cc1a2014-08-25 21:59:41 -07001package org.onlab.onos.net.device;
2
3import org.onlab.onos.event.AbstractEvent;
4import org.onlab.onos.net.Device;
5
6/**
7 * Describes infrastructure device event.
8 */
9public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> {
10
11 /**
12 * Type of device events.
13 */
14 public enum Type {
tom64b7aac2014-08-26 00:18:21 -070015 /**
16 * Signifies that a new device has been detected.
17 */
tome33cc1a2014-08-25 21:59:41 -070018 DEVICE_ADDED,
19
tom64b7aac2014-08-26 00:18:21 -070020 /**
tome5ec3fd2014-09-04 15:18:06 -070021 * Signifies that some device attributes have changed; excludes
22 * availability changes.
23 */
24 DEVICE_UPDATED,
25
26 /**
tom64b7aac2014-08-26 00:18:21 -070027 * Signifies that a device has been removed.
28 */
tome33cc1a2014-08-25 21:59:41 -070029 DEVICE_REMOVED,
30
tom64b7aac2014-08-26 00:18:21 -070031 /**
32 * Signifies that a device has been administratively suspended.
33 */
tome33cc1a2014-08-25 21:59:41 -070034 DEVICE_SUSPENDED,
35
tom64b7aac2014-08-26 00:18:21 -070036 /**
37 * Signifies that a device has come online or has gone offline.
38 */
tome33cc1a2014-08-25 21:59:41 -070039 DEVICE_AVAILABILITY_CHANGED,
40
41 /**
42 * Signifies that the current controller instance relationship has
43 * changed with respect to a device.
44 */
45 DEVICE_MASTERSHIP_CHANGED
46 }
47
48 /**
tom64b7aac2014-08-26 00:18:21 -070049 * Creates an event of a given type and for the specified device and the
tome33cc1a2014-08-25 21:59:41 -070050 * current time.
51 *
tom64b7aac2014-08-26 00:18:21 -070052 * @param type device event type
53 * @param device event device subject
tome33cc1a2014-08-25 21:59:41 -070054 */
tom64b7aac2014-08-26 00:18:21 -070055 public DeviceEvent(Type type, Device device) {
56 super(type, device);
tome33cc1a2014-08-25 21:59:41 -070057 }
58
59 /**
tom64b7aac2014-08-26 00:18:21 -070060 * Creates an event of a given type and for the specified device and time.
tome33cc1a2014-08-25 21:59:41 -070061 *
tom64b7aac2014-08-26 00:18:21 -070062 * @param type device event type
63 * @param device event device subject
64 * @param time occurrence time
tome33cc1a2014-08-25 21:59:41 -070065 */
tom64b7aac2014-08-26 00:18:21 -070066 public DeviceEvent(Type type, Device device, long time) {
67 super(type, device, time);
tome33cc1a2014-08-25 21:59:41 -070068 }
69
70}