[ONOS-3394] JsonModels for Swagger UI
Change-Id: I57503b28df517642ab15e2b18f66ad63c15b7b8a
diff --git a/apps/dhcp/app/src/main/java/org/onosproject/dhcp/rest/DhcpWebResource.java b/apps/dhcp/app/src/main/java/org/onosproject/dhcp/rest/DhcpWebResource.java
index 3b5baf9..cd8149e 100644
--- a/apps/dhcp/app/src/main/java/org/onosproject/dhcp/rest/DhcpWebResource.java
+++ b/apps/dhcp/app/src/main/java/org/onosproject/dhcp/rest/DhcpWebResource.java
@@ -68,6 +68,7 @@
* Get all MAC/IP mappings.
* Shows all MAC/IP mappings held by the DHCP server.
*
+ * @rsModel DhcpConfigGetMappings
* @return 200 OK
*/
@GET
@@ -89,6 +90,7 @@
* Get all available IPs.
* Shows all the IPs in the free pool of the DHCP Server.
*
+ * @rsModel DhcpConfigGetAvailable
* @return 200 OK
*/
@GET
diff --git a/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetAvailable.json b/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetAvailable.json
new file mode 100644
index 0000000..2dcb91d
--- /dev/null
+++ b/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetAvailable.json
@@ -0,0 +1,16 @@
+{
+ "type": "object",
+ "required": [
+ "availableIp"
+ ],
+ "properties": {
+ "availableIp": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": "[127.0.0.1]"
+ }
+ }
+}
+
diff --git a/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetMappings.json b/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetMappings.json
new file mode 100644
index 0000000..c4d17f6
--- /dev/null
+++ b/apps/dhcp/app/src/main/resources/definitions/DhcpConfigGetMappings.json
@@ -0,0 +1,16 @@
+{
+ "type": "object",
+ "required": [
+ "mappings"
+ ],
+ "properties": {
+ "mappings": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": "[]"
+ }
+ }
+}
+
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
index 05756e5..23ca46e 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/DevicesWebResource.java
@@ -46,6 +46,7 @@
* Returns array of all discovered infrastructure devices.
*
* @return 200 OK
+ * @rsModel DevicesGet
*/
@GET
public Response getDevices() {
@@ -59,6 +60,7 @@
*
* @param id device identifier
* @return 200 OK
+ * @rsModel DeviceGet
*/
@GET
@Path("{id}")
@@ -89,6 +91,7 @@
* Get ports of infrastructure device.
* Returns details of the specified infrastructure device.
*
+ * @rsModel DeviceGetPorts
* @param id device identifier
* @return 200 OK
*/
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
index 808fcc1..94a6f96 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/NetworkConfigWebResource.java
@@ -40,7 +40,7 @@
/**
* Get entire network configuration base.
- *
+ * @rsModel NetCfgGet
* @return network configuration JSON
*/
@GET
@@ -131,6 +131,7 @@
/**
* 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
diff --git a/web/api/src/main/resources/definitions/DeviceGet.json b/web/api/src/main/resources/definitions/DeviceGet.json
new file mode 100644
index 0000000..03e67d5
--- /dev/null
+++ b/web/api/src/main/resources/definitions/DeviceGet.json
@@ -0,0 +1,77 @@
+{
+ "type": "object",
+ "title": "device",
+ "required": [
+ "id",
+ "type",
+ "available",
+ "role",
+ "mfr",
+ "hw",
+ "sw",
+ "serial",
+ "chassisId",
+ "annotations"
+ ],
+ "properties": {
+ "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"
+ },
+ "chassisId": {
+ "type": "string",
+ "example": "1"
+ },
+ "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/DeviceGetPorts.json b/web/api/src/main/resources/definitions/DeviceGetPorts.json
new file mode 100644
index 0000000..3a5230c
--- /dev/null
+++ b/web/api/src/main/resources/definitions/DeviceGetPorts.json
@@ -0,0 +1,132 @@
+{
+ "type": "object",
+ "title": "device",
+ "required": [
+ "id",
+ "type",
+ "available",
+ "role",
+ "mfr",
+ "hw",
+ "sw",
+ "serial",
+ "chassisId",
+ "annotations"
+ ],
+ "properties": {
+ "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"
+ },
+ "chassisId": {
+ "type": "string",
+ "example": "1"
+ },
+ "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"
+ }
+ }
+ },
+ "ports": {
+ "type": "array",
+ "xml": {
+ "name": "port",
+ "wrapped": true
+ },
+ "items": {
+ "type": "object",
+ "title": "port",
+ "required": [
+ "element",
+ "port",
+ "isEnabled",
+ "type",
+ "portSpeed",
+ "annotations"
+ ],
+ "properties": {
+ "element": {
+ "type": "string",
+ "example": "of:0000000000000001"
+ },
+ "port": {
+ "type": "string",
+ "example": "2"
+ },
+ "isEnabled": {
+ "type": "boolean",
+ "example": true
+ },
+ "type": {
+ "type": "string",
+ "example": "copper"
+ },
+ "portSpeed": {
+ "type": "integer",
+ "format": "int64",
+ "example": 0
+ },
+ "annotations": {
+ "type": "object",
+ "title": "annotations",
+ "required": [
+ "portName"
+ ],
+ "properties": {
+ "portName": {
+ "type": "string",
+ "example": "s1"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ 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
new file mode 100644
index 0000000..d1d22ad
--- /dev/null
+++ b/web/api/src/main/resources/definitions/DevicesGet.json
@@ -0,0 +1,84 @@
+{
+ "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": {
+ "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": {
+ "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/NetCfgGet.json b/web/api/src/main/resources/definitions/NetCfgGet.json
new file mode 100644
index 0000000..0fdcf58
--- /dev/null
+++ b/web/api/src/main/resources/definitions/NetCfgGet.json
@@ -0,0 +1,93 @@
+{
+ "type": "object",
+ "required": [
+ "apps",
+ "links",
+ "domains",
+ "hosts",
+ "ports",
+ "devices"
+ ],
+ "properties": {
+ "apps": {
+ "type": "object"
+ },
+ "links": {
+ "title": "links",
+ "type": "object",
+ "properties": {
+ "deviceId/port-deviceId/port": {
+ "title": "basic",
+ "type": "object",
+ "required": [
+ "basic"
+ ],
+ "properties": {
+ "basic": {
+ "title": "basic",
+ "type": "object",
+ "properties": {
+ "allowed": {
+ "type": "boolean",
+ "example": true
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "domains": {
+ "type": "object"
+ },
+ "hosts": {
+ "type": "object"
+ },
+ "ports": {
+ "type": "object"
+ },
+ "devices": {
+ "title": "Devices",
+ "type": "object",
+ "required": [
+ "deviceId"
+ ],
+ "properties": {
+ "deviceId": {
+ "title": "basic",
+ "type": "object",
+ "required": [
+ "basic"
+ ],
+ "properties": {
+ "basic": {
+ "title": "basicDevice",
+ "type": "object",
+ "required": [
+ "allowed"
+ ],
+ "properties": {
+ "allowed": {
+ "type": "boolean",
+ "example": true
+ },
+ "name": {
+ "type": "string",
+ "example": "DeviceName"
+ },
+ "owner": {
+ "type": "string",
+ "example": "OwnerName"
+ },
+ "latitude": {
+ "type": "string",
+ "example": "25"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}