From ec6574daf067ae7ad98e7fb6e3ddf4c88d899e36 Mon Sep 17 00:00:00 2001 From: Huang Haibin Date: Tue, 27 Feb 2018 22:43:10 +0800 Subject: Move swagger from newton to newton_base Change-Id: I35ed7b54d89d9c9eb6df94c7aae261eba7cc236d Issue-ID: MULTICLOUD-138 Signed-off-by: Huang Haibin --- share/newton_base/swagger/__init__.py | 10 + .../swagger/multicloud.identity.swagger.json | 59 +++ .../swagger/multivim.flavor.swagger.json | 392 +++++++++++++++++ .../newton_base/swagger/multivim.host.swagger.json | 233 ++++++++++ .../swagger/multivim.image.swagger.json | 359 +++++++++++++++ .../swagger/multivim.limit.swagger.json | 158 +++++++ .../swagger/multivim.network.swagger.json | 349 +++++++++++++++ .../swagger/multivim.server.swagger.json | 488 +++++++++++++++++++++ .../swagger/multivim.subnet.swagger.json | 417 ++++++++++++++++++ .../swagger/multivim.tenant.swagger.json | 102 +++++ .../swagger/multivim.volume.swagger.json | 378 ++++++++++++++++ .../swagger/multivim.vport.swagger.json | 363 +++++++++++++++ share/newton_base/swagger/views.py | 96 ++++ 13 files changed, 3404 insertions(+) create mode 100644 share/newton_base/swagger/__init__.py create mode 100644 share/newton_base/swagger/multicloud.identity.swagger.json create mode 100644 share/newton_base/swagger/multivim.flavor.swagger.json create mode 100644 share/newton_base/swagger/multivim.host.swagger.json create mode 100644 share/newton_base/swagger/multivim.image.swagger.json create mode 100644 share/newton_base/swagger/multivim.limit.swagger.json create mode 100644 share/newton_base/swagger/multivim.network.swagger.json create mode 100644 share/newton_base/swagger/multivim.server.swagger.json create mode 100644 share/newton_base/swagger/multivim.subnet.swagger.json create mode 100644 share/newton_base/swagger/multivim.tenant.swagger.json create mode 100644 share/newton_base/swagger/multivim.volume.swagger.json create mode 100644 share/newton_base/swagger/multivim.vport.swagger.json create mode 100644 share/newton_base/swagger/views.py (limited to 'share') diff --git a/share/newton_base/swagger/__init__.py b/share/newton_base/swagger/__init__.py new file mode 100644 index 00000000..802f3fba --- /dev/null +++ b/share/newton_base/swagger/__init__.py @@ -0,0 +1,10 @@ +# Copyright (c) 2017 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/share/newton_base/swagger/multicloud.identity.swagger.json b/share/newton_base/swagger/multicloud.identity.swagger.json new file mode 100644 index 00000000..b8020648 --- /dev/null +++ b/share/newton_base/swagger/multicloud.identity.swagger.json @@ -0,0 +1,59 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiCloud Identity Proxy rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiCloud services" + } + ], + "paths": { + "/{vimid}/identity/v3/auth/tokens": { + "post": { + "tags": [ + "MultiCloud Identity Proxy" + ], + "summary": "Authenticate and get Catalog of endpoints", + "description": "Authenticate to get token and catalog of service endpoints", + "operationId": "authenticate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id, composed by {cloud-owner}_{cloud-region-id}", + "required": true, + "type": "string" + }, + { + "name": "tenant_name", + "in": "body", + "description": "tenant name", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "type": "string" + }, + "404": { + "description": "the vim id or tenant name is wrong" + }, + "500": { + "description": "the vim instance is not accessable" + } + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.flavor.swagger.json b/share/newton_base/swagger/multivim.flavor.swagger.json new file mode 100644 index 00000000..e73be9ed --- /dev/null +++ b/share/newton_base/swagger/multivim.flavor.swagger.json @@ -0,0 +1,392 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/flavors": { + "post": { + "tags": [ + "vim flavors" + ], + "summary": "create a flavor", + "description": "create a flavor", + "operationId": "create_vim_flavor", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim flavor request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimFlavor" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimFlavorInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim flavor is not accessable" + } + } + }, + "get": { + "tags": [ + "vim flavors" + ], + "summary": "query vim flavors list", + "description": "query vim flavors list", + "operationId": "query_vim_flavors", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "flavor name to filter list", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "Requests a page size of items", + "required": false, + "type": "string" + }, + { + "name": "marker", + "in": "query", + "description": "image ID of the last-seen item", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimFlavorsInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim flavor is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/flavors/{flavorid}": { + "delete": { + "tags": [ + "vim flavors" + ], + "summary": "delete specific vim flavor", + "description": "delete specific vim flavor", + "operationId": "delete_vim_flavor", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "flavorid", + "in": "path", + "description": "vim flavor id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim flavor is not accessable" + } + } + }, + "get": { + "tags": [ + "vim flavors" + ], + "summary": "query specific vim flavor", + "description": "query specific vim flavor", + "operationId": "query_vim_flavor", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "flavorid", + "in": "path", + "description": "vim flavor id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimFlavorInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim flavor is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimFlavor": { + "type": "object", + "required": [ + "vcpu", + "name", + "memory", + "disk" + ], + "properties": { + "name": { + "type": "string", + "description": "flavor name" + }, + "vcpu": { + "type": "integer", + "description": "virtual cpu number" + }, + "memory": { + "type": "integer", + "description": "memory size" + }, + "disk": { + "type": "integer", + "description": "The size of the root disk" + }, + "ephemeral": { + "type": "integer", + "description": "The size of the ephemeral disk" + }, + "swap": { + "type": "integer", + "description": "The size of the swap disk" + }, + "isPublic": { + "type": "boolean", + "description": "whether the flavor is public" + }, + "extraSpecs": { + "type": "array", + "description": "list of extra specs", + "items": { + "$ref": "#/definitions/VimFlavorExtraSpecInfo" + } + } + } + }, + "VimFlavorExtraSpecInfo": { + "type": "object", + "properties": { + "keyName": { + "type": "string", + "description": "extra spec key" + }, + "value": { + "type": "string", + "description": "extra spec value" + } + } + }, + "VimFlavorsInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "flavors" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "flavors": { + "type": "array", + "description": "flavor list information", + "items": { + "$ref": "#/definitions/VimFlavorInfo" + } + } + } + }, + "VimFlavorInfo": { + "type": "object", + "required": [ + "name", + "id", + "vcpu", + "memory", + "disk", + "ephemeral", + "swap", + "isPublic" + ], + "properties": { + "name": { + "type": "string", + "description": "flavor name" + }, + "id": { + "type": "string", + "description": "flavor UUID" + }, + "vcpu": { + "type": "integer", + "description": "virtual cpu number" + }, + "memory": { + "type": "integer", + "description": "memory size" + }, + "disk": { + "type": "integer", + "description": "The size of the root disk" + }, + "ephemeral": { + "type": "integer", + "description": "The size of the ephemeral disk" + }, + "swap": { + "type": "integer", + "description": "The size of the swap disk" + }, + "isPublic": { + "type": "boolean", + "description": "whether the flavor is public" + }, + "extraSpecs": { + "type": "array", + "description": "list of extra specs", + "items": { + "$ref": "#/definitions/VimFlavorExtraSpecInfo" + } + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.host.swagger.json b/share/newton_base/swagger/multivim.host.swagger.json new file mode 100644 index 00000000..1ea4603e --- /dev/null +++ b/share/newton_base/swagger/multivim.host.swagger.json @@ -0,0 +1,233 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/hosts": { + "get": { + "tags": [ + "vim hosts" + ], + "summary": "query vim hosts list", + "description": "query vim hosts list", + "operationId": "query_vim_hosts", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimHostsInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim host is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/hosts/{hostname}": { + "get": { + "tags": [ + "vim hosts" + ], + "summary": "query specific vim host", + "description": "query specific vim host", + "operationId": "query_vim_host", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "hostname", + "in": "path", + "description": "vim host name", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimHostDetail" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim host is not accessable" + } + } + } + } + }, + "definitions": { + "VimHostsInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "hosts" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "hosts": { + "type": "array", + "description": "list of host information", + "items": { + "$ref": "#/definitions/VimHostInfo" + } + } + } + }, + "VimHostInfo": { + "type": "object", + "required": [ + "name", + "service" + ], + "properties": { + "name": { + "type": "string", + "description": "host name" + }, + "service": { + "type": "string", + "description": "service name running on the host" + }, + "zone": { + "type": "string", + "description": "available zone name of the host" + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + } + } + }, + "VimHostDetail": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "host" + ], + "properties": { + "host": { + "type": "array", + "description": "list of host information", + "items": { + "$ref": "#/definitions/VimHostResource" + } + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + } + } + }, + "VimHostResource": { + "type": "object", + "required": [ + "name", + "cpu", + "memory_mb", + "disk_gb", + "project" + ], + "properties": { + "name": { + "type": "string", + "description": "host name" + }, + "cpu": { + "type": "integer", + "description": "The cpu info on the host" + }, + "memory_mb": { + "type": "integer", + "description": "The memory info on the host (in MB)" + }, + "disk_gb": { + "type": "integer", + "description": "The disk info on the host (in GB)" + }, + "project": { + "type": "string", + "description": "The project id (or special name like total, used_now, used_max)." + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.image.swagger.json b/share/newton_base/swagger/multivim.image.swagger.json new file mode 100644 index 00000000..1ff3741a --- /dev/null +++ b/share/newton_base/swagger/multivim.image.swagger.json @@ -0,0 +1,359 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/images": { + "post": { + "tags": [ + "vim images" + ], + "summary": "create a image", + "description": "create a image", + "operationId": "create_vim_image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim image request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimImage" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimImageInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim image is not accessable" + } + } + }, + "get": { + "tags": [ + "vim images" + ], + "summary": "query vim images list", + "description": "query vim images list", + "operationId": "query_vim_images", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "images name to filter list", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "Requests a page size of items", + "required": false, + "type": "string" + }, + { + "name": "marker", + "in": "query", + "description": "image ID of the last-seen item", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimImagesInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim image is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/images/{imageid}": { + "delete": { + "tags": [ + "vim images" + ], + "summary": "delete specific vim image", + "description": "delete specific vim image", + "operationId": "delete_vim_image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "imageid", + "in": "path", + "description": "vim image id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim image is not accessable" + } + } + }, + "get": { + "tags": [ + "vim images" + ], + "summary": "query specific vim image", + "description": "query specific vim image", + "operationId": "query_vim_image", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "imageid", + "in": "path", + "description": "vim image id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimImageInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim image is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimImage": { + "type": "object", + "required": [ + "imagePath", + "name", + "imageType", + "containerFormat" + ], + "properties": { + "name": { + "type": "string", + "description": "image name" + }, + "imageType": { + "type": "string", + "description": "image type: ami, ari, aki, vhd, vhdx, vmdk, raw, qcow2, vdi, iso" + }, + "imagePath": { + "type": "string", + "description": "image url to catalog" + }, + "containerFormat": { + "type": "string", + "description": "image container format: ami, ari, aki, bare, ovf, ova, docker" + }, + "visibility": { + "type": "string", + "description": "public, private, shared, or community" + } + } + }, + "VimImagesInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "images" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "images": { + "type": "array", + "description": "image list information", + "items": { + "$ref": "#/definitions/VimImageInfo" + } + } + } + }, + "VimImageInfo": { + "type": "object", + "required": [ + "name", + "status", + "id" + ], + "properties": { + "name": { + "type": "string", + "description": "image name" + }, + "id": { + "type": "string", + "description": "image UUID" + }, + "imageType": { + "type": "string", + "description": "image type: ami, ari, aki, vhd, vhdx, vmdk, raw, qcow2, vdi, iso" + }, + "imagePath": { + "type": "string", + "description": "image url to catalog" + }, + "containerFormat": { + "type": "string", + "description": "image container format: ami, ari, aki, bare, ovf, ova, docker" + }, + "visibility": { + "type": "string", + "description": "public, private, shared, or community" + }, + "properties": { + "type": "array", + "description": "list of properties", + "items": { + "$ref": "#/definitions/VimImagePropertyInfo" + } + }, + "status": { + "type": "string", + "description": "image status" + }, + "size": { + "type": "string", + "description": "image size" + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.limit.swagger.json b/share/newton_base/swagger/multivim.limit.swagger.json new file mode 100644 index 00000000..3fea1b72 --- /dev/null +++ b/share/newton_base/swagger/multivim.limit.swagger.json @@ -0,0 +1,158 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/limits": { + "get": { + "tags": [ + "vim limits" + ], + "summary": "query vim limits list", + "description": "query vim limits list", + "operationId": "query_vim_limits", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimLimitsInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim limits is not accessable" + } + } + } + } + }, + "definitions": { + "VimLimitsInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "maxPersonality": { + "type": "integer", + "description": "The number of allowed injected files for each tenant" + }, + "maxPersonalitySize": { + "type": "integer", + "description": "The number of allowed bytes of content for each injected file" + }, + "maxServerGroupMembers": { + "type": "integer", + "description": "The number of allowed members for each server group" + }, + "maxServerGroups": { + "type": "integer", + "description": "The number of allowed server groups for each tenant" + }, + "maxServerMeta": { + "type": "integer", + "description": "The number of allowed metadata items for each instance" + }, + "maxTotalCores": { + "type": "integer", + "description": "The number of allowed instance cores for each tenant" + }, + "maxTotalInstances": { + "type": "integer", + "description": "The number of allowed instances for each tenant" + }, + "maxTotalKeypairs": { + "type": "integer", + "description": "The number of allowed key pairs for each user" + }, + "maxTotalRAMSize": { + "type": "integer", + "description": "The amount of allowed instance RAM, in MB, for each tenant" + }, + "maxTotalVolumeGigabytes": { + "type": "integer", + "description": "The maximum total amount of volumes, in gibibytes (GiB)." + }, + "maxTotalVolumes": { + "type": "integer", + "description": "The maximum number of volumes" + }, + "totalGigabytesUsed": { + "type": "integer", + "description": "The total number of gibibytes (GiB) used" + }, + "network": { + "type": "integer", + "description": "The number of networks allowed for each project" + }, + "subnet": { + "type": "integer", + "description": "The number of subnets allowed for each project" + }, + "subnetpool": { + "type": "integer", + "description": "The number of subnet pools allowed for each project" + }, + "security_group_rule": { + "type": "integer", + "description": "The number of security group rules allowed for each project" + }, + "security_group": { + "type": "integer", + "description": "The number of security groups allowed for each project" + }, + "router": { + "type": "integer", + "description": "The number of routers allowed for each project" + }, + "port": { + "type": "integer", + "description": "The number of ports allowed for each project" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.network.swagger.json b/share/newton_base/swagger/multivim.network.swagger.json new file mode 100644 index 00000000..3962e891 --- /dev/null +++ b/share/newton_base/swagger/multivim.network.swagger.json @@ -0,0 +1,349 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/networks": { + "post": { + "tags": [ + "vim networks" + ], + "summary": "create a network", + "description": "create a network", + "operationId": "create_vim_network", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim network request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimNetwork" + } + } + ], + "responses": { + "201": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimNetworkInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim network is not accessable" + } + } + }, + "get": { + "tags": [ + "vim networks" + ], + "summary": "query vim networks list", + "description": "query vim networks list", + "operationId": "query_vim_networks", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "network name to filter list", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimNetworksInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim network is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/networks/{networkid}": { + "delete": { + "tags": [ + "vim networks" + ], + "summary": "delete specific vim network", + "description": "delete specific vim network", + "operationId": "delete_vim_network", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "networkid", + "in": "path", + "description": "vim network id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the network is not accessable" + } + } + }, + "get": { + "tags": [ + "vim networks" + ], + "summary": "query specific vim network", + "description": "query specific vim network", + "operationId": "query_vim_network", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "networkid", + "in": "path", + "description": "vim network id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimNetworkInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim network is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimNetwork": { + "type": "object", + "required": [ + "networkType", + "name", + "shared" + ], + "properties": { + "name": { + "type": "string", + "description": "network name" + }, + "networkType": { + "type": "string", + "description": "network type" + }, + "physicalNetwork": { + "type": "string", + "description": "physical network name" + }, + "segmentationId": { + "type": "integer", + "description": "segmentation ID of physical network" + }, + "vlanTransparent": { + "type": "boolean", + "description": "vlan transparent" + }, + "shared": { + "type": "boolean", + "description": "network is shared across tenants" + }, + "routerExternal": { + "type": "boolean", + "description": "network can provide floating IPs via a router" + } + } + }, + "VimNetworksInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "networks" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "networks": { + "type": "array", + "description": "network information", + "items": { + "$ref": "#/definitions/VimNetworkInfo" + } + } + } + }, + "VimNetworkInfo": { + "type": "object", + "required": [ + "name", + "status", + "id" + ], + "properties": { + "name": { + "type": "string", + "description": "network name" + }, + "id": { + "type": "string", + "description": "network UUID" + }, + "status": { + "type": "string", + "description": "network status" + }, + "networkType": { + "type": "string", + "description": "network type" + }, + "physicalNetwork": { + "type": "string", + "description": "physical network name" + }, + "segmentationId": { + "type": "boolean", + "description": "segmentationId of physical network" + }, + "vlanTransparent": { + "type": "boolean", + "description": "vlan transparent" + }, + "shared": { + "type": "boolean", + "description": "network is shared across tenants" + }, + "routerExternal": { + "type": "boolean", + "description": "network can provide floating IPs via a router" + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.server.swagger.json b/share/newton_base/swagger/multivim.server.swagger.json new file mode 100644 index 00000000..c309a394 --- /dev/null +++ b/share/newton_base/swagger/multivim.server.swagger.json @@ -0,0 +1,488 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/servers": { + "post": { + "tags": [ + "vim servers" + ], + "summary": "create a server", + "description": "create a server", + "operationId": "create_vim_server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim server request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimServer" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimServerInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + }, + "get": { + "tags": [ + "vim servers" + ], + "summary": "query vim servers list", + "description": "query vim servers list", + "operationId": "query_vim_servers", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "server name to filter list", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "Requests a page size of items", + "required": false, + "type": "string" + }, + { + "name": "marker", + "in": "query", + "description": "image ID of the last-seen item", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimServersInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/servers/{serverid}": { + "delete": { + "tags": [ + "vim servers" + ], + "summary": "delete specific vim server", + "description": "delete specific vim server", + "operationId": "delete_vim_server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "serverid", + "in": "path", + "description": "vim server id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + }, + "get": { + "tags": [ + "vim servers" + ], + "summary": "query specific vim server", + "description": "query specific vim server", + "operationId": "query_vim_server", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "serverid", + "in": "path", + "description": "vim server id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimServerInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim server is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimServer": { + "type": "object", + "required": [ + "name", + "boot", + "flavorId" + ], + "properties": { + "name": { + "type": "string", + "description": "server name" + }, + "boot": { + "type": "object", + "description": "Parameters to start a server", + "properties": { + "type": { + "type": "integer", + "description": "boot type: 1: boot from volume, 2: boot from image" + }, + "volumeId": { + "type": "string", + "description": "volume UUID to boot server" + }, + "imageId": { + "type": "string", + "description": "image UUID to boot server" + } + } + }, + "flavorId": { + "type": "string", + "description": "flavor uuid to start server" + }, + "contextArray": { + "type": "array", + "description": "list of injected files", + "items": { + "$ref": "#/definitions/VimServerContextInfo" + } + }, + "volumeArray": { + "type": "array", + "description": "list of volumes attached to a server", + "items": { + "$ref": "#/definitions/VimServerVolumeInfo" + } + }, + "nicArray": { + "type": "array", + "description": "list of volumes attached to a server", + "items": { + "$ref": "#/definitions/VimServerNicInfo" + } + }, + "availabilityZone": { + "type": "string", + "description": "The availability zone from which to launch the server." + }, + "metadata": { + "type": "array", + "description": "list of key-value pairs for metadata to start a server", + "items": { + "$ref": "#/definitions/VimServerKeyValuePair" + } + }, + "userdata": { + "type": "string", + "description": "user data to start a aserver" + }, + "securityGroups": { + "type": "array", + "description": "list of security groups for a server", + "items": { + "type": "string", + "description": "name of security group" + } + }, + "serverGroup": { + "type": "string", + "description": "server group" + } + } + }, + "VimServerKeyValuePair": { + "type": "object", + "properties": { + "keyName": { + "type": "string", + "description": "key name" + }, + "value": { + "type": "string", + "description": "value " + } + } + }, + "VimServerContextInfo": { + "type": "object", + "properties": { + "fileName": { + "type": "string", + "description": "Injected file name" + }, + "fileData": { + "type": "string", + "description": "Injected file content " + } + } + }, + "VimServerVolumeInfo": { + "type": "object", + "properties": { + "volumeId": { + "type": "string", + "description": "volume UUID" + } + } + }, + "VimServerNicInfo": { + "type": "object", + "properties": { + "portId": { + "type": "string", + "description": "virtual port UUID to boot a server" + } + } + }, + "VimServersInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "servers" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "servers": { + "type": "array", + "description": "server list information", + "items": { + "$ref": "#/definitions/VimServerInfo" + } + } + } + }, + "VimServerInfo": { + "type": "object", + "required": [ + "name", + "status", + "id" + ], + "properties": { + "name": { + "type": "string", + "description": "server name" + }, + "id": { + "type": "string", + "description": "server UUID" + }, + "status": { + "type": "string", + "description": "server status,0:INACTIVE,1:ACTIVE,2:ERROR" + }, + "boot": { + "type": "object", + "description": "Parameters to start a server", + "properties": { + "type": { + "type": "integer", + "description": "boot type: 1: boot from volume, 2: boot from image" + }, + "volumeId": { + "type": "string", + "description": "volume UUID to boot server" + }, + "ImageId": { + "type": "string", + "description": "image UUID to boot server" + } + } + }, + "flavorId": { + "type": "string", + "description": "flavor uuid to start server" + }, + "volumeArray": { + "type": "array", + "description": "list of volumes attached to a server", + "items": { + "$ref": "#/definitions/VimServerVolumeInfo" + } + }, + "nicArray": { + "type": "array", + "description": "list of volumes attached to a server", + "items": { + "$ref": "#/definitions/VimServerNicInfo" + } + }, + "availabilityZone": { + "type": "string", + "description": "available zone for a server" + }, + "metadata": { + "type": "array", + "description": "list of key-value pairs for metadata to start a server", + "items": { + "$ref": "#/definitions/VimServerKeyValuePair" + } + }, + "securityGroups": { + "type": "array", + "description": "list of security groups for a server", + "items": { + "type": "string", + "description": "name of security group" + } + }, + "serverGroup": { + "type": "string", + "description": "server group" + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.subnet.swagger.json b/share/newton_base/swagger/multivim.subnet.swagger.json new file mode 100644 index 00000000..ae466d49 --- /dev/null +++ b/share/newton_base/swagger/multivim.subnet.swagger.json @@ -0,0 +1,417 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/subnets": { + "post": { + "tags": [ + "vim subnets" + ], + "summary": "create a subnet", + "description": "create a subnet", + "operationId": "create_vim_subnet", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim subnet request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimSubnet" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimSubnetInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim subnet is not accessable" + } + } + }, + "get": { + "tags": [ + "vim subnets" + ], + "summary": "query vim subnets list", + "description": "query vim subnets list", + "operationId": "query_vim_subnets", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "subnet name to filter list", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimSubnetsInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim subnet is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/subnets/{subnetid}": { + "delete": { + "tags": [ + "vim subnets" + ], + "summary": "delete specific vim subnet", + "description": "delete specific vim subnet", + "operationId": "delete_vim_subnet", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "subnetid", + "in": "path", + "description": "vim subnet id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the subnet is not accessable" + } + } + }, + "get": { + "tags": [ + "vim subnets" + ], + "summary": "query specific vim subnet", + "description": "query specific vim subnet", + "operationId": "query_vim_subnet", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "subnetid", + "in": "path", + "description": "vim subnet id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimSubnetInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim subnet id is invalid" + } + } + } + } + }, + "definitions": { + "CreateVimSubnet": { + "type": "object", + "required": [ + "networkId", + "name", + "cidr", + "ipVersion" + ], + "properties": { + "networkId": { + "type": "string", + "description": "network UUID" + }, + "name": { + "type": "string", + "description": "subnet name" + }, + "cidr": { + "type": "string", + "description": "subnet CIDR" + }, + "ipVersion": { + "type": "integer", + "description": "IP version: 4 for IPv4, 6 for IPv6" + }, + "enableDhcp": { + "type": "boolean", + "description": "Enable DHCP or not" + }, + "gatewayIp": { + "type": "string", + "description": "gateway IP address" + }, + "dnsNameservers": { + "type": "array", + "description": "DNS Nameservers", + "items": { + "type": "string" + } + }, + "hostRoutes": { + "type": "array", + "description": "Host route entries", + "items": { + "$ref": "#/definitions/VimHostRouteInfo" + } + }, + "allocationPools": { + "type": "array", + "description": "IP address allocation pools", + "items": { + "$ref": "#/definitions/VimIpAllocationPoolInfo" + } + } + } + }, + "VimHostRouteInfo": { + "type": "object", + "properties": { + "destination": { + "type": "string", + "description": "destination field of a route entry" + }, + "nexthop ": { + "type": "string", + "description": "next hop of a route entry" + } + } + }, + "VimIpAllocationPoolInfo": { + "type": "object", + "properties": { + "start": { + "type": "string", + "description": "start IP address of a pool" + }, + "end ": { + "type": "string", + "description": "end IP address of a pool" + } + } + }, + "VimSubnetsInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "subnets" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "subnets": { + "type": "array", + "description": "subnets information", + "items": { + "$ref": "#/definitions/VimSubnetInfo" + } + } + } + }, + "VimSubnetInfo": { + "type": "object", + "required": [ + "name", + "status", + "id", + "networkId", + "cidr", + "ipVersion" + ], + "properties": { + "name": { + "type": "string", + "description": "subnet name" + }, + "id": { + "type": "string", + "description": "subnet UUID" + }, + "status": { + "type": "string", + "description": "subnet status" + }, + "networkId": { + "type": "string", + "description": "network UUID" + }, + "networkName": { + "type": "string", + "description": "network name" + }, + "cidr": { + "type": "string", + "description": "subnet CIDR" + }, + "ipVersion": { + "type": "integer", + "description": "IP version: 4 for IPv4, 6 for IPv6" + }, + "enableDhcp": { + "type": "boolean", + "description": "Enable DHCP or not" + }, + "gatewayIp": { + "type": "string", + "description": "gateway IP address" + }, + "dnsNameservers": { + "type": "array", + "description": "DNS Nameservers", + "items": { + "type": "string" + } + }, + "hostRoutes": { + "type": "array", + "description": "Host route entries", + "items": { + "$ref": "#/definitions/VimHostRouteInfo" + } + }, + "allocationPools": { + "type": "array", + "description": "IP address allocation pools", + "items": { + "$ref": "#/definitions/VimIpAllocationPoolInfo" + } + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.tenant.swagger.json b/share/newton_base/swagger/multivim.tenant.swagger.json new file mode 100644 index 00000000..ed0c6c45 --- /dev/null +++ b/share/newton_base/swagger/multivim.tenant.swagger.json @@ -0,0 +1,102 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/tenants": { + "get": { + "tags": [ + "vim tenants" + ], + "summary": "query vim tenants list", + "description": "query vim tenants list", + "operationId": "query_vim_tenants", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "tenant name to filter tenant list", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimTenantsInfo" + } + }, + "404": { + "description": "the vim id is wrong" + }, + "500": { + "description": "the vim tenants is not accessable" + } + } + } + } + }, + "definitions": { + "VimTenantsInfo": { + "type": "object", + "required": [ + "vimId", + "tenants" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenants": { + "type": "array", + "description": "tenant list information", + "items": { + "$ref": "#/definitions/VimTenantInfo" + } + } + } + }, + "VimTenantInfo": { + "type": "object", + "required": [ + "name", + "id" + ], + "properties": { + "name": { + "type": "string", + "description": "tenant name" + }, + "id": { + "type": "string", + "description": "tenant UUID" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.volume.swagger.json b/share/newton_base/swagger/multivim.volume.swagger.json new file mode 100644 index 00000000..7dd787d1 --- /dev/null +++ b/share/newton_base/swagger/multivim.volume.swagger.json @@ -0,0 +1,378 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/volumes": { + "post": { + "tags": [ + "vim volumes" + ], + "summary": "create a volume", + "description": "create a volume", + "operationId": "create_vim_volume", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim volume request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimVolume" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimVolumeInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim volume is not accessable" + } + } + }, + "get": { + "tags": [ + "vim volumes" + ], + "summary": "query vim volumes list", + "description": "query vim volumes list", + "operationId": "query_vim_volumes", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "volumn name to filter list", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "description": "Requests a page size of items", + "required": false, + "type": "string" + }, + { + "name": "marker", + "in": "query", + "description": "image ID of the last-seen item", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimVolumesInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim volume is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/volumes/{volumeid}": { + "delete": { + "tags": [ + "vim volumes" + ], + "summary": "delete specific vim volume", + "description": "delete specific vim volume", + "operationId": "delete_vim_volume", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "volumeid", + "in": "path", + "description": "vim volume id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim volume is not accessable" + } + } + }, + "get": { + "tags": [ + "vim volumes" + ], + "summary": "query specific vim volume", + "description": "query specific vim volume", + "operationId": "query_vim_volume", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "volumeid", + "in": "path", + "description": "vim volume id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimVolumeInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim volume is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimVolume": { + "type": "object", + "required": [ + "name", + "volumeSize" + ], + "properties": { + "name": { + "type": "string", + "description": "volume name" + }, + "volumeSize": { + "type": "integer", + "description": "volume size" + }, + "imageId": { + "type": "string", + "description": "image UUID to create volume" + }, + "volumeType": { + "type": "string", + "description": "volume type" + }, + "availabilityZone": { + "type": "integer", + "description": "available zone for volume" + } + } + }, + "VimVolumesInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "volumes" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "volumes": { + "type": "array", + "description": "volume list information", + "items": { + "$ref": "#/definitions/VimVolumeInfo" + } + } + } + }, + "VimVolumeInfo": { + "type": "object", + "required": [ + "name", + "id", + "status" + ], + "properties": { + "name": { + "type": "string", + "description": "volume name" + }, + "id": { + "type": "string", + "description": "volume UUID" + }, + "createTime": { + "type": "string", + "description": "created time" + }, + "volumeSize": { + "type": "integer", + "description": "volume size" + }, + "volumeType": { + "type": "string", + "description": "volume type" + }, + "availabilityZone": { + "type": "integer", + "description": "available zone for volume" + }, + "attachments": { + "type": "array", + "description": "attachment list information", + "items": { + "$ref": "#/definitions/VimVolumeAttachmentInfo" + } + }, + "status": { + "type": "string", + "description": "volume status" + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "return code: 0: Already exist 1: Newly created" + } + } + }, + "VimVolumeAttachmentInfo": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "attachment UUID" + }, + "serverId": { + "type": "string", + "description": "server UUID" + }, + "volumeId": { + "type": "string", + "description": "volume UUID" + }, + "device": { + "type": "string", + "description": "device to be attached" + }, + "hostName": { + "type": "string", + "description": "host name" + } + } + } + } +} diff --git a/share/newton_base/swagger/multivim.vport.swagger.json b/share/newton_base/swagger/multivim.vport.swagger.json new file mode 100644 index 00000000..5b0a04a7 --- /dev/null +++ b/share/newton_base/swagger/multivim.vport.swagger.json @@ -0,0 +1,363 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "MultiVIM Service rest API" + }, + "basePath": "/api/multicloud-newton/v0/", + "tags": [ + { + "name": "MultiVIM services" + } + ], + "paths": { + "/{vimid}/{tenantid}/ports": { + "post": { + "tags": [ + "vim virtual ports" + ], + "summary": "create a virtual port", + "description": "create a virtual port", + "operationId": "create_vim_port", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "body", + "description": "create vim virtual port request param", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVimPort" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimPortInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim virtual port is not accessable" + } + } + }, + "get": { + "tags": [ + "vim virtual ports" + ], + "summary": "query vim ports list", + "description": "query vim ports list", + "operationId": "query_vim_ports", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "virtual port name to filter list", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimPortsInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim virtual port is not accessable" + } + } + } + }, + "/{vimid}/{tenantid}/ports/{portid}": { + "delete": { + "tags": [ + "vim virtual ports" + ], + "summary": "delete specific vim virtual port", + "description": "delete specific vim virtual port", + "operationId": "delete_vim_port", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "portid", + "in": "path", + "description": "vim virtual port id", + "required": true, + "type": "string" + } + ], + "responses": { + "204": { + "description": "successful operation" + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the virtual port is not accessable" + } + } + }, + "get": { + "tags": [ + "vim virtual ports" + ], + "summary": "query specific vim virtual port", + "description": "query specific vim virtual port", + "operationId": "query_vim_port", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "vimid", + "in": "path", + "description": "vim instance id", + "required": true, + "type": "string" + }, + { + "name": "tenantid", + "in": "path", + "description": "tenant UUID", + "required": true, + "type": "string" + }, + { + "name": "portid", + "in": "path", + "description": "vim virtual port id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VimPortInfo" + } + }, + "404": { + "description": "the vim id or tenant UUID is wrong" + }, + "500": { + "description": "the vim virtual port id is not accessable" + } + } + } + } + }, + "definitions": { + "CreateVimPort": { + "type": "object", + "required": [ + "networkId", + "name" + ], + "properties": { + "networkId": { + "type": "string", + "description": "network UUID" + }, + "subnetId": { + "type": "string", + "description": "subnet UUID" + }, + "name": { + "type": "string", + "description": "virtual port name" + }, + "ip": { + "type": "string", + "description": "virtual port fixed IP" + }, + "macAddress": { + "type": "string", + "description": "virtual port MAC address" + }, + "vnicType": { + "type": "string", + "description": "vnicType: normal,direct,macvtap" + }, + "securityGroups": { + "type": "array", + "description": "List of security group names", + "items": { + "type": "string" + } + } + } + }, + "VimPortsInfo": { + "type": "object", + "required": [ + "vimId", + "tenantId", + "ports" + ], + "properties": { + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "ports": { + "type": "array", + "description": "ports information", + "items": { + "$ref": "#/definitions/VimPortInfo" + } + } + } + }, + "VimPortInfo": { + "type": "object", + "required": [ + "name", + "status", + "id", + "networkId" + ], + "properties": { + "name": { + "type": "string", + "description": "virtual port name" + }, + "id": { + "type": "string", + "description": "virtual port UUID" + }, + "status": { + "type": "string", + "description": "subnet status" + }, + "networkId": { + "type": "string", + "description": "network UUID" + }, + "networkName": { + "type": "string", + "description": "network name" + }, + "subnetName": { + "type": "string", + "description": "subnet name" + }, + "subnetId": { + "type": "string", + "description": "subnet UUID" + }, + "ip": { + "type": "string", + "description": "virtual port fixed IP" + }, + "macAddress": { + "type": "string", + "description": "virtual port MAC address" + }, + "vnicType": { + "type": "string", + "description": "vnicType: normal,direct,macvtap" + }, + "securityGroups": { + "type": "array", + "description": "list of securityGroups names", + "items": { + "type": "string" + } + }, + "vimId": { + "type": "string" + }, + "vimName": { + "type": "string" + }, + "tenantId": { + "type": "string", + "description": "tenant UUID" + }, + "returnCode": { + "type": "integer", + "description": "0: Already exist 1: Newly created" + } + } + } + } +} diff --git a/share/newton_base/swagger/views.py b/share/newton_base/swagger/views.py new file mode 100644 index 00000000..10f3c0cc --- /dev/null +++ b/share/newton_base/swagger/views.py @@ -0,0 +1,96 @@ +# Copyright (c) 2017 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + +import json +import logging +import os +import traceback + +from rest_framework import status +from rest_framework.response import Response +from rest_framework.views import APIView + +from newton.pub.exceptions import VimDriverNewtonException + +logger = logging.getLogger(__name__) + + +class SwaggerJsonView(APIView): + def get(self, request): + json_file = os.path.join(os.path.dirname(__file__), 'multivim.flavor.swagger.json') + f = open(json_file) + json_data = json.JSONDecoder().decode(f.read()) + f.close() + json_file = os.path.join(os.path.dirname(__file__), 'multivim.image.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.network.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.subnet.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.server.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.volume.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.vport.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.tenant.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.host.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'multivim.limit.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + + json_file = os.path.join(os.path.dirname(__file__), 'multicloud.identity.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + json_data["paths"].update(json_data_temp["paths"]) + + json_data["basePath"] = "/api/multicloud-newton/v0/" + json_data["info"]["title"] = "Service NBI of MultiCloud plugin for OpenStack Newton" + return Response(json_data) + -- cgit 1.2.3-korg