commit | 346edaf2462ee05b0cde00969c473ecf4c9b5fdc | [log] [tgz] |
---|---|---|
author | Jian Li <pyguni@gmail.com> | Thu Sep 26 13:14:46 2019 +0900 |
committer | Jian Li <pyguni@gmail.com> | Wed Mar 04 08:44:56 2020 +0000 |
tree | 4e49b8e74b48123042a8c6813b7d3afd16bbc158 | |
parent | 15235cb033af1ce64e6ecd59735b8dda3072e3f9 [diff] |
Add a REST API to query the active node's IP address Change-Id: I48261a5988a291cc93795188bcf09e72e4fd9e4c
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 c6776c7..7159222 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
@@ -105,6 +105,8 @@ private static final String FLAG_TRUE = "true"; private static final String FLAG_FALSE = "false"; + private static final String ACTIVE_IP = "activeIp"; + private final ObjectNode root = mapper().createObjectNode(); private final ArrayNode floatingipsNode = root.putArray(FLOATINGIPS); @@ -439,6 +441,19 @@ } /** + * Obtains the active node's IP address. + * + * @return 200 OK with active node's IP address. + */ + @GET + @Path("active/ip") + @Produces(MediaType.APPLICATION_JSON) + public Response getActiveIp() { + return ok(mapper().createObjectNode() + .put(ACTIVE_IP, osHaService.getActiveIp().toString())).build(); + } + + /** * Configures the HA active IP address. * * @param ip IP address of active node