tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.device; |
| 2 | |
| 3 | import org.onlab.onos.event.AbstractEvent; |
| 4 | import org.onlab.onos.net.Device; |
| 5 | |
| 6 | /** |
| 7 | * Describes infrastructure device event. |
| 8 | */ |
| 9 | public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> { |
| 10 | |
| 11 | /** |
| 12 | * Type of device events. |
| 13 | */ |
| 14 | public enum Type { |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 15 | /** |
| 16 | * Signifies that a new device has been detected. |
| 17 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 18 | DEVICE_ADDED, |
| 19 | |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 20 | /** |
tom | e5ec3fd | 2014-09-04 15:18:06 -0700 | [diff] [blame^] | 21 | * Signifies that some device attributes have changed; excludes |
| 22 | * availability changes. |
| 23 | */ |
| 24 | DEVICE_UPDATED, |
| 25 | |
| 26 | /** |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 27 | * Signifies that a device has been removed. |
| 28 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 29 | DEVICE_REMOVED, |
| 30 | |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 31 | /** |
| 32 | * Signifies that a device has been administratively suspended. |
| 33 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 34 | DEVICE_SUSPENDED, |
| 35 | |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Signifies that a device has come online or has gone offline. |
| 38 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 39 | 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 | /** |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 49 | * Creates an event of a given type and for the specified device and the |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 50 | * current time. |
| 51 | * |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 52 | * @param type device event type |
| 53 | * @param device event device subject |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 54 | */ |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 55 | public DeviceEvent(Type type, Device device) { |
| 56 | super(type, device); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | /** |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 60 | * Creates an event of a given type and for the specified device and time. |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 61 | * |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 62 | * @param type device event type |
| 63 | * @param device event device subject |
| 64 | * @param time occurrence time |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 65 | */ |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 66 | public DeviceEvent(Type type, Device device, long time) { |
| 67 | super(type, device, time); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | } |