ONOS-5682 Introduced VIRTUAL_DEVICE_* events.
Change-Id: I42354c2168775b59c6ca515ac114f0ca31e3bf98
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java
index 6c2727d..7fde1e3 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java
@@ -45,18 +45,44 @@
/**
* Signifies that a virtual network was removed.
*/
- NETWORK_REMOVED
+ NETWORK_REMOVED,
+ /**
+ * Signifies that a new virtual network device was added.
+ */
+ VIRTUAL_DEVICE_ADDED,
+ /**
+ * Signifies that a virtual network device was updated.
+ */
+ VIRTUAL_DEVICE_UPDATED,
+ /**
+ * Signifies that a virtual network device was removed.
+ */
+ VIRTUAL_DEVICE_REMOVED
}
+ private final VirtualDevice virtualDevice;
+
/**
- * Creates an event of a given type and for the specified subject and the
- * current time.
+ * Creates an event of a given type and for the specified subject.
*
* @param type event type
* @param subject event subject
*/
public VirtualNetworkEvent(Type type, NetworkId subject) {
+ this(type, subject, null);
+ }
+
+ /**
+ * Creates an event of a given type and for the specified subject and the
+ * virtual device.
+ *
+ * @param type event type
+ * @param subject event subject
+ * @param virtualDevice virtual device
+ */
+ public VirtualNetworkEvent(Type type, NetworkId subject, VirtualDevice virtualDevice) {
super(type, subject);
+ this.virtualDevice = virtualDevice;
}
/**
@@ -67,6 +93,29 @@
* @param time occurrence time
*/
public VirtualNetworkEvent(Type type, NetworkId subject, long time) {
+ this(type, subject, null, time);
+ }
+
+ /**
+ * Creates an event of a given type and for the specified subject, virtual device and time.
+ *
+ * @param type device event type
+ * @param subject event subject
+ * @param virtualDevice virtual device
+ * @param time occurrence time
+ */
+ public VirtualNetworkEvent(Type type, NetworkId subject, VirtualDevice virtualDevice, long time) {
super(type, subject, time);
+ this.virtualDevice = virtualDevice;
+ }
+
+ /**
+ * Returns virtual device affected by event - may be null (for events relating to
+ * tenants and virtual networks).
+ *
+ * @return virtual device
+ */
+ public VirtualDevice virtualDevice() {
+ return virtualDevice;
}
}