Adding ServerSentEvents to Rest Southbound interface

Change-Id: I77411df608be8a1cab9d828db17202f88b969a0f
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
index ada5496..0f5b32b 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/http/HttpSBController.java
@@ -18,8 +18,10 @@
 
 import java.io.InputStream;
 import java.util.Map;
+import java.util.function.Consumer;
 
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.sse.InboundSseEvent;
 
 import org.onlab.packet.IpAddress;
 import org.onosproject.net.DeviceId;
@@ -125,7 +127,8 @@
     InputStream get(DeviceId device, String request, MediaType mediaType);
 
     /**
-     * Does a HTTP POST request with specified parameters to the device.
+     * Does a HTTP POST request with specified parameters to the device and
+     * extracts an object of type T from the response entity field.
      *
      * @param <T> post return type
      * @param device device to make the request to
@@ -138,5 +141,27 @@
      */
      <T> T post(DeviceId device, String request, InputStream payload, MediaType mediaType, Class<T> responseClass);
 
+    /**
+     * Does a HTTP GET against a Server Sent Events (SSE_INBOUND) resource on the device.
+     *
+     * This is a low level function that can take callbacks.
+     * For a higher level function that emits events based on this callback
+     * see startServerSentEvents() in the RestSBController
+     *
+     * @param deviceId device to make the request to
+     * @param request url of the request
+     * @param onEvent A consumer of inbound SSE_INBOUND events
+     * @param onError A consumer of inbound SSE_INBOUND errors
+     * @return status Commonly used status codes defined by HTTP
+     */
+     int getServerSentEvents(DeviceId deviceId, String request,
+                             Consumer<InboundSseEvent> onEvent, Consumer<Throwable> onError);
 
+    /**
+     * Cancels a Server Sent Events listener to a device.
+     *
+     * @param deviceId device to cancel the listener for
+     * @return status Commonly used status codes defined by HTTP
+     */
+    int cancelServerSentEvents(DeviceId deviceId);
 }