diff options
-rwxr-xr-x | docker/instance_init.sh | 6 | ||||
-rw-r--r-- | docs/platform/APIs/CATALOG_API/CATALOG_API_Specification_v0.1.json | 1787 | ||||
-rw-r--r-- | docs/platform/APIs/CATALOG_API/index.rst | 6 | ||||
-rw-r--r-- | docs/platform/APIs/index.rst | 11 | ||||
-rw-r--r-- | lcm/ns/biz/scaleaspect.py | 2 | ||||
-rw-r--r-- | lcm/ns/const.py | 7 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/cp_serializers.py | 11 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/create_ns_serializers.py | 16 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/ns_instance.py | 344 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/pub_serializers.py | 5 | ||||
-rw-r--r-- | lcm/ns/serializers/sol/scale_ns_serializers.py | 231 | ||||
-rw-r--r-- | lcm/ns/tests/test_ns_manual_scale.py | 22 | ||||
-rw-r--r-- | lcm/ns/tests/test_sol_ns_scale_api.py | 16 | ||||
-rw-r--r-- | lcm/ns/views/deprecated/scale_ns_views.py | 9 | ||||
-rw-r--r-- | lcm/ns/views/sol/scale_ns_views.py | 6 | ||||
-rw-r--r-- | resources/bin/initDB.sh | 6 | ||||
-rw-r--r-- | resources/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql | 8 |
17 files changed, 2216 insertions, 277 deletions
diff --git a/docker/instance_init.sh b/docker/instance_init.sh index 6c289657..7e5fcf31 100755 --- a/docker/instance_init.sh +++ b/docker/instance_init.sh @@ -26,9 +26,9 @@ function migrate_database { } -cd /service -if [ ! -f dbexist.txt ]; then - echo 1 > dbexist.txt +GET_NSLCM_DB="show databases like 'vfcnfvolcm';" +NSLCM_DB=`mysql -u$MYSQL_ROOT_USER -p$MYSQL_ROOT_PASSWORD -P$MYSQL_PORT -h$MYSQL_IP -e "GET_NSLCM_DB"` +if [[ "$NSLCM_DB" == "" ]]; then create_database migrate_database fi diff --git a/docs/platform/APIs/CATALOG_API/CATALOG_API_Specification_v0.1.json b/docs/platform/APIs/CATALOG_API/CATALOG_API_Specification_v0.1.json new file mode 100644 index 00000000..df013d19 --- /dev/null +++ b/docs/platform/APIs/CATALOG_API/CATALOG_API_Specification_v0.1.json @@ -0,0 +1,1787 @@ +{ + "swagger": "2.0", + "info": { + "title": "VFC Catalog API", + "description": "\n\nThe `swagger-ui` view can be found [here](/api/catalog/v1/swagger).\nThe `ReDoc` view can be found [here](/api/catalog/v1/redoc).\nThe swagger YAML document can be found [here](/api/catalog/v1/swagger.yaml).\nThe swagger JSON document can be found [here](/api/catalog/v1/swagger.json).", + "version": "v1" + }, + "host": "127.0.0.1:8000", + "schemes": ["http"], + "basePath": "/", + "paths": { + "/api/catalog/v1/jobs/{job_id}": { + "get": { + "operationId": "api_catalog_v1_jobs_read", + "description": "Get job status", + "parameters": [{ + "name": "job_id", + "in": "query", + "description": "job id", + "type": "string" + }, { + "name": "responseId", + "in": "query", + "description": "response id", + "type": "string" + }], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/GetJobResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/PostJobResponseResult" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_catalog_v1_jobs_create", + "description": "Update job status", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/PostJobRequest" + } + }, { + "name": "job_id", + "in": "query", + "description": "job id", + "type": "string" + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/PostJobResponseResult" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/PostJobResponseResult" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "job_id", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/catalog/v1/mandb/{modelName}": { + "get": { + "operationId": "api_catalog_v1_mandb_read", + "description": "", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_catalog_v1_mandb_delete", + "description": "", + "parameters": [], + "responses": { + "204": { + "description": "" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "modelName", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/catalog/v1/nspackages": { + "get": { + "operationId": "api_catalog_v1_nspackages_list", + "description": "Query NS packages", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/NsPackage" + } + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_catalog_v1_nspackages_create", + "description": "On distribute NS package", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/NsPackageDistributeRequest" + } + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/NsPackageDistributeResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/catalog/v1/nspackages/{csarId}": { + "get": { + "operationId": "api_catalog_v1_nspackages_read", + "description": "Query one NS package", + "parameters": [{ + "name": "csarId", + "in": "query", + "description": "csarId", + "type": "string" + }], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/NsPackage" + } + }, + "500": { + "description": "error message", + "schema": { + "type": "string" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_catalog_v1_nspackages_delete", + "description": "Delete one NS package", + "parameters": [{ + "name": "csarId", + "in": "query", + "description": "csarId", + "type": "string" + }], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/NsPackageDistributeResponse" + } + }, + "500": { + "description": "error message", + "schema": { + "type": "string" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "csarId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/catalog/v1/parsernsd": { + "post": { + "operationId": "api_catalog_v1_parsernsd_create", + "description": "Parse NS model", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ParseModelRequest" + } + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/ParseModelResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/catalog/v1/parserpnfd": { + "post": { + "operationId": "api_catalog_v1_parserpnfd_create", + "description": "Parse PNF model", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ParseModelRequest" + } + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/ParseModelResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/catalog/v1/parservnfd": { + "post": { + "operationId": "api_catalog_v1_parservnfd_create", + "description": "Parse NF model", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ParseModelRequest" + } + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/ParseModelResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/catalog/v1/vnfpackages": { + "get": { + "operationId": "api_catalog_v1_vnfpackages_list", + "description": "Query Nf packages", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/NfPackage" + } + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_catalog_v1_vnfpackages_create", + "description": "On distribute Nf package", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/NfPackageDistributeRequest" + } + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/PostJobResponse" + } + }, + "500": { + "description": "", + "schema": { + "$ref": "#/definitions/InternalErrorRequest" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/catalog/v1/vnfpackages/{csarId}": { + "get": { + "operationId": "api_catalog_v1_vnfpackages_read", + "description": "Query one Nf package", + "parameters": [{ + "name": "csarId", + "in": "query", + "description": "csarId", + "type": "string" + }], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/NfPackage" + } + }, + "500": { + "description": "error message", + "schema": { + "type": "string" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_catalog_v1_vnfpackages_delete", + "description": "Delete one Nf package", + "parameters": [{ + "name": "csarId", + "in": "query", + "description": "csarId", + "type": "string" + }], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/PostJobResponse" + } + }, + "500": { + "description": "error message", + "schema": { + "type": "string" + } + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "csarId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/nsd/v1/ns_descriptors": { + "get": { + "operationId": "api_nsd_v1_ns_descriptors_list", + "description": "Query multiple NSDs", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/NsdInfo" + } + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_nsd_v1_ns_descriptors_create", + "description": "Create a NSD", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateNsdInfoRequest" + } + }], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/NsdInfo" + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/nsd/v1/ns_descriptors/{nsdInfoId}": { + "get": { + "operationId": "api_nsd_v1_ns_descriptors_read", + "description": "Query a NSD", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/NsdInfo" + } + }, + "500": { + "description": "Internal error" + }, + "404": { + "description": "NSDs do not exist" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_nsd_v1_ns_descriptors_delete", + "description": "Delete a NSD", + "parameters": [], + "responses": { + "500": { + "description": "Internal error" + }, + "204": { + "description": "No content" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "nsdInfoId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/nsd/v1/ns_descriptors/{nsdInfoId}/nsd_content": { + "get": { + "operationId": "api_nsd_v1_ns_descriptors_nsd_content_list", + "description": "Download NSD content", + "parameters": [], + "responses": { + "404": { + "description": "NSD does not exist." + }, + "204": { + "description": "No content" + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "put": { + "operationId": "api_nsd_v1_ns_descriptors_nsd_content_update", + "description": "Upload NSD content", + "parameters": [], + "responses": { + "500": { + "description": "Internal error" + }, + "204": { + "description": "PNFD file" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "nsdInfoId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/nsd/v1/pnf_descriptors": { + "get": { + "operationId": "api_nsd_v1_pnf_descriptors_list", + "description": "Query multiple PNFDs", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/PnfdInfo" + } + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_nsd_v1_pnf_descriptors_create", + "description": "Create a PNFD", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreatePnfdInfoRequest" + } + }], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/PnfdInfo" + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/nsd/v1/pnf_descriptors/{pnfdInfoId}": { + "get": { + "operationId": "api_nsd_v1_pnf_descriptors_read", + "description": "Query a PNFD", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/PnfdInfo" + } + }, + "500": { + "description": "Internal error" + }, + "404": { + "description": "PNFD does not exist" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_nsd_v1_pnf_descriptors_delete", + "description": "Delete a PNFD", + "parameters": [], + "responses": { + "500": { + "description": "Internal error" + }, + "204": { + "description": "No content" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "pnfdInfoId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/nsd/v1/pnf_descriptors/{pnfdInfoId}/pnfd_content": { + "get": { + "operationId": "api_nsd_v1_pnf_descriptors_pnfd_content_list", + "description": "Fetch PNFD content", + "parameters": [], + "responses": { + "404": { + "description": "PNFD does not exist" + }, + "204": { + "description": "PNFD file" + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "put": { + "operationId": "api_nsd_v1_pnf_descriptors_pnfd_content_update", + "description": "Upload PNFD content", + "parameters": [], + "responses": { + "500": { + "description": "Internal error" + }, + "204": { + "description": "No content" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "pnfdInfoId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/vnfpkgm/v1/vnf_packages": { + "get": { + "operationId": "api_vnfpkgm_v1_vnf_packages_list", + "description": "Query multiple VNF package resource", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/VnfPkgInfo" + } + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "post": { + "operationId": "api_vnfpkgm_v1_vnf_packages_create", + "description": "Create an individual VNF package resource", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/CreateVnfPkgInfoRequest" + } + }], + "responses": { + "201": { + "description": "", + "schema": { + "$ref": "#/definitions/VnfPkgInfo" + } + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [] + }, + "/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}": { + "get": { + "operationId": "api_vnfpkgm_v1_vnf_packages_read", + "description": "Query an individual VNF package resource", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/VnfPkgInfo" + } + }, + "500": { + "description": "Internal error" + }, + "404": { + "description": "VNF package does not exist" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "delete": { + "operationId": "api_vnfpkgm_v1_vnf_packages_delete", + "description": "Delete an individual VNF package resource", + "parameters": [], + "responses": { + "500": { + "description": "Internal error" + }, + "204": { + "description": "No content" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "vnfPkgId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}/package_content": { + "get": { + "operationId": "api_vnfpkgm_v1_vnf_packages_package_content_list", + "description": "Fetch VNF package content", + "parameters": [], + "responses": { + "200": { + "description": "", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/VnfPkgInfo" + } + } + }, + "500": { + "description": "Internal error" + }, + "404": { + "description": "VNF package does not exist" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "put": { + "operationId": "api_vnfpkgm_v1_vnf_packages_package_content_update", + "description": "Upload VNF package content", + "parameters": [], + "responses": { + "202": { + "description": "Successfully" + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "vnfPkgId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}/package_content/upload_from_uri": { + "post": { + "operationId": "api_vnfpkgm_v1_vnf_packages_package_content_upload_from_uri_create", + "description": "Upload VNF package content from uri", + "parameters": [{ + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/UploadVnfPackageFromUriRequest" + } + }], + "responses": { + "202": { + "description": "Successfully" + }, + "500": { + "description": "Internal error" + } + }, + "consumes": ["application/json"], + "tags": ["api"] + }, + "parameters": [{ + "name": "vnfPkgId", + "in": "path", + "required": true, + "type": "string" + }] + }, + "/samples/": { + "get": { + "operationId": "samples_list", + "description": "List all samples.", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "consumes": ["application/json"], + "tags": ["samples"] + }, + "parameters": [] + } + }, + "definitions": { + "JobResponseHistoryList": { + "description": "Response History List", + "type": "object", + "properties": { + "status": { + "title": "Status", + "description": "Status", + "type": "string" + }, + "progress": { + "title": "Progress", + "description": "Job Progress", + "type": "string" + }, + "statusDescription": { + "title": "Statusdescription", + "description": "Status Description", + "type": "string" + }, + "errorCode": { + "title": "Errorcode", + "description": "Error Code", + "type": "string" + }, + "responseId": { + "title": "Responseid", + "description": "Response Id", + "type": "string" + } + } + }, + "JobResponseDescriptor": { + "title": "Responsedescriptor", + "description": "Job Response Descriptor", + "type": "object", + "properties": { + "status": { + "title": "Status", + "description": "Status", + "type": "string" + }, + "progress": { + "title": "Progress", + "description": "Job Progress", + "type": "string" + }, + "statusDescription": { + "title": "Statusdescription", + "description": "Status Description", + "type": "string" + }, + "errorCode": { + "title": "Errorcode", + "description": "Error Code", + "type": "string" + }, + "responseId": { + "title": "Responseid", + "description": "Response Id", + "type": "string" + }, + "responseHistoryList": { + "title": "Responsehistorylist", + "description": "Response History List", + "type": "array", + "items": { + "$ref": "#/definitions/JobResponseHistoryList" + } + } + } + }, + "GetJobResponse": { + "type": "object", + "properties": { + "jobId": { + "title": "Jobid", + "description": "Job Id", + "type": "string" + }, + "responseDescriptor": { + "$ref": "#/definitions/JobResponseDescriptor" + } + } + }, + "PostJobResponseResult": { + "required": ["result"], + "type": "object", + "properties": { + "result": { + "title": "Result", + "description": "Result", + "type": "string" + }, + "msg": { + "title": "Msg", + "description": "Message", + "type": "string" + } + } + }, + "PostJobRequest": { + "type": "object", + "properties": { + "progress": { + "title": "Progress", + "description": "Job Progress", + "type": "string" + }, + "desc": { + "title": "Desc", + "description": "Description", + "type": "string" + }, + "errcode": { + "title": "Errcode", + "description": "Error Code", + "type": "string" + } + } + }, + "NsPackageInfo": { + "title": "Packageinfo", + "description": "NS Package Info", + "type": "object", + "properties": { + "nsdId": { + "title": "Nsdid", + "description": "NSD ID", + "type": "string" + }, + "nsPackageId": { + "title": "Nspackageid", + "description": "NS Package ID", + "type": "string" + }, + "nsdProvider": { + "title": "Nsdprovider", + "description": "NSD Provider", + "type": "string" + }, + "nsdVersion": { + "title": "Nsdversion", + "description": "NSD Version", + "type": "string" + }, + "csarName": { + "title": "Csarname", + "description": "CSAR name", + "type": "string" + }, + "nsdModel": { + "title": "Nsdmodel", + "description": "NSD Model", + "type": "string" + }, + "downloadUrl": { + "title": "Downloadurl", + "description": "URL to download NSD Model", + "type": "string" + } + } + }, + "NsPackage": { + "type": "object", + "properties": { + "csarId": { + "title": "Csarid", + "description": "CSAR ID", + "type": "string" + }, + "packageInfo": { + "$ref": "#/definitions/NsPackageInfo" + } + } + }, + "InternalErrorRequest": { + "required": ["error"], + "type": "object", + "properties": { + "error": { + "title": "Error", + "description": "Error", + "type": "string" + }, + "errorMessage": { + "title": "Errormessage", + "description": "Error Message", + "type": "string" + } + } + }, + "NsPackageDistributeRequest": { + "required": ["csarId"], + "type": "object", + "properties": { + "csarId": { + "title": "Csarid", + "description": "csarId", + "type": "string" + } + } + }, + "NsPackageDistributeResponse": { + "required": ["status", "statusDescription", "errorCode"], + "type": "object", + "properties": { + "status": { + "title": "Status", + "description": "status", + "type": "string" + }, + "statusDescription": { + "title": "Statusdescription", + "description": "statusDescription", + "type": "string" + }, + "errorCode": { + "title": "Errorcode", + "description": "errorCode", + "type": "string" + } + } + }, + "ParseModelRequest": { + "required": ["csarId"], + "type": "object", + "properties": { + "csarId": { + "title": "Csarid", + "description": "CSAR ID", + "type": "string" + }, + "inputs": { + "title": "Inputs", + "description": "Inputs", + "type": "string" + } + } + }, + "ParseModelResponse": { + "required": ["model"], + "type": "object", + "properties": { + "model": { + "title": "Model", + "description": "Model", + "type": "string" + } + } + }, + "NfPackageInfo": { + "title": "Packageinfo", + "description": "VNF Package Info", + "required": ["vnfPackageId"], + "type": "object", + "properties": { + "vnfdId": { + "title": "Vnfdid", + "description": "VNFD ID", + "type": "string" + }, + "vnfPackageId": { + "title": "Vnfpackageid", + "description": "VNF Package ID", + "type": "string" + }, + "vnfdProvider": { + "title": "Vnfdprovider", + "description": "VNFD Provider", + "type": "string" + }, + "vnfdVersion": { + "title": "Vnfdversion", + "description": "VNFD Version", + "type": "string" + }, + "vnfVersion": { + "title": "Vnfversion", + "description": "VNF Version", + "type": "string" + }, + "csarName": { + "title": "Csarname", + "description": "CSAR Name", + "type": "string" + }, + "vnfdModel": { + "title": "Vnfdmodel", + "description": "VNFD Model", + "type": "string" + }, + "downloadUrl": { + "title": "Downloadurl", + "description": "URL to download VNFD Model", + "type": "string" + } + } + }, + "NfImageInfo": { + "description": "Image Info", + "required": ["index", "fileName", "imageId", "vimId", "vimUser", "tenant", "status"], + "type": "object", + "properties": { + "index": { + "title": "Index", + "description": "Index of VNF Image", + "type": "string" + }, + "fileName": { + "title": "Filename", + "description": "Image file name", + "type": "string" + }, + "imageId": { + "title": "Imageid", + "description": "Image ID", + "type": "string" + }, + "vimId": { + "title": "Vimid", + "description": "VIM ID", + "type": "string" + }, + "vimUser": { + "title": "Vimuser", + "description": "User of VIM", + "type": "string" + }, + "tenant": { + "title": "Tenant", + "description": "Tenant", + "type": "string" + }, + "status": { + "title": "Status", + "description": "Status", + "type": "string" + } + } + }, + "NfPackage": { + "required": ["csarId", "packageInfo"], + "type": "object", + "properties": { + "csarId": { + "title": "Csarid", + "description": "CSAR ID", + "type": "string" + }, + "packageInfo": { + "$ref": "#/definitions/NfPackageInfo" + }, + "imageInfo": { + "title": "Imageinfo", + "description": "Image Info", + "type": "array", + "items": { + "$ref": "#/definitions/NfImageInfo" + } + } + } + }, + "NfPackageDistributeRequest": { + "required": ["csarId"], + "type": "object", + "properties": { + "csarId": { + "title": "Csarid", + "description": "CSAR ID", + "type": "string" + }, + "vimIds": { + "title": "Vimids", + "description": "A string for vimIds", + "type": "array", + "items": { + "type": "string" + } + }, + "labVimId": { + "title": "Labvimid", + "description": "A list of VIM IDs.", + "type": "string" + } + } + }, + "PostJobResponse": { + "required": ["jobId"], + "type": "object", + "properties": { + "jobId": { + "title": "Jobid", + "description": "jobId", + "type": "string" + } + } + }, + "ProblemDetails": { + "title": "Onboardingfailuredetails", + "description": "Failure details of current onboarding procedure. It shall be present when the \"nsdOnboardingState\" attribute is CREATED and the uploading or processing fails in NFVO.", + "required": ["title", "detail"], + "type": "object", + "properties": { + "type": { + "title": "Type", + "description": "A URI reference according to IETF RFC 3986 [10] that identifies the problem type. It is encouraged that the URI provides human-readable documentation for the problem (e.g. using HTML) when dereferenced. When this member is not present, its value is assumed to be \"about:blank\".", + "type": "string" + }, + "title": { + "title": "Title", + "description": "The HTTP status code for this occurrence of the problem.", + "type": "integer" + }, + "detail": { + "title": "Detail", + "description": "A human-readable explanation specific to this occurrence of the problem.", + "type": "string" + }, + "instance": { + "title": "Instance", + "description": "A URI reference that identifies the specific occurrence of the problem. It may yield further information if dereferenced.", + "type": "string" + }, + "additional_attributes": { + "title": "Additional attributes", + "description": "Any number of additional attributes, as defined in a specification or by an implementation.", + "type": "object", + "additionalProperties": { + "description": "Additional attribute", + "type": "string" + } + } + } + }, + "Link": { + "title": "Self", + "description": "URI of this resource.", + "required": ["href"], + "type": "object", + "properties": { + "href": { + "title": "Href", + "description": "URI of the referenced resource", + "type": "string" + } + } + }, + "_Link": { + "title": " links", + "description": "Links to resources related to this resource.", + "required": ["self", "nsd_content"], + "type": "object", + "properties": { + "self": { + "$ref": "#/definitions/Link" + }, + "nsd_content": { + "$ref": "#/definitions/Link" + } + } + }, + "NsdInfo": { + "required": ["id", "nsdOnboardingState", "nsdOperationalState", "nsdUsageState", "_links"], + "type": "object", + "properties": { + "id": { + "title": "Id", + "description": "Identifier of the onboarded individual NS descriptor resource. This identifier is allocated by the NFVO.", + "type": "string" + }, + "nsdId": { + "title": "Nsdid", + "description": "This identifier, which is allocated by the NSD designer, identifies the NSD in a globally unique way. It is copied from the NSD content and shall be present after the NSD content is on-boarded.", + "type": "string" + }, + "nsdName": { + "title": "Nsdname", + "description": "Name of the onboarded NSD. This information is copied from the NSD content and shall be present after the NSD content is on-boarded.", + "type": "string" + }, + "nsdVersion": { + "title": "Nsdversion", + "description": "Version of the on-boarded NSD. This information is copied from the NSD content and shall be present after the NSD content is on-boarded.", + "type": "string" + }, + "nsdDesigner": { + "title": "Nsddesigner", + "description": "Designer of the on-boarded NSD. This information is copied from the NSD content and shall be present after the NSD content is on-boarded.", + "type": "string" + }, + "nsdInvariantId": { + "title": "Nsdinvariantid", + "description": "This identifier, which is allocated by the NSD designer, identifies an NSD in a version independent manner. This information is copied from the NSD content and shall be present after the NSD content is on-boarded.", + "type": "string" + }, + "vnfPkgIds": { + "title": "Vnfpkgids", + "description": "Identifies the VNF package for the VNFD referenced by the on-boarded NS descriptor resource.", + "type": "array", + "items": { + "description": "Identifier of the VNF package", + "type": "string" + } + }, + "pnfdInfoIds": { + "title": "Pnfdinfoids", + "description": "Identifies the PnfdInfo element for the PNFD referenced by the on-boarded NS descriptor resource.", + "type": "array", + "items": { + "description": "Identifier of the PnfdInfo element", + "type": "string" + } + }, + "nestedNsdInfoIds": { + "title": "Nestednsdinfoids", + "description": "Identifies the NsdInfo element for the nested NSD referenced by the on-boarded NS descriptor resource.", + "type": "array", + "items": { + "description": "Identifier of the NsdInfo element", + "type": "string" + } + }, + "nsdOnboardingState": { + "title": "Nsdonboardingstate", + "description": "Onboarding state of the individual NS descriptor resource.", + "type": "string", + "enum": ["CREATED", "UPLOADING", "PROCESSING", "ONBOARDED"] + }, + "onboardingFailureDetails": { + "$ref": "#/definitions/ProblemDetails" + }, + "nsdOperationalState": { + "title": "Nsdoperationalstate", + "description": "Operational state of the individual NS descriptor resource. This attribute can be modified with the PATCH method.", + "type": "string", + "enum": ["ENABLED", "DISABLED"] + }, + "nsdUsageState": { + "title": "Nsdusagestate", + "description": "Usage state of the individual NS descriptor resource.", + "type": "string", + "enum": ["IN_USE", "NOT_IN_USE"] + }, + "userDefinedData": { + "title": "Userdefineddata", + "description": "User defined data for the individual NS descriptor resource. This attribute can be modified with the PATCH method.", + "type": "object", + "additionalProperties": { + "description": "Key Value Pairs", + "type": "string" + } + }, + "_links": { + "$ref": "#/definitions/_Link" + } + } + }, + "CreateNsdInfoRequest": { + "type": "object", + "properties": { + "userDefinedData": { + "title": "Userdefineddata", + "description": "User-defined data for the NS descriptor resource to be created. It shall be present when the user defined data is set for the individual NS descriptor resource to be created.", + "type": "object", + "additionalProperties": { + "description": "Key Value Pairs", + "type": "string" + } + } + } + }, + "PnfdInfo": { + "required": ["id", "pnfdOnboardingState", "pnfdUsageState", "_links"], + "type": "object", + "properties": { + "id": { + "title": "Id", + "description": "Identifier of the onboarded individual PNF descriptor resource. This identifier is allocated by the NFVO.", + "type": "string" + }, + "pnfdId": { + "title": "Pnfdid", + "description": "This identifier, which is allocated by the PNFD designer, identifies the PNFD in a globally unique way. It is copied from the PNFD content and shall be present after the PNFD content is on-boarded.", + "type": "string" + }, + "pnfdName": { + "title": "Pnfdname", + "description": "Name of the onboarded PNFD. This information is copied from the PNFD content and shall be present after the PNFD content is on-boarded.", + "type": "string" + }, + "pnfdVersion": { + "title": "Pnfdversion", + "description": "Version of the on-boarded PNFD. This information is copied from the PNFD content and shall be present after the PNFD content is on-boarded.", + "type": "string" + }, + "pnfdProvider": { + "title": "Pnfdprovider", + "description": "Provider of the on-boarded PNFD. This information is copied from the PNFD content and shall be present after the PNFD content is on-boarded.", + "type": "string" + }, + "pnfdInvariantId": { + "title": "Pnfdinvariantid", + "description": "Identifies a PNFD in a version independent manner. This attribute is invariant across versions of PNFD.", + "type": "string" + }, + "pnfdOnboardingState": { + "title": "Pnfdonboardingstate", + "description": "Onboarding state of the individual PNF descriptor resource.", + "type": "string", + "enum": ["CREATED", "UPLOADING", "PROCESSING", "ONBOARDED"] + }, + "onboardingFailureDetails": { + "$ref": "#/definitions/ProblemDetails" + }, + "pnfdUsageState": { + "title": "Pnfdusagestate", + "description": "Usage state of the individual PNF descriptor resource.", + "type": "string", + "enum": ["IN_USE", "NOT_IN_USE"] + }, + "userDefinedData": { + "title": "Userdefineddata", + "description": "User defined data for the individual PNF descriptor resource. This attribute can be modified with the PATCH method.", + "type": "object", + "additionalProperties": { + "description": "Key Value Pairs", + "type": "string" + } + }, + "_links": { + "$ref": "#/definitions/_Link" + } + } + }, + "CreatePnfdInfoRequest": { + "type": "object", + "properties": { + "userDefinedData": { + "title": "Userdefineddata", + "description": "User-defined data for the PNF descriptor resource to be created. It shall be present when the user defined data is set for the individual PNF descriptor resource to be created.", + "type": "object", + "additionalProperties": { + "description": "Key Value Pairs", + "type": "string" + } + } + } + }, + "Checksum": { + "title": "Checksum", + "description": "Checksum of the on-boarded VNF package.", + "required": ["algorithm", "hash"], + "type": "object", + "properties": { + "algorithm": { + "title": "Algorithm", + "description": "Name of the algorithm used to generate the checksum.", + "type": "string" + }, + "hash": { + "title": "Hash", + "description": "The hexadecimal value of the checksum.", + "type": "string" + } + } + }, + "VnfPackageSoftwareImageInfo": { + "description": "Information about VNF package artifacts that are software images.", + "required": ["id", "name", "provider", "version", "checksum", "containerFormat", "diskFormat", "createdAt", "minDisk", "minRam", "size", "imagePath"], + "type": "object", + "properties": { + "id": { + "title": "Id", + "description": "Identifier of the software image.", + "type": "string" + }, + "name": { + "title": "Name", + "description": "Name of the software image.", + "type": "string" + }, + "provider": { + "title": "Provider", + "description": "Provider of the software image.", + "type": "string" + }, + "version": { + "title": "Version", + "description": "Version of the software image.", + "type": "string" + }, + "checksum": { + "$ref": "#/definitions/Checksum" + }, + "containerFormat": { + "title": "Containerformat", + "description": "terminationType: Indicates whether forceful or graceful termination is requested.", + "type": "string", + "enum": ["AKI", "AMI", "ARI", "BARE", "DOCKER", "OVA", "OVF"] + }, + "diskFormat": { + "title": "Diskformat", + "description": "Disk format of a software image is the format of the underlying disk image.", + "type": "string", + "enum": ["AKI", "AMI", "ARI", "ISO", "QCOW2", "RAW", "VDI", "VHD", "VHDX", "VMDK"] + }, + "createdAt": { + "title": "Createdat", + "description": "Time when this software image was created.", + "type": "string", + "format": "date-time" + }, + "minDisk": { + "title": "Mindisk", + "description": "The minimal disk for this software image in bytes.", + "type": "integer" + }, + "minRam": { + "title": "Minram", + "description": "The minimal RAM for this software image in bytes.", + "type": "integer" + }, + "size": { + "title": "Size", + "description": "Size of this software image in bytes.", + "type": "integer" + }, + "userMetadata": { + "title": "Usermetadata", + "description": "User-defined data.", + "type": "object", + "additionalProperties": { + "description": "KeyValue Pairs", + "type": "string" + } + }, + "imagePath": { + "title": "Imagepath", + "description": "Path in the VNF package.", + "type": "string" + } + } + }, + "VnfPackageArtifactInfo": { + "description": "Information about VNF package artifacts contained in the VNF package that are not software images.", + "required": ["artifactPath", "checksum"], + "type": "object", + "properties": { + "artifactPath": { + "title": "Artifactpath", + "description": "Path in the VNF package.", + "type": "string" + }, + "checksum": { + "$ref": "#/definitions/Checksum" + }, + "metadata": { + "title": "Metadata", + "description": "The metadata of the artifact that are available in the VNF package", + "type": "object", + "additionalProperties": { + "description": "KeyValue Pairs", + "type": "string" + } + } + } + }, + "VnfPkgInfo": { + "required": ["id", "onboardingState", "operationalState", "usageState", "_links"], + "type": "object", + "properties": { + "id": { + "title": "Id", + "description": "Identifier of the on-boarded VNF package.", + "type": "string" + }, + "vnfdId": { + "title": "Vnfdid", + "description": "This identifier, which is managed by the VNF provider, identifies the VNF package and the VNFD in a globally unique way.", + "type": "string" + }, + "vnfProvider": { + "title": "Vnfprovider", + "description": "Provider of the VNF package and the VNFD.", + "type": "string" + }, + "vnfProductName": { + "title": "Vnfproductname", + "description": "Name to identify the VNF product.", + "type": "string" + }, + "vnfSoftwareVersion": { + "title": "Vnfsoftwareversion", + "description": "Software version of the VNF.", + "type": "string" + }, + "vnfdVersion": { + "title": "Vnfdversion", + "description": "The version of the VNvFD.", + "type": "string" + }, + "checksum": { + "$ref": "#/definitions/Checksum" + }, + "softwareImages": { + "title": "Softwareimages", + "description": "Information about VNF package artifacts that are software images.", + "type": "array", + "items": { + "$ref": "#/definitions/VnfPackageSoftwareImageInfo" + } + }, + "additionalArtifacts": { + "title": "Additionalartifacts", + "description": "Information about VNF package artifacts contained in the VNF package that are not software images.", + "type": "array", + "items": { + "$ref": "#/definitions/VnfPackageArtifactInfo" + } + }, + "onboardingState": { + "title": "Onboardingstate", + "description": "On-boarding state of the VNF package.", + "type": "string", + "enum": ["CREATED", "UPLOADING", "PROCESSING", "ONBOARDED"] + }, + "operationalState": { + "title": "Operationalstate", + "description": "Operational state of the VNF package.", + "type": "string", + "enum": ["ENABLED", "DISABLED"] + }, + "usageState": { + "title": "Usagestate", + "description": "Usage state of the VNF package.", + "type": "string", + "enum": ["IN_USE", "NOT_IN_USE"] + }, + "userDefinedData": { + "title": "Userdefineddata", + "description": "User defined data for the VNF package.", + "type": "object", + "additionalProperties": { + "description": "KeyValue Pairs", + "type": "string" + } + }, + "_links": { + "$ref": "#/definitions/_Link" + } + } + }, + "CreateVnfPkgInfoRequest": { + "type": "object", + "properties": { + "userDefinedData": { + "title": "Userdefineddata", + "description": "User defined data for the VNF package.", + "type": "object", + "additionalProperties": { + "description": "KeyValue Pairs", + "type": "string" + } + } + } + }, + "UploadVnfPackageFromUriRequest": { + "required": ["addressInformation"], + "type": "object", + "properties": { + "addressInformation": { + "title": "Addressinformation", + "description": "Address information of the VNF package content.", + "type": "string" + }, + "userName": { + "title": "Username", + "description": "User name to be used for authentication.", + "type": "string" + }, + "password": { + "title": "Password", + "description": "Password to be used for authentication.", + "type": "string" + } + } + } + }, + "securityDefinitions": { + "basic": { + "type": "basic" + } + } +}
\ No newline at end of file diff --git a/docs/platform/APIs/CATALOG_API/index.rst b/docs/platform/APIs/CATALOG_API/index.rst new file mode 100644 index 00000000..2932389d --- /dev/null +++ b/docs/platform/APIs/CATALOG_API/index.rst @@ -0,0 +1,6 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 +.. International License. http://creativecommons.org/licenses/by/4.0 + +CATALOG API +------------ +.. swaggerv2doc:: CATALOG_API_Specification_v0.1.json
\ No newline at end of file diff --git a/docs/platform/APIs/index.rst b/docs/platform/APIs/index.rst index 816bad25..f0a88a4a 100644 --- a/docs/platform/APIs/index.rst +++ b/docs/platform/APIs/index.rst @@ -41,3 +41,14 @@ GVNFM Northbound & Southbound APIs for VNF Integration VNFLCM_API/index + +CATALOG APIs +------------- + +CATALOG APIs for VNF Integration + +.. toctree:: + :maxdepth: 1 + + CATALOG_API/index + diff --git a/lcm/ns/biz/scaleaspect.py b/lcm/ns/biz/scaleaspect.py index 0d6a0338..9c941817 100644 --- a/lcm/ns/biz/scaleaspect.py +++ b/lcm/ns/biz/scaleaspect.py @@ -124,7 +124,7 @@ def check_and_set_params(scaleNsData, ns_InstanceId): if scaleNsData is None: raise Exception("Error! scaleNsData in the request is Empty!") - scaleNsByStepsData = scaleNsData[0]["scaleNsByStepsData"][0] + scaleNsByStepsData = scaleNsData["scaleNsByStepsData"] # scaleNsData[0]["scaleNsByStepsData"][0] if scaleNsByStepsData is None: raise Exception("Error! scaleNsByStepsData in the request is Empty!") diff --git a/lcm/ns/const.py b/lcm/ns/const.py index c0293598..4eaf8109 100644 --- a/lcm/ns/const.py +++ b/lcm/ns/const.py @@ -101,11 +101,16 @@ CHANGE_RESULTS = enum( PARTIALLY_COMPLETED='PARTIALLY_COMPLETED' ) -IPADDRESSES_TYPES = enum( +IPADDRESSES_TYPE_ENUM = enum( IPV4='IPV4', IPV6='IPV6' ) +IPADDRESSES_TYPE_LIST = [ + IPADDRESSES_TYPE_ENUM.IPV4, + IPADDRESSES_TYPE_ENUM.IPV6 +] + LCCNNOTIFICATION = "NsLcmOperationOccurrenceNotification" NOTIFICATION_TYPES = [ diff --git a/lcm/ns/serializers/sol/cp_serializers.py b/lcm/ns/serializers/sol/cp_serializers.py index c15166d4..bf93d9d9 100644 --- a/lcm/ns/serializers/sol/cp_serializers.py +++ b/lcm/ns/serializers/sol/cp_serializers.py @@ -13,12 +13,9 @@ # limitations under the License. from rest_framework import serializers -from lcm.ns.const import IPADDRESSES_TYPES +from lcm.ns.const import IPADDRESSES_TYPE_LIST + -IPADDRESSES_TYPE = [ - IPADDRESSES_TYPES.IPV4, - IPADDRESSES_TYPES.IPV6 -] LAYER_PROTOCOL = [ "IP_OVER_ETHERNET" ] @@ -37,7 +34,7 @@ class IpAddressesDataSerialzier(serializers.Serializer): type = serializers.ChoiceField( help_text="The type of the IP addresses.", required=True, - choices=IPADDRESSES_TYPE) + choices=IPADDRESSES_TYPE_LIST) fixedAddresses = serializers.ListField( child=serializers.CharField( help_text="Fixed addresses to assign.", @@ -60,7 +57,7 @@ class IpAddressesInfoSerialzier(serializers.Serializer): type = serializers.ChoiceField( help_text="The type of the IP addresses.", required=True, - choices=IPADDRESSES_TYPE) + choices=IPADDRESSES_TYPE_LIST) addresses = serializers.ListField( help_text="An IPV4 or IPV6 address", required=False, diff --git a/lcm/ns/serializers/sol/create_ns_serializers.py b/lcm/ns/serializers/sol/create_ns_serializers.py index d3f7832d..a6b87e2b 100644 --- a/lcm/ns/serializers/sol/create_ns_serializers.py +++ b/lcm/ns/serializers/sol/create_ns_serializers.py @@ -1,4 +1,5 @@ # Copyright (c) 2018, CMCC Technologies Co., Ltd. +# Copyright 2019 ZTE Corporation. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +17,15 @@ from rest_framework import serializers class CreateNsRequestSerializer(serializers.Serializer): - nsdId = serializers.CharField(help_text="Identifier of the NSD that defines the NS instance to be created.", required=True, allow_null=False) - nsName = serializers.CharField(help_text="Name of NS", required=True, allow_null=True) - nsDescription = serializers.CharField(help_text="Description of NS", required=True, allow_null=True) + nsdId = serializers.CharField( + help_text="Identifier of the NSD that defines the NS instance to be created.", + required=True, + allow_null=False) + nsName = serializers.CharField( + help_text="Name of NS", + required=True, + allow_null=True) + nsDescription = serializers.CharField( + help_text="Description of NS", + required=True, + allow_null=True) diff --git a/lcm/ns/serializers/sol/ns_instance.py b/lcm/ns/serializers/sol/ns_instance.py index f8e3d824..059ddafe 100644 --- a/lcm/ns/serializers/sol/ns_instance.py +++ b/lcm/ns/serializers/sol/ns_instance.py @@ -21,6 +21,7 @@ from lcm.ns.serializers.sol.resource_handle import ResourceHandleSerializer from lcm.ns.serializers.sol.ext_virtual_link_info import ExtVirtualLinkInfoSerializer from lcm.ns.serializers.sol.ext_managed_virtual_link_info import ExtManagedVirtualLinkInfo, VnfLinkPortInfo from lcm.ns.serializers.sol.pub_serializers import AffinityOrAntiAffinityRuleSerializer +from lcm.ns.const import IPADDRESSES_TYPE_LIST INSTANTIATION_STATE = [ @@ -30,45 +31,40 @@ INSTANTIATION_STATE = [ class VnfScaleInfoSerializer(serializers.Serializer): - aspectlId = serializers.Serializer(help_text="The scaling aspect", required=True) - scaleLevel = serializers.Serializer(help_text="The scale level for that aspect", required=True) + aspectlId = serializers.Serializer( + help_text="Identifier of the scaling aspect", + required=True) + scaleLevel = serializers.Serializer( + help_text="The scale level for that aspect.", + required=True) class NsScaleInfoSerializer(serializers.Serializer): - nsScalingAspectId = serializers.CharField(help_text="Identifier of the NS scaling aspect.", required=True) - nsScaleLevelId = serializers.CharField(help_text="Identifier of the NS scale level.", required=True) + nsScalingAspectId = serializers.CharField( + help_text="Identifier of the NS scaling aspect.", + required=True) + nsScaleLevelId = serializers.CharField( + help_text="Identifier of the NS scale level.", + required=True) class VnfcCpInfo(serializers.Serializer): id = serializers.CharField( help_text="Identifier of the external CP instance and the related information instance.", - max_length=255, - required=True, - allow_null=False, - allow_blank=False) + required=True) cpdId = serializers.CharField( help_text="Identifier of the external CPD, VnfExtCpd, in the VNFD.", - max_length=255, - required=True, - allow_null=False, - allow_blank=False) + required=True) vnfExtCpId = serializers.CharField( help_text="When the VNFC CP is exposed as external CP of the VNF, the identifier of this external VNF CP.", - required=False, - max_length=255, - allow_null=True, - allow_blank=True) + required=False) cpProtocolInfo = CpProtocolInfoSerializer( help_text="Network protocol information for this CP.", many=True, - required=False, - allow_null=True) + required=False) vnfLinkPortId = serializers.CharField( help_text="Identifier of the vnfLinkPorts structure in the vnfVirtualLinkResourceInfo structure.", - max_length=255, - required=True, - allow_null=False, - allow_blank=False) + required=True) class VnfcResourceInfoSerializer(serializers.Serializer): @@ -87,8 +83,7 @@ class VnfcResourceInfoSerializer(serializers.Serializer): required=True, allow_null=False) storageResourceIds = serializers.ListSerializer( - help_text="References to the VirtualStorage resources. \ - The value refers to a VirtualStorageResourceInfo item in the VnfInstance.", + help_text="References to the VirtualStorage resources. The value refers to a VirtualStorageResourceInfo item in the VnfInstance.", child=serializers.CharField(help_text="Identifier In Vnf", allow_blank=True), required=False, allow_null=True) @@ -99,16 +94,13 @@ class VnfcResourceInfoSerializer(serializers.Serializer): allow_null=True, allow_blank=True) vnfcCpInfo = VnfcCpInfo( - help_text="CPs of the VNFC instance. \ - Shall be present when that particular CP of the VNFC instance is associated to an external CP of the VNF instance.", + help_text="CPs of the VNFC instance. Shall be present when that particular CP of the VNFC instance is associated to an external CP of the VNF instance.", many=True, required=False, allow_null=True) metadata = serializers.DictField( help_text="Metadata about this resource.", - child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True), - required=False, - allow_null=True) + required=False) # class VnfLinkPortInfo(serializers.Serializer): @@ -397,23 +389,40 @@ class VnfInstanceSerializer(serializers.Serializer): class PnfExtCpInfoSerializer(serializers.Serializer): - cpInstanceId = serializers.CharField(help_text="Identifier of the CP in the scope of the PNF.", - required=True) + cpInstanceId = serializers.CharField( + help_text="Identifier of the CP in the scope of the PNF.", + required=True) - cpdId = serializers.CharField(help_text="Identifier of (reference to) the Connection Point Descriptor" - "(CPD) for this CP.", required=True) + cpdId = serializers.CharField( + help_text="Identifier of (reference to) the Connection Point Descriptor (CPD) for this CP.", + required=True) - cpProtocolData = CpProtocolDataSerializer(help_text="Parameters for configuring the network protocols on" - "the CP.", required=True, many=True) + cpProtocolData = CpProtocolDataSerializer( + help_text="Parameters for configuring the network protocols on the CP.", + required=True, + many=True) class PnfInfoSerializer(serializers.Serializer): - pnfId = serializers.CharField(help_text="Identifier of the PNF.", required=True) - pnfName = serializers.CharField(help_text="Name of the PNF.", required=True) - pnfdId = serializers.CharField(help_text="Identifier of the PNFD on which the PNF is based.", required=True) - pnfdInfoId = serializers.CharField(help_text="Identifier of the PNFD information onject related to this PNF.", required=True) - pnfProfileId = serializers.CharField(help_text="Identifier of the related PnfProfile in the NSD on which the PNF is based.", required=True) - cpInfo = PnfExtCpInfoSerializer(help_text="Information on the external CP of the PNF", required=True, many=True) + pnfId = serializers.CharField( + help_text="Identifier of the PNF.", + required=True) + pnfName = serializers.CharField( + help_text="Name of the PNF.", + required=True) + pnfdId = serializers.CharField( + help_text="Identifier of the PNFD on which the PNF is based.", + required=True) + pnfdInfoId = serializers.CharField( + help_text="Identifier of the PNFD information onject related to this PNF.", + required=True) + pnfProfileId = serializers.CharField( + help_text="Identifier of the related PnfProfile in the NSD on which the PNF is based.", + required=True) + cpInfo = PnfExtCpInfoSerializer( + help_text="Information on the external CP of the PNF", + required=True, + many=True) class NsLinkPortInfo(serializers.Serializer): @@ -437,106 +446,181 @@ class NsLinkPortInfo(serializers.Serializer): class NsVirtualLinkInfoSerializer(serializers.Serializer): - id = serializers.CharField(help_text="Identifier of the VL instance.", required=True) - nsVirtualLinkDescId = serializers.CharField(help_text="Identifier of the VLD in the NSD.", required=True) - nsVirtualLinkProfileId = serializers.CharField(help_text="Identifier of the VL profile in the NSD.", required=True) - resourceHandle = ResourceHandleSerializer(help_text="Identifier(s) of the virtualised network resource(s) realizing the VL instance", required=True, many=True) - linkPort = NsLinkPortInfo(help_text="Link ports of this VL.", many=True, required=False, allow_null=True) + id = serializers.CharField( + help_text="Identifier of the VL instance.", + required=True) + nsVirtualLinkDescId = serializers.CharField( + help_text="Identifier of the VLD in the NSD.", + required=True) + nsVirtualLinkProfileId = serializers.CharField( + help_text="Identifier of the VL profile in the NSD.", + required=True) + resourceHandle = ResourceHandleSerializer( + help_text="Identifier(s) of the virtualised network resource(s) realizing the VL instance", + required=True, + many=True) + linkPort = NsLinkPortInfo( + help_text="Link ports of this VL.", + many=True, + required=False, + allow_null=True) class NsCpHandleSerializer(serializers.Serializer): - vnfInstanceId = serializers.CharField(help_text="Identifier of the VNF instance associated to the CP" - "instance.", required=False, allow_null=True) - vnfExtCpInstanceId = serializers.CharField(help_text="Identifier of the VNF external CP instance in the" - "scope of the VNF instance.", - required=False, allow_null=True) - pnfInfoId = serializers.CharField(help_text="Identifier of the PNF instance associated to the CP" - "instance.", required=False, allow_null=True) - pnfExtCpInstanceId = serializers.CharField(help_text="Identifier of the PNF external CP instance in the" - "scope of the PNF.", required=False, allow_null=True) - nsInstanceId = serializers.CharField(help_text="Identifier of the NS instance associated to the SAP" - "instance", required=False, allow_null=True) - nsSapInstanceId = serializers.CharField(help_text="Identifier of the SAP instance in the scope of the NS" - "instance.", required=False, allow_null=True) + vnfInstanceId = serializers.CharField( + help_text="Identifier of the VNF instance associated to the CP instance.", + required=False, + allow_null=True) + vnfExtCpInstanceId = serializers.CharField( + help_text="Identifier of the VNF external CP instance in the scope of the VNF instance.", + required=False, + allow_null=True) + pnfInfoId = serializers.CharField( + help_text="Identifier of the PNF instance associated to the CP instance.", + required=False, + allow_null=True) + pnfExtCpInstanceId = serializers.CharField( + help_text="Identifier of the PNF external CP instance in the scope of the PNF.", + required=False, + allow_null=True) + nsInstanceId = serializers.CharField( + help_text="Identifier of the NS instance associated to the SAP instance", + required=False, + allow_null=True) + nsSapInstanceId = serializers.CharField( + help_text="Identifier of the SAP instance in the scope of the NS instance.", + required=False, + allow_null=True) class MaskSerializer(serializers.Serializer): - startingPoint = serializers.CharField(help_text="Indicates the offset between the last bit of the source" - "mac address and the first bit of the sequence of bits" - "to be matched.", required=True) - length = serializers.CharField(help_text="Indicates the number of bits to be matched", required=True) - value = serializers.CharField(help_text="Provide the sequence of bit values to be matched.", - required=True) + startingPoint = serializers.CharField( + help_text="Indicates the offset between the last bit of the source mac address and the first bit of the sequence of bits to be matched.", + required=True) + length = serializers.CharField( + help_text="Indicates the number of bits to be matched.", + required=True) + value = serializers.CharField( + help_text="Provide the sequence of bit values to be matched.", + required=True) class NfpRuleSerializer(serializers.Serializer): - etherDestinationAddress = serializers.CharField(help_text="Indicates a destination Mac address", - required=False, allow_null=True) - etherSourceAddress = serializers.CharField(help_text="Indicates a source Mac address", - required=False, allow_null=True) - etherType = serializers.ChoiceField(help_text="Indicates the protocol carried over the Ethernet layer", - choices=["IPV4", "IPV6"], required=False, allow_null=True) - vlanTag = serializers.ListField(help_text="ndicates a VLAN identifier in an IEEE 802.1Q-2014 tag", - required=False, allow_null=True) - protocol = serializers.ChoiceField(help_text="Indicates the L4 protocol, For IPv4 [7] this corresponds to" - "the field called Protocol to identifythe next level " - "protocol", choices=["TCP", "UDP", "ICMP"], - required=False, allow_null=True) - dscp = serializers.CharField(help_text="For IPv4 [7] a string of 0 and 1 digits that corresponds to the" - "6-bit Differentiated Services Code Point (DSCP) field of the" - "IP header.", required=False, allow_null=True) - sourcePortRange = serializers.CharField(help_text="Indicates a range of source ports", - required=False, allow_null=True) - destinationPortRange = serializers.CharField(help_text="Indicates a range of destination ports", - required=False, allow_null=True) - sourceIpAddressPrefix = serializers.CharField(help_text="Indicates the source IP address range in CIDR" - "format.", required=False, allow_null=True) - destinationIpAddressPrefix = serializers.CharField(help_text="Indicates the destination IP address range" - "in CIDRformat.", - required=False, allow_null=True) - extendedCriteria = MaskSerializer(help_text="Indicates values of specific bits in a frame", - required=False, allow_null=True, many=True) + etherDestinationAddress = serializers.CharField( + help_text="Indicates a destination Mac address", + required=False, + allow_null=True) + etherSourceAddress = serializers.CharField( + help_text="Indicates a source Mac address", + required=False, + allow_null=True) + etherType = serializers.ChoiceField( + help_text="Indicates the protocol carried over the Ethernet layer", + choices=IPADDRESSES_TYPE_LIST, + required=False, + allow_null=True) + vlanTag = serializers.ListField( + help_text="ndicates a VLAN identifier in an IEEE 802.1Q-2014 tag", + required=False, + allow_null=True) + protocol = serializers.ChoiceField( + help_text="Indicates the L4 protocol, For IPv4 [7] this corresponds to" + "the field called Protocol to identifythe next level protocol", + choices=["TCP", "UDP", "ICMP"], + required=False, + allow_null=True) + dscp = serializers.CharField( + help_text="For IPv4 [7] a string of 0 and 1 digits that corresponds to the" + "6-bit Differentiated Services Code Point (DSCP) field of the IP header.", + required=False, + allow_null=True) + sourcePortRange = serializers.CharField( + help_text="Indicates a range of source ports", + required=False, + allow_null=True) + destinationPortRange = serializers.CharField( + help_text="Indicates a range of destination ports", + required=False, + allow_null=True) + sourceIpAddressPrefix = serializers.CharField( + help_text="Indicates the source IP address range in CIDR format.", + required=False, + allow_null=True) + destinationIpAddressPrefix = serializers.CharField( + help_text="Indicates the destination IP address range in CIDR format.", + required=False, + allow_null=True) + extendedCriteria = MaskSerializer( + help_text="Indicates values of specific bits in a frame", + required=False, + allow_null=True, + many=True) class NfpInfoSerializer(serializers.Serializer): - id = serializers.CharField(help_text="Identifier of this NFP instance.", required=True) - nfpdId = serializers.CharField(help_text="Identifier of the NFPD used to instantiate this NFP" - "instance.", required=False, allow_null=True) - nfpName = serializers.CharField(help_text="Human readable name for the NFP instance.", - required=False, allow_null=True) - description = serializers.CharField(help_text="Human readable description for the NFP instance.", - required=True) - nscpHandle = NsCpHandleSerializer(help_text="Identifier(s) of the CPs and/or SAPs which the NFP " - "passes by", required=True, many=True) - totalCp = serializers.CharField(help_text="Total number of CP and SAP instances in this NFP" - "instance.", required=False, allow_null=True) - nfpRule = NfpRuleSerializer(help_text="The NfpRule data type is an expression of the conditions that " - "shall be met in order for the NFP to be applicable to the packet", - required=True) - nfpState = serializers.ChoiceField(help_text="The state of the NFP instance.", - choices=["ENABLED", "DISABLED"], required=True) + id = serializers.CharField( + help_text="Identifier of this NFP instance.", + required=True) + nfpdId = serializers.CharField( + help_text="Identifier of the NFPD used to instantiate this NFP instance.", + required=False, + allow_null=True) + nfpName = serializers.CharField( + help_text="Human readable name for the NFP instance.", + required=False, + allow_null=True) + description = serializers.CharField( + help_text="Human readable description for the NFP instance.", + required=True) + nscpHandle = NsCpHandleSerializer( + help_text="Identifier(s) of the CPs and/or SAPs which the NFP passes by", + required=True, + many=True) + totalCp = serializers.CharField( + help_text="Total number of CP and SAP instances in this NFP instance.", + required=False, + allow_null=True) + nfpRule = NfpRuleSerializer( + help_text="The NfpRule data type is an expression of the conditions that shall be met in order for the NFP to be applicable to the packet", + required=True) + nfpState = serializers.ChoiceField( + help_text="The state of the NFP instance.", + choices=["ENABLED", "DISABLED"], + required=True) class VnffgInfoSerializer(serializers.Serializer): - id = serializers.CharField(help_text="Identifier of this VNFFG instance.", required=True) - vnffgdId = serializers.CharField(help_text="Identifier of the VNFFGD in the NSD.", required=True) - vnfInstanceId = serializers.ListField(help_text="Identifier(s) of the constituent VNF instance(s) of this" - "VNFFG instance.", - child=serializers.CharField(help_text="ID of vnf instance"), - required=True) - pnfInfoId = serializers.ListField(help_text="Identifier(s) of the constituent PNF instance(s) of this" - "VNFFG instance", - child=serializers.CharField(help_text="ID of pnf info"), - required=False, allow_null=True) - nsVirtualLinkInfoId = serializers.ListField(help_text="Identifier(s) of the constituent VL instance(s) of" - "thisVNFFG instance.", - child=serializers.CharField( - help_text="ID of ns virtual link info"), required=True) - nsCpHandle = NsCpHandleSerializer(help_text="Identifiers of the CP instances attached to the " - "constituent VNFs and PNFs or the SAP instances of " - "the VNFFG.", required=True, allow_null=False, many=True) - nfpInfo = NfpInfoSerializer(help_text="Information on the NFP instances.", - required=True, allow_null=False, many=True) + id = serializers.CharField( + help_text="Identifier of this VNFFG instance.", + required=True) + vnffgdId = serializers.CharField( + help_text="Identifier of the VNFFGD in the NSD.", + required=True) + vnfInstanceId = serializers.ListField( + help_text="Identifier(s) of the constituent VNF instance(s) of this VNFFG instance.", + child=serializers.CharField( + help_text="ID of vnf instance"), + required=True) + pnfInfoId = serializers.ListField( + help_text="Identifier(s) of the constituent PNF instance(s) of this VNFFG instance", + child=serializers.CharField(help_text="ID of pnf info"), + required=False, + allow_null=True) + nsVirtualLinkInfoId = serializers.ListField( + help_text="Identifier(s) of the constituent VL instance(s) of thisVNFFG instance.", + child=serializers.CharField(help_text="ID of ns virtual link info"), + required=True) + nsCpHandle = NsCpHandleSerializer( + help_text="Identifiers of the CP instances attached to the " + "constituent VNFs and PNFs or the SAP instances of the VNFFG.", + required=True, + allow_null=False, + many=True) + nfpInfo = NfpInfoSerializer( + help_text="Information on the NFP instances.", + required=True, + allow_null=False, + many=True) class SapInfo(serializers.Serializer): @@ -645,8 +729,10 @@ class NsInstanceSerializer(serializers.Serializer): allow_null=True, many=True) additionalAffinityOrAntiAffinityRule = AffinityOrAntiAffinityRuleSerializer( + help_text="Specifies additional affinity or anti-affinity constraint for the VNF instances to be instantiated as part of the NS instantiation.", many=True, required=False, - allow_null=True, - help_text="Specifies additional affinity or anti-affinity constraint for the VNF instances to be instantiated as part of the NS instantiation.") - _links = NsLinkSerializer(help_text="The links of the NS instance.", required=True) + allow_null=True) + _links = NsLinkSerializer( + help_text="The links of the NS instance.", + required=True) diff --git a/lcm/ns/serializers/sol/pub_serializers.py b/lcm/ns/serializers/sol/pub_serializers.py index 4825f63c..fab3c656 100644 --- a/lcm/ns/serializers/sol/pub_serializers.py +++ b/lcm/ns/serializers/sol/pub_serializers.py @@ -51,7 +51,10 @@ class ProblemDetailsSerializer(serializers.Serializer): class LinkSerializer(serializers.Serializer): href = serializers.CharField( - help_text="URI of the referenced resource.", required=True, allow_null=False, allow_blank=False) + help_text="URI of the referenced resource.", + required=True, + allow_null=False, + allow_blank=False) class AffinityOrAntiAffinityRuleSerializer(serializers.Serializer): diff --git a/lcm/ns/serializers/sol/scale_ns_serializers.py b/lcm/ns/serializers/sol/scale_ns_serializers.py index a15d1a59..b993ed2d 100644 --- a/lcm/ns/serializers/sol/scale_ns_serializers.py +++ b/lcm/ns/serializers/sol/scale_ns_serializers.py @@ -28,25 +28,33 @@ from lcm.ns.serializers.sol.ns_instance import NsScaleInfoSerializer, VnfScaleIn class ScaleNsByStepsDataSerializer(serializers.Serializer): - scalingDirection = serializers.ChoiceField(help_text="The scaling direction", - choices=["SCALE_IN", "SCALE_OUT"], required=True) - aspectId = serializers.CharField(help_text="The aspect of the NS that is requested to be scaled, as " - "declared in the NSD. ", required=True) - numberOfSteps = serializers.CharField(help_text="The number of scaling steps to be performed. Defaults " - "to 1. ", required=False, allow_null=True) + scalingDirection = serializers.ChoiceField( + help_text="The scaling direction", + choices=["SCALE_IN", "SCALE_OUT"], + required=True) + aspectId = serializers.CharField( + help_text="The aspect of the NS that is requested to be scaled, as declared in the NSD. ", + required=True) + numberOfSteps = serializers.CharField( + help_text="The number of scaling steps to be performed. Defaults to 1. ", + required=False, + allow_null=True) class ScaleNsToLevelDataSerializer(serializers.Serializer): - nsInstantiationLevel = serializers.CharField(help_text="Identifier of the target NS instantiation level " - "of the current DF to which the NS instance is " - "requested to be scaled.", - required=False, allow_null=True) - nsScaleInfo = serializers.ListField(help_text="For each NS scaling aspect of the current DF", - child=NsScaleInfoSerializer( - help_text="This type represents the target NS Scale level for " - "each NS scaling aspect of the current deployment " - "flavour.", required=True), - required=False, allow_null=True) + nsInstantiationLevel = serializers.CharField( + help_text="Identifier of the target NS instantiation level " + "of the current DF to which the NS instance is requested to be scaled.", + required=False, + allow_null=True) + nsScaleInfo = serializers.ListField( + help_text="For each NS scaling aspect of the current DF", + child=NsScaleInfoSerializer( + help_text="This type represents the target NS Scale level for " + "each NS scaling aspect of the current deployment flavour.", + required=True), + required=False, + allow_null=True) # class ParamsForVnfSerializer(serializers.Serializer): @@ -78,102 +86,125 @@ class ScaleNsToLevelDataSerializer(serializers.Serializer): class ScaleNsDataSerializer(serializers.Serializer): - vnfInstanceToBeAdded = serializers.ListField(help_text="An existing VNF instance to be added to the NS " - "instance as part of the scaling operation. ", - child=VnfInstanceDataSerializer( - help_text="This type specifies an existing VNF instance " - "to be used in the NS instance and if needed", - required=True), required=False, allow_null=True) - vnfInstanceToBeRemoved = serializers.ListField(help_text="The VNF instance to be removed from the NS " - "instance as part of the scaling operation", - required=False, allow_null=True) - scaleNsByStepsData = ScaleNsByStepsDataSerializer(help_text="The information used to scale an NS " - "instance by one or more scaling steps", - required=False, allow_null=True) - scaleNsToLevelData = ScaleNsToLevelDataSerializer(help_text="The information used to scale an NS instance" - " to a target size. ", - required=False, allow_null=True) - additionalParamsForNs = serializers.DictField(help_text="Allows the OSS/BSS to provide additional " - "parameter(s) at the NS level necessary for the " - "NS scaling ", - child=serializers.CharField(help_text="KeyValue Pairs", - allow_blank=True), - required=False, allow_null=True) - additionalParamsForVnf = serializers.ListField(help_text="Allows the OSS/BSS to provide additional " - "parameter(s) per VNF instance", - child=ParamsForVnfSerializer( - help_text="This type defines the additional parameters" - " for the VNF instance to be created " - "associated with an NS instance.", - required=True), required=False, allow_null=True) - locationConstraints = serializers.ListField(help_text="The location constraints for the VNF to be " - "instantiated as part of the NS scaling.", - child=VnfLocationConstraintSerializer( - help_text="This type represents the association of " - "location constraints to a VNF instance to" - "be created according to a specific VNF " - "profile", required=True), - required=False, allow_null=True) + vnfInstanceToBeAdded = serializers.ListField( + help_text="An existing VNF instance to be added to the NS instance as part of the scaling operation.", + child=VnfInstanceDataSerializer( + help_text="This type specifies an existing VNF instance to be used in the NS instance and if needed", + required=True), + required=False, + allow_null=True) + vnfInstanceToBeRemoved = serializers.ListField( + help_text="The VNF instance to be removed from the NS instance as part of the scaling operation", + required=False, + allow_null=True) + scaleNsByStepsData = ScaleNsByStepsDataSerializer( + help_text="The information used to scale an NS instance by one or more scaling steps", + required=False, + allow_null=True) + scaleNsToLevelData = ScaleNsToLevelDataSerializer( + help_text="The information used to scale an NS instance to a target size. ", + required=False, + allow_null=True) + additionalParamsForNs = serializers.DictField( + help_text="Allows the OSS/BSS to provide additional parameter(s) at the NS level necessary for the NS scaling ", + child=serializers.CharField(help_text="KeyValue Pairs", + allow_blank=True), + required=False, + allow_null=True) + additionalParamsForVnf = serializers.ListField( + help_text="Allows the OSS/BSS to provide additional parameter(s) per VNF instance", + child=ParamsForVnfSerializer( + help_text="This type defines the additional parameters for the VNF instance to be created associated with an NS instance.", + required=True), + required=False, + allow_null=True) + locationConstraints = serializers.ListField( + help_text="The location constraints for the VNF to be instantiated as part of the NS scaling.", + child=VnfLocationConstraintSerializer( + help_text="This type represents the association of location constraints to a VNF instance to" + "be created according to a specific VNF profile", + required=True), + required=False, + allow_null=True) class ScaleToLevelDataSerializer(serializers.Serializer): - vnfInstantiationLevelId = serializers.CharField(help_text="Identifier of the target instantiation level " - "of the current deployment flavour to which " - "the VNF is requested to be scaled.", - required=False, allow_null=True) - vnfScaleInfo = serializers.ListField(help_text="For each scaling aspect of the current deployment " - "flavour", - child=VnfScaleInfoSerializer(help_text="This type describes the " - "provides information about" - " the scale level of a VNF" - " instance with respect to " - "one scaling aspect", - required=True), - required=False, allow_null=True) - - additionalParams = serializers.DictField(help_text="Additional parameters passed by the NFVO as input to " - "the scaling process", required=False, allow_null=True) + vnfInstantiationLevelId = serializers.CharField( + help_text="Identifier of the target instantiation level of the current deployment flavour to which the VNF is requested to be scaled.", + required=False, + allow_null=True) + vnfScaleInfo = serializers.ListField( + help_text="For each scaling aspect of the current deployment flavour", + child=VnfScaleInfoSerializer( + help_text="This type describes the provides information about the scale level of a VNF instance with respect to one scaling aspect", + required=True), + required=False, + allow_null=True) + additionalParams = serializers.DictField( + help_text="Additional parameters passed by the NFVO as input to the scaling process", + required=False, + allow_null=True) class ScaleByStepDataSerializer(serializers.Serializer): - aspectId = serializers.CharField(help_text="Identifier of (reference to) the aspect of the VNF that is " - "requested to be scaled", required=True) - numberOfSteps = serializers.CharField(help_text="Number of scaling steps.", - required=False, allow_null=True) - additionalParams = serializers.DictField(help_text="Additional parameters passed by the NFVO as input to" - "he scaling process", required=False, allow_null=True) + aspectId = serializers.CharField( + help_text="Identifier of (reference to) the aspect of the VNF that is requested to be scaled.", + required=True) + numberOfSteps = serializers.CharField( + help_text="Number of scaling steps.", + required=False, + allow_null=True) + additionalParams = serializers.DictField( + help_text="Additional parameters passed by the NFVO as input to the scaling process.", + required=False, + allow_null=True) class ScaleVnfDataSerializer(serializers.Serializer): - vnfInstanceid = serializers.CharField(help_text="Identifier of the VNF instance being scaled.", - required=True) + vnfInstanceid = serializers.CharField( + help_text="Identifier of the VNF instance being scaled.", + required=True) - scaleVnfType = serializers.ChoiceField(help_text="Type of the scale VNF operation requested.", - choices=["SCALE_OUT", "SCALE_IN", "SCALE_TO_INSTANTIATION_LEVEL", - "SCALE_TO_SCALE_LEVEL(S)"], required=True) + scaleVnfType = serializers.ChoiceField( + help_text="Type of the scale VNF operation requested.", + choices=["SCALE_OUT", "SCALE_IN", "SCALE_TO_INSTANTIATION_LEVEL", "SCALE_TO_SCALE_LEVEL(S)"], + required=True) - scaleToLevelData = ScaleToLevelDataSerializer(help_text="The information used for scaling to a " - "given level.", required=False) + scaleToLevelData = ScaleToLevelDataSerializer( + help_text="The information used for scaling to a given level.", + required=False) - scaleByStepData = ScaleByStepDataSerializer(help_text="The information used for scaling by steps", - required=False) + scaleByStepData = ScaleByStepDataSerializer( + help_text="The information used for scaling by steps.", + required=False) class ScaleNsRequestSerializer(serializers.Serializer): - scaleType = serializers.ChoiceField(help_text="Indicates the type of scaling to be performed", - choices=["SCALE_NS ", "SCALE_VNF"], required=True) - scaleNsData = ScaleNsDataSerializer(help_text="The necessary information to scale the referenced NS " - "instance. ", required=False, allow_null=True) - scaleVnfData = serializers.ListField(help_text="Timestamp indicating the scale time of the NS", - child=ScaleVnfDataSerializer(help_text="This type represents defines" - "the information to scale a " - "VNF instance to a given " - "level", required=True), - required=False, allow_null=True) - scaleTime = serializers.CharField(help_text="Timestamp indicating the scale time of the NS", - required=False, allow_null=True) - - -class ManualScaleNsReqSerializer(serializers.Serializer): - scaleType = serializers.CharField(help_text="Type of NS Scale", required=True) - scaleNsData = ScaleNsDataSerializer(help_text="Scale NS data", many=True) + scaleType = serializers.ChoiceField( + help_text="Indicates the type of scaling to be performed", + choices=["SCALE_NS", "SCALE_VNF"], + required=True) + scaleNsData = ScaleNsDataSerializer( + help_text="The necessary information to scale the referenced NS instance.", + required=False, + allow_null=True) + scaleVnfData = serializers.ListField( + help_text="Timestamp indicating the scale time of the NS", + child=ScaleVnfDataSerializer( + help_text="This type represents defines the information to scale a VNF instance to a given level", + required=True), + required=False, + allow_null=True) + scaleTime = serializers.CharField( + help_text="Timestamp indicating the scale time of the NS", + required=False, + allow_null=True) + + +# class ManualScaleNsReqSerializer(serializers.Serializer): +# scaleType = serializers.CharField( +# help_text="Type of NS Scale", +# required=True) +# scaleNsData = ScaleNsDataSerializer( +# help_text="Scale NS data", +# many=True) diff --git a/lcm/ns/tests/test_ns_manual_scale.py b/lcm/ns/tests/test_ns_manual_scale.py index 4d32d98e..6ebd5bb0 100644 --- a/lcm/ns/tests/test_ns_manual_scale.py +++ b/lcm/ns/tests/test_ns_manual_scale.py @@ -17,6 +17,7 @@ import uuid import mock from django.test import Client +from rest_framework.test import APIClient from django.test import TestCase from lcm.ns.biz.scaleaspect import get_json_data from rest_framework import status @@ -114,6 +115,7 @@ class TestNsManualScale(TestCase): "NS", JOB_TYPE.MANUAL_SCALE_VNF, self.ns_inst_id) self.package_id = "7" self.client = Client() + self.apiClient = APIClient() NSInstModel( id=self.ns_inst_id, name="abc", @@ -179,17 +181,19 @@ class TestNsManualScale(TestCase): def test_ns_manual_scale(self, mock_run): data = { "scaleType": "SCALE_NS", - "scaleNsData": [{ - "scaleNsByStepsData": [{ - "aspectId": "1", - "numberOfSteps": 1, - "scalingDirection": "0" - }] - }] + "scaleNsData": [ + { + "scaleNsByStepsData": [{ + "aspectId": "1", + "numberOfSteps": 1, + "scalingDirection": "0" + }] + } + ] } - response = self.client.post( + response = self.apiClient.post( "/api/nslcm/v1/ns/%s/scale" % - self.ns_inst_id, data=data) + self.ns_inst_id, data=data, format='json') self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code) def test_ns_manual_scale_error_scaletype(self): diff --git a/lcm/ns/tests/test_sol_ns_scale_api.py b/lcm/ns/tests/test_sol_ns_scale_api.py index 9d4ed938..d11570a5 100644 --- a/lcm/ns/tests/test_sol_ns_scale_api.py +++ b/lcm/ns/tests/test_sol_ns_scale_api.py @@ -187,13 +187,13 @@ class TestScaleNsApi(TestCase): def test_ns_scale(self, mock_run): data = { "scaleType": "SCALE_NS", - "scaleNsData": [{ - "scaleNsByStepsData": [{ + "scaleNsData": { + "scaleNsByStepsData": { "aspectId": "1", "numberOfSteps": 1, "scalingDirection": "0" - }] - }] + } + } } response = self.client.post(self.url % self.ns_inst_id, data=data) self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code) @@ -216,13 +216,13 @@ class TestScaleNsApi(TestCase): mock_start.side_effect = NSLCMException("NS scale failed.") data = { "scaleType": "SCALE_NS", - "scaleNsData": [{ - "scaleNsByStepsData": [{ + "scaleNsData": { + "scaleNsByStepsData": { "aspectId": "1", "numberOfSteps": 1, "scalingDirection": "0" - }] - }] + } + } } response = self.client.post(self.url % '11', data=data) self.assertEqual( diff --git a/lcm/ns/views/deprecated/scale_ns_views.py b/lcm/ns/views/deprecated/scale_ns_views.py index ee37532c..20f7b51e 100644 --- a/lcm/ns/views/deprecated/scale_ns_views.py +++ b/lcm/ns/views/deprecated/scale_ns_views.py @@ -13,7 +13,6 @@ # limitations under the License. import logging import traceback - from drf_yasg.utils import swagger_auto_schema from rest_framework import status from rest_framework.response import Response @@ -43,8 +42,12 @@ class NSManualScaleView(APIView): req_serializer = _ManualScaleNsReqSerializer(data=request.data) if not req_serializer.is_valid(): raise NSLCMException(req_serializer.errors) - - NSManualScaleService(ns_instance_id, request.data, job_id).start() + req = request.data + scale_data = {} + scale_data['scaleType'] = req['scaleType'] + scaleNsData = req['scaleNsData'][0] + scale_data['scaleNsData'] = {"scaleNsByStepsData": scaleNsData['scaleNsByStepsData'][0]} + NSManualScaleService(ns_instance_id, scale_data, job_id).start() resp_serializer = _NsOperateJobSerializer(data={'jobId': job_id}) if not resp_serializer.is_valid(): diff --git a/lcm/ns/views/sol/scale_ns_views.py b/lcm/ns/views/sol/scale_ns_views.py index 8a5c19d5..07de7d4c 100644 --- a/lcm/ns/views/sol/scale_ns_views.py +++ b/lcm/ns/views/sol/scale_ns_views.py @@ -18,7 +18,7 @@ from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView from lcm.ns.biz.ns_manual_scale import NSManualScaleService -from lcm.ns.serializers.sol.scale_ns_serializers import ManualScaleNsReqSerializer +from lcm.ns.serializers.sol.scale_ns_serializers import ScaleNsRequestSerializer from lcm.pub.exceptions import NSLCMException from lcm.pub.utils.jobutil import JobUtil, JOB_TYPE from lcm.ns.const import NS_OCC_BASE_URI @@ -30,7 +30,7 @@ logger = logging.getLogger(__name__) class ScaleNSView(APIView): @swagger_auto_schema( - request_body=ManualScaleNsReqSerializer(help_text="NS Scale"), + request_body=ScaleNsRequestSerializer(help_text="NS Scale"), responses={ status.HTTP_202_ACCEPTED: "HTTP_202_ACCEPTED", status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer() @@ -40,7 +40,7 @@ class ScaleNSView(APIView): logger.debug("Enter ScaleNSView::post %s, %s", request.data, ns_instance_id) job_id = JobUtil.create_job("NS", JOB_TYPE.MANUAL_SCALE_VNF, ns_instance_id) try: - req_serializer = ManualScaleNsReqSerializer(data=request.data) + req_serializer = ScaleNsRequestSerializer(data=request.data) if not req_serializer.is_valid(): raise NSLCMException(req_serializer.errors) nsManualScaleService = NSManualScaleService(ns_instance_id, request.data, job_id) diff --git a/resources/bin/initDB.sh b/resources/bin/initDB.sh index 01bb1561..7c0fa02a 100644 --- a/resources/bin/initDB.sh +++ b/resources/bin/initDB.sh @@ -26,10 +26,10 @@ sql_path=$HOME/../ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -P$MYSQL_PORT -h$MYSQL_IP <$sql_path/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql sql_result=$? if [ $sql_result -ne 0 ] ; then - echo "failed to create vfcnfvolcm database" + echo "Failed to create vfcnfvolcm database" exit 1 -elif [ $sql_result -eq 0 ]; then - echo "create vfcnfvolcm database successfully" +else + echo "Create vfcnfvolcm database successfully" exit 0 fi diff --git a/resources/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql b/resources/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql index 94e630b5..bd90a1fa 100644 --- a/resources/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql +++ b/resources/dbscripts/mysql/vfc-nfvo-lcm-createdb.sql @@ -14,14 +14,10 @@ -- limitations under the License. -- -/******************drop old database and user***************************/ +/******************create database and user***************************/ use mysql; -drop database IF EXISTS vfcnfvolcm; -delete from user where User='vfcnfvolcm'; -FLUSH PRIVILEGES; +create database if not exists vfcnfvolcm CHARACTER SET utf8; -/******************create new database and user***************************/ -create database vfcnfvolcm CHARACTER SET utf8; GRANT ALL PRIVILEGES ON vfcnfvolcm.* TO 'vfcnfvolcm'@'%' IDENTIFIED BY 'vfcnfvolcm' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON mysql.* TO 'vfcnfvolcm'@'%' IDENTIFIED BY 'vfcnfvolcm' WITH GRANT OPTION; |