Add Swagger comments and dependencies to appsm with REST APIs
ONOS-2704 and ONOS-2705
Change-Id: I77655af94f8b5aba647a94b3b786a6de8a285d7c
diff --git a/src/main/java/org/onosproject/segmentrouting/web/PolicyWebResource.java b/src/main/java/org/onosproject/segmentrouting/web/PolicyWebResource.java
index 384ff0f..257b42a 100644
--- a/src/main/java/org/onosproject/segmentrouting/web/PolicyWebResource.java
+++ b/src/main/java/org/onosproject/segmentrouting/web/PolicyWebResource.java
@@ -34,11 +34,20 @@
import java.io.InputStream;
import java.util.List;
+/**
+ * Query, create and remove segment routing plicies.
+ */
@Path("policy")
public class PolicyWebResource extends AbstractWebResource {
private static final PolicyCodec POLICY_CODEC = new PolicyCodec();
+ /**
+ * Get all segment routing policies.
+ * Returns an array of segment routing policies.
+ *
+ * @return status of OK
+ */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getPolicy() {
@@ -50,6 +59,14 @@
return ok(result.toString()).build();
}
+ /**
+ * Create a new segment routing policy.
+ *
+ * @param input JSON stream for policy to create
+ * @return status of the request - OK if the policy is created,
+ * INTERNAL_SERVER_ERROR if the JSON is invalid or the policy cannot be created
+ * @throws IOException
+ */
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createPolicy(InputStream input) throws IOException {
@@ -66,6 +83,14 @@
}
}
+ /**
+ * Delete a segment routing policy.
+ *
+ * @param input JSON stream for policy to delete
+ * @return status of the request - OK if the policy is removed,
+ * INTERNAL_SERVER_ERROR otherwise
+ * @throws IOException if JSON is invalid
+ */
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
public Response removePolicy(InputStream input) throws IOException {
diff --git a/src/main/java/org/onosproject/segmentrouting/web/TunnelWebResource.java b/src/main/java/org/onosproject/segmentrouting/web/TunnelWebResource.java
index 4ed4b8c..fb30308 100644
--- a/src/main/java/org/onosproject/segmentrouting/web/TunnelWebResource.java
+++ b/src/main/java/org/onosproject/segmentrouting/web/TunnelWebResource.java
@@ -34,11 +34,20 @@
import java.io.InputStream;
import java.util.List;
+/**
+ * Query, create and remove segment routing tunnels.
+ */
@Path("tunnel")
public class TunnelWebResource extends AbstractWebResource {
private static final TunnelCodec TUNNEL_CODEC = new TunnelCodec();
+ /**
+ * Get all segment routing tunnels.
+ * Returns an array of segment routing tunnels.
+ *
+ * @return status of OK
+ */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getTunnel() {
@@ -50,6 +59,14 @@
return ok(result.toString()).build();
}
+ /**
+ * Create a new segment routing tunnel.
+ *
+ * @param input JSON stream for tunnel to create
+ * @return status of the request - OK if the tunnel is created,
+ * INTERNAL_SERVER_ERROR if the JSON is invalid or the tunnel cannot be created
+ * @throws IOException if the JSON is invalid
+ */
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createTunnel(InputStream input) throws IOException {
@@ -62,6 +79,14 @@
return Response.ok().build();
}
+ /**
+ * Delete a segment routing tunnel.
+ *
+ * @param input JSON stream for tunnel to delete
+ * @return status of the request - OK if the tunnel is removed,
+ * INTERNAL_SERVER_ERROR otherwise
+ * @throws IOException if JSON is invalid
+ */
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
public Response removeTunnel(InputStream input) throws IOException {