[ONOS-3603] Implement REST API for Group query, insert, delete
* Implement decoding feature for GroupBucketCodec and GroupCodec
* Implement GroupsWebResource
* Add unit test for GroupBucketCodec and GroupCodec
* Add unit test for GroupsWebResource
* Add group insertion json example
* Add Swagger doc
Change-Id: Ie58cba2e1af996c7b8652a55d9ef0c27207beafc
diff --git a/web/api/src/main/resources/definitions/Groups.json b/web/api/src/main/resources/definitions/Groups.json
new file mode 100644
index 0000000..517c564
--- /dev/null
+++ b/web/api/src/main/resources/definitions/Groups.json
@@ -0,0 +1,124 @@
+{
+ "type": "object",
+ "title": "groups",
+ "required": [
+ "groups"
+ ],
+ "properties": {
+ "groups": {
+ "type": "array",
+ "xml": {
+ "name": "groups",
+ "wrapped": true
+ },
+ "items": {
+ "type": "object",
+ "title": "group",
+ "required": [
+ "id",
+ "state",
+ "life",
+ "packets",
+ "bytes",
+ "referenceCount",
+ "type",
+ "deviceId",
+ "buckets"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "example": "1"
+ },
+ "state": {
+ "type": "string",
+ "example": "PENDING_ADD"
+ },
+ "life": {
+ "type": "integer",
+ "format": "int64",
+ "example": 69889
+ },
+ "packets": {
+ "type": "integer",
+ "format": "int64",
+ "example": 22546
+ },
+ "bytes": {
+ "type": "integer",
+ "format": "int64",
+ "example": 1826226
+ },
+ "referenceCount": {
+ "type": "integer",
+ "format": "int64",
+ "example": 1826226
+ },
+ "type": {
+ "type": "string",
+ "example": "ALL"
+ },
+ "deviceId": {
+ "type": "string",
+ "example": "of:0000000000000003"
+ },
+ "buckets": {
+ "type": "array",
+ "xml": {
+ "name": "buckets",
+ "wrapped": true
+ },
+ "items": {
+ "type": "object",
+ "title": "buckets",
+ "required": [
+ "treatment",
+ "weight",
+ "watchPort",
+ "watchGroup"
+ ],
+ "properties": {
+ "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": "string",
+ "example": "2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/web/api/src/main/resources/definitions/GroupsPost.json b/web/api/src/main/resources/definitions/GroupsPost.json
new file mode 100644
index 0000000..f096201
--- /dev/null
+++ b/web/api/src/main/resources/definitions/GroupsPost.json
@@ -0,0 +1,84 @@
+{
+ "type": "object",
+ "title": "group",
+ "required": [
+ "type",
+ "deviceId",
+ "appCookie",
+ "groupId",
+ "buckets"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "example": "ALL"
+ },
+ "deviceId": {
+ "type": "string",
+ "example": "of:0000000000000001"
+ },
+ "appCookie": {
+ "type": "string",
+ "example": "1"
+ },
+ "groupId": {
+ "type": "string",
+ "example": "1"
+ },
+ "buckets": {
+ "type": "array",
+ "xml": {
+ "name": "buckets",
+ "wrapped": true
+ },
+ "items": {
+ "type": "object",
+ "title": "buckets",
+ "required": [
+ "treatment",
+ "weight",
+ "watchPort",
+ "watchGroup"
+ ],
+ "properties": {
+ "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": "string",
+ "example": "2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file