[ONOS-3394] Json Models for Intents
Change-Id: I33620d826fddffa69982d49cb99fe4199c2bf522
diff --git a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
index c146724..306597b 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
@@ -114,6 +114,8 @@
return this;
}
+
+
/**
* Builds a host to host intent from the accumulated parameters.
*
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
index a4dd938..2c63db9 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/IntentsWebResource.java
@@ -70,7 +70,7 @@
/**
* Get all intents.
* Returns array containing all the intents in the system.
- *
+ * @rsModel Intents
* @return array of all the intents in the system
*/
@GET
@@ -84,7 +84,7 @@
/**
* Get intent by application and key.
* Returns details of the specified intent.
- *
+ * @rsModel Intents
* @param appId application identifier
* @param key intent key
* @return intent data
@@ -136,7 +136,7 @@
/**
* Submit a new intent.
* Creates and submits intent from the JSON request.
- *
+ * @rsModel IntentHost
* @param stream input JSON
* @return status of the request - CREATED if the JSON is correct,
* BAD_REQUEST if the JSON is invalid
diff --git a/web/api/src/main/resources/definitions/IntentHost.json b/web/api/src/main/resources/definitions/IntentHost.json
new file mode 100644
index 0000000..67c181c
--- /dev/null
+++ b/web/api/src/main/resources/definitions/IntentHost.json
@@ -0,0 +1,34 @@
+{
+ "type": "object",
+ "title": "host",
+ "required": [
+ "type",
+ "appId",
+ "priority",
+ "one",
+ "two"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "example": "HostToHostIntent"
+ },
+ "appId": {
+ "type": "string",
+ "example": "org.onosproject.ovsdb"
+ },
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "example": 55
+ },
+ "one": {
+ "type": "string",
+ "example": "46:E4:3C:A4:17:C8/-1"
+ },
+ "two": {
+ "type": "string",
+ "example": "08:00:27:56:8a:15/-1"
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/IntentPoint.json b/web/api/src/main/resources/definitions/IntentPoint.json
new file mode 100644
index 0000000..b84ad98
--- /dev/null
+++ b/web/api/src/main/resources/definitions/IntentPoint.json
@@ -0,0 +1,62 @@
+{
+ "type": "object",
+ "title": "host",
+ "required": [
+ "type",
+ "appId",
+ "priority",
+ "ingressPoint",
+ "egressPoint"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "example": "PointToPointIntent"
+ },
+ "appId": {
+ "type": "string",
+ "example": "org.onosproject.ovsdb"
+ },
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "example": 55
+ },
+ "ingressPoint": {
+ "type": "object",
+ "title": "point",
+ "required": [
+ "port",
+ "device"
+ ],
+ "properties": {
+ "port": {
+ "type": "string",
+ "example": "3"
+ },
+ "device": {
+ "type": "string",
+ "example": "of:0000000000000002"
+ }
+ }
+ },
+ "egressPoint": {
+ "type": "object",
+ "title": "point",
+ "required": [
+ "port",
+ "device"
+ ],
+ "properties": {
+ "port": {
+ "type": "string",
+ "example": "2"
+ },
+ "device": {
+ "type": "string",
+ "example": "of:0000000000000003"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/Intents.json b/web/api/src/main/resources/definitions/Intents.json
new file mode 100644
index 0000000..f32ef07
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Intents.json
@@ -0,0 +1,60 @@
+{
+ "type": "object",
+ "title": "intents",
+ "required": [
+ "intents"
+ ],
+ "properties": {
+ "intents": {
+ "type": "array",
+ "xml": {
+ "name": "intents",
+ "wrapped": true
+ },
+ "items": {
+ "type": "object",
+ "title": "host",
+ "required": [
+ "type",
+ "id",
+ "appId",
+ "state"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "example": "HostToHostIntent"
+ },
+ "id": {
+ "type": "string",
+ "example": "0x6"
+ },
+ "appId": {
+ "type": "string",
+ "example": "org.onosproject.ovsdb"
+ },
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "example": 55
+ },
+ "resources": {
+ "type": "array",
+ "xml": {
+ "name": "resources",
+ "wrapped": true
+ },
+ "items": {
+ "type": "string",
+ "example": "46:E4:3C:A4:17:C8/-1"
+ },
+ "state": {
+ "type": "string",
+ "example": "INSTALLED"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ 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
deleted file mode 100644
index 20575c2..0000000
--- a/web/api/src/main/resources/definitions/StatisticsFlowsTablesDevices.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "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