aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/web/api
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
commit77ce3be7567bd01c66d8ee88a93b485666723501 (patch)
tree283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/web/api
parent00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff)
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995 Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/web/api')
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/AbstractMapper.java7
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/ServerErrorMapper.java6
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java3
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java3
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java3
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java8
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java5
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java2
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java97
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java4
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java14
-rw-r--r--framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java21
12 files changed, 127 insertions, 46 deletions
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/AbstractMapper.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/AbstractMapper.java
index f49202dd..0d9d94d3 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/AbstractMapper.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/AbstractMapper.java
@@ -29,6 +29,11 @@ import static com.google.common.base.Strings.isNullOrEmpty;
public abstract class AbstractMapper<E extends Throwable> implements ExceptionMapper<E> {
/**
+ * Holds the current exception for use in subclasses.
+ */
+ protected Throwable error;
+
+ /**
* Returns the response status to be given when the exception occurs.
*
* @return response status
@@ -37,6 +42,7 @@ public abstract class AbstractMapper<E extends Throwable> implements ExceptionMa
@Override
public Response toResponse(E exception) {
+ error = exception;
return response(responseStatus(), exception).build();
}
@@ -50,6 +56,7 @@ public abstract class AbstractMapper<E extends Throwable> implements ExceptionMa
*/
protected Response.ResponseBuilder response(Response.Status status,
Throwable exception) {
+ error = exception;
ObjectMapper mapper = new ObjectMapper();
String message = messageFrom(exception);
ObjectNode result = mapper.createObjectNode()
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/ServerErrorMapper.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/ServerErrorMapper.java
index 5a9050d0..778750e6 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/ServerErrorMapper.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/exceptions/ServerErrorMapper.java
@@ -18,13 +18,19 @@ package org.onosproject.rest.exceptions;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
+import org.slf4j.Logger;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
/**
* Mapper for service not found exceptions to the INTERNAL_SERVER_ERROR response code.
*/
@Provider
public class ServerErrorMapper extends AbstractMapper<RuntimeException> {
+ private static final Logger log = getLogger(ServerErrorMapper.class);
@Override
protected Response.Status responseStatus() {
+ log.warn("Unhandled REST exception", error);
return Response.Status.INTERNAL_SERVER_ERROR;
}
}
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
index 636fc333..b38633bf 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
@@ -44,6 +44,7 @@ public class ApplicationsWebResource extends AbstractWebResource {
* Get all installed applications.
* Returns array of all installed applications.
*
+ * @rsModel Applications
* @return 200 OK
*/
@GET
@@ -56,7 +57,7 @@ public class ApplicationsWebResource extends AbstractWebResource {
/**
* Get application details.
* Returns details of the specified application.
- *
+ * @rsModel Application
* @param name application name
* @return 200 OK; 404; 401
*/
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
index 312f6e35..16a4dc7f 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
@@ -49,6 +49,7 @@ public class ClusterWebResource extends AbstractWebResource {
* Returns array of all cluster nodes.
*
* @return 200 OK
+ * @rsModel Cluster
*/
@GET
public Response getClusterNodes() {
@@ -62,6 +63,7 @@ public class ClusterWebResource extends AbstractWebResource {
*
* @param id cluster node identifier
* @return 200 OK
+ * @rsModel ClusterNode
*/
@GET
@Path("{id}")
@@ -78,6 +80,7 @@ public class ClusterWebResource extends AbstractWebResource {
* @param config cluster definition
* @return 200 OK
* @throws IOException to signify bad request
+ * @rsModel ClusterPost
*/
@POST
@Path("configuration")
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
index 05756e5a..23ca46e7 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
@@ -46,6 +46,7 @@ public class DevicesWebResource extends AbstractWebResource {
* Returns array of all discovered infrastructure devices.
*
* @return 200 OK
+ * @rsModel DevicesGet
*/
@GET
public Response getDevices() {
@@ -59,6 +60,7 @@ public class DevicesWebResource extends AbstractWebResource {
*
* @param id device identifier
* @return 200 OK
+ * @rsModel DeviceGet
*/
@GET
@Path("{id}")
@@ -89,6 +91,7 @@ public class DevicesWebResource extends AbstractWebResource {
* Get ports of infrastructure device.
* Returns details of the specified infrastructure device.
*
+ * @rsModel DeviceGetPorts
* @param id device identifier
* @return 200 OK
*/
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
index 0e88e34e..252a3ba7 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
@@ -58,7 +58,7 @@ public class FlowsWebResource extends AbstractWebResource {
/**
* Get all flow entries. Returns array of all flow rules in the system.
- *
+ * @rsModel Flows
* @return array of all the intents in the system
*/
@GET
@@ -80,7 +80,7 @@ public class FlowsWebResource extends AbstractWebResource {
/**
* Get flow entries of a device. Returns array of all flow rules for the
* specified device.
- *
+ * @rsModel Flows
* @param deviceId device identifier
* @return flow data as an array
*/
@@ -103,7 +103,7 @@ public class FlowsWebResource extends AbstractWebResource {
/**
* Get flow rule. Returns the flow entry specified by the device id and
* flow rule id.
- *
+ * @rsModel Flows
* @param deviceId device identifier
* @param flowId flow rule identifier
* @return flow data as an array
@@ -130,7 +130,7 @@ public class FlowsWebResource extends AbstractWebResource {
/**
* Create new flow rule. Creates and installs a new flow rule for the
* specified device.
- *
+ * @rsModel FlowsPost
* @param deviceId device identifier
* @param stream flow rule JSON
* @return status of the request - CREATED if the JSON is correct,
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
index b89f5add..455e4929 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
@@ -70,6 +70,7 @@ public class HostsWebResource extends AbstractWebResource {
* Returns array of all known end-station hosts.
*
* @return 200 OK
+ * @rsModel Hosts
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -85,6 +86,7 @@ public class HostsWebResource extends AbstractWebResource {
*
* @param id host identifier
* @return 200 OK
+ * @rsModel Host
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -103,6 +105,7 @@ public class HostsWebResource extends AbstractWebResource {
* @param mac host MAC address
* @param vlan host VLAN identifier
* @return 200 OK
+ * @rsModel Host
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -122,6 +125,7 @@ public class HostsWebResource extends AbstractWebResource {
* @param stream input JSON
* @return status of the request - CREATED if the JSON is correct,
* BAD_REQUEST if the JSON is invalid
+ * @rsModel HostPut
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@@ -195,6 +199,7 @@ public class HostsWebResource extends AbstractWebResource {
while (ipStrings.hasNext()) {
ips.add(IpAddress.valueOf(ipStrings.next().asText()));
}
+ //TODO remove elements from json node after reading them
SparseAnnotations annotations = annotations(node);
// Update host inventory
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
index c6270199..e36ea8af 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
@@ -44,7 +44,7 @@ public class LinksWebResource extends AbstractWebResource {
/**
* Get infrastructure links.
* Returns array of all links, or links for the specified device or port.
- *
+ * @rsModel LinksGet
* @param deviceId (optional) device identifier
* @param port (optional) port number
* @param direction (optional) direction qualifier
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
index 808fcc16..69c0b6a3 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
@@ -15,10 +15,9 @@
*/
package org.onosproject.rest.resources;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.config.SubjectFactory;
-import org.onosproject.rest.AbstractWebResource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -29,8 +28,16 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
+
+import org.onosproject.net.config.Config;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.SubjectFactory;
+import org.onosproject.rest.AbstractWebResource;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import static org.onlab.util.Tools.emptyIsNotFound;
+import static org.onlab.util.Tools.nullIsNotFound;
/**
* Manage network configurations.
@@ -38,9 +45,30 @@ import java.io.InputStream;
@Path("network/configuration")
public class NetworkConfigWebResource extends AbstractWebResource {
+
+ private String subjectClassNotFoundErrorString(String subjectClassKey) {
+ return "Config for '" + subjectClassKey + "' not found";
+ }
+
+ private String subjectNotFoundErrorString(String subjectClassKey,
+ String subjectKey) {
+ return "Config for '"
+ + subjectClassKey + "/" + subjectKey
+ + "' not found";
+ }
+
+ private String configKeyNotFoundErrorString(String subjectClassKey,
+ String subjectKey,
+ String configKey) {
+ return "Config for '"
+ + subjectClassKey + "/" + subjectKey + "/" + configKey
+ + "' not found";
+ }
+
/**
* Get entire network configuration base.
*
+ * @rsModel NetCfgGet
* @return network configuration JSON
*/
@GET
@@ -70,7 +98,9 @@ public class NetworkConfigWebResource extends AbstractWebResource {
public Response download(@PathParam("subjectClassKey") String subjectClassKey) {
NetworkConfigService service = get(NetworkConfigService.class);
ObjectNode root = mapper().createObjectNode();
- SubjectFactory subjectFactory = service.getSubjectFactory(subjectClassKey);
+ SubjectFactory subjectFactory =
+ nullIsNotFound(service.getSubjectFactory(subjectClassKey),
+ subjectClassNotFoundErrorString(subjectClassKey));
produceJson(service, root, subjectFactory, subjectFactory.subjectClass());
return ok(root).build();
}
@@ -90,8 +120,12 @@ public class NetworkConfigWebResource extends AbstractWebResource {
@PathParam("subjectKey") String subjectKey) {
NetworkConfigService service = get(NetworkConfigService.class);
ObjectNode root = mapper().createObjectNode();
- SubjectFactory subjectFactory = service.getSubjectFactory(subjectClassKey);
- produceSubjectJson(service, root, subjectFactory.createSubject(subjectKey));
+ SubjectFactory subjectFactory =
+ nullIsNotFound(service.getSubjectFactory(subjectClassKey),
+ subjectClassNotFoundErrorString(subjectClassKey));
+ produceSubjectJson(service, root, subjectFactory.createSubject(subjectKey),
+ true,
+ subjectNotFoundErrorString(subjectClassKey, subjectKey));
return ok(root).build();
}
@@ -111,26 +145,47 @@ public class NetworkConfigWebResource extends AbstractWebResource {
@PathParam("subjectKey") String subjectKey,
@PathParam("configKey") String configKey) {
NetworkConfigService service = get(NetworkConfigService.class);
- return ok(service.getConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey),
- service.getConfigClass(subjectClassKey, configKey)).node()).build();
+
+ Object subject =
+ nullIsNotFound(service.getSubjectFactory(subjectClassKey)
+ .createSubject(subjectKey),
+ subjectNotFoundErrorString(subjectClassKey, subjectKey));
+
+ Class configClass =
+ nullIsNotFound(service.getConfigClass(subjectClassKey, configKey),
+ configKeyNotFoundErrorString(subjectClassKey, subjectKey, configKey));
+ Config config =
+ nullIsNotFound(service.getConfig(subject, configClass),
+ configKeyNotFoundErrorString(subjectClassKey,
+ subjectKey,
+ configKey));
+ return ok(config.node()).build();
}
@SuppressWarnings("unchecked")
private void produceJson(NetworkConfigService service, ObjectNode node,
SubjectFactory subjectFactory, Class subjectClass) {
service.getSubjects(subjectClass).forEach(s ->
- produceSubjectJson(service, newObject(node, subjectFactory.subjectKey(s)), s));
+ produceSubjectJson(service, newObject(node, subjectFactory.subjectKey(s)), s, false, ""));
}
private void produceSubjectJson(NetworkConfigService service, ObjectNode node,
- Object subject) {
- service.getConfigs(subject).forEach(c -> node.set(c.key(), c.node()));
+ Object subject,
+ boolean emptyIsError,
+ String emptyErrorMessage) {
+ Set<? extends Config<Object>> configs = service.getConfigs(subject);
+ if (emptyIsError) {
+ // caller wants an empty set to be a 404
+ configs = emptyIsNotFound(configs, emptyErrorMessage);
+ }
+ configs.forEach(c -> node.set(c.key(), c.node()));
}
/**
* Upload bulk network configuration.
*
+ * @rsModel NetCfgGet
* @param request network configuration JSON rooted at the top node
* @return empty response
* @throws IOException if unable to parse the request
@@ -253,17 +308,15 @@ public class NetworkConfigWebResource extends AbstractWebResource {
* Clear all network configurations for a subject class.
*
* @param subjectClassKey subject class key
- * @return empty response
*/
@DELETE
@Path("{subjectClassKey}")
@SuppressWarnings("unchecked")
- public Response delete(@PathParam("subjectClassKey") String subjectClassKey) {
+ public void delete(@PathParam("subjectClassKey") String subjectClassKey) {
NetworkConfigService service = get(NetworkConfigService.class);
- service.getSubjects(service.getSubjectFactory(subjectClassKey).getClass())
+ service.getSubjects(service.getSubjectFactory(subjectClassKey).subjectClass())
.forEach(subject -> service.getConfigs(subject)
.forEach(config -> service.removeConfig(subject, config.getClass())));
- return Response.ok().build();
}
/**
@@ -271,17 +324,15 @@ public class NetworkConfigWebResource extends AbstractWebResource {
*
* @param subjectClassKey subjectKey class key
* @param subjectKey subjectKey key
- * @return empty response
*/
@DELETE
@Path("{subjectClassKey}/{subjectKey}")
@SuppressWarnings("unchecked")
- public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
+ public void delete(@PathParam("subjectClassKey") String subjectClassKey,
@PathParam("subjectKey") String subjectKey) {
NetworkConfigService service = get(NetworkConfigService.class);
Object s = service.getSubjectFactory(subjectClassKey).createSubject(subjectKey);
service.getConfigs(s).forEach(c -> service.removeConfig(s, c.getClass()));
- return Response.ok().build();
}
/**
@@ -290,18 +341,16 @@ public class NetworkConfigWebResource extends AbstractWebResource {
* @param subjectClassKey subjectKey class key
* @param subjectKey subjectKey key
* @param configKey configuration class key
- * @return empty response
*/
@DELETE
@Path("{subjectClassKey}/{subjectKey}/{configKey}")
@SuppressWarnings("unchecked")
- public Response delete(@PathParam("subjectClassKey") String subjectClassKey,
+ public void delete(@PathParam("subjectClassKey") String subjectClassKey,
@PathParam("subjectKey") String subjectKey,
@PathParam("configKey") String configKey) {
NetworkConfigService service = get(NetworkConfigService.class);
service.removeConfig(service.getSubjectFactory(subjectClassKey).createSubject(subjectKey),
service.getConfigClass(subjectClassKey, configKey));
- return Response.ok().build();
}
}
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
index 9714690c..c14b4ec2 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
@@ -60,7 +60,7 @@ public class PathsWebResource extends AbstractWebResource {
/**
* Get all shortest paths between any two hosts or devices.
* Returns array of all shortest paths between any two elements.
- *
+ * @rsModel Paths
* @param src source identifier
* @param dst destination identifier
* @return path data
@@ -79,7 +79,7 @@ public class PathsWebResource extends AbstractWebResource {
/**
* Get all shortest disjoint paths between any two hosts or devices.
* Returns array of all shortest disjoint paths between any two elements.
- *
+ * @rsModel Paths
* @param src source identifier
* @param dst destination identifier
* @return path data
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
index c91cb6d0..7a452044 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
@@ -59,7 +59,7 @@ public class StatisticsWebResource extends AbstractWebResource {
/**
* Get load statistics for all links or for a specific link.
- *
+ * @rsModel StatisticsFlowsLink
* @param deviceId (optional) device ID for a specific link
* @param port (optional) port number for a specified link
* @return JSON encoded array lof Load objects
@@ -101,7 +101,7 @@ public class StatisticsWebResource extends AbstractWebResource {
/**
* Get table statistics for all tables of all devices.
- *
+ * @rsModel StatisticsFlowsTables
* @return JSON encoded array of table statistics
*/
@GET
@@ -111,11 +111,11 @@ public class StatisticsWebResource extends AbstractWebResource {
final FlowRuleService service = get(FlowRuleService.class);
final Iterable<Device> devices = get(DeviceService.class).getDevices();
final ObjectNode root = mapper().createObjectNode();
- final ArrayNode rootArrayNode = root.putArray("device-table-statistics");
+ final ArrayNode rootArrayNode = root.putArray("statistics");
for (final Device device : devices) {
final ObjectNode deviceStatsNode = mapper().createObjectNode();
deviceStatsNode.put("device", device.id().toString());
- final ArrayNode statisticsNode = deviceStatsNode.putArray("table-statistics");
+ final ArrayNode statisticsNode = deviceStatsNode.putArray("table");
final Iterable<TableStatisticsEntry> tableStatsEntries = service.getFlowTableStatistics(device.id());
if (tableStatsEntries != null) {
for (final TableStatisticsEntry entry : tableStatsEntries) {
@@ -130,7 +130,7 @@ public class StatisticsWebResource extends AbstractWebResource {
/**
* Get table statistics for all tables of a specified device.
- *
+ * @rsModel StatisticsFlowsTables
* @param deviceId device ID
* @return JSON encoded array of table statistics
*/
@@ -142,11 +142,11 @@ public class StatisticsWebResource extends AbstractWebResource {
final Iterable<TableStatisticsEntry> tableStatisticsEntries =
service.getFlowTableStatistics(DeviceId.deviceId(deviceId));
final ObjectNode root = mapper().createObjectNode();
- final ArrayNode rootArrayNode = root.putArray("table-statistics");
+ final ArrayNode rootArrayNode = root.putArray("statistics");
final ObjectNode deviceStatsNode = mapper().createObjectNode();
deviceStatsNode.put("device", deviceId);
- final ArrayNode statisticsNode = deviceStatsNode.putArray("table-statistics");
+ final ArrayNode statisticsNode = deviceStatsNode.putArray("table");
for (final TableStatisticsEntry entry : tableStatisticsEntries) {
statisticsNode.add(codec(TableStatisticsEntry.class).encode(entry, this));
}
diff --git a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
index f6ae8253..d51bd5a0 100644
--- a/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
+++ b/framework/src/onos/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
@@ -50,6 +50,7 @@ public class TopologyWebResource extends AbstractWebResource {
* Get overview of current topology.
*
* @return topology overview
+ * @rsModel Topology
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -63,6 +64,7 @@ public class TopologyWebResource extends AbstractWebResource {
* Get overview of topology SCCs.
*
* @return topology clusters overview
+ * @rsModel TopologyClusters
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -80,6 +82,7 @@ public class TopologyWebResource extends AbstractWebResource {
*
* @param clusterId id of the cluster to query
* @return topology cluster details
+ * @rsModel TopologyCluster
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -103,6 +106,7 @@ public class TopologyWebResource extends AbstractWebResource {
*
* @param clusterId id of the cluster to query
* @return topology cluster devices
+ * @rsModel TopologyClustersDevices
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -126,6 +130,7 @@ public class TopologyWebResource extends AbstractWebResource {
*
* @param clusterId id of the cluster to query
* @return topology cluster links
+ * @rsModel LinksGet
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -136,7 +141,7 @@ public class TopologyWebResource extends AbstractWebResource {
List<Link> links =
Lists.newArrayList(get(TopologyService.class)
- .getClusterLinks(topology, cluster));
+ .getClusterLinks(topology, cluster));
return ok(encodeArray(Link.class, "links", links)).build();
}
@@ -174,7 +179,8 @@ public class TopologyWebResource extends AbstractWebResource {
*
* @param connectPointString deviceid:portnumber
* @return JSON representation of true if the connect point is broadcast,
- * false otherwise
+ * false otherwise
+ * @rsModel TopologyBroadcast
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -188,8 +194,8 @@ public class TopologyWebResource extends AbstractWebResource {
boolean isBroadcast = get(TopologyService.class).isBroadcastPoint(topology, connectPoint);
return ok(mapper()
- .createObjectNode()
- .put("broadcast", isBroadcast))
+ .createObjectNode()
+ .put("broadcast", isBroadcast))
.build();
}
@@ -198,7 +204,8 @@ public class TopologyWebResource extends AbstractWebResource {
*
* @param connectPointString deviceid:portnumber
* @return JSON representation of true if the connect point is broadcast,
- * false otherwise
+ * false otherwise
+ * @rsModel TopologyInfrastructure
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -212,8 +219,8 @@ public class TopologyWebResource extends AbstractWebResource {
boolean isInfrastructure = get(TopologyService.class).isInfrastructure(topology, connectPoint);
return ok(mapper()
- .createObjectNode()
- .put("infrastructure", isInfrastructure))
+ .createObjectNode()
+ .put("infrastructure", isInfrastructure))
.build();
}