blob: 250e14058a2cd34b65147e638dae357b999da2a9 [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 /**
21 * Signifies that a device has been removed.
22 */
tome33cc1a2014-08-25 21:59:41 -070023 DEVICE_REMOVED,
24
tom64b7aac2014-08-26 00:18:21 -070025 /**
26 * Signifies that a device has been administratively suspended.
27 */
tome33cc1a2014-08-25 21:59:41 -070028 DEVICE_SUSPENDED,
29
tom64b7aac2014-08-26 00:18:21 -070030 /**
31 * Signifies that a device has come online or has gone offline.
32 */
tome33cc1a2014-08-25 21:59:41 -070033 DEVICE_AVAILABILITY_CHANGED,
34
35 /**
36 * Signifies that the current controller instance relationship has
37 * changed with respect to a device.
38 */
39 DEVICE_MASTERSHIP_CHANGED
40 }
41
42 /**
tom64b7aac2014-08-26 00:18:21 -070043 * Creates an event of a given type and for the specified device and the
tome33cc1a2014-08-25 21:59:41 -070044 * current time.
45 *
tom64b7aac2014-08-26 00:18:21 -070046 * @param type device event type
47 * @param device event device subject
tome33cc1a2014-08-25 21:59:41 -070048 */
tom64b7aac2014-08-26 00:18:21 -070049 public DeviceEvent(Type type, Device device) {
50 super(type, device);
tome33cc1a2014-08-25 21:59:41 -070051 }
52
53 /**
tom64b7aac2014-08-26 00:18:21 -070054 * Creates an event of a given type and for the specified device and time.
tome33cc1a2014-08-25 21:59:41 -070055 *
tom64b7aac2014-08-26 00:18:21 -070056 * @param type device event type
57 * @param device event device subject
58 * @param time occurrence time
tome33cc1a2014-08-25 21:59:41 -070059 */
tom64b7aac2014-08-26 00:18:21 -070060 public DeviceEvent(Type type, Device device, long time) {
61 super(type, device, time);
tome33cc1a2014-08-25 21:59:41 -070062 }
63
64}