Skip to content

Commit 6db2a1f

Browse files
committed
Add a REST API to query the active node's IP address
Change-Id: I48261a5988a291cc93795188bcf09e72e4fd9e4c
1 parent f8f7e85 commit 6db2a1f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

apps/openstacknetworking/app/src/main/java/org/onosproject/openstacknetworking/web/OpenstackManagementWebResource.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public class OpenstackManagementWebResource extends AbstractWebResource {
105105
private static final String FLAG_TRUE = "true";
106106
private static final String FLAG_FALSE = "false";
107107

108+
private static final String ACTIVE_IP = "activeIp";
109+
108110
private final ObjectNode root = mapper().createObjectNode();
109111
private final ArrayNode floatingipsNode = root.putArray(FLOATINGIPS);
110112

@@ -438,6 +440,19 @@ public Response getActiveStatus() {
438440
return ok(mapper().createObjectNode().put(IS_ACTIVE, osHaService.isActive())).build();
439441
}
440442

443+
/**
444+
* Obtains the active node's IP address.
445+
*
446+
* @return 200 OK with active node's IP address.
447+
*/
448+
@GET
449+
@Path("active/ip")
450+
@Produces(MediaType.APPLICATION_JSON)
451+
public Response getActiveIp() {
452+
return ok(mapper().createObjectNode()
453+
.put(ACTIVE_IP, osHaService.getActiveIp().toString())).build();
454+
}
455+
441456
/**
442457
* Configures the HA active IP address.
443458
*

0 commit comments

Comments
 (0)