[ONOS-3394] Json models for REST api

Change-Id: I69c396ae08d25e83dce31e4d2ec92cd9a28c54f5
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
index 636fc33..b38633b 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ApplicationsWebResource.java
@@ -44,6 +44,7 @@
      * Get all installed applications.
      * Returns array of all installed applications.
      *
+     * @rsModel Applications
      * @return 200 OK
      */
     @GET
@@ -56,7 +57,7 @@
     /**
      * Get application details.
      * Returns details of the specified application.
-     *
+     * @rsModel Application
      * @param name application name
      * @return 200 OK; 404; 401
      */
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
index 312f6e3..16a4dc7 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
@@ -49,6 +49,7 @@
      * Returns array of all cluster nodes.
      *
      * @return 200 OK
+     * @rsModel Cluster
      */
     @GET
     public Response getClusterNodes() {
@@ -62,6 +63,7 @@
      *
      * @param id cluster node identifier
      * @return 200 OK
+     * @rsModel ClusterNode
      */
     @GET
     @Path("{id}")
@@ -78,6 +80,7 @@
      * @param config cluster definition
      * @return 200 OK
      * @throws IOException to signify bad request
+     * @rsModel ClusterPost
      */
     @POST
     @Path("configuration")
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
index 0e88e34..252a3ba 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/FlowsWebResource.java
@@ -58,7 +58,7 @@
 
     /**
      * 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 @@
     /**
      * 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 @@
     /**
      * 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 @@
     /**
      * 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/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
index b89f5ad..455e492 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/HostsWebResource.java
@@ -70,6 +70,7 @@
      * Returns array of all known end-station hosts.
      *
      * @return 200 OK
+     * @rsModel Hosts
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -85,6 +86,7 @@
      *
      * @param id host identifier
      * @return 200 OK
+     * @rsModel Host
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -103,6 +105,7 @@
      * @param mac  host MAC address
      * @param vlan host VLAN identifier
      * @return 200 OK
+     * @rsModel Host
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -122,6 +125,7 @@
      * @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 @@
             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/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
index c627019..e36ea8a 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/LinksWebResource.java
@@ -44,7 +44,7 @@
     /**
      * 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/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
index 9714690..c14b4ec 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java
@@ -60,7 +60,7 @@
     /**
      * 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 @@
     /**
      * 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/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
index c91cb6d..7a45204 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/StatisticsWebResource.java
@@ -59,7 +59,7 @@
 
     /**
      * 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 @@
 
     /**
      * Get table statistics for all tables of all devices.
-     *
+     * @rsModel StatisticsFlowsTables
      * @return JSON encoded array of table statistics
      */
     @GET
@@ -111,11 +111,11 @@
         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 @@
 
     /**
      * 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 @@
         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/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
index f6ae825..d51bd5a 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/TopologyWebResource.java
@@ -50,6 +50,7 @@
      * Get overview of current topology.
      *
      * @return topology overview
+     * @rsModel Topology
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -63,6 +64,7 @@
      * Get overview of topology SCCs.
      *
      * @return topology clusters overview
+     * @rsModel TopologyClusters
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -80,6 +82,7 @@
      *
      * @param clusterId id of the cluster to query
      * @return topology cluster details
+     * @rsModel TopologyCluster
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -103,6 +106,7 @@
      *
      * @param clusterId id of the cluster to query
      * @return topology cluster devices
+     * @rsModel TopologyClustersDevices
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -126,6 +130,7 @@
      *
      * @param clusterId id of the cluster to query
      * @return topology cluster links
+     * @rsModel LinksGet
      */
     @GET
     @Produces(MediaType.APPLICATION_JSON)
@@ -136,7 +141,7 @@
 
         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 @@
      *
      * @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 @@
         boolean isBroadcast = get(TopologyService.class).isBroadcastPoint(topology, connectPoint);
 
         return ok(mapper()
-                .createObjectNode()
-                .put("broadcast", isBroadcast))
+                          .createObjectNode()
+                          .put("broadcast", isBroadcast))
                 .build();
     }
 
@@ -198,7 +204,8 @@
      *
      * @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 @@
         boolean isInfrastructure = get(TopologyService.class).isInfrastructure(topology, connectPoint);
 
         return ok(mapper()
-                .createObjectNode()
-                .put("infrastructure", isInfrastructure))
+                          .createObjectNode()
+                          .put("infrastructure", isInfrastructure))
                 .build();
     }
 
