BMP abstraction for statistics and initiation message

Change-Id: I8bb02194ba022e010a11d7907f8410acffb9d9e4
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpStats.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpStats.java
new file mode 100644
index 0000000..a5c8da5
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpStats.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+
+/**
+ * Abstraction of an entity providing BMP statistics.
+ */
+public interface BmpStats {
+
+    /**
+     * Returns BMP stats type.
+     *
+     * @return BMP stats type
+     */
+    StatsType getStatsType();
+
+    /**
+     * Returns BMP stats length.
+     *
+     * @return BMP BMP stats length
+     */
+    int getStatLen();
+
+    /**
+     * Returns BMP stats value.
+     *
+     * @return BMP stats value
+     */
+    long getValue();
+}
\ No newline at end of file
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpVersion.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpVersion.java
new file mode 100644
index 0000000..da02d0a
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/BmpVersion.java
@@ -0,0 +1,68 @@
+/*
+ * 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 BMP Message Version.
+ */
+public enum BmpVersion {
+
+    BMP_3(3);
+
+    public final int packetVersion;
+
+    /**
+     * Assign BMP PacketVersion with specified packetVersion.
+     *
+     * @param packetVersion version of BMP
+     */
+    BmpVersion(final int packetVersion) {
+        this.packetVersion = packetVersion;
+    }
+
+    /**
+     * Returns Packet version of BMP Message.
+     *
+     * @return packetVersion
+     */
+    public int getPacketVersion() {
+        return packetVersion;
+    }
+
+    private static Map<Integer, BmpVersion> parser = new ConcurrentHashMap<>();
+
+    static {
+        Arrays.stream(BmpVersion.values()).forEach(v -> parser.put(v.packetVersion, v));
+    }
+
+    public static BmpVersion getVersion(int version) throws DeserializationException {
+        if (version != 3) {
+            throw new DeserializationException("Invalid bmp version");
+        }
+        return Optional.of(version)
+                .filter(id -> parser.containsKey(id))
+                .map(id -> parser.get(id))
+                .orElse(BMP_3);
+    }
+}
\ No newline at end of file
diff --git a/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/InitiationMessage.java b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/InitiationMessage.java
new file mode 100644
index 0000000..df48cba
--- /dev/null
+++ b/apps/bgpmonitoring/api/src/main/java/org/onosproject/bgpmonitoring/InitiationMessage.java
@@ -0,0 +1,36 @@
+/*
+ * 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 initiation message.
+ */
+public abstract class InitiationMessage extends BmpMessage {
+
+    public static final int INIT_MSG_NOTIFICATION_HEADER_MIN_LENGTH = 4;
+
+    /**
+     * Returns BMP initiation message.
+     *
+     * @return BMP initiation message
+     */
+    public abstract List<BmpMsg> getInitiationMeassages();
+
+}
\ No newline at end of file