Committed by
Gerrit Code Review
Clean up source code of REST API
- Add missing @Produces annotation - Correct comments - Restrict variable access level Change-Id: I7f75650b83651248370e7781b1e8aec7eac2314c
Showing
22 changed files
with
221 additions
and
192 deletions
... | @@ -28,6 +28,8 @@ import javax.ws.rs.GET; | ... | @@ -28,6 +28,8 @@ import javax.ws.rs.GET; |
28 | import javax.ws.rs.POST; | 28 | import javax.ws.rs.POST; |
29 | import javax.ws.rs.Path; | 29 | import javax.ws.rs.Path; |
30 | import javax.ws.rs.PathParam; | 30 | import javax.ws.rs.PathParam; |
31 | +import javax.ws.rs.Produces; | ||
32 | +import javax.ws.rs.core.MediaType; | ||
31 | import javax.ws.rs.core.Response; | 33 | import javax.ws.rs.core.Response; |
32 | import java.io.IOException; | 34 | import java.io.IOException; |
33 | import java.io.InputStream; | 35 | import java.io.InputStream; |
... | @@ -42,16 +44,17 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -42,16 +44,17 @@ import static org.onlab.util.Tools.nullIsNotFound; |
42 | @Path("cluster") | 44 | @Path("cluster") |
43 | public class ClusterWebResource extends AbstractWebResource { | 45 | public class ClusterWebResource extends AbstractWebResource { |
44 | 46 | ||
45 | - public static final String NODE_NOT_FOUND = "Node is not found"; | 47 | + private static final String NODE_NOT_FOUND = "Node is not found"; |
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Get all cluster nodes. | 50 | * Get all cluster nodes. |
49 | * Returns array of all cluster nodes. | 51 | * Returns array of all cluster nodes. |
50 | * | 52 | * |
51 | - * @return 200 OK | 53 | + * @return 200 OK with a collection of cluster nodes |
52 | * @onos.rsModel Cluster | 54 | * @onos.rsModel Cluster |
53 | */ | 55 | */ |
54 | @GET | 56 | @GET |
57 | + @Produces(MediaType.APPLICATION_JSON) | ||
55 | public Response getClusterNodes() { | 58 | public Response getClusterNodes() { |
56 | Iterable<ControllerNode> nodes = get(ClusterService.class).getNodes(); | 59 | Iterable<ControllerNode> nodes = get(ClusterService.class).getNodes(); |
57 | return ok(encodeArray(ControllerNode.class, "nodes", nodes)).build(); | 60 | return ok(encodeArray(ControllerNode.class, "nodes", nodes)).build(); |
... | @@ -62,11 +65,12 @@ public class ClusterWebResource extends AbstractWebResource { | ... | @@ -62,11 +65,12 @@ public class ClusterWebResource extends AbstractWebResource { |
62 | * Returns details of the specified cluster node. | 65 | * Returns details of the specified cluster node. |
63 | * | 66 | * |
64 | * @param id cluster node identifier | 67 | * @param id cluster node identifier |
65 | - * @return 200 OK | 68 | + * @return 200 OK with a cluster node |
66 | * @onos.rsModel ClusterNode | 69 | * @onos.rsModel ClusterNode |
67 | */ | 70 | */ |
68 | @GET | 71 | @GET |
69 | @Path("{id}") | 72 | @Path("{id}") |
73 | + @Produces(MediaType.APPLICATION_JSON) | ||
70 | public Response getClusterNode(@PathParam("id") String id) { | 74 | public Response getClusterNode(@PathParam("id") String id) { |
71 | ControllerNode node = nullIsNotFound(get(ClusterService.class).getNode(new NodeId(id)), | 75 | ControllerNode node = nullIsNotFound(get(ClusterService.class).getNode(new NodeId(id)), |
72 | NODE_NOT_FOUND); | 76 | NODE_NOT_FOUND); |
... | @@ -84,6 +88,7 @@ public class ClusterWebResource extends AbstractWebResource { | ... | @@ -84,6 +88,7 @@ public class ClusterWebResource extends AbstractWebResource { |
84 | */ | 88 | */ |
85 | @POST | 89 | @POST |
86 | @Path("configuration") | 90 | @Path("configuration") |
91 | + @Produces(MediaType.APPLICATION_JSON) | ||
87 | public Response formCluster(InputStream config) throws IOException { | 92 | public Response formCluster(InputStream config) throws IOException { |
88 | JsonCodec<ControllerNode> codec = codec(ControllerNode.class); | 93 | JsonCodec<ControllerNode> codec = codec(ControllerNode.class); |
89 | ObjectNode root = (ObjectNode) mapper().readTree(config); | 94 | ObjectNode root = (ObjectNode) mapper().readTree(config); |
... | @@ -93,5 +98,4 @@ public class ClusterWebResource extends AbstractWebResource { | ... | @@ -93,5 +98,4 @@ public class ClusterWebResource extends AbstractWebResource { |
93 | 98 | ||
94 | return Response.ok().build(); | 99 | return Response.ok().build(); |
95 | } | 100 | } |
96 | - | ||
97 | } | 101 | } | ... | ... |
... | @@ -26,6 +26,7 @@ import javax.ws.rs.GET; | ... | @@ -26,6 +26,7 @@ import javax.ws.rs.GET; |
26 | import javax.ws.rs.POST; | 26 | import javax.ws.rs.POST; |
27 | import javax.ws.rs.Path; | 27 | import javax.ws.rs.Path; |
28 | import javax.ws.rs.PathParam; | 28 | import javax.ws.rs.PathParam; |
29 | +import javax.ws.rs.Produces; | ||
29 | import javax.ws.rs.core.MediaType; | 30 | import javax.ws.rs.core.MediaType; |
30 | import javax.ws.rs.core.Response; | 31 | import javax.ws.rs.core.Response; |
31 | import java.io.IOException; | 32 | import java.io.IOException; |
... | @@ -41,12 +42,13 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -41,12 +42,13 @@ import static org.onlab.util.Tools.nullIsNotFound; |
41 | public class ComponentConfigWebResource extends AbstractWebResource { | 42 | public class ComponentConfigWebResource extends AbstractWebResource { |
42 | 43 | ||
43 | /** | 44 | /** |
44 | - * Get all component configurations. | 45 | + * Gets all component configurations. |
45 | * Returns collection of all registered component configurations. | 46 | * Returns collection of all registered component configurations. |
46 | * | 47 | * |
47 | - * @return 200 OK | 48 | + * @return 200 OK with a collection of component configurations |
48 | */ | 49 | */ |
49 | @GET | 50 | @GET |
51 | + @Produces(MediaType.APPLICATION_JSON) | ||
50 | public Response getComponentConfigs() { | 52 | public Response getComponentConfigs() { |
51 | ComponentConfigService service = get(ComponentConfigService.class); | 53 | ComponentConfigService service = get(ComponentConfigService.class); |
52 | Set<String> components = service.getComponentNames(); | 54 | Set<String> components = service.getComponentNames(); |
... | @@ -56,13 +58,14 @@ public class ComponentConfigWebResource extends AbstractWebResource { | ... | @@ -56,13 +58,14 @@ public class ComponentConfigWebResource extends AbstractWebResource { |
56 | } | 58 | } |
57 | 59 | ||
58 | /** | 60 | /** |
59 | - * Get configuration of the specified component. | 61 | + * Gets configuration of the specified component. |
60 | * | 62 | * |
61 | * @param component component name | 63 | * @param component component name |
62 | - * @return 200 OK | 64 | + * @return 200 OK with a collection of component configurations |
63 | */ | 65 | */ |
64 | @GET | 66 | @GET |
65 | @Path("{component}") | 67 | @Path("{component}") |
68 | + @Produces(MediaType.APPLICATION_JSON) | ||
66 | public Response getComponentConfigs(@PathParam("component") String component) { | 69 | public Response getComponentConfigs(@PathParam("component") String component) { |
67 | ComponentConfigService service = get(ComponentConfigService.class); | 70 | ComponentConfigService service = get(ComponentConfigService.class); |
68 | ObjectNode root = mapper().createObjectNode(); | 71 | ObjectNode root = mapper().createObjectNode(); |
... | @@ -80,7 +83,7 @@ public class ComponentConfigWebResource extends AbstractWebResource { | ... | @@ -80,7 +83,7 @@ public class ComponentConfigWebResource extends AbstractWebResource { |
80 | } | 83 | } |
81 | 84 | ||
82 | /** | 85 | /** |
83 | - * Selectively set configuration properties. | 86 | + * Selectively sets configuration properties. |
84 | * Sets only the properties present in the JSON request. | 87 | * Sets only the properties present in the JSON request. |
85 | * | 88 | * |
86 | * @param component component name | 89 | * @param component component name |
... | @@ -97,11 +100,11 @@ public class ComponentConfigWebResource extends AbstractWebResource { | ... | @@ -97,11 +100,11 @@ public class ComponentConfigWebResource extends AbstractWebResource { |
97 | ObjectNode props = (ObjectNode) mapper().readTree(request); | 100 | ObjectNode props = (ObjectNode) mapper().readTree(request); |
98 | props.fieldNames().forEachRemaining(k -> service.setProperty(component, k, | 101 | props.fieldNames().forEachRemaining(k -> service.setProperty(component, k, |
99 | props.path(k).asText())); | 102 | props.path(k).asText())); |
100 | - return Response.noContent().build(); | 103 | + return Response.ok().build(); |
101 | } | 104 | } |
102 | 105 | ||
103 | /** | 106 | /** |
104 | - * Selectively clear configuration properties. | 107 | + * Selectively clears configuration properties. |
105 | * Clears only the properties present in the JSON request. | 108 | * Clears only the properties present in the JSON request. |
106 | * | 109 | * |
107 | * @param component component name | 110 | * @param component component name | ... | ... |
... | @@ -15,15 +15,8 @@ | ... | @@ -15,15 +15,8 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.rest.resources; | 16 | package org.onosproject.rest.resources; |
17 | 17 | ||
18 | -import java.io.InputStream; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | - | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import javax.ws.rs.Consumes; | ||
21 | -import javax.ws.rs.POST; | ||
22 | -import javax.ws.rs.Path; | ||
23 | -import javax.ws.rs.Produces; | ||
24 | -import javax.ws.rs.core.MediaType; | ||
25 | -import javax.ws.rs.core.Response; | ||
26 | - | ||
27 | import org.onlab.rest.BaseResource; | 20 | import org.onlab.rest.BaseResource; |
28 | import org.onosproject.net.device.DeviceProviderRegistry; | 21 | import org.onosproject.net.device.DeviceProviderRegistry; |
29 | import org.onosproject.net.device.DeviceService; | 22 | import org.onosproject.net.device.DeviceService; |
... | @@ -32,8 +25,12 @@ import org.onosproject.net.link.LinkProviderRegistry; | ... | @@ -32,8 +25,12 @@ import org.onosproject.net.link.LinkProviderRegistry; |
32 | import org.slf4j.Logger; | 25 | import org.slf4j.Logger; |
33 | import org.slf4j.LoggerFactory; | 26 | import org.slf4j.LoggerFactory; |
34 | 27 | ||
35 | -import com.fasterxml.jackson.databind.JsonNode; | 28 | +import javax.ws.rs.Consumes; |
36 | -import com.fasterxml.jackson.databind.ObjectMapper; | 29 | +import javax.ws.rs.POST; |
30 | +import javax.ws.rs.Path; | ||
31 | +import javax.ws.rs.core.MediaType; | ||
32 | +import javax.ws.rs.core.Response; | ||
33 | +import java.io.InputStream; | ||
37 | 34 | ||
38 | import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | 35 | import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; |
39 | 36 | ||
... | @@ -54,7 +51,6 @@ public class ConfigWebResource extends BaseResource { | ... | @@ -54,7 +51,6 @@ public class ConfigWebResource extends BaseResource { |
54 | @POST | 51 | @POST |
55 | @Path("topology") | 52 | @Path("topology") |
56 | @Consumes(MediaType.APPLICATION_JSON) | 53 | @Consumes(MediaType.APPLICATION_JSON) |
57 | - @Produces(MediaType.APPLICATION_JSON) | ||
58 | public Response topology(InputStream input) { | 54 | public Response topology(InputStream input) { |
59 | try { | 55 | try { |
60 | ObjectMapper mapper = new ObjectMapper(); | 56 | ObjectMapper mapper = new ObjectMapper(); | ... | ... |
... | @@ -47,7 +47,7 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -47,7 +47,7 @@ import static org.onlab.util.Tools.nullIsNotFound; |
47 | public class DeviceKeyWebResource extends AbstractWebResource { | 47 | public class DeviceKeyWebResource extends AbstractWebResource { |
48 | 48 | ||
49 | @Context | 49 | @Context |
50 | - UriInfo uriInfo; | 50 | + private UriInfo uriInfo; |
51 | 51 | ||
52 | private static final String DEVICE_KEY_NOT_FOUND = "Device key was not found"; | 52 | private static final String DEVICE_KEY_NOT_FOUND = "Device key was not found"; |
53 | 53 | ||
... | @@ -55,25 +55,27 @@ public class DeviceKeyWebResource extends AbstractWebResource { | ... | @@ -55,25 +55,27 @@ public class DeviceKeyWebResource extends AbstractWebResource { |
55 | * Gets all device keys. | 55 | * Gets all device keys. |
56 | * Returns array of all device keys. | 56 | * Returns array of all device keys. |
57 | * | 57 | * |
58 | - * @return 200 OK | 58 | + * @return 200 OK with a collection of device keys |
59 | * @onos.rsModel Devicekeys | 59 | * @onos.rsModel Devicekeys |
60 | */ | 60 | */ |
61 | @GET | 61 | @GET |
62 | + @Produces(MediaType.APPLICATION_JSON) | ||
62 | public Response getDeviceKeys() { | 63 | public Response getDeviceKeys() { |
63 | Iterable<DeviceKey> deviceKeys = get(DeviceKeyService.class).getDeviceKeys(); | 64 | Iterable<DeviceKey> deviceKeys = get(DeviceKeyService.class).getDeviceKeys(); |
64 | return ok(encodeArray(DeviceKey.class, "keys", deviceKeys)).build(); | 65 | return ok(encodeArray(DeviceKey.class, "keys", deviceKeys)).build(); |
65 | } | 66 | } |
66 | 67 | ||
67 | /** | 68 | /** |
68 | - * Get a single device key by device key unique identifier. | 69 | + * Gets a single device key by device key unique identifier. |
69 | * Returns the specified device key. | 70 | * Returns the specified device key. |
70 | * | 71 | * |
71 | * @param id device key identifier | 72 | * @param id device key identifier |
72 | - * @return 200 OK, 404 not found | 73 | + * @return 200 OK with a device key, 404 not found |
73 | * @onos.rsModel Devicekey | 74 | * @onos.rsModel Devicekey |
74 | */ | 75 | */ |
75 | @GET | 76 | @GET |
76 | @Path("{id}") | 77 | @Path("{id}") |
78 | + @Produces(MediaType.APPLICATION_JSON) | ||
77 | public Response getDeviceKey(@PathParam("id") String id) { | 79 | public Response getDeviceKey(@PathParam("id") String id) { |
78 | DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), | 80 | DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), |
79 | DEVICE_KEY_NOT_FOUND); | 81 | DEVICE_KEY_NOT_FOUND); |
... | @@ -115,10 +117,11 @@ public class DeviceKeyWebResource extends AbstractWebResource { | ... | @@ -115,10 +117,11 @@ public class DeviceKeyWebResource extends AbstractWebResource { |
115 | * Removes a device key by device key identifier. | 117 | * Removes a device key by device key identifier. |
116 | * | 118 | * |
117 | * @param id device key identifier | 119 | * @param id device key identifier |
118 | - * @return 200 OK, 404 not found | 120 | + * @return 200 OK with a removed device key, 404 not found |
119 | */ | 121 | */ |
120 | @DELETE | 122 | @DELETE |
121 | @Path("{id}") | 123 | @Path("{id}") |
124 | + @Produces(MediaType.APPLICATION_JSON) | ||
122 | public Response removeDeviceKey(@PathParam("id") String id) { | 125 | public Response removeDeviceKey(@PathParam("id") String id) { |
123 | DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), | 126 | DeviceKey deviceKey = nullIsNotFound(get(DeviceKeyService.class).getDeviceKey(DeviceKeyId.deviceKeyId(id)), |
124 | DEVICE_KEY_NOT_FOUND); | 127 | DEVICE_KEY_NOT_FOUND); | ... | ... |
... | @@ -26,6 +26,8 @@ import javax.ws.rs.DELETE; | ... | @@ -26,6 +26,8 @@ import javax.ws.rs.DELETE; |
26 | import javax.ws.rs.GET; | 26 | import javax.ws.rs.GET; |
27 | import javax.ws.rs.Path; | 27 | import javax.ws.rs.Path; |
28 | import javax.ws.rs.PathParam; | 28 | import javax.ws.rs.PathParam; |
29 | +import javax.ws.rs.Produces; | ||
30 | +import javax.ws.rs.core.MediaType; | ||
29 | import javax.ws.rs.core.Response; | 31 | import javax.ws.rs.core.Response; |
30 | import java.util.List; | 32 | import java.util.List; |
31 | 33 | ||
... | @@ -39,31 +41,33 @@ import static org.onosproject.net.DeviceId.deviceId; | ... | @@ -39,31 +41,33 @@ import static org.onosproject.net.DeviceId.deviceId; |
39 | @Path("devices") | 41 | @Path("devices") |
40 | public class DevicesWebResource extends AbstractWebResource { | 42 | public class DevicesWebResource extends AbstractWebResource { |
41 | 43 | ||
42 | - public static final String DEVICE_NOT_FOUND = "Device is not found"; | 44 | + private static final String DEVICE_NOT_FOUND = "Device is not found"; |
43 | 45 | ||
44 | /** | 46 | /** |
45 | - * Get all infrastructure devices. | 47 | + * Gets all infrastructure devices. |
46 | * Returns array of all discovered infrastructure devices. | 48 | * Returns array of all discovered infrastructure devices. |
47 | * | 49 | * |
48 | - * @return 200 OK | 50 | + * @return 200 OK with a collection of devices |
49 | * @onos.rsModel DevicesGet | 51 | * @onos.rsModel DevicesGet |
50 | */ | 52 | */ |
51 | @GET | 53 | @GET |
54 | + @Produces(MediaType.APPLICATION_JSON) | ||
52 | public Response getDevices() { | 55 | public Response getDevices() { |
53 | Iterable<Device> devices = get(DeviceService.class).getDevices(); | 56 | Iterable<Device> devices = get(DeviceService.class).getDevices(); |
54 | return ok(encodeArray(Device.class, "devices", devices)).build(); | 57 | return ok(encodeArray(Device.class, "devices", devices)).build(); |
55 | } | 58 | } |
56 | 59 | ||
57 | /** | 60 | /** |
58 | - * Get details of infrastructure device. | 61 | + * Gets details of infrastructure device. |
59 | * Returns details of the specified infrastructure device. | 62 | * Returns details of the specified infrastructure device. |
60 | * | 63 | * |
61 | * @param id device identifier | 64 | * @param id device identifier |
62 | - * @return 200 OK | 65 | + * @return 200 OK with a device |
63 | * @onos.rsModel DeviceGet | 66 | * @onos.rsModel DeviceGet |
64 | */ | 67 | */ |
65 | @GET | 68 | @GET |
66 | @Path("{id}") | 69 | @Path("{id}") |
70 | + @Produces(MediaType.APPLICATION_JSON) | ||
67 | public Response getDevice(@PathParam("id") String id) { | 71 | public Response getDevice(@PathParam("id") String id) { |
68 | Device device = nullIsNotFound(get(DeviceService.class).getDevice(deviceId(id)), | 72 | Device device = nullIsNotFound(get(DeviceService.class).getDevice(deviceId(id)), |
69 | DEVICE_NOT_FOUND); | 73 | DEVICE_NOT_FOUND); |
... | @@ -71,15 +75,16 @@ public class DevicesWebResource extends AbstractWebResource { | ... | @@ -71,15 +75,16 @@ public class DevicesWebResource extends AbstractWebResource { |
71 | } | 75 | } |
72 | 76 | ||
73 | /** | 77 | /** |
74 | - * Remove infrastructure device. | 78 | + * Removes infrastructure device. |
75 | * Administratively deletes the specified device from the inventory of | 79 | * Administratively deletes the specified device from the inventory of |
76 | * known devices. | 80 | * known devices. |
77 | * | 81 | * |
78 | * @param id device identifier | 82 | * @param id device identifier |
79 | - * @return 200 OK | 83 | + * @return 200 OK with the removed device |
80 | */ | 84 | */ |
81 | @DELETE | 85 | @DELETE |
82 | @Path("{id}") | 86 | @Path("{id}") |
87 | + @Produces(MediaType.APPLICATION_JSON) | ||
83 | public Response removeDevice(@PathParam("id") String id) { | 88 | public Response removeDevice(@PathParam("id") String id) { |
84 | Device device = nullIsNotFound(get(DeviceService.class).getDevice(deviceId(id)), | 89 | Device device = nullIsNotFound(get(DeviceService.class).getDevice(deviceId(id)), |
85 | DEVICE_NOT_FOUND); | 90 | DEVICE_NOT_FOUND); |
... | @@ -88,15 +93,16 @@ public class DevicesWebResource extends AbstractWebResource { | ... | @@ -88,15 +93,16 @@ public class DevicesWebResource extends AbstractWebResource { |
88 | } | 93 | } |
89 | 94 | ||
90 | /** | 95 | /** |
91 | - * Get ports of infrastructure device. | 96 | + * Gets ports of infrastructure device. |
92 | * Returns details of the specified infrastructure device. | 97 | * Returns details of the specified infrastructure device. |
93 | * | 98 | * |
94 | * @onos.rsModel DeviceGetPorts | 99 | * @onos.rsModel DeviceGetPorts |
95 | * @param id device identifier | 100 | * @param id device identifier |
96 | - * @return 200 OK | 101 | + * @return 200 OK with a collection of ports of the given device |
97 | */ | 102 | */ |
98 | @GET | 103 | @GET |
99 | @Path("{id}/ports") | 104 | @Path("{id}/ports") |
105 | + @Produces(MediaType.APPLICATION_JSON) | ||
100 | public Response getDevicePorts(@PathParam("id") String id) { | 106 | public Response getDevicePorts(@PathParam("id") String id) { |
101 | DeviceService service = get(DeviceService.class); | 107 | DeviceService service = get(DeviceService.class); |
102 | Device device = nullIsNotFound(service.getDevice(deviceId(id)), DEVICE_NOT_FOUND); | 108 | Device device = nullIsNotFound(service.getDevice(deviceId(id)), DEVICE_NOT_FOUND); | ... | ... |
... | @@ -45,14 +45,14 @@ import java.io.InputStream; | ... | @@ -45,14 +45,14 @@ import java.io.InputStream; |
45 | public class FlowObjectiveWebResource extends AbstractWebResource { | 45 | public class FlowObjectiveWebResource extends AbstractWebResource { |
46 | 46 | ||
47 | @Context | 47 | @Context |
48 | - UriInfo uriInfo; | 48 | + private UriInfo uriInfo; |
49 | 49 | ||
50 | - public static final String DEVICE_INVALID = | 50 | + private static final String DEVICE_INVALID = |
51 | "Invalid deviceId in objective creation request"; | 51 | "Invalid deviceId in objective creation request"; |
52 | - public static final String POLICY_INVALID = "Invalid policy"; | 52 | + private static final String POLICY_INVALID = "Invalid policy"; |
53 | 53 | ||
54 | - final FlowObjectiveService flowObjectiveService = get(FlowObjectiveService.class); | 54 | + private final FlowObjectiveService flowObjectiveService = get(FlowObjectiveService.class); |
55 | - final ObjectNode root = mapper().createObjectNode(); | 55 | + private final ObjectNode root = mapper().createObjectNode(); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Creates and installs a new filtering objective for the specified device. | 58 | * Creates and installs a new filtering objective for the specified device. |
... | @@ -168,7 +168,7 @@ public class FlowObjectiveWebResource extends AbstractWebResource { | ... | @@ -168,7 +168,7 @@ public class FlowObjectiveWebResource extends AbstractWebResource { |
168 | /** | 168 | /** |
169 | * Returns the globally unique nextId. | 169 | * Returns the globally unique nextId. |
170 | * | 170 | * |
171 | - * @return nextId | 171 | + * @return 200 OK with next identifier |
172 | * @onos.rsModel NextId | 172 | * @onos.rsModel NextId |
173 | */ | 173 | */ |
174 | @GET | 174 | @GET |
... | @@ -183,13 +183,13 @@ public class FlowObjectiveWebResource extends AbstractWebResource { | ... | @@ -183,13 +183,13 @@ public class FlowObjectiveWebResource extends AbstractWebResource { |
183 | * Installs the filtering rules onto the specified device. | 183 | * Installs the filtering rules onto the specified device. |
184 | * | 184 | * |
185 | * @param stream filtering rule JSON | 185 | * @param stream filtering rule JSON |
186 | + * @return 200 OK | ||
186 | * @onos.rsModel ObjectivePolicy | 187 | * @onos.rsModel ObjectivePolicy |
187 | */ | 188 | */ |
188 | @POST | 189 | @POST |
189 | @Path("policy") | 190 | @Path("policy") |
190 | @Consumes(MediaType.APPLICATION_JSON) | 191 | @Consumes(MediaType.APPLICATION_JSON) |
191 | - @Produces(MediaType.APPLICATION_JSON) | 192 | + public Response initPolicy(InputStream stream) { |
192 | - public void initPolicy(InputStream stream) { | ||
193 | 193 | ||
194 | try { | 194 | try { |
195 | ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream); | 195 | ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream); |
... | @@ -200,13 +200,14 @@ public class FlowObjectiveWebResource extends AbstractWebResource { | ... | @@ -200,13 +200,14 @@ public class FlowObjectiveWebResource extends AbstractWebResource { |
200 | } | 200 | } |
201 | 201 | ||
202 | flowObjectiveService.initPolicy(policyJson.asText()); | 202 | flowObjectiveService.initPolicy(policyJson.asText()); |
203 | + return Response.ok().build(); | ||
203 | } catch (IOException e) { | 204 | } catch (IOException e) { |
204 | throw new IllegalArgumentException(e); | 205 | throw new IllegalArgumentException(e); |
205 | } | 206 | } |
206 | } | 207 | } |
207 | 208 | ||
208 | /** | 209 | /** |
209 | - * Validate the deviceId that is contained in json string against the | 210 | + * Validates the deviceId that is contained in json string against the |
210 | * input deviceId. | 211 | * input deviceId. |
211 | * | 212 | * |
212 | * @param deviceId device identifier | 213 | * @param deviceId device identifier | ... | ... |
... | @@ -57,22 +57,23 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -57,22 +57,23 @@ import static org.onlab.util.Tools.nullIsNotFound; |
57 | public class FlowsWebResource extends AbstractWebResource { | 57 | public class FlowsWebResource extends AbstractWebResource { |
58 | 58 | ||
59 | @Context | 59 | @Context |
60 | - UriInfo uriInfo; | 60 | + private UriInfo uriInfo; |
61 | 61 | ||
62 | - public static final String DEVICE_NOT_FOUND = "Device is not found"; | 62 | + private static final String DEVICE_NOT_FOUND = "Device is not found"; |
63 | - public static final String FLOW_NOT_FOUND = "Flow is not found"; | 63 | + private static final String FLOW_NOT_FOUND = "Flow is not found"; |
64 | - public static final String FLOWS = "flows"; | 64 | + private static final String FLOWS = "flows"; |
65 | - public static final String DEVICE_ID = "deviceId"; | 65 | + private static final String DEVICE_ID = "deviceId"; |
66 | - public static final String FLOW_ID = "flowId"; | 66 | + private static final String FLOW_ID = "flowId"; |
67 | 67 | ||
68 | - final FlowRuleService service = get(FlowRuleService.class); | 68 | + private final FlowRuleService service = get(FlowRuleService.class); |
69 | - final ObjectNode root = mapper().createObjectNode(); | 69 | + private final ObjectNode root = mapper().createObjectNode(); |
70 | - final ArrayNode flowsNode = root.putArray(FLOWS); | 70 | + private final ArrayNode flowsNode = root.putArray(FLOWS); |
71 | 71 | ||
72 | /** | 72 | /** |
73 | - * Get all flow entries. Returns array of all flow rules in the system. | 73 | + * Gets all flow entries. Returns array of all flow rules in the system. |
74 | + * | ||
75 | + * @return 200 OK with a collection of flows | ||
74 | * @onos.rsModel Flows | 76 | * @onos.rsModel Flows |
75 | - * @return array of all the intents in the system | ||
76 | */ | 77 | */ |
77 | @GET | 78 | @GET |
78 | @Produces(MediaType.APPLICATION_JSON) | 79 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -91,17 +92,17 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -91,17 +92,17 @@ public class FlowsWebResource extends AbstractWebResource { |
91 | } | 92 | } |
92 | 93 | ||
93 | /** | 94 | /** |
94 | - * Create new flow rules. Creates and installs a new flow rules.<br> | 95 | + * Creates new flow rules. Creates and installs a new flow rules.<br> |
95 | * Instructions description: | 96 | * Instructions description: |
96 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Instructions | 97 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Instructions |
97 | * <br> | 98 | * <br> |
98 | * Criteria description: | 99 | * Criteria description: |
99 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Criteria | 100 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Criteria |
100 | * | 101 | * |
101 | - * @onos.rsModel FlowsBatchPost | ||
102 | * @param stream flow rules JSON | 102 | * @param stream flow rules JSON |
103 | * @return status of the request - CREATED if the JSON is correct, | 103 | * @return status of the request - CREATED if the JSON is correct, |
104 | * BAD_REQUEST if the JSON is invalid | 104 | * BAD_REQUEST if the JSON is invalid |
105 | + * @onos.rsModel FlowsBatchPost | ||
105 | */ | 106 | */ |
106 | @POST | 107 | @POST |
107 | @Consumes(MediaType.APPLICATION_JSON) | 108 | @Consumes(MediaType.APPLICATION_JSON) |
... | @@ -125,11 +126,12 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -125,11 +126,12 @@ public class FlowsWebResource extends AbstractWebResource { |
125 | } | 126 | } |
126 | 127 | ||
127 | /** | 128 | /** |
128 | - * Get flow entries of a device. Returns array of all flow rules for the | 129 | + * Gets flow entries of a device. Returns array of all flow rules for the |
129 | * specified device. | 130 | * specified device. |
130 | - * @onos.rsModel Flows | 131 | + * |
131 | * @param deviceId device identifier | 132 | * @param deviceId device identifier |
132 | - * @return flow data as an array | 133 | + * @return 200 OK with a collection of flows of given device |
134 | + * @onos.rsModel Flows | ||
133 | */ | 135 | */ |
134 | @GET | 136 | @GET |
135 | @Produces(MediaType.APPLICATION_JSON) | 137 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -148,12 +150,13 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -148,12 +150,13 @@ public class FlowsWebResource extends AbstractWebResource { |
148 | } | 150 | } |
149 | 151 | ||
150 | /** | 152 | /** |
151 | - * Get flow rule. Returns the flow entry specified by the device id and | 153 | + * Gets flow rule. Returns the flow entry specified by the device id and |
152 | * flow rule id. | 154 | * flow rule id. |
153 | - * @onos.rsModel Flows | 155 | + * |
154 | * @param deviceId device identifier | 156 | * @param deviceId device identifier |
155 | * @param flowId flow rule identifier | 157 | * @param flowId flow rule identifier |
156 | - * @return flow data as an array | 158 | + * @return 200 OK with a flows of given device and flow |
159 | + * @onos.rsModel Flows | ||
157 | */ | 160 | */ |
158 | @GET | 161 | @GET |
159 | @Produces(MediaType.APPLICATION_JSON) | 162 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -175,7 +178,7 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -175,7 +178,7 @@ public class FlowsWebResource extends AbstractWebResource { |
175 | } | 178 | } |
176 | 179 | ||
177 | /** | 180 | /** |
178 | - * Create new flow rule. Creates and installs a new flow rule for the | 181 | + * Creates new flow rule. Creates and installs a new flow rule for the |
179 | * specified device. <br> | 182 | * specified device. <br> |
180 | * Instructions description: | 183 | * Instructions description: |
181 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Instructions | 184 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Instructions |
... | @@ -183,11 +186,11 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -183,11 +186,11 @@ public class FlowsWebResource extends AbstractWebResource { |
183 | * Criteria description: | 186 | * Criteria description: |
184 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Criteria | 187 | * https://wiki.onosproject.org/display/ONOS/Flow+Rule+Criteria |
185 | * | 188 | * |
186 | - * @onos.rsModel FlowsPost | ||
187 | * @param deviceId device identifier | 189 | * @param deviceId device identifier |
188 | * @param stream flow rule JSON | 190 | * @param stream flow rule JSON |
189 | * @return status of the request - CREATED if the JSON is correct, | 191 | * @return status of the request - CREATED if the JSON is correct, |
190 | * BAD_REQUEST if the JSON is invalid | 192 | * BAD_REQUEST if the JSON is invalid |
193 | + * @onos.rsModel FlowsPost | ||
191 | */ | 194 | */ |
192 | @POST | 195 | @POST |
193 | @Path("{deviceId}") | 196 | @Path("{deviceId}") |
... | @@ -227,7 +230,6 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -227,7 +230,6 @@ public class FlowsWebResource extends AbstractWebResource { |
227 | * @return 204 NO CONTENT | 230 | * @return 204 NO CONTENT |
228 | */ | 231 | */ |
229 | @DELETE | 232 | @DELETE |
230 | - @Produces(MediaType.APPLICATION_JSON) | ||
231 | @Path("{deviceId}/{flowId}") | 233 | @Path("{deviceId}/{flowId}") |
232 | public Response deleteFlowByDeviceIdAndFlowId(@PathParam("deviceId") String deviceId, | 234 | public Response deleteFlowByDeviceIdAndFlowId(@PathParam("deviceId") String deviceId, |
233 | @PathParam("flowId") long flowId) { | 235 | @PathParam("flowId") long flowId) { |
... | @@ -248,10 +250,9 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -248,10 +250,9 @@ public class FlowsWebResource extends AbstractWebResource { |
248 | * Removes a batch of flow rules. | 250 | * Removes a batch of flow rules. |
249 | * | 251 | * |
250 | * @param stream stream for posted JSON | 252 | * @param stream stream for posted JSON |
251 | - * @return NO CONTENT | 253 | + * @return 204 NO CONTENT |
252 | */ | 254 | */ |
253 | @DELETE | 255 | @DELETE |
254 | - @Produces(MediaType.APPLICATION_JSON) | ||
255 | public Response deleteFlows(InputStream stream) { | 256 | public Response deleteFlows(InputStream stream) { |
256 | ListMultimap<DeviceId, Long> deviceMap = ArrayListMultimap.create(); | 257 | ListMultimap<DeviceId, Long> deviceMap = ArrayListMultimap.create(); |
257 | List<FlowEntry> rulesToRemove = new ArrayList<>(); | 258 | List<FlowEntry> rulesToRemove = new ArrayList<>(); |
... | @@ -288,5 +289,4 @@ public class FlowsWebResource extends AbstractWebResource { | ... | @@ -288,5 +289,4 @@ public class FlowsWebResource extends AbstractWebResource { |
288 | service.removeFlowRules(rulesToRemove.toArray(new FlowEntry[0])); | 289 | service.removeFlowRules(rulesToRemove.toArray(new FlowEntry[0])); |
289 | return Response.noContent().build(); | 290 | return Response.noContent().build(); |
290 | } | 291 | } |
291 | - | ||
292 | } | 292 | } | ... | ... |
... | @@ -54,19 +54,19 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -54,19 +54,19 @@ import static org.onlab.util.Tools.nullIsNotFound; |
54 | public class GroupsWebResource extends AbstractWebResource { | 54 | public class GroupsWebResource extends AbstractWebResource { |
55 | 55 | ||
56 | @Context | 56 | @Context |
57 | - UriInfo uriInfo; | 57 | + private UriInfo uriInfo; |
58 | 58 | ||
59 | - public static final String DEVICE_INVALID = "Invalid deviceId in group creation request"; | 59 | + private static final String DEVICE_INVALID = "Invalid deviceId in group creation request"; |
60 | - public static final String GROUP_NOT_FOUND = "Group was not found"; | 60 | + private static final String GROUP_NOT_FOUND = "Group was not found"; |
61 | 61 | ||
62 | - final GroupService groupService = get(GroupService.class); | 62 | + private final GroupService groupService = get(GroupService.class); |
63 | - final ObjectNode root = mapper().createObjectNode(); | 63 | + private final ObjectNode root = mapper().createObjectNode(); |
64 | - final ArrayNode groupsNode = root.putArray("groups"); | 64 | + private final ArrayNode groupsNode = root.putArray("groups"); |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Returns all groups of all devices. | 67 | * Returns all groups of all devices. |
68 | * | 68 | * |
69 | - * @return array of all the groups in the system | 69 | + * @return 200 OK with array of all the groups in the system |
70 | * @onos.rsModel Groups | 70 | * @onos.rsModel Groups |
71 | */ | 71 | */ |
72 | @GET | 72 | @GET |
... | @@ -87,7 +87,7 @@ public class GroupsWebResource extends AbstractWebResource { | ... | @@ -87,7 +87,7 @@ public class GroupsWebResource extends AbstractWebResource { |
87 | * Returns all groups associated with the given device. | 87 | * Returns all groups associated with the given device. |
88 | * | 88 | * |
89 | * @param deviceId device identifier | 89 | * @param deviceId device identifier |
90 | - * @return array of all the groups in the system | 90 | + * @return 200 OK with array of all the groups in the system |
91 | * @onos.rsModel Groups | 91 | * @onos.rsModel Groups |
92 | */ | 92 | */ |
93 | @GET | 93 | @GET |
... | @@ -106,7 +106,7 @@ public class GroupsWebResource extends AbstractWebResource { | ... | @@ -106,7 +106,7 @@ public class GroupsWebResource extends AbstractWebResource { |
106 | * | 106 | * |
107 | * @param deviceId device identifier | 107 | * @param deviceId device identifier |
108 | * @param appCookie group key | 108 | * @param appCookie group key |
109 | - * @return a group entry in the system | 109 | + * @return 200 OK with a group entry in the system |
110 | * @onos.rsModel Group | 110 | * @onos.rsModel Group |
111 | */ | 111 | */ |
112 | @GET | 112 | @GET |
... | @@ -175,7 +175,6 @@ public class GroupsWebResource extends AbstractWebResource { | ... | @@ -175,7 +175,6 @@ public class GroupsWebResource extends AbstractWebResource { |
175 | * @return 204 NO CONTENT | 175 | * @return 204 NO CONTENT |
176 | */ | 176 | */ |
177 | @DELETE | 177 | @DELETE |
178 | - @Produces(MediaType.APPLICATION_JSON) | ||
179 | @Path("{deviceId}/{appCookie}") | 178 | @Path("{deviceId}/{appCookie}") |
180 | public Response deleteGroupByDeviceIdAndAppCookie(@PathParam("deviceId") String deviceId, | 179 | public Response deleteGroupByDeviceIdAndAppCookie(@PathParam("deviceId") String deviceId, |
181 | @PathParam("appCookie") String appCookie) { | 180 | @PathParam("appCookie") String appCookie) { | ... | ... |
... | @@ -64,15 +64,15 @@ import static org.onosproject.net.HostId.hostId; | ... | @@ -64,15 +64,15 @@ import static org.onosproject.net.HostId.hostId; |
64 | public class HostsWebResource extends AbstractWebResource { | 64 | public class HostsWebResource extends AbstractWebResource { |
65 | 65 | ||
66 | @Context | 66 | @Context |
67 | - UriInfo uriInfo; | 67 | + private UriInfo uriInfo; |
68 | - public static final String HOST_NOT_FOUND = "Host is not found"; | 68 | + private static final String HOST_NOT_FOUND = "Host is not found"; |
69 | private static final String[] REMOVAL_KEYS = {"mac", "vlan", "location", "ipAddresses"}; | 69 | private static final String[] REMOVAL_KEYS = {"mac", "vlan", "location", "ipAddresses"}; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Get all end-station hosts. | 72 | * Get all end-station hosts. |
73 | * Returns array of all known end-station hosts. | 73 | * Returns array of all known end-station hosts. |
74 | * | 74 | * |
75 | - * @return 200 OK | 75 | + * @return 200 OK with array of all known end-station hosts. |
76 | * @onos.rsModel Hosts | 76 | * @onos.rsModel Hosts |
77 | */ | 77 | */ |
78 | @GET | 78 | @GET |
... | @@ -88,7 +88,7 @@ public class HostsWebResource extends AbstractWebResource { | ... | @@ -88,7 +88,7 @@ public class HostsWebResource extends AbstractWebResource { |
88 | * Returns detailed properties of the specified end-station host. | 88 | * Returns detailed properties of the specified end-station host. |
89 | * | 89 | * |
90 | * @param id host identifier | 90 | * @param id host identifier |
91 | - * @return 200 OK | 91 | + * @return 200 OK with detailed properties of the specified end-station host |
92 | * @onos.rsModel Host | 92 | * @onos.rsModel Host |
93 | */ | 93 | */ |
94 | @GET | 94 | @GET |
... | @@ -107,7 +107,7 @@ public class HostsWebResource extends AbstractWebResource { | ... | @@ -107,7 +107,7 @@ public class HostsWebResource extends AbstractWebResource { |
107 | * | 107 | * |
108 | * @param mac host MAC address | 108 | * @param mac host MAC address |
109 | * @param vlan host VLAN identifier | 109 | * @param vlan host VLAN identifier |
110 | - * @return 200 OK | 110 | + * @return 200 OK with detailed properties of the specified end-station host |
111 | * @onos.rsModel Host | 111 | * @onos.rsModel Host |
112 | */ | 112 | */ |
113 | @GET | 113 | @GET |
... | @@ -160,11 +160,17 @@ public class HostsWebResource extends AbstractWebResource { | ... | @@ -160,11 +160,17 @@ public class HostsWebResource extends AbstractWebResource { |
160 | .build(); | 160 | .build(); |
161 | } | 161 | } |
162 | 162 | ||
163 | + /** | ||
164 | + * Internal host provider that provides host events. | ||
165 | + */ | ||
163 | private final class InternalHostProvider implements HostProvider { | 166 | private final class InternalHostProvider implements HostProvider { |
164 | private final ProviderId providerId = | 167 | private final ProviderId providerId = |
165 | new ProviderId("host", "org.onosproject.rest", true); | 168 | new ProviderId("host", "org.onosproject.rest", true); |
166 | private HostProviderService hostProviderService; | 169 | private HostProviderService hostProviderService; |
167 | 170 | ||
171 | + /** | ||
172 | + * Prevents from instantiation. | ||
173 | + */ | ||
168 | private InternalHostProvider() { | 174 | private InternalHostProvider() { |
169 | } | 175 | } |
170 | 176 | ... | ... |
... | @@ -58,18 +58,19 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -58,18 +58,19 @@ import static org.slf4j.LoggerFactory.getLogger; |
58 | @Path("intents") | 58 | @Path("intents") |
59 | public class IntentsWebResource extends AbstractWebResource { | 59 | public class IntentsWebResource extends AbstractWebResource { |
60 | @Context | 60 | @Context |
61 | - UriInfo uriInfo; | 61 | + private UriInfo uriInfo; |
62 | 62 | ||
63 | private static final Logger log = getLogger(IntentsWebResource.class); | 63 | private static final Logger log = getLogger(IntentsWebResource.class); |
64 | private static final int WITHDRAW_EVENT_TIMEOUT_SECONDS = 5; | 64 | private static final int WITHDRAW_EVENT_TIMEOUT_SECONDS = 5; |
65 | 65 | ||
66 | - public static final String INTENT_NOT_FOUND = "Intent is not found"; | 66 | + private static final String INTENT_NOT_FOUND = "Intent is not found"; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | - * Get all intents. | 69 | + * Gets all intents. |
70 | * Returns array containing all the intents in the system. | 70 | * Returns array containing all the intents in the system. |
71 | + * | ||
72 | + * @return 200 OK with array of all the intents in the system | ||
71 | * @onos.rsModel Intents | 73 | * @onos.rsModel Intents |
72 | - * @return array of all the intents in the system | ||
73 | */ | 74 | */ |
74 | @GET | 75 | @GET |
75 | @Produces(MediaType.APPLICATION_JSON) | 76 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -80,12 +81,13 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -80,12 +81,13 @@ public class IntentsWebResource extends AbstractWebResource { |
80 | } | 81 | } |
81 | 82 | ||
82 | /** | 83 | /** |
83 | - * Get intent by application and key. | 84 | + * Gets intent by application and key. |
84 | * Returns details of the specified intent. | 85 | * Returns details of the specified intent. |
85 | - * @onos.rsModel Intents | 86 | + * |
86 | * @param appId application identifier | 87 | * @param appId application identifier |
87 | * @param key intent key | 88 | * @param key intent key |
88 | - * @return intent data | 89 | + * @return 200 OK with intent data |
90 | + * @onos.rsModel Intents | ||
89 | */ | 91 | */ |
90 | @GET | 92 | @GET |
91 | @Produces(MediaType.APPLICATION_JSON) | 93 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -112,10 +114,19 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -112,10 +114,19 @@ public class IntentsWebResource extends AbstractWebResource { |
112 | return ok(root).build(); | 114 | return ok(root).build(); |
113 | } | 115 | } |
114 | 116 | ||
115 | - class DeleteListener implements IntentListener { | 117 | + /** |
118 | + * Internal listener for tracking the intent deletion events. | ||
119 | + */ | ||
120 | + private class DeleteListener implements IntentListener { | ||
116 | final Key key; | 121 | final Key key; |
117 | final CountDownLatch latch; | 122 | final CountDownLatch latch; |
118 | 123 | ||
124 | + /** | ||
125 | + * Default constructor. | ||
126 | + * | ||
127 | + * @param key key | ||
128 | + * @param latch count down latch | ||
129 | + */ | ||
119 | DeleteListener(Key key, CountDownLatch latch) { | 130 | DeleteListener(Key key, CountDownLatch latch) { |
120 | this.key = key; | 131 | this.key = key; |
121 | this.latch = latch; | 132 | this.latch = latch; |
... | @@ -132,12 +143,13 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -132,12 +143,13 @@ public class IntentsWebResource extends AbstractWebResource { |
132 | } | 143 | } |
133 | 144 | ||
134 | /** | 145 | /** |
135 | - * Submit a new intent. | 146 | + * Submits a new intent. |
136 | * Creates and submits intent from the JSON request. | 147 | * Creates and submits intent from the JSON request. |
137 | - * @onos.rsModel IntentHost | 148 | + * |
138 | * @param stream input JSON | 149 | * @param stream input JSON |
139 | * @return status of the request - CREATED if the JSON is correct, | 150 | * @return status of the request - CREATED if the JSON is correct, |
140 | * BAD_REQUEST if the JSON is invalid | 151 | * BAD_REQUEST if the JSON is invalid |
152 | + * @onos.rsModel IntentHost | ||
141 | */ | 153 | */ |
142 | @POST | 154 | @POST |
143 | @Consumes(MediaType.APPLICATION_JSON) | 155 | @Consumes(MediaType.APPLICATION_JSON) |
... | @@ -161,7 +173,7 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -161,7 +173,7 @@ public class IntentsWebResource extends AbstractWebResource { |
161 | } | 173 | } |
162 | 174 | ||
163 | /** | 175 | /** |
164 | - * Withdraw intent. | 176 | + * Withdraws intent. |
165 | * Withdraws the specified intent from the system. | 177 | * Withdraws the specified intent from the system. |
166 | * | 178 | * |
167 | * @param appId application identifier | 179 | * @param appId application identifier |
... | @@ -216,5 +228,4 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -216,5 +228,4 @@ public class IntentsWebResource extends AbstractWebResource { |
216 | } | 228 | } |
217 | return Response.noContent().build(); | 229 | return Response.noContent().build(); |
218 | } | 230 | } |
219 | - | ||
220 | } | 231 | } | ... | ... |
... | @@ -24,7 +24,9 @@ import org.onosproject.rest.AbstractWebResource; | ... | @@ -24,7 +24,9 @@ import org.onosproject.rest.AbstractWebResource; |
24 | 24 | ||
25 | import javax.ws.rs.GET; | 25 | import javax.ws.rs.GET; |
26 | import javax.ws.rs.Path; | 26 | import javax.ws.rs.Path; |
27 | +import javax.ws.rs.Produces; | ||
27 | import javax.ws.rs.QueryParam; | 28 | import javax.ws.rs.QueryParam; |
29 | +import javax.ws.rs.core.MediaType; | ||
28 | import javax.ws.rs.core.Response; | 30 | import javax.ws.rs.core.Response; |
29 | 31 | ||
30 | import static org.onosproject.net.DeviceId.deviceId; | 32 | import static org.onosproject.net.DeviceId.deviceId; |
... | @@ -37,15 +39,16 @@ import static org.onosproject.net.PortNumber.portNumber; | ... | @@ -37,15 +39,16 @@ import static org.onosproject.net.PortNumber.portNumber; |
37 | public class LinksWebResource extends AbstractWebResource { | 39 | public class LinksWebResource extends AbstractWebResource { |
38 | 40 | ||
39 | /** | 41 | /** |
40 | - * Get infrastructure links. | 42 | + * Gets infrastructure links. |
41 | * Returns array of all links, or links for the specified device or port. | 43 | * Returns array of all links, or links for the specified device or port. |
42 | * @onos.rsModel LinksGet | 44 | * @onos.rsModel LinksGet |
43 | * @param deviceId (optional) device identifier | 45 | * @param deviceId (optional) device identifier |
44 | * @param port (optional) port number | 46 | * @param port (optional) port number |
45 | * @param direction (optional) direction qualifier | 47 | * @param direction (optional) direction qualifier |
46 | - * @return 200 OK | 48 | + * @return 200 OK with array of all links, or links for the specified device or port |
47 | */ | 49 | */ |
48 | @GET | 50 | @GET |
51 | + @Produces(MediaType.APPLICATION_JSON) | ||
49 | public Response getLinks(@QueryParam("device") String deviceId, | 52 | public Response getLinks(@QueryParam("device") String deviceId, |
50 | @QueryParam("port") String port, | 53 | @QueryParam("port") String port, |
51 | @QueryParam("direction") String direction) { | 54 | @QueryParam("direction") String direction) { | ... | ... |
... | @@ -65,7 +65,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -65,7 +65,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
65 | * Returns the role of the local node for the specified device. | 65 | * Returns the role of the local node for the specified device. |
66 | * | 66 | * |
67 | * @param deviceId device identifier | 67 | * @param deviceId device identifier |
68 | - * @return role of the current node | 68 | + * @return 200 OK with role of the current node |
69 | * @onos.rsModel MastershipRole | 69 | * @onos.rsModel MastershipRole |
70 | */ | 70 | */ |
71 | @GET | 71 | @GET |
... | @@ -81,7 +81,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -81,7 +81,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
81 | * Returns the current master for a given device. | 81 | * Returns the current master for a given device. |
82 | * | 82 | * |
83 | * @param deviceId device identifier | 83 | * @param deviceId device identifier |
84 | - * @return the identifier of the master controller for the device | 84 | + * @return 200 OK with the identifier of the master controller for the device |
85 | * @onos.rsModel NodeId | 85 | * @onos.rsModel NodeId |
86 | */ | 86 | */ |
87 | @GET | 87 | @GET |
... | @@ -101,7 +101,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -101,7 +101,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
101 | * preference. The first entry in the list is the current master. | 101 | * preference. The first entry in the list is the current master. |
102 | * | 102 | * |
103 | * @param deviceId device identifier | 103 | * @param deviceId device identifier |
104 | - * @return a list of controller identifiers | 104 | + * @return 200 OK with a list of controller identifiers |
105 | * @onos.rsModel RoleInfo | 105 | * @onos.rsModel RoleInfo |
106 | */ | 106 | */ |
107 | @GET | 107 | @GET |
... | @@ -118,7 +118,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -118,7 +118,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
118 | * Returns the devices for which a controller is master. | 118 | * Returns the devices for which a controller is master. |
119 | * | 119 | * |
120 | * @param nodeId controller identifier | 120 | * @param nodeId controller identifier |
121 | - * @return a set of device identifiers | 121 | + * @return 200 OK with a set of device identifiers |
122 | * @onos.rsModel DeviceIds | 122 | * @onos.rsModel DeviceIds |
123 | */ | 123 | */ |
124 | @GET | 124 | @GET |
... | @@ -141,7 +141,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -141,7 +141,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
141 | * device forcing master selection if necessary. | 141 | * device forcing master selection if necessary. |
142 | * | 142 | * |
143 | * @param deviceId device identifier | 143 | * @param deviceId device identifier |
144 | - * @return the role of this controller instance | 144 | + * @return 200 OK with the role of this controller instance |
145 | * @onos.rsModel MastershipRole | 145 | * @onos.rsModel MastershipRole |
146 | */ | 146 | */ |
147 | @GET | 147 | @GET |
... | @@ -160,7 +160,7 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -160,7 +160,7 @@ public final class MastershipWebResource extends AbstractWebResource { |
160 | * for this device, no master selection will occur. | 160 | * for this device, no master selection will occur. |
161 | * | 161 | * |
162 | * @param deviceId device identifier | 162 | * @param deviceId device identifier |
163 | - * @return status of the request | 163 | + * @return status of the request - CREATED if the JSON is correct |
164 | */ | 164 | */ |
165 | @GET | 165 | @GET |
166 | @Produces(MediaType.APPLICATION_JSON) | 166 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -181,7 +181,6 @@ public final class MastershipWebResource extends AbstractWebResource { | ... | @@ -181,7 +181,6 @@ public final class MastershipWebResource extends AbstractWebResource { |
181 | */ | 181 | */ |
182 | @PUT | 182 | @PUT |
183 | @Consumes(MediaType.APPLICATION_JSON) | 183 | @Consumes(MediaType.APPLICATION_JSON) |
184 | - @Produces(MediaType.APPLICATION_JSON) | ||
185 | public Response setRole(InputStream stream) { | 184 | public Response setRole(InputStream stream) { |
186 | 185 | ||
187 | try { | 186 | try { | ... | ... |
... | @@ -52,20 +52,20 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -52,20 +52,20 @@ import static org.slf4j.LoggerFactory.getLogger; |
52 | public class MetersWebResource extends AbstractWebResource { | 52 | public class MetersWebResource extends AbstractWebResource { |
53 | 53 | ||
54 | @Context | 54 | @Context |
55 | - UriInfo uriInfo; | 55 | + private UriInfo uriInfo; |
56 | 56 | ||
57 | private final Logger log = getLogger(getClass()); | 57 | private final Logger log = getLogger(getClass()); |
58 | - public static final String DEVICE_INVALID = "Invalid deviceId in meter creation request"; | 58 | + private static final String DEVICE_INVALID = "Invalid deviceId in meter creation request"; |
59 | - public static final String METER_NOT_FOUND = "Meter is not found for "; | 59 | + private static final String METER_NOT_FOUND = "Meter is not found for "; |
60 | 60 | ||
61 | - final MeterService meterService = get(MeterService.class); | 61 | + private final MeterService meterService = get(MeterService.class); |
62 | - final ObjectNode root = mapper().createObjectNode(); | 62 | + private final ObjectNode root = mapper().createObjectNode(); |
63 | - final ArrayNode metersNode = root.putArray("meters"); | 63 | + private final ArrayNode metersNode = root.putArray("meters"); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Returns all meters of all devices. | 66 | * Returns all meters of all devices. |
67 | * | 67 | * |
68 | - * @return array of all the meters in the system | 68 | + * @return 200 OK with array of all the meters in the system |
69 | * @onos.rsModel Meters | 69 | * @onos.rsModel Meters |
70 | */ | 70 | */ |
71 | @GET | 71 | @GET |
... | @@ -82,7 +82,7 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -82,7 +82,7 @@ public class MetersWebResource extends AbstractWebResource { |
82 | * Returns a collection of meters by the device id. | 82 | * Returns a collection of meters by the device id. |
83 | * | 83 | * |
84 | * @param deviceId device identifier | 84 | * @param deviceId device identifier |
85 | - * @return array of meters which belongs to specified device | 85 | + * @return 200 OK with array of meters which belongs to specified device |
86 | * @onos.rsModel Meters | 86 | * @onos.rsModel Meters |
87 | */ | 87 | */ |
88 | @GET | 88 | @GET |
... | @@ -102,7 +102,7 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -102,7 +102,7 @@ public class MetersWebResource extends AbstractWebResource { |
102 | * | 102 | * |
103 | * @param deviceId device identifier | 103 | * @param deviceId device identifier |
104 | * @param meterId meter identifier | 104 | * @param meterId meter identifier |
105 | - * @return a meter, return 404 if no entry has been found | 105 | + * @return 200 OK with a meter, return 404 if no entry has been found |
106 | * @onos.rsModel Meter | 106 | * @onos.rsModel Meter |
107 | */ | 107 | */ |
108 | @GET | 108 | @GET |
... | @@ -121,7 +121,7 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -121,7 +121,7 @@ public class MetersWebResource extends AbstractWebResource { |
121 | } | 121 | } |
122 | 122 | ||
123 | /** | 123 | /** |
124 | - * Create new meter rule. Creates and installs a new meter rule for the | 124 | + * Creates new meter rule. Creates and installs a new meter rule for the |
125 | * specified device. | 125 | * specified device. |
126 | * | 126 | * |
127 | * @param deviceId device identifier | 127 | * @param deviceId device identifier |
... | @@ -182,7 +182,7 @@ public class MetersWebResource extends AbstractWebResource { | ... | @@ -182,7 +182,7 @@ public class MetersWebResource extends AbstractWebResource { |
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | - * Convert a meter instance to meterRequest instance with a certain operation. | 185 | + * Converts a meter instance to meterRequest instance with a certain operation. |
186 | * | 186 | * |
187 | * @param meter meter instance | 187 | * @param meter meter instance |
188 | * @param operation operation | 188 | * @param operation operation | ... | ... |
... | @@ -44,14 +44,14 @@ import java.util.Map; | ... | @@ -44,14 +44,14 @@ import java.util.Map; |
44 | @Path("metrics") | 44 | @Path("metrics") |
45 | public class MetricsWebResource extends AbstractWebResource { | 45 | public class MetricsWebResource extends AbstractWebResource { |
46 | 46 | ||
47 | - final MetricsService service = get(MetricsService.class); | 47 | + private final MetricsService service = get(MetricsService.class); |
48 | - final ObjectNode root = mapper().createObjectNode(); | 48 | + private final ObjectNode root = mapper().createObjectNode(); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | - * Get stats information of all metrics. Returns array of all information for | 51 | + * Gets stats information of all metrics. Returns array of all information for |
52 | * all metrics. | 52 | * all metrics. |
53 | * | 53 | * |
54 | - * @return metric information as array | 54 | + * @return 200 OK with metric information as array |
55 | * @onos.rsModel Metrics | 55 | * @onos.rsModel Metrics |
56 | */ | 56 | */ |
57 | @GET | 57 | @GET |
... | @@ -69,11 +69,11 @@ public class MetricsWebResource extends AbstractWebResource { | ... | @@ -69,11 +69,11 @@ public class MetricsWebResource extends AbstractWebResource { |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
72 | - * Get stats information of a metric. Returns array of all information for the | 72 | + * Gets stats information of a metric. Returns array of all information for the |
73 | * specified metric. | 73 | * specified metric. |
74 | * | 74 | * |
75 | * @param metricName metric name | 75 | * @param metricName metric name |
76 | - * @return metric information as array | 76 | + * @return 200 OK with metric information as array |
77 | * @onos.rsModel Metric | 77 | * @onos.rsModel Metric |
78 | */ | 78 | */ |
79 | @GET | 79 | @GET | ... | ... |
... | @@ -44,7 +44,7 @@ public class MulticastRouteWebResource extends AbstractWebResource { | ... | @@ -44,7 +44,7 @@ public class MulticastRouteWebResource extends AbstractWebResource { |
44 | * Get all multicast routes. | 44 | * Get all multicast routes. |
45 | * Returns array of all known multicast routes. | 45 | * Returns array of all known multicast routes. |
46 | * | 46 | * |
47 | - * @return 200 OK | 47 | + * @return 200 OK with array of all known multicast routes |
48 | * @onos.rsModel McastRoutesGet | 48 | * @onos.rsModel McastRoutesGet |
49 | */ | 49 | */ |
50 | @GET | 50 | @GET | ... | ... |
... | @@ -64,9 +64,9 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -64,9 +64,9 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
67 | - * Get entire network configuration base. | 67 | + * Gets entire network configuration base. |
68 | * | 68 | * |
69 | - * @return network configuration JSON | 69 | + * @return 200 OK with network configuration JSON |
70 | */ | 70 | */ |
71 | @GET | 71 | @GET |
72 | @Produces(MediaType.APPLICATION_JSON) | 72 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -83,10 +83,10 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -83,10 +83,10 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | - * Get all network configuration for a subject class. | 86 | + * Gets all network configuration for a subject class. |
87 | * | 87 | * |
88 | * @param subjectClassKey subject class key | 88 | * @param subjectClassKey subject class key |
89 | - * @return network configuration JSON | 89 | + * @return 200 OK with network configuration JSON |
90 | */ | 90 | */ |
91 | @GET | 91 | @GET |
92 | @Path("{subjectClassKey}") | 92 | @Path("{subjectClassKey}") |
... | @@ -103,11 +103,11 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -103,11 +103,11 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
103 | } | 103 | } |
104 | 104 | ||
105 | /** | 105 | /** |
106 | - * Get all network configuration for a subjectKey. | 106 | + * Gets all network configuration for a subjectKey. |
107 | * | 107 | * |
108 | * @param subjectClassKey subjectKey class key | 108 | * @param subjectClassKey subjectKey class key |
109 | * @param subjectKey subjectKey key | 109 | * @param subjectKey subjectKey key |
110 | - * @return network configuration JSON | 110 | + * @return 200 OK with network configuration JSON |
111 | */ | 111 | */ |
112 | @GET | 112 | @GET |
113 | @Path("{subjectClassKey}/{subjectKey}") | 113 | @Path("{subjectClassKey}/{subjectKey}") |
... | @@ -127,12 +127,12 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -127,12 +127,12 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
127 | } | 127 | } |
128 | 128 | ||
129 | /** | 129 | /** |
130 | - * Get specific network configuration for a subjectKey. | 130 | + * Gets specific network configuration for a subjectKey. |
131 | * | 131 | * |
132 | * @param subjectClassKey subjectKey class key | 132 | * @param subjectClassKey subjectKey class key |
133 | * @param subjectKey subjectKey key | 133 | * @param subjectKey subjectKey key |
134 | * @param configKey configuration class key | 134 | * @param configKey configuration class key |
135 | - * @return network configuration JSON | 135 | + * @return 200 OK with network configuration JSON |
136 | */ | 136 | */ |
137 | @GET | 137 | @GET |
138 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") | 138 | @Path("{subjectClassKey}/{subjectKey}/{configKey}") |
... | @@ -180,10 +180,10 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -180,10 +180,10 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
180 | 180 | ||
181 | 181 | ||
182 | /** | 182 | /** |
183 | - * Upload bulk network configuration. | 183 | + * Uploads bulk network configuration. |
184 | * | 184 | * |
185 | * @param request network configuration JSON rooted at the top node | 185 | * @param request network configuration JSON rooted at the top node |
186 | - * @return empty response | 186 | + * @return 200 OK |
187 | * @throws IOException if unable to parse the request | 187 | * @throws IOException if unable to parse the request |
188 | */ | 188 | */ |
189 | @POST | 189 | @POST |
... | @@ -203,7 +203,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -203,7 +203,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
203 | * | 203 | * |
204 | * @param subjectClassKey subject class key | 204 | * @param subjectClassKey subject class key |
205 | * @param request network configuration JSON rooted at the top node | 205 | * @param request network configuration JSON rooted at the top node |
206 | - * @return empty response | 206 | + * @return 200 OK |
207 | * @throws IOException if unable to parse the request | 207 | * @throws IOException if unable to parse the request |
208 | */ | 208 | */ |
209 | @POST | 209 | @POST |
... | @@ -224,7 +224,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -224,7 +224,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
224 | * @param subjectClassKey subjectKey class key | 224 | * @param subjectClassKey subjectKey class key |
225 | * @param subjectKey subjectKey key | 225 | * @param subjectKey subjectKey key |
226 | * @param request network configuration JSON rooted at the top node | 226 | * @param request network configuration JSON rooted at the top node |
227 | - * @return empty response | 227 | + * @return 200 OK |
228 | * @throws IOException if unable to parse the request | 228 | * @throws IOException if unable to parse the request |
229 | */ | 229 | */ |
230 | @POST | 230 | @POST |
... | @@ -249,7 +249,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { | ... | @@ -249,7 +249,7 @@ public class NetworkConfigWebResource extends AbstractWebResource { |
249 | * @param subjectKey subjectKey key | 249 | * @param subjectKey subjectKey key |
250 | * @param configKey configuration class key | 250 | * @param configKey configuration class key |
251 | * @param request network configuration JSON rooted at the top node | 251 | * @param request network configuration JSON rooted at the top node |
252 | - * @return empty response | 252 | + * @return 200 OK |
253 | * @throws IOException if unable to parse the request | 253 | * @throws IOException if unable to parse the request |
254 | */ | 254 | */ |
255 | @POST | 255 | @POST | ... | ... |
... | @@ -58,12 +58,12 @@ public class PathsWebResource extends AbstractWebResource { | ... | @@ -58,12 +58,12 @@ public class PathsWebResource extends AbstractWebResource { |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | - * Get all shortest paths between any two hosts or devices. | 61 | + * Gets all shortest paths between any two hosts or devices. |
62 | * Returns array of all shortest paths between any two elements. | 62 | * Returns array of all shortest paths between any two elements. |
63 | * @onos.rsModel Paths | 63 | * @onos.rsModel Paths |
64 | * @param src source identifier | 64 | * @param src source identifier |
65 | * @param dst destination identifier | 65 | * @param dst destination identifier |
66 | - * @return path data | 66 | + * @return 200 OK with array of all shortest paths between any two elements |
67 | */ | 67 | */ |
68 | @GET | 68 | @GET |
69 | @Produces(MediaType.APPLICATION_JSON) | 69 | @Produces(MediaType.APPLICATION_JSON) |
... | @@ -77,12 +77,12 @@ public class PathsWebResource extends AbstractWebResource { | ... | @@ -77,12 +77,12 @@ public class PathsWebResource extends AbstractWebResource { |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | - * Get all shortest disjoint paths between any two hosts or devices. | 80 | + * Gets all shortest disjoint paths between any two hosts or devices. |
81 | * Returns array of all shortest disjoint paths between any two elements. | 81 | * Returns array of all shortest disjoint paths between any two elements. |
82 | * @onos.rsModel Paths | 82 | * @onos.rsModel Paths |
83 | * @param src source identifier | 83 | * @param src source identifier |
84 | * @param dst destination identifier | 84 | * @param dst destination identifier |
85 | - * @return path data | 85 | + * @return 200 OK with array of all shortest disjoint paths between any two elements |
86 | */ | 86 | */ |
87 | @GET | 87 | @GET |
88 | @Produces(MediaType.APPLICATION_JSON) | 88 | @Produces(MediaType.APPLICATION_JSON) | ... | ... |
... | @@ -59,7 +59,7 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -59,7 +59,7 @@ public class RegionsWebResource extends AbstractWebResource { |
59 | /** | 59 | /** |
60 | * Returns set of all regions. | 60 | * Returns set of all regions. |
61 | * | 61 | * |
62 | - * @return 200 OK | 62 | + * @return 200 OK with set of all regions |
63 | * @onos.rsModel Regions | 63 | * @onos.rsModel Regions |
64 | */ | 64 | */ |
65 | @GET | 65 | @GET |
... | @@ -73,7 +73,7 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -73,7 +73,7 @@ public class RegionsWebResource extends AbstractWebResource { |
73 | * Returns the region with the specified identifier. | 73 | * Returns the region with the specified identifier. |
74 | * | 74 | * |
75 | * @param regionId region identifier | 75 | * @param regionId region identifier |
76 | - * @return 200 OK, 404 not found | 76 | + * @return 200 OK with a region, 404 not found |
77 | * @onos.rsModel Region | 77 | * @onos.rsModel Region |
78 | */ | 78 | */ |
79 | @GET | 79 | @GET |
... | @@ -90,7 +90,7 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -90,7 +90,7 @@ public class RegionsWebResource extends AbstractWebResource { |
90 | * Returns the set of devices that belong to the specified region. | 90 | * Returns the set of devices that belong to the specified region. |
91 | * | 91 | * |
92 | * @param regionId region identifier | 92 | * @param regionId region identifier |
93 | - * @return 200 OK | 93 | + * @return 200 OK with set of devices that belong to the specified region |
94 | * @onos.rsModel RegionDeviceIds | 94 | * @onos.rsModel RegionDeviceIds |
95 | */ | 95 | */ |
96 | @GET | 96 | @GET |
... | @@ -143,7 +143,6 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -143,7 +143,6 @@ public class RegionsWebResource extends AbstractWebResource { |
143 | @PUT | 143 | @PUT |
144 | @Path("{regionId}") | 144 | @Path("{regionId}") |
145 | @Consumes(MediaType.APPLICATION_JSON) | 145 | @Consumes(MediaType.APPLICATION_JSON) |
146 | - @Produces(MediaType.APPLICATION_JSON) | ||
147 | public Response updateRegion(@PathParam("regionId") String regionId, | 146 | public Response updateRegion(@PathParam("regionId") String regionId, |
148 | InputStream stream) { | 147 | InputStream stream) { |
149 | try { | 148 | try { |
... | @@ -169,7 +168,7 @@ public class RegionsWebResource extends AbstractWebResource { | ... | @@ -169,7 +168,7 @@ public class RegionsWebResource extends AbstractWebResource { |
169 | * Removes the specified region using the given region identifier. | 168 | * Removes the specified region using the given region identifier. |
170 | * | 169 | * |
171 | * @param regionId region identifier | 170 | * @param regionId region identifier |
172 | - * @return 200 OK, 404 not found | 171 | + * @return 204 NO CONTENT |
173 | */ | 172 | */ |
174 | @DELETE | 173 | @DELETE |
175 | @Path("{regionId}") | 174 | @Path("{regionId}") | ... | ... |
... | @@ -56,14 +56,15 @@ import static org.onosproject.net.PortNumber.portNumber; | ... | @@ -56,14 +56,15 @@ import static org.onosproject.net.PortNumber.portNumber; |
56 | @Path("statistics") | 56 | @Path("statistics") |
57 | public class StatisticsWebResource extends AbstractWebResource { | 57 | public class StatisticsWebResource extends AbstractWebResource { |
58 | @Context | 58 | @Context |
59 | - UriInfo uriInfo; | 59 | + private UriInfo uriInfo; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | - * Get load statistics for all links or for a specific link. | 62 | + * Gets load statistics for all links or for a specific link. |
63 | + * | ||
63 | * @onos.rsModel StatisticsFlowsLink | 64 | * @onos.rsModel StatisticsFlowsLink |
64 | * @param deviceId (optional) device ID for a specific link | 65 | * @param deviceId (optional) device ID for a specific link |
65 | * @param port (optional) port number for a specified link | 66 | * @param port (optional) port number for a specified link |
66 | - * @return JSON encoded array lof Load objects | 67 | + * @return 200 OK with JSON encoded array of Load objects |
67 | */ | 68 | */ |
68 | @GET | 69 | @GET |
69 | @Path("flows/link") | 70 | @Path("flows/link") |
... | @@ -101,9 +102,10 @@ public class StatisticsWebResource extends AbstractWebResource { | ... | @@ -101,9 +102,10 @@ public class StatisticsWebResource extends AbstractWebResource { |
101 | } | 102 | } |
102 | 103 | ||
103 | /** | 104 | /** |
104 | - * Get table statistics for all tables of all devices. | 105 | + * Gets table statistics for all tables of all devices. |
106 | + * | ||
105 | * @onos.rsModel StatisticsFlowsTables | 107 | * @onos.rsModel StatisticsFlowsTables |
106 | - * @return JSON encoded array of table statistics | 108 | + * @return 200 OK with JSON encoded array of table statistics |
107 | */ | 109 | */ |
108 | @GET | 110 | @GET |
109 | @Path("flows/tables") | 111 | @Path("flows/tables") |
... | @@ -130,10 +132,11 @@ public class StatisticsWebResource extends AbstractWebResource { | ... | @@ -130,10 +132,11 @@ public class StatisticsWebResource extends AbstractWebResource { |
130 | } | 132 | } |
131 | 133 | ||
132 | /** | 134 | /** |
133 | - * Get table statistics for all tables of a specified device. | 135 | + * Gets table statistics for all tables of a specified device. |
136 | + * | ||
134 | * @onos.rsModel StatisticsFlowsTables | 137 | * @onos.rsModel StatisticsFlowsTables |
135 | * @param deviceId device ID | 138 | * @param deviceId device ID |
136 | - * @return JSON encoded array of table statistics | 139 | + * @return 200 OK with JSON encoded array of table statistics |
137 | */ | 140 | */ |
138 | @GET | 141 | @GET |
139 | @Path("flows/tables/{deviceId}") | 142 | @Path("flows/tables/{deviceId}") |
... | @@ -156,9 +159,9 @@ public class StatisticsWebResource extends AbstractWebResource { | ... | @@ -156,9 +159,9 @@ public class StatisticsWebResource extends AbstractWebResource { |
156 | } | 159 | } |
157 | 160 | ||
158 | /** | 161 | /** |
159 | - * Get port statistics of all devices. | 162 | + * Gets port statistics of all devices. |
160 | * @onos.rsModel StatisticsPorts | 163 | * @onos.rsModel StatisticsPorts |
161 | - * @return JSON encoded array of port statistics | 164 | + * @return 200 OK with JSON encoded array of port statistics |
162 | */ | 165 | */ |
163 | @GET | 166 | @GET |
164 | @Path("ports") | 167 | @Path("ports") |
... | @@ -185,10 +188,10 @@ public class StatisticsWebResource extends AbstractWebResource { | ... | @@ -185,10 +188,10 @@ public class StatisticsWebResource extends AbstractWebResource { |
185 | } | 188 | } |
186 | 189 | ||
187 | /** | 190 | /** |
188 | - * Get port statistics of a specified devices. | 191 | + * Gets port statistics of a specified devices. |
189 | * @onos.rsModel StatisticsPorts | 192 | * @onos.rsModel StatisticsPorts |
190 | * @param deviceId device ID | 193 | * @param deviceId device ID |
191 | - * @return JSON encoded array of port statistics | 194 | + * @return 200 OK with JSON encoded array of port statistics |
192 | */ | 195 | */ |
193 | @GET | 196 | @GET |
194 | @Path("ports/{deviceId}") | 197 | @Path("ports/{deviceId}") | ... | ... |
... | @@ -49,14 +49,14 @@ public class TenantWebResource extends AbstractWebResource { | ... | @@ -49,14 +49,14 @@ public class TenantWebResource extends AbstractWebResource { |
49 | private static final String INVALID_TENANTID = "Invalid tenant identifier "; | 49 | private static final String INVALID_TENANTID = "Invalid tenant identifier "; |
50 | 50 | ||
51 | @Context | 51 | @Context |
52 | - UriInfo uriInfo; | 52 | + private UriInfo uriInfo; |
53 | 53 | ||
54 | private final VirtualNetworkAdminService vnetAdminService = get(VirtualNetworkAdminService.class); | 54 | private final VirtualNetworkAdminService vnetAdminService = get(VirtualNetworkAdminService.class); |
55 | 55 | ||
56 | /** | 56 | /** |
57 | - * Returns all tenants. | 57 | + * Returns all tenant identifiers. |
58 | * | 58 | * |
59 | - * @return 200 OK | 59 | + * @return 200 OK with set of tenant identifiers |
60 | * @onos.rsModel TenantIds | 60 | * @onos.rsModel TenantIds |
61 | */ | 61 | */ |
62 | @GET | 62 | @GET |
... | @@ -109,7 +109,7 @@ public class TenantWebResource extends AbstractWebResource { | ... | @@ -109,7 +109,7 @@ public class TenantWebResource extends AbstractWebResource { |
109 | } | 109 | } |
110 | 110 | ||
111 | /** | 111 | /** |
112 | - * Get the tenant identifier from the JSON stream. | 112 | + * Gets the tenant identifier from the JSON stream. |
113 | * | 113 | * |
114 | * @param stream TenantId JSON stream | 114 | * @param stream TenantId JSON stream |
115 | * @return TenantId | 115 | * @return TenantId |
... | @@ -132,14 +132,13 @@ public class TenantWebResource extends AbstractWebResource { | ... | @@ -132,14 +132,13 @@ public class TenantWebResource extends AbstractWebResource { |
132 | * @param tidIn tenant identifier | 132 | * @param tidIn tenant identifier |
133 | * @return TenantId | 133 | * @return TenantId |
134 | */ | 134 | */ |
135 | - static TenantId getExistingTenantId(VirtualNetworkAdminService vnetAdminSvc, | 135 | + protected static TenantId getExistingTenantId(VirtualNetworkAdminService vnetAdminSvc, |
136 | TenantId tidIn) { | 136 | TenantId tidIn) { |
137 | - final TenantId resultTid = vnetAdminSvc | 137 | + return vnetAdminSvc |
138 | .getTenantIds() | 138 | .getTenantIds() |
139 | .stream() | 139 | .stream() |
140 | .filter(tenantId -> tenantId.equals(tidIn)) | 140 | .filter(tenantId -> tenantId.equals(tidIn)) |
141 | .findFirst() | 141 | .findFirst() |
142 | .orElseThrow(() -> new ItemNotFoundException(TENANTID_NOT_FOUND)); | 142 | .orElseThrow(() -> new ItemNotFoundException(TENANTID_NOT_FOUND)); |
143 | - return resultTid; | ||
144 | } | 143 | } |
145 | } | 144 | } | ... | ... |
... | @@ -44,12 +44,12 @@ import static org.onlab.util.Tools.nullIsNotFound; | ... | @@ -44,12 +44,12 @@ import static org.onlab.util.Tools.nullIsNotFound; |
44 | @Path("topology") | 44 | @Path("topology") |
45 | public class TopologyWebResource extends AbstractWebResource { | 45 | public class TopologyWebResource extends AbstractWebResource { |
46 | 46 | ||
47 | - public static final String CLUSTER_NOT_FOUND = "Cluster is not found"; | 47 | + private static final String CLUSTER_NOT_FOUND = "Cluster is not found"; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | - * Get overview of current topology. | 50 | + * Gets overview of current topology. |
51 | * | 51 | * |
52 | - * @return topology overview | 52 | + * @return 200 OK with topology overview |
53 | * @onos.rsModel Topology | 53 | * @onos.rsModel Topology |
54 | */ | 54 | */ |
55 | @GET | 55 | @GET |
... | @@ -61,9 +61,9 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -61,9 +61,9 @@ public class TopologyWebResource extends AbstractWebResource { |
61 | } | 61 | } |
62 | 62 | ||
63 | /** | 63 | /** |
64 | - * Get overview of topology SCCs. | 64 | + * Gets overview of topology SCCs. |
65 | * | 65 | * |
66 | - * @return topology clusters overview | 66 | + * @return 200 OK with topology clusters overview |
67 | * @onos.rsModel TopologyClusters | 67 | * @onos.rsModel TopologyClusters |
68 | */ | 68 | */ |
69 | @GET | 69 | @GET |
... | @@ -78,10 +78,10 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -78,10 +78,10 @@ public class TopologyWebResource extends AbstractWebResource { |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | - * Get details of a specific SCC. | 81 | + * Gets details of a specific SCC. |
82 | * | 82 | * |
83 | * @param clusterId id of the cluster to query | 83 | * @param clusterId id of the cluster to query |
84 | - * @return topology cluster details | 84 | + * @return 200 OK with topology cluster details |
85 | * @onos.rsModel TopologyCluster | 85 | * @onos.rsModel TopologyCluster |
86 | */ | 86 | */ |
87 | @GET | 87 | @GET |
... | @@ -102,10 +102,10 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -102,10 +102,10 @@ public class TopologyWebResource extends AbstractWebResource { |
102 | } | 102 | } |
103 | 103 | ||
104 | /** | 104 | /** |
105 | - * Get devices in a specific SCC. | 105 | + * Gets devices in a specific SCC. |
106 | * | 106 | * |
107 | * @param clusterId id of the cluster to query | 107 | * @param clusterId id of the cluster to query |
108 | - * @return topology cluster devices | 108 | + * @return 200 OK with topology cluster devices |
109 | * @onos.rsModel TopologyClustersDevices | 109 | * @onos.rsModel TopologyClustersDevices |
110 | */ | 110 | */ |
111 | @GET | 111 | @GET |
... | @@ -126,10 +126,10 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -126,10 +126,10 @@ public class TopologyWebResource extends AbstractWebResource { |
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | - * Get links in specific SCC. | 129 | + * Gets links in specific SCC. |
130 | * | 130 | * |
131 | * @param clusterId id of the cluster to query | 131 | * @param clusterId id of the cluster to query |
132 | - * @return topology cluster links | 132 | + * @return 200 OK with topology cluster links |
133 | * @onos.rsModel LinksGet | 133 | * @onos.rsModel LinksGet |
134 | */ | 134 | */ |
135 | @GET | 135 | @GET |
... | @@ -175,11 +175,11 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -175,11 +175,11 @@ public class TopologyWebResource extends AbstractWebResource { |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | - * Test if a connect point is in broadcast set. | 178 | + * Tests if a connect point is in broadcast set. |
179 | * | 179 | * |
180 | * @param connectPointString deviceid:portnumber | 180 | * @param connectPointString deviceid:portnumber |
181 | - * @return JSON representation of true if the connect point is broadcast, | 181 | + * @return 200 OK with JSON representation of true if the connect point is |
182 | - * false otherwise | 182 | + * broadcast, false otherwise |
183 | * @onos.rsModel TopologyBroadcast | 183 | * @onos.rsModel TopologyBroadcast |
184 | */ | 184 | */ |
185 | @GET | 185 | @GET |
... | @@ -193,17 +193,16 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -193,17 +193,16 @@ public class TopologyWebResource extends AbstractWebResource { |
193 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); | 193 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); |
194 | boolean isBroadcast = get(TopologyService.class).isBroadcastPoint(topology, connectPoint); | 194 | boolean isBroadcast = get(TopologyService.class).isBroadcastPoint(topology, connectPoint); |
195 | 195 | ||
196 | - return ok(mapper() | 196 | + return ok(mapper().createObjectNode() |
197 | - .createObjectNode() | ||
198 | .put("broadcast", isBroadcast)) | 197 | .put("broadcast", isBroadcast)) |
199 | .build(); | 198 | .build(); |
200 | } | 199 | } |
201 | 200 | ||
202 | /** | 201 | /** |
203 | - * Test if a connect point is infrastructure or edge. | 202 | + * Tests if a connect point is infrastructure or edge. |
204 | * | 203 | * |
205 | * @param connectPointString deviceid:portnumber | 204 | * @param connectPointString deviceid:portnumber |
206 | - * @return JSON representation of true if the connect point is broadcast, | 205 | + * @return 200 OK with JSON representation of true if the connect point is broadcast, |
207 | * false otherwise | 206 | * false otherwise |
208 | * @onos.rsModel TopologyInfrastructure | 207 | * @onos.rsModel TopologyInfrastructure |
209 | */ | 208 | */ |
... | @@ -218,10 +217,8 @@ public class TopologyWebResource extends AbstractWebResource { | ... | @@ -218,10 +217,8 @@ public class TopologyWebResource extends AbstractWebResource { |
218 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); | 217 | ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); |
219 | boolean isInfrastructure = get(TopologyService.class).isInfrastructure(topology, connectPoint); | 218 | boolean isInfrastructure = get(TopologyService.class).isInfrastructure(topology, connectPoint); |
220 | 219 | ||
221 | - return ok(mapper() | 220 | + return ok(mapper().createObjectNode() |
222 | - .createObjectNode() | ||
223 | .put("infrastructure", isInfrastructure)) | 221 | .put("infrastructure", isInfrastructure)) |
224 | .build(); | 222 | .build(); |
225 | } | 223 | } |
226 | - | ||
227 | } | 224 | } | ... | ... |
... | @@ -67,14 +67,14 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -67,14 +67,14 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
67 | private final VirtualNetworkService vnetService = get(VirtualNetworkService.class); | 67 | private final VirtualNetworkService vnetService = get(VirtualNetworkService.class); |
68 | 68 | ||
69 | @Context | 69 | @Context |
70 | - UriInfo uriInfo; | 70 | + private UriInfo uriInfo; |
71 | 71 | ||
72 | // VirtualNetwork | 72 | // VirtualNetwork |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Returns all virtual networks. | 75 | * Returns all virtual networks. |
76 | * | 76 | * |
77 | - * @return 200 OK | 77 | + * @return 200 OK with set of virtual networks |
78 | * @onos.rsModel VirtualNetworks | 78 | * @onos.rsModel VirtualNetworks |
79 | */ | 79 | */ |
80 | @GET | 80 | @GET |
... | @@ -92,7 +92,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -92,7 +92,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
92 | * Returns the virtual networks with the specified tenant identifier. | 92 | * Returns the virtual networks with the specified tenant identifier. |
93 | * | 93 | * |
94 | * @param tenantId tenant identifier | 94 | * @param tenantId tenant identifier |
95 | - * @return 200 OK, 404 not found | 95 | + * @return 200 OK with a virtual network, 404 not found |
96 | * @onos.rsModel VirtualNetworks | 96 | * @onos.rsModel VirtualNetworks |
97 | */ | 97 | */ |
98 | @GET | 98 | @GET |
... | @@ -151,7 +151,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -151,7 +151,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
151 | * Returns all virtual network devices in a virtual network. | 151 | * Returns all virtual network devices in a virtual network. |
152 | * | 152 | * |
153 | * @param networkId network identifier | 153 | * @param networkId network identifier |
154 | - * @return 200 OK | 154 | + * @return 200 OK with set of virtual devices, 404 not found |
155 | * @onos.rsModel VirtualDevices | 155 | * @onos.rsModel VirtualDevices |
156 | */ | 156 | */ |
157 | @GET | 157 | @GET |
... | @@ -222,7 +222,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -222,7 +222,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
222 | * | 222 | * |
223 | * @param networkId network identifier | 223 | * @param networkId network identifier |
224 | * @param deviceId virtual device identifier | 224 | * @param deviceId virtual device identifier |
225 | - * @return 200 OK | 225 | + * @return 200 OK with set of virtual ports, 404 not found |
226 | * @onos.rsModel VirtualPorts | 226 | * @onos.rsModel VirtualPorts |
227 | */ | 227 | */ |
228 | @GET | 228 | @GET |
... | @@ -312,7 +312,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { | ... | @@ -312,7 +312,7 @@ public class VirtualNetworkWebResource extends AbstractWebResource { |
312 | * Returns all virtual network links in a virtual network. | 312 | * Returns all virtual network links in a virtual network. |
313 | * | 313 | * |
314 | * @param networkId network identifier | 314 | * @param networkId network identifier |
315 | - * @return 200 OK | 315 | + * @return 200 OK with set of virtual network links |
316 | * @onos.rsModel VirtualLinks | 316 | * @onos.rsModel VirtualLinks |
317 | */ | 317 | */ |
318 | @GET | 318 | @GET | ... | ... |
-
Please register or login to post a comment