Implement BGP Prefix Listener for BGP Controler

Change-Id: I8cbb43df45104e5cfd7dc7aa7225e5bf99a8ee37
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
index a8520ce..4620d18 100644
--- a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
@@ -151,6 +151,27 @@
     Set<BgpLinkListener> linkListener();
 
     /**
+     * Register a listener for BGP Prefix message events.
+     *
+     * @param listener the listener to notify
+     */
+    void addPrefixListener(BgpPrefixListener listener);
+
+    /**
+     * Unregister a listener for BGP Prefix message events.
+     *
+     * @param listener the listener to unregister
+     */
+    void removePrefixListener(BgpPrefixListener listener);
+
+    /**
+     * Returns set of BGP prefix listeners.
+     *
+     * @return set of BGP prefix listeners
+     */
+    Set<BgpPrefixListener> prefixListener();
+
+    /**
      * Stores the exceptions occurred during an active session.
      *
      * @param peerId BGP peer id
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPrefixListener.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPrefixListener.java
new file mode 100644
index 0000000..c047921
--- /dev/null
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPrefixListener.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019-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.bgp.controller;
+
+import org.onosproject.bgpio.exceptions.BgpParseException;
+import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4;
+import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
+
+/**
+ * Allows for providers interested in bgp prefix events to be notified.
+ */
+public interface BgpPrefixListener {
+
+    /**
+     * Notify that prefix was added or updated.
+     *
+     * @param prefixNlri BGP prefix NLRI
+     * @param details path attributes and NLRI information
+     * @throws BgpParseException BGP parse exception
+     */
+    void addPrefix(BgpPrefixIPv4LSNlriVer4 prefixNlri, PathAttrNlriDetails details) throws BgpParseException;
+
+    /**
+     * Notify that prefix was removed.
+     *
+     * @param prefixNlri BGP prefix NLRI
+     * @throws BgpParseException BGP parse exception
+     */
+    void deletePrefix(BgpPrefixIPv4LSNlriVer4 prefixNlri) throws BgpParseException;
+}