Add events to DHCP L2 relay application.
The app will send events regarding the DHCP state machine.
Change-Id: I0a20d74e1a1f3b5359509611e9cf1f59495153d5
diff --git a/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java b/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java
new file mode 100644
index 0000000..364197d
--- /dev/null
+++ b/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencord.dhcpl2relay;
+
+import org.onosproject.event.AbstractEvent;
+import org.onosproject.net.ConnectPoint;
+
+/**
+ * Dhcp L2 relay event.
+ */
+public class DhcpL2RelayEvent extends AbstractEvent<DhcpL2RelayEvent.Type, DhcpAllocationInfo> {
+
+ private final ConnectPoint connectPoint;
+
+ /**
+ * Type of the event.
+ */
+ public enum Type {
+ /**
+ * DHCP lease was updated.
+ */
+ UPDATED,
+
+ /**
+ * DHCP lease was removed.
+ */
+ REMOVED
+ }
+
+ /**
+ * Creates a new event.
+ *
+ * @param type type of the event
+ * @param allocationInfo DHCP allocation info
+ * @param connectPoint connect point the client is on
+ */
+ public DhcpL2RelayEvent(Type type, DhcpAllocationInfo allocationInfo, ConnectPoint connectPoint) {
+ super(type, allocationInfo);
+ this.connectPoint = connectPoint;
+ }
+
+ /**
+ * Gets the DHCP client connect point.
+ *
+ * @return connect point
+ */
+ public ConnectPoint connectPoint() {
+ return connectPoint;
+ }
+}