[SEBA-144] Operational Status DHCP L2 Relay.
Cherry-picked from dhcpl2relay-1.6
Change-Id: I58aab083152793af36dfd34fa91cd78385fd2ed7
Signed-off-by: Marcos Aurelio Carrero <mcarrero@furukawalatam.com>
diff --git a/api/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java b/api/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java
index 364197d..596fb6c 100644
--- a/api/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java
+++ b/api/src/main/java/org/opencord/dhcpl2relay/DhcpL2RelayEvent.java
@@ -19,13 +19,24 @@
import org.onosproject.event.AbstractEvent;
import org.onosproject.net.ConnectPoint;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
* Dhcp L2 relay event.
*/
public class DhcpL2RelayEvent extends AbstractEvent<DhcpL2RelayEvent.Type, DhcpAllocationInfo> {
+ public static final String GLOBAL_COUNTER = "global";
+
private final ConnectPoint connectPoint;
+ private final Map.Entry<String, AtomicLong> countersEntry;
+
+ private final String dhcpCountersTopic;
+
+ private final String subscriberId;
+
/**
* Type of the event.
*/
@@ -38,7 +49,32 @@
/**
* DHCP lease was removed.
*/
- REMOVED
+ REMOVED,
+
+ /**
+ * DHCP stats update.
+ */
+ STATS_UPDATE
+ }
+
+ /**
+ * Creates a new event used for STATS.
+ *
+ * @param type type of the event
+ * @param allocationInfo DHCP allocation info
+ * @param connectPoint connect point the client is on
+ * @param countersEntry an entry that represents the counters (used for STATS events)
+ * @param dhcpCountersTopic Kafka topic where the dhcp counters are published
+ * @param subscriberId the subscriber identifier information
+ */
+ public DhcpL2RelayEvent(Type type, DhcpAllocationInfo allocationInfo, ConnectPoint connectPoint,
+ Map.Entry<String, AtomicLong> countersEntry,
+ String dhcpCountersTopic, String subscriberId) {
+ super(type, allocationInfo);
+ this.connectPoint = connectPoint;
+ this.countersEntry = countersEntry;
+ this.dhcpCountersTopic = dhcpCountersTopic;
+ this.subscriberId = subscriberId;
}
/**
@@ -51,6 +87,9 @@
public DhcpL2RelayEvent(Type type, DhcpAllocationInfo allocationInfo, ConnectPoint connectPoint) {
super(type, allocationInfo);
this.connectPoint = connectPoint;
+ this.countersEntry = null;
+ this.dhcpCountersTopic = null;
+ this.subscriberId = null;
}
/**
@@ -61,4 +100,31 @@
public ConnectPoint connectPoint() {
return connectPoint;
}
+
+ /**
+ * Gets the counters map entry.
+ *
+ * @return counters map entry
+ */
+ public Map.Entry<String, AtomicLong> getCountersEntry() {
+ return countersEntry;
+ }
+
+ /**
+ * Gets the Kafka topic where the dhcp counters are published.
+ *
+ * @return the dhcp kafka topic
+ */
+ public String getDhcpCountersTopic() {
+ return dhcpCountersTopic;
+ }
+
+ /**
+ * Gets the subscriber identifier information.
+ *
+ * @return the Id from subscriber
+ */
+ public String getSubscriberId() {
+ return subscriberId;
+ }
}