[ONOS-5607] Revise LISP ctrl impl class to track msgs and routers
Change-Id: I4a51a8ef9162e3feee543f40fa92a0435186d1c9
diff --git a/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispController.java b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispController.java
index 5c47109..1a3641d 100644
--- a/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispController.java
+++ b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispController.java
@@ -29,6 +29,13 @@
Iterable<LispRouter> getRouters();
/**
+ * Obtains all subscribed LISP routers known to this LISP controllers.
+ *
+ * @return Iterable of LISP router elements
+ */
+ Iterable<LispRouter> getSubscribedRouters();
+
+ /**
* Obtains the actual router for the given LispRouterId.
*
* @param routerId the router to fetch
diff --git a/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispRouter.java b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispRouter.java
index a6fa99f..5b32853 100644
--- a/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispRouter.java
+++ b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/LispRouter.java
@@ -80,4 +80,47 @@
* @return whether the router is connected
*/
boolean isConnected();
+
+ /**
+ * Sets whether the router is connected.
+ *
+ * @param connected whether the router is connected
+ */
+ void setConnected(boolean connected);
+
+ /**
+ * Checks if the router is subscribed.
+ * As long as a router sends Map-Request message,
+ * we treat the router is subscribed.
+ *
+ * @return whether the router is subscribed
+ */
+ boolean isSubscribed();
+
+ /**
+ * Sets whether the router is subscribed.
+ *
+ * @param subscribed whether the router is subscribed
+ */
+ void setSubscribed(boolean subscribed);
+
+ /**
+ * Sets the LISP agent to be used. This method can only be invoked once.
+ *
+ * @param agent the agent to set
+ */
+ void setAgent(LispRouterAgent agent);
+
+ /**
+ * Announces to the LISP agent that this router has connected.
+ *
+ * @return true if successful, false if duplicate router
+ */
+ boolean connectRouter();
+
+ /**
+ * Disconnects the router by closing UDP connection.
+ * Results in a call to the channel handler's close method for cleanup.
+ */
+ void disconnectRouter();
}
diff --git a/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispControllerAdapter.java b/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispControllerAdapter.java
index c096131..aeebeeb 100644
--- a/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispControllerAdapter.java
+++ b/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispControllerAdapter.java
@@ -25,6 +25,11 @@
}
@Override
+ public Iterable<LispRouter> getSubscribedRouters() {
+ return null;
+ }
+
+ @Override
public LispRouter getRouter(LispRouterId routerId) {
return null;
}
diff --git a/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispRouterAdapter.java b/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispRouterAdapter.java
index 4dcc736..d6570e8 100644
--- a/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispRouterAdapter.java
+++ b/protocols/lisp/api/src/test/java/org/onosproject/lisp/ctl/LispRouterAdapter.java
@@ -63,4 +63,34 @@
public boolean isConnected() {
return false;
}
+
+ @Override
+ public void setConnected(boolean connected) {
+
+ }
+
+ @Override
+ public boolean isSubscribed() {
+ return false;
+ }
+
+ @Override
+ public void setSubscribed(boolean subscribed) {
+
+ }
+
+ @Override
+ public void setAgent(LispRouterAgent agent) {
+
+ }
+
+ @Override
+ public boolean connectRouter() {
+ return false;
+ }
+
+ @Override
+ public void disconnectRouter() {
+
+ }
}