[ONOS-7480] Add swagger API doc of openstack node module
Change-Id: I7a7e387d970d08ed280fd6cb10ccfe40cc369dfc
diff --git a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java
index 591b1d1..e960d4b 100644
--- a/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java
+++ b/apps/openstacknode/app/src/main/java/org/onosproject/openstacknode/web/OpenstackNodeWebResource.java
@@ -44,6 +44,10 @@
import static com.fasterxml.jackson.databind.SerializationFeature.INDENT_OUTPUT;
import static javax.ws.rs.core.Response.created;
+/**
+ * Handles REST API call of openstack node config.
+ */
+
@Path("configure")
public class OpenstackNodeWebResource extends AbstractWebResource {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -63,6 +67,14 @@
@Context
private UriInfo uriInfo;
+ /**
+ * Creates a set of openstack nodes' config from the JSON input stream.
+ *
+ * @param input openstack nodes JSON input stream
+ * @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
+ * is malformed
+ * @onos.rsModel OpenstackNode
+ */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@@ -83,6 +95,14 @@
return created(locationBuilder.build()).build();
}
+ /**
+ * Creates a set of openstack nodes' config from the JSON input stream.
+ *
+ * @param input openstack nodes JSON input stream
+ * @return 200 OK with the updated openstack node's config, 400 BAD_REQUEST
+ * if the JSON is malformed
+ * @onos.rsModel OpenstackNode
+ */
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@@ -103,6 +123,13 @@
return Response.ok().build();
}
+ /**
+ * Removes a set of openstack nodes' config from the JSON input stream.
+ *
+ * @param input openstack nodes JSON input stream
+ * @return 204 NO_CONTENT, 400 BAD_REQUEST if the JSON is malformed
+ * @onos.rsModel OpenstackNode
+ */
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
diff --git a/apps/openstacknode/app/src/main/resources/definitions/OpenstackNode.json b/apps/openstacknode/app/src/main/resources/definitions/OpenstackNode.json
new file mode 100644
index 0000000..8ac64e3
--- /dev/null
+++ b/apps/openstacknode/app/src/main/resources/definitions/OpenstackNode.json
@@ -0,0 +1,45 @@
+{
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "hostname",
+ "type",
+ "managementIp",
+ "dataIp",
+ "uplinkPort",
+ "integrationBridge",
+ "vlanPort"
+ ],
+ "properties": {
+ "hostname": {
+ "type": "string",
+ "example": "host1"
+ },
+ "type": {
+ "type": "string",
+ "example": "GATEWAY"
+ },
+ "managementIp": {
+ "type": "string",
+ "example": "10.10.10.1"
+ },
+ "dataIp": {
+ "type": "string",
+ "example": "20.20.20.2"
+ },
+ "uplinkPort": {
+ "type": "string",
+ "example": "2"
+ },
+ "integrationBridge": {
+ "type": "string",
+ "example": "of:0000000000000001"
+ },
+ "vlanPort": {
+ "type": "string",
+ "example": "1"
+ }
+ }
+ }
+}
\ No newline at end of file