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 | /** |
| 21 | * Signifies that a device has been removed. |
| 22 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 23 | DEVICE_REMOVED, |
| 24 | |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Signifies that a device has been administratively suspended. |
| 27 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 28 | DEVICE_SUSPENDED, |
| 29 | |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Signifies that a device has come online or has gone offline. |
| 32 | */ |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 33 | 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 | /** |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 43 | * 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] | 44 | * current time. |
| 45 | * |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 46 | * @param type device event type |
| 47 | * @param device event device subject |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 48 | */ |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 49 | public DeviceEvent(Type type, Device device) { |
| 50 | super(type, device); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /** |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 54 | * 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] | 55 | * |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 56 | * @param type device event type |
| 57 | * @param device event device subject |
| 58 | * @param time occurrence time |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 59 | */ |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 60 | public DeviceEvent(Type type, Device device, long time) { |
| 61 | super(type, device, time); |
tom | e33cc1a | 2014-08-25 21:59:41 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | } |