Support to query active status of the nodes through REST API
Change-Id: If4d918fd39b40c0cdd6c73594f45420bf4d6e88c
diff --git a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
index 3628848..c1d332b 100644
--- a/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
+++ b/apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java
@@ -98,6 +98,7 @@
private static final String HTTP_HEADER_ACCEPT = "accept";
private static final String HTTP_HEADER_VALUE_JSON = "application/json";
+ private static final String IS_ACTIVE = "isActive";
private static final String FLAG_TRUE = "true";
private static final String FLAG_FALSE = "false";
@@ -388,6 +389,19 @@
}
/**
+ * Configures the HA active-standby status.
+ *
+ * @return 200 OK with HA status.
+ * True if the node runs in active mode, false otherwise
+ */
+ @GET
+ @Path("active/status")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getActiveStatus() {
+ return ok(mapper().createObjectNode().put(IS_ACTIVE, osHaService.isActive())).build();
+ }
+
+ /**
* Configures the HA active IP address.
*
* @param ip IP address of active node