BMP statistics message type

Change-Id: I4a23da99df2b3d0b6aa0d8f4b66f8b081fb84abc
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsMessage.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsMessage.java
new file mode 100644
index 0000000..ee12381
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsMessage.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2024-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.onosproject.bgpmonitoring;
+
+import java.util.List;
+
+/**
+ * Abstraction of an BMP statistics report message.
+ */
+public abstract class StatsMessage extends BmpMessage {
+
+    public static final int STATS_REPORT_HEADER_MIN_LENGTH = 4;
+
+    /**
+     * Returns BMP Peer Header of BMP Message.
+     *
+     * @return BMP Peer Header of BMP Message
+     */
+    public abstract PerPeer getPerPeer();
+
+    /**
+     * Returns number of BMP statistics records.
+     *
+     * @return number of BMP statistics records
+     */
+    public abstract int getStatsCount();
+
+    /**
+     * Returns BGP statistics.
+     *
+     * @return BGP statistics
+     */
+    public abstract List<BmpStats> getStats();
+
+}
\ No newline at end of file
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsType.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsType.java
new file mode 100644
index 0000000..780fd7d
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/StatsType.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2024-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.onosproject.bgpmonitoring;
+
+import org.onlab.packet.DeserializationException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Enum to Provide the Different types of BMP stats.
+ */
+public enum StatsType {
+
+    PREFIXES_REJECTED(0),
+
+    DUPLICATE_PREFIX(1),
+
+    DUPLICATE_WITHDRAW(2),
+
+    CLUSTER_LIST(3),
+
+    AS_PATH(4),
+
+    ORIGINATOR_ID(5),
+
+    AS_CONFED(6),
+
+    ADJ_RIB_IN(7),
+
+    LOC_RIB(8),
+
+    ADJ_RIB_IN_AFI_SAFI(9),
+
+    LOC_RIB_AFI_SAFI(10),
+
+    UPDATES_SUBJECTED_WITHDRAW(11),
+
+    PREFIXES_SUBJECTED_WITHDRAW(12),
+
+    DUPLICATE_UPDATE_MESSAGES(13),
+
+    JNX_ADJ_RIB_IN(17);
+
+
+    private final int value;
+
+    /**
+     * Assign value with the value val as the types of BMP stats.
+     *
+     * @param val type of BMP stats
+     */
+    StatsType(int val) {
+        value = val;
+    }
+
+    /**
+     * Returns value as type of BMP stats.
+     *
+     * @return value type of BMP stats
+     */
+    public int getType() {
+        return value;
+    }
+
+    private static Map<Integer, StatsType> parser = new ConcurrentHashMap<>();
+
+    static {
+        Arrays.stream(StatsType.values()).forEach(v -> parser.put(v.value, v));
+    }
+
+    public static StatsType getType(int type) throws DeserializationException {
+        if (type > 2) {
+            throw new DeserializationException("Invalid bmp stats message type");
+        }
+        return Optional.of(type)
+                .filter(id -> parser.containsKey(id))
+                .map(id -> parser.get(id))
+                .orElse(AS_PATH);
+    }
+}
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/TerminationType.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/TerminationType.java
new file mode 100644
index 0000000..82fd340
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/TerminationType.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2024-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.onosproject.bgpmonitoring;
+
+import org.onlab.packet.DeserializationException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Enum to Provide the Different types of BMP termination message.
+ */
+public enum TerminationType {
+
+    UTF8_STRING(0),
+
+    REASON(1);
+
+    private final int value;
+
+    /**
+     * Assign value with the value val as the types of BMP termination message.
+     *
+     * @param val type of BMP termination message
+     */
+    TerminationType(int val) {
+        value = val;
+    }
+
+    /**
+     * Returns value as type of BMP termination message.
+     *
+     * @return value type of BMP termination message
+     */
+    public int getType() {
+        return value;
+    }
+
+
+    private static Map<Integer, TerminationType> parser = new ConcurrentHashMap<>();
+
+    static {
+        Arrays.stream(TerminationType.values()).forEach(v -> parser.put(v.value, v));
+    }
+
+    public static TerminationType getType(int type) throws DeserializationException {
+        if (type > 2) {
+            throw new DeserializationException("Invalid bmp termination message type");
+        }
+        return Optional.of(type)
+                .filter(id -> parser.containsKey(id))
+                .map(id -> parser.get(id))
+                .orElse(REASON);
+    }
+
+}