Reimplemented the ProxyArp app on top of the NeighbourResolutionService.

Also some small API changes to track app ID of handler registrations, and
improved interface matching in NeighbourPacketManager.

Added CLI to view handler registrations.

Change-Id: I8cd0b91a16d9ec60287b65f9d8fc5e3cd87560e8
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/neighbour/NeighbourResolutionService.java b/incubator/api/src/main/java/org/onosproject/incubator/net/neighbour/NeighbourResolutionService.java
index 94401cc..4e4adb9 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/neighbour/NeighbourResolutionService.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/neighbour/NeighbourResolutionService.java
@@ -17,9 +17,13 @@
 package org.onosproject.incubator.net.neighbour;
 
 import com.google.common.annotations.Beta;
+import org.onosproject.core.ApplicationId;
 import org.onosproject.incubator.net.intf.Interface;
 import org.onosproject.net.ConnectPoint;
 
+import java.util.Collection;
+import java.util.Map;
+
 /**
  * Provides a means of registering logic for handling neighbour messages.
  */
@@ -32,8 +36,10 @@
      *
      * @param connectPoint connect point
      * @param handler neighbour message handler
+     * @param appId application ID
      */
-    void registerNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler);
+    void registerNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler,
+                                  ApplicationId appId);
 
     /**
      * Registers a neighbour message handler for all neighbour messages incoming
@@ -42,8 +48,10 @@
      *
      * @param intf interface
      * @param handler neighbour message handler
+     * @param appId application ID
      */
-    void registerNeighbourHandler(Interface intf, NeighbourMessageHandler handler);
+    void registerNeighbourHandler(Interface intf, NeighbourMessageHandler handler,
+                                  ApplicationId appId);
 
     /**
      * Unregisters a neighbour message handler that was assigned to a connect
@@ -51,14 +59,34 @@
      *
      * @param connectPoint connect point
      * @param handler neighbour message handler
+     * @param appId application ID
      */
-    void unregisterNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler);
+    void unregisterNeighbourHandler(ConnectPoint connectPoint, NeighbourMessageHandler handler,
+                                    ApplicationId appId);
 
     /**
      * Unregisters a neighbour message handler that was assigned to an interface.
      *
      * @param intf interface
      * @param handler neighbour message handler
+     * @param appId application ID
      */
-    void unregisterNeighbourHandler(Interface intf, NeighbourMessageHandler handler);
+    void unregisterNeighbourHandler(Interface intf, NeighbourMessageHandler handler,
+                                    ApplicationId appId);
+
+    /**
+     * Unregisters all neighbour handlers that were registered by the given
+     * application.
+     *
+     * @param appId application ID
+     */
+    void unregisterNeighbourHandlers(ApplicationId appId);
+
+    /**
+     * Gets the neighbour message handlers that have been registered with the
+     * service.
+     *
+     * @return neighbour message handlers indexed by connect point
+     */
+    Map<ConnectPoint, Collection<NeighbourHandlerRegistration>> getHandlerRegistrations();
 }