diff --git a/web/api/src/main/resources/definitions/Application.json b/web/api/src/main/resources/definitions/Application.json
new file mode 100644
index 0000000..ea6c3ea25
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Application.json
@@ -0,0 +1,80 @@
+{
+  "type": "object",
+  "title": "application",
+  "required": [
+    "name",
+    "id",
+    "version",
+    "description",
+    "origin",
+    "permissions",
+    "featuresRepo",
+    "features",
+    "requiredApps",
+    "state"
+  ],
+  "properties": {
+    "name": {
+      "type": "string",
+      "example": "org.onosproject.distributedprimitives"
+    },
+    "id": {
+      "type": "integer",
+      "format": "int64",
+      "example": 1
+    },
+    "version": {
+      "type": "string",
+      "example": "1.4.0.SNAPSHOT"
+    },
+    "description": {
+      "type": "string",
+      "example": "ONOS app to test distributed primitives"
+    },
+    "origin": {
+      "type": "string",
+      "example": "ON.Lab"
+    },
+    "permissions": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": ""
+      }
+    },
+    "featuresRepo": {
+      "type": "string",
+      "example": "mvn:org.onosproject/onos-app-cip/1.4.0-SNAPSHOT/xml/features"
+    },
+    "features": {
+      "type": "array",
+      "xml": {
+        "name": "features",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": "onos-app-distributed-primitives"
+      }
+    },
+    "requiredApps": {
+      "type": "array",
+      "xml": {
+        "name": "requiredApps",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": ""
+      }
+    },
+    "state": {
+      "type": "string",
+      "example": "ACTIVE"
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/ApplicationPost.json b/web/api/src/main/resources/definitions/ApplicationPost.json
new file mode 100644
index 0000000..ea6c3ea25
--- /dev/null
+++ b/web/api/src/main/resources/definitions/ApplicationPost.json
@@ -0,0 +1,80 @@
+{
+  "type": "object",
+  "title": "application",
+  "required": [
+    "name",
+    "id",
+    "version",
+    "description",
+    "origin",
+    "permissions",
+    "featuresRepo",
+    "features",
+    "requiredApps",
+    "state"
+  ],
+  "properties": {
+    "name": {
+      "type": "string",
+      "example": "org.onosproject.distributedprimitives"
+    },
+    "id": {
+      "type": "integer",
+      "format": "int64",
+      "example": 1
+    },
+    "version": {
+      "type": "string",
+      "example": "1.4.0.SNAPSHOT"
+    },
+    "description": {
+      "type": "string",
+      "example": "ONOS app to test distributed primitives"
+    },
+    "origin": {
+      "type": "string",
+      "example": "ON.Lab"
+    },
+    "permissions": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": ""
+      }
+    },
+    "featuresRepo": {
+      "type": "string",
+      "example": "mvn:org.onosproject/onos-app-cip/1.4.0-SNAPSHOT/xml/features"
+    },
+    "features": {
+      "type": "array",
+      "xml": {
+        "name": "features",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": "onos-app-distributed-primitives"
+      }
+    },
+    "requiredApps": {
+      "type": "array",
+      "xml": {
+        "name": "requiredApps",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": ""
+      }
+    },
+    "state": {
+      "type": "string",
+      "example": "ACTIVE"
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Applications.json b/web/api/src/main/resources/definitions/Applications.json
new file mode 100644
index 0000000..d765361
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Applications.json
@@ -0,0 +1,96 @@
+{
+  "type": "object",
+  "title": "applications",
+  "required": [
+    "applications"
+  ],
+  "properties": {
+    "applications": {
+      "type": "array",
+      "xml": {
+        "name": "applications",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "application",
+        "required": [
+          "name",
+          "id",
+          "version",
+          "description",
+          "origin",
+          "permissions",
+          "featuresRepo",
+          "features",
+          "requiredApps",
+          "state"
+        ],
+        "properties": {
+          "name": {
+            "type": "string",
+            "example": "org.onosproject.distributedprimitives"
+          },
+          "id": {
+            "type": "integer",
+            "format": "int64",
+            "example": 1
+          },
+          "version": {
+            "type": "string",
+            "example": "1.4.0.SNAPSHOT"
+          },
+          "description": {
+            "type": "string",
+            "example": "ONOS app to test distributed primitives"
+          },
+          "origin": {
+            "type": "string",
+            "example": "ON.Lab"
+          },
+          "permissions": {
+            "type": "array",
+            "xml": {
+              "name": "hosts",
+              "wrapped": true
+            },
+            "items": {
+              "type": "string",
+              "example": ""
+            }
+          },
+          "featuresRepo": {
+            "type": "string",
+            "example": "mvn:org.onosproject/onos-app-cip/1.4.0-SNAPSHOT/xml/features"
+          },
+          "features": {
+            "type": "array",
+            "xml": {
+              "name": "features",
+              "wrapped": true
+            },
+            "items": {
+              "type": "string",
+              "example": "onos-app-distributed-primitives"
+            }
+          },
+          "requiredApps": {
+            "type": "array",
+            "xml": {
+              "name": "requiredApps",
+              "wrapped": true
+            },
+            "items": {
+              "type": "string",
+              "example": ""
+            }
+          },
+          "state": {
+            "type": "string",
+            "example": "ACTIVE"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Cluster.json b/web/api/src/main/resources/definitions/Cluster.json
new file mode 100644
index 0000000..f2d32a8
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Cluster.json
@@ -0,0 +1,45 @@
+{
+  "type": "object",
+  "title": "cluster",
+  "required": [
+    "nodes"
+  ],
+  "properties": {
+    "nodes": {
+      "type": "array",
+      "xml": {
+        "name": "nodes",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "nodes",
+        "required": [
+          "id",
+          "ip",
+          "tcpPort",
+          "status"
+        ],
+        "properties": {
+          "id": {
+            "type": "string",
+            "example": "127.0.0.1"
+          },
+          "ip": {
+            "type": "string",
+            "example": "127.0.0.1"
+          },
+          "tcpPort": {
+            "type": "integer",
+            "format": "int64",
+            "example": 9876
+          },
+          "status": {
+            "type": "string",
+            "example": "ACTIVE"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/ClusterNode.json b/web/api/src/main/resources/definitions/ClusterNode.json
new file mode 100644
index 0000000..831f02f
--- /dev/null
+++ b/web/api/src/main/resources/definitions/ClusterNode.json
@@ -0,0 +1,28 @@
+{
+  "type": "object",
+  "required": [
+    "id",
+    "ip",
+    "tcpPort",
+    "status"
+  ],
+  "properties": {
+    "id": {
+      "type": "string",
+      "example": "127.0.0.1"
+    },
+    "ip": {
+      "type": "string",
+      "example": "127.0.0.1"
+    },
+    "tcpPort": {
+      "type": "integer",
+      "format": "int64",
+      "example": 9876
+    },
+    "status": {
+      "type": "string",
+      "example": "ACTIVE"
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/ClusterPost.json b/web/api/src/main/resources/definitions/ClusterPost.json
new file mode 100644
index 0000000..ad67fc7
--- /dev/null
+++ b/web/api/src/main/resources/definitions/ClusterPost.json
@@ -0,0 +1,42 @@
+{
+  "type": "object",
+  "title": "nodes",
+  "properties": {
+    "nodes": {
+      "type": "array",
+      "xml": {
+        "name": "nodes",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "nodes",
+        "required": [
+          "id",
+          "ip",
+          "tcpPort",
+          "status"
+        ],
+        "properties": {
+          "id": {
+            "type": "string",
+            "example": "127.0.0.1"
+          },
+          "ip": {
+            "type": "string",
+            "example": "127.0.0.1"
+          },
+          "tcpPort": {
+            "type": "integer",
+            "format": "int64",
+            "example": 9876
+          },
+          "status": {
+            "type": "string",
+            "example": "ACTIVE"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/DevicesGet.json b/web/api/src/main/resources/definitions/DevicesGet.json
index d1d22ad..4cf4d9d 100644
--- a/web/api/src/main/resources/definitions/DevicesGet.json
+++ b/web/api/src/main/resources/definitions/DevicesGet.json
@@ -1,81 +1,90 @@
 {
-  "type": "array",
-  "xml": {
-    "name": "device",
-    "wrapped": true
-  },
-  "items": {
-    "type": "object",
-    "title": "device",
-    "required": [
-      "id",
-      "type",
-      "available",
-      "role",
-      "mfr",
-      "hw",
-      "sw",
-      "serial",
-      "chassisId",
-      "annotations"
-    ],
-    "properties": {
-      "id": {
-        "type": "string",
-        "example": "of:0000000000000001"
+  "type": "object",
+  "title": "nodes",
+  "required": [
+    "devices"
+  ],
+  "properties": {
+    "devices": {
+      "type": "array",
+      "xml": {
+        "name": "device",
+        "wrapped": true
       },
-      "type": {
-        "type": "string",
-        "example": "SWITCH"
-      },
-      "available": {
-        "type": "boolean",
-        "example": true
-      },
-      "role": {
-        "type": "string",
-        "example": "of:0000000000000001"
-      },
-      "mfr": {
-        "type": "string",
-        "example": "Nicira, Inc."
-      },
-      "hw": {
-        "type": "string",
-        "example": "Open vSwitch"
-      },
-      "sw": {
-        "type": "string",
-        "example": "2.3.1"
-      },
-      "serial": {
-        "type": "string",
-        "example": "123"
-      },
-      "chassisId": {
-        "type": "string",
-        "example": "1"
-      },
-      "annotations": {
+      "items": {
         "type": "object",
-        "title": "annotations",
+        "title": "device",
         "required": [
-          "managementAddress",
-          "protocol",
-          "channelId"
+          "id",
+          "type",
+          "available",
+          "role",
+          "mfr",
+          "hw",
+          "sw",
+          "serial",
+          "chassisId",
+          "annotations"
         ],
         "properties": {
-          "managementAddress": {
+          "id": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          },
+          "type": {
+            "type": "string",
+            "example": "SWITCH"
+          },
+          "available": {
+            "type": "boolean",
+            "example": true
+          },
+          "role": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          },
+          "mfr": {
+            "type": "string",
+            "example": "Nicira, Inc."
+          },
+          "hw": {
+            "type": "string",
+            "example": "Open vSwitch"
+          },
+          "sw": {
+            "type": "string",
+            "example": "2.3.1"
+          },
+          "serial": {
             "type": "string",
             "example": "123"
           },
-          "protocol": {
+          "chassisId": {
             "type": "string",
-            "example": "OF_13"
+            "example": "1"
           },
-          "channelId": {
-            "type": "string",
-            "example": "10.128.12.4:34689"
+          "annotations": {
+            "type": "object",
+            "title": "annotations",
+            "required": [
+              "managementAddress",
+              "protocol",
+              "channelId"
+            ],
+            "properties": {
+              "managementAddress": {
+                "type": "string",
+                "example": "123"
+              },
+              "protocol": {
+                "type": "string",
+                "example": "OF_13"
+              },
+              "channelId": {
+                "type": "string",
+                "example": "10.128.12.4:34689"
+              }
+            }
           }
         }
       }
diff --git a/web/api/src/main/resources/definitions/Flows.json b/web/api/src/main/resources/definitions/Flows.json
new file mode 100644
index 0000000..8879629
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Flows.json
@@ -0,0 +1,173 @@
+{
+  "type": "object",
+  "title": "flows",
+  "required": [
+    "flows"
+  ],
+  "properties": {
+    "flows": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "flow",
+        "required": [
+          "id",
+          "appId",
+          "groupId",
+          "priority",
+          "timeout",
+          "isPermanent",
+          "deviceId",
+          "state",
+          "life",
+          "packets",
+          "bytes",
+          "lastSeen"
+        ],
+        "properties": {
+          "id": {
+            "type": "string",
+            "example": "12103425214920339"
+          },
+          "appId": {
+            "type": "string",
+            "example": "org.onosproject.core"
+          },
+          "groupId": {
+            "type": "integer",
+            "format": "int64",
+            "example": 0
+          },
+          "priority": {
+            "type": "integer",
+            "format": "int64",
+            "example": 400000
+          },
+          "timeout": {
+            "type": "integer",
+            "format": "int64",
+            "example": 0
+          },
+          "isPermanent": {
+            "type": "boolean",
+            "example": true
+          },
+          "deviceId": {
+            "type": "string",
+            "example": "of:0000000000000003"
+          },
+          "state": {
+            "type": "string",
+            "example": "ADDED"
+          },
+          "life": {
+            "type": "integer",
+            "format": "int64",
+            "example": 69889
+          },
+          "packets": {
+            "type": "integer",
+            "format": "int64",
+            "example": 22546
+          },
+          "bytes": {
+            "type": "integer",
+            "format": "int64",
+            "example": 1826226
+          },
+          "lastSeen": {
+            "type": "integer",
+            "format": "int64",
+            "example": 1447892365670
+          },
+          "treatment": {
+            "type": "object",
+            "title": "treatment",
+            "required": [
+              "instructions",
+              "deferred"
+            ],
+            "properties": {
+              "instructions": {
+                "type": "array",
+                "title": "treatment",
+                "required": [
+                  "properties",
+                  "port"
+                ],
+                "items": {
+                  "type": "object",
+                  "title": "instruction",
+                  "required": [
+                    "type",
+                    "port"
+                  ],
+                  "properties": {
+                    "type": {
+                      "type": "string",
+                      "example": "OUTPUT"
+                    },
+                    "port": {
+                      "type": "integer",
+                      "format": "int64",
+                      "example": -3
+                    }
+                  }
+                }
+              },
+              "deferred": {
+                "type": "array",
+                "xml": {
+                  "name": "deferred",
+                  "wrapped": true
+                },
+                "items": {
+                  "type": "string"
+                }
+              }
+            }
+          }
+        }
+      }
+    },
+    "selector": {
+      "type": "object",
+      "title": "selector",
+      "required": [
+        "criteria"
+      ],
+      "properties": {
+        "criteria": {
+          "type": "array",
+          "xml": {
+            "name": "criteria",
+            "wrapped": true
+          },
+          "items": {
+            "type": "object",
+            "title": "criteria",
+            "required": [
+              "type",
+              "ethType"
+            ],
+            "properties": {
+              "type": {
+                "type": "string",
+                "example": "ETH_TYPE"
+              },
+              "ethType": {
+                "type": "integer",
+                "format": "int64",
+                "example": -30516
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/FlowsPost.json b/web/api/src/main/resources/definitions/FlowsPost.json
new file mode 100644
index 0000000..c514105
--- /dev/null
+++ b/web/api/src/main/resources/definitions/FlowsPost.json
@@ -0,0 +1,102 @@
+{
+  "type": "object",
+  "title": "flow",
+  "required": [
+    "priority",
+    "timeout",
+    "isPermanent",
+    "deviceId"
+  ],
+  "properties": {
+    "priority": {
+      "type": "integer",
+      "format": "int64",
+      "example": 400000
+    },
+    "timeout": {
+      "type": "integer",
+      "format": "int64",
+      "example": 0
+    },
+    "isPermanent": {
+      "type": "boolean",
+      "example": true
+    },
+    "deviceId": {
+      "type": "string",
+      "example": "of:0000000000000003"
+    },
+    "treatment": {
+      "type": "object",
+      "title": "treatment",
+      "required": [
+        "instructions",
+        "deferred"
+      ],
+      "properties": {
+        "instructions": {
+          "type": "array",
+          "title": "treatment",
+          "required": [
+            "properties",
+            "port"
+          ],
+          "items": {
+            "type": "object",
+            "title": "instructions",
+            "required": [
+              "type",
+              "port"
+            ],
+            "properties": {
+              "type": {
+                "type": "string",
+                "example": "OUTPUT"
+              },
+              "port": {
+                "type": "integer",
+                "format": "int64",
+                "example": -3
+              }
+            }
+          }
+        }
+      }
+    },
+    "selector": {
+      "type": "object",
+      "title": "selector",
+      "required": [
+        "criteria"
+      ],
+      "properties": {
+        "criteria": {
+          "type": "array",
+          "xml": {
+            "name": "criteria",
+            "wrapped": true
+          },
+          "items": {
+            "type": "object",
+            "title": "criteria",
+            "required": [
+              "type",
+              "ethType"
+            ],
+            "properties": {
+              "type": {
+                "type": "string",
+                "example": "ETH_TYPE"
+              },
+              "ethType": {
+                "type": "integer",
+                "format": "int64",
+                "example": -30516
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Host.json b/web/api/src/main/resources/definitions/Host.json
new file mode 100644
index 0000000..208bf1f
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Host.json
@@ -0,0 +1,54 @@
+{
+  "type": "object",
+  "title": "host",
+  "required": [
+    "id",
+    "mac",
+    "vlan",
+    "ipAddresses",
+    "location"
+  ],
+  "properties": {
+    "id": {
+      "type": "string",
+      "example": "46:E4:3C:A4:17:C8/-1"
+    },
+    "mac": {
+      "type": "string",
+      "example": "46:E4:3C:A4:17:C8"
+    },
+    "vlan": {
+      "type": "string",
+      "example": "-1"
+    },
+    "ipAddresses": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": "127.0.0.1"
+      }
+    },
+    "location": {
+      "type": "object",
+      "title": "location",
+      "required": [
+        "elementId",
+        "port"
+      ],
+      "properties": {
+        "elementId": {
+          "type": "string",
+          "example": "of:0000000000000002"
+        },
+        "port": {
+          "type": "string",
+          "example": "3"
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/HostPut.json b/web/api/src/main/resources/definitions/HostPut.json
new file mode 100644
index 0000000..66bf654
--- /dev/null
+++ b/web/api/src/main/resources/definitions/HostPut.json
@@ -0,0 +1,49 @@
+{
+  "type": "object",
+  "title": "host",
+  "required": [
+    "mac",
+    "vlan",
+    "ipAddresses",
+    "location"
+  ],
+  "properties": {
+    "mac": {
+      "type": "string",
+      "example": "46:E4:3C:A4:17:C8"
+    },
+    "vlan": {
+      "type": "string",
+      "example": "-1"
+    },
+    "ipAddresses": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "example": "127.0.0.1"
+      }
+    },
+    "location": {
+      "type": "object",
+      "title": "location",
+      "required": [
+        "elementId",
+        "port"
+      ],
+      "properties": {
+        "elementId": {
+          "type": "string",
+          "example": "of:0000000000000002"
+        },
+        "port": {
+          "type": "string",
+          "example": "3"
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Hosts.json b/web/api/src/main/resources/definitions/Hosts.json
new file mode 100644
index 0000000..235a083
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Hosts.json
@@ -0,0 +1,70 @@
+{
+  "type": "object",
+  "title": "hosts",
+  "required": [
+    "hosts"
+  ],
+  "properties": {
+    "hosts": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "host",
+        "required": [
+          "id",
+          "mac",
+          "vlan",
+          "ipAddresses",
+          "location"
+        ],
+        "properties": {
+          "id": {
+            "type": "string",
+            "example": "46:E4:3C:A4:17:C8/-1"
+          },
+          "mac": {
+            "type": "string",
+            "example": "46:E4:3C:A4:17:C8"
+          },
+          "vlan": {
+            "type": "string",
+            "example": "-1"
+          },
+          "ipAddresses": {
+            "type": "array",
+            "xml": {
+              "name": "hosts",
+              "wrapped": true
+            },
+            "items": {
+              "type": "string",
+              "example": "127.0.0.1"
+            }
+          },
+          "location": {
+            "type": "object",
+            "title": "location",
+            "required": [
+              "elementId",
+              "port"
+            ],
+            "properties": {
+              "elementId": {
+                "type": "string",
+                "example": "of:0000000000000002"
+              },
+              "port": {
+                "type": "string",
+                "example": "3"
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/LinksGet.json b/web/api/src/main/resources/definitions/LinksGet.json
new file mode 100644
index 0000000..367cb67
--- /dev/null
+++ b/web/api/src/main/resources/definitions/LinksGet.json
@@ -0,0 +1,72 @@
+{
+  "type": "object",
+  "title": "links",
+  "required": [
+    "links"
+  ],
+  "properties": {
+    "links": {
+      "type": "array",
+      "xml": {
+        "name": "links",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "link",
+        "required": [
+          "src",
+          "dst",
+          "type",
+          "state"
+        ],
+        "properties": {
+          "src": {
+            "type": "object",
+            "title": "src",
+            "required": [
+              "port",
+              "device"
+            ],
+            "properties": {
+              "port": {
+                "type": "string",
+                "example": "3"
+              },
+              "device": {
+                "type": "string",
+                "example": "of:0000000000000002"
+              }
+            }
+          },
+          "dst": {
+            "type": "object",
+            "title": "dst",
+            "required": [
+              "port",
+              "device"
+            ],
+            "properties": {
+              "port": {
+                "type": "string",
+                "example": "2"
+              },
+              "device": {
+                "type": "string",
+                "example": "of:0000000000000003"
+              }
+            }
+          },
+          "type": {
+            "type": "string",
+            "example": "DIRECT"
+          },
+          "state": {
+            "type": "string",
+            "example": "ACTIVE"
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/web/api/src/main/resources/definitions/Paths.json b/web/api/src/main/resources/definitions/Paths.json
new file mode 100644
index 0000000..2407036
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Paths.json
@@ -0,0 +1,94 @@
+{
+  "type": "object",
+  "title": "paths",
+  "required": [
+    "paths"
+  ],
+  "properties": {
+    "paths": {
+      "type": "array",
+      "xml": {
+        "name": "hosts",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "host",
+        "required": [
+          "cost",
+          "links"
+        ],
+        "properties": {
+          "cost": {
+            "type": "integer",
+            "format": "int64",
+            "example": 2
+          },
+          "links": {
+            "type": "array",
+            "xml": {
+              "name": "links",
+              "wrapped": true
+            },
+            "items": {
+              "type": "object",
+              "title": "link",
+              "required": [
+                "src",
+                "dst",
+                "type",
+                "state"
+              ],
+              "properties": {
+                "src": {
+                  "type": "object",
+                  "title": "src",
+                  "required": [
+                    "port",
+                    "device"
+                  ],
+                  "properties": {
+                    "port": {
+                      "type": "string",
+                      "example": "3"
+                    },
+                    "device": {
+                      "type": "string",
+                      "example": "of:0000000000000002"
+                    }
+                  }
+                },
+                "dst": {
+                  "type": "object",
+                  "title": "dst",
+                  "required": [
+                    "port",
+                    "device"
+                  ],
+                  "properties": {
+                    "port": {
+                      "type": "string",
+                      "example": "2"
+                    },
+                    "device": {
+                      "type": "string",
+                      "example": "of:0000000000000003"
+                    }
+                  }
+                },
+                "type": {
+                  "type": "string",
+                  "example": "DIRECT"
+                },
+                "state": {
+                  "type": "string",
+                  "example": "ACTIVE"
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/StatisticsFlowsLink.json b/web/api/src/main/resources/definitions/StatisticsFlowsLink.json
new file mode 100644
index 0000000..886902b
--- /dev/null
+++ b/web/api/src/main/resources/definitions/StatisticsFlowsLink.json
@@ -0,0 +1,54 @@
+{
+  "type": "object",
+  "title": "loads",
+  "required": [
+    "loads"
+  ],
+  "properties": {
+    "loads": {
+      "type": "array",
+      "required": [
+        "loads"
+      ],
+      "xml": {
+        "name": "loads",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "loads",
+        "required": [
+          "rate",
+          "latest",
+          "valid",
+          "time",
+          "link"
+        ],
+        "properties": {
+          "rate": {
+            "type": "integer",
+            "format": "int64",
+            "example": 0
+          },
+          "latest": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          },
+          "valid": {
+            "type": "boolean",
+            "example": false
+          },
+          "time": {
+            "type": "integer",
+            "format": "int64",
+            "example": 1447980119542
+          },
+          "link": {
+            "type": "string",
+            "example": "http://10.128.12.1:8181/onos/v1/links?device=of:0000000000000002&port=3"
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/StatisticsFlowsTables.json b/web/api/src/main/resources/definitions/StatisticsFlowsTables.json
new file mode 100644
index 0000000..7766873
--- /dev/null
+++ b/web/api/src/main/resources/definitions/StatisticsFlowsTables.json
@@ -0,0 +1,76 @@
+{
+  "type": "object",
+  "title": "statistics",
+  "required": [
+    "statistics"
+  ],
+  "properties": {
+    "statistics": {
+      "type": "array",
+      "required": [
+        "statistics"
+      ],
+      "xml": {
+        "name": "statistics",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "statistics",
+        "required": [
+          "table"
+        ],
+        "properties": {
+          "deviceId": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          },
+          "table": {
+            "type": "array",
+            "xml": {
+              "name": "table",
+              "wrapped": true
+            },
+            "items": {
+              "type": "object",
+              "title": "tables",
+              "required": [
+                "tableId",
+                "deviceId",
+                "activeEntries",
+                "packetsLookedUp",
+                "packetsMathced"
+              ],
+              "properties": {
+                "tableId": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 0
+                },
+                "deviceId": {
+                  "type": "string",
+                  "example": "of:0000000000000001"
+                },
+                "activeEntries": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 3
+                },
+                "packetsLookedUp": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 458530
+                },
+                "packetsMathced": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 458501
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/StatisticsFlowsTablesDevices.json b/web/api/src/main/resources/definitions/StatisticsFlowsTablesDevices.json
new file mode 100644
index 0000000..20575c2
--- /dev/null
+++ b/web/api/src/main/resources/definitions/StatisticsFlowsTablesDevices.json
@@ -0,0 +1,76 @@
+{
+  "type": "object",
+  "title": "device-table-statistics",
+  "required": [
+    "table-statistics"
+  ],
+  "properties": {
+    "device-table-statistics": {
+      "type": "array",
+      "required": [
+        "device-table-statistics"
+      ],
+      "xml": {
+        "name": "table-statistics",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "table-statistics",
+        "required": [
+          "device-table-statistics"
+        ],
+        "properties": {
+          "deviceId": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          },
+          "table-statistics": {
+            "type": "array",
+            "xml": {
+              "name": "table",
+              "wrapped": true
+            },
+            "items": {
+              "type": "object",
+              "title": "table-statistics",
+              "required": [
+                "tableId",
+                "deviceId",
+                "activeEntries",
+                "packetsLookedUp",
+                "packetsMathced"
+              ],
+              "properties": {
+                "tableId": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 0
+                },
+                "deviceId": {
+                  "type": "string",
+                  "example": "of:0000000000000001"
+                },
+                "activeEntries": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 3
+                },
+                "packetsLookedUp": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 458530
+                },
+                "packetsMathced": {
+                  "type": "integer",
+                  "format": "int64",
+                  "example": 458501
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Topology.json b/web/api/src/main/resources/definitions/Topology.json
new file mode 100644
index 0000000..5e38d32
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Topology.json
@@ -0,0 +1,32 @@
+{
+  "type": "object",
+  "title": "topology",
+  "required": [
+    "time",
+    "devices",
+    "links",
+    "clusters"
+  ],
+  "properties": {
+    "time": {
+      "type": "integer",
+      "format": "int64",
+      "example": 183004405835967
+    },
+    "devices": {
+      "type": "integer",
+      "format": "int64",
+      "example": 3
+    },
+    "links": {
+      "type": "integer",
+      "format": "int64",
+      "example": 4
+    },
+    "clusters": {
+      "type": "integer",
+      "format": "int64",
+      "example": 1
+    }
+  }
+}
diff --git a/web/api/src/main/resources/definitions/TopologyBroadcast.json b/web/api/src/main/resources/definitions/TopologyBroadcast.json
new file mode 100644
index 0000000..5248853
--- /dev/null
+++ b/web/api/src/main/resources/definitions/TopologyBroadcast.json
@@ -0,0 +1,13 @@
+{
+  "type": "object",
+  "title": "response",
+  "required": [
+    "broadcast"
+  ],
+  "properties": {
+    "broadcast": {
+      "type": "boolean",
+      "example": true
+    }
+  }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/TopologyCluster.json b/web/api/src/main/resources/definitions/TopologyCluster.json
new file mode 100644
index 0000000..8adf2de
--- /dev/null
+++ b/web/api/src/main/resources/definitions/TopologyCluster.json
@@ -0,0 +1,31 @@
+{
+  "type": "object",
+  "title": "device",
+  "required": [
+    "id",
+    "deviceCount",
+    "linkCount",
+    "root"
+  ],
+  "properties": {
+    "id": {
+      "type": "integer",
+      "format": "int64",
+      "example": 1
+    },
+    "deviceCount": {
+      "type": "integer",
+      "format": "int64",
+      "example": 3
+    },
+    "linkCount": {
+      "type": "integer",
+      "format": "int64",
+      "example": 4
+    },
+    "root": {
+      "type": "string",
+      "example": "of:0000000000000001"
+    }
+  }
+}
diff --git a/web/api/src/main/resources/definitions/TopologyClusters.json b/web/api/src/main/resources/definitions/TopologyClusters.json
new file mode 100644
index 0000000..5974b44
--- /dev/null
+++ b/web/api/src/main/resources/definitions/TopologyClusters.json
@@ -0,0 +1,48 @@
+{
+  "type": "object",
+  "title": "clusters",
+  "required": [
+    "clusters"
+  ],
+  "properties": {
+    "clusters": {
+      "type": "array",
+      "xml": {
+        "name": "cluster",
+        "wrapped": true
+      },
+      "items": {
+        "type": "object",
+        "title": "cluster",
+        "required": [
+          "id",
+          "deviceCount",
+          "linkCount",
+          "root"
+        ],
+        "properties": {
+          "id": {
+            "type": "integer",
+            "format": "int64",
+            "example": 1
+          },
+          "deviceCount": {
+            "type": "integer",
+            "format": "int64",
+            "example": 3
+          },
+          "linkCount": {
+            "type": "integer",
+            "format": "int64",
+            "example": 4
+          },
+          "root": {
+            "type": "string",
+            "example": "of:0000000000000001"
+          }
+        }
+      }
+    }
+  }
+}
+
diff --git a/web/api/src/main/resources/definitions/TopologyClustersDevices.json b/web/api/src/main/resources/definitions/TopologyClustersDevices.json
new file mode 100644
index 0000000..6077d9d
--- /dev/null
+++ b/web/api/src/main/resources/definitions/TopologyClustersDevices.json
@@ -0,0 +1,22 @@
+{
+  "type": "object",
+  "title": "devices",
+  "required": [
+    "devices"
+  ],
+  "properties": {
+    "devices": {
+      "type": "array",
+      "xml": {
+        "name": "cluster",
+        "wrapped": true
+      },
+      "items": {
+        "type": "string",
+        "title": "device",
+        "example": "of:0000000000000001"
+      }
+    }
+  }
+}
+
diff --git a/web/api/src/main/resources/definitions/TopologyInfrastructure.json b/web/api/src/main/resources/definitions/TopologyInfrastructure.json
new file mode 100644
index 0000000..64564c0
--- /dev/null
+++ b/web/api/src/main/resources/definitions/TopologyInfrastructure.json
@@ -0,0 +1,13 @@
+{
+  "type": "object",
+  "title": "response",
+  "required": [
+    "infrastructure"
+  ],
+  "properties": {
+    "infrastructure": {
+      "type": "boolean",
+      "example": true
+    }
+  }
+}
\ No newline at end of file