diff --git a/doc/rest_api_model.json b/doc/rest_api_model.json index 5e590bb..b70648a 100644 --- a/doc/rest_api_model.json +++ b/doc/rest_api_model.json @@ -1 +1 @@ -{"swagger": "2.0", "basePath": "http://tng-package.5gtango.eu/api", "paths": {"/v1/packages": {"post": {"responses": {"400": {"description": "Bad package: Could not unpackage given package."}, "200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "operationId": "post_packages", "parameters": [{"name": "package", "in": "formData", "type": "file", "required": true, "description": "Uploaded package file"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "layer", "in": "formData", "type": "string", "description": "Layer tag to be unpackaged (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (optional)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "output", "in": "formData", "type": "string", "description": "Output (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}}, "/v1/packages/status": {"get": {"responses": {"200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusListGetReturn"}}}, "operationId": "get_packages_status_list", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/packages/status/{package_process_uuid}": {"parameters": [{"name": "package_process_uuid", "in": "path", "required": true, "type": "string"}], "get": {"responses": {"404": {"description": "Package process not found."}, "200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "operationId": "get_packages_status_item", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/pings": {"get": {"responses": {"200": {"description": "Success", "schema": {"$ref": "#/definitions/PingGetReturn"}}}, "operationId": "get_ping", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/projects": {"get": {"responses": {"200": {"description": "Success"}}, "summary": "Get a list created packages", "description": "Returns: List of dictionaries: [{'package_name: ,\n 'package_download_link': }, ..]", "operationId": "get_projects", "tags": ["v1"]}, "post": {"responses": {"400": {"description": "Bad project: Could not package given project."}, "200": {"description": "Successfully started packaging."}}, "operationId": "post_projects", "parameters": [{"name": "project", "in": "formData", "type": "file", "required": true, "description": "Uploaded project archive"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (ignored)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "output", "in": "formData", "type": "string", "description": "Output"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "no_subfolder_compression", "in": "formData", "type": "boolean", "description": "Ignore type:\n application/vnd.folder.compressed.zip"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}}, "/v1/projects/{filename}": {"parameters": [{"name": "filename", "in": "path", "required": true, "type": "string"}], "get": {"responses": {"200": {"description": "Success"}}, "operationId": "get_project_download", "parameters": [{"name": "project", "in": "formData", "type": "file", "required": true, "description": "Uploaded project archive"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (ignored)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "output", "in": "formData", "type": "string", "description": "Output"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "no_subfolder_compression", "in": "formData", "type": "boolean", "description": "Ignore type:\n application/vnd.folder.compressed.zip"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}}}, "info": {"title": "5GTANGO tng-package API", "version": "0.1", "description": "5GTANGO tng-package REST API to package/unpacke NFV packages."}, "produces": ["application/json"], "consumes": ["application/json"], "tags": [{"name": "v1", "description": "tng-package API v1"}], "definitions": {"PackagesStatusItemGetReturn": {"required": ["package_process_uuid", "status"], "properties": {"package_process_uuid": {"type": "string", "description": "UUID of started unpackaging process."}, "status": {"type": "string", "description": "Status of the unpacking process: waiting|runnig|failed|done"}, "error_msg": {"type": "string", "description": "More detailed error message."}}, "type": "object"}, "PackagesStatusListGetReturn": {"properties": {"package_processes": {"type": "array", "items": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "type": "object"}, "PingGetReturn": {"required": ["alive_since"], "properties": {"alive_since": {"type": "string", "description": "system uptime"}}, "type": "object"}}, "responses": {"ParseError": {"description": "When a mask can't be parsed"}, "MaskError": {"description": "When any error occurs on mask"}}, "host": "tng-package.5gtango.eu"} \ No newline at end of file +{"swagger": "2.0", "basePath": "/api", "paths": {"/v1/packages": {"post": {"responses": {"400": {"description": "Bad package: Could not unpackage given package."}, "200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "operationId": "post_packages", "parameters": [{"name": "package", "in": "formData", "type": "file", "required": true, "description": "Uploaded package file"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "layer", "in": "formData", "type": "string", "description": "Layer tag to be unpackaged (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (optional)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "output", "in": "formData", "type": "string", "description": "Output (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}}, "/v1/packages/status": {"get": {"responses": {"200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusListGetReturn"}}}, "operationId": "get_packages_status_list", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/packages/status/{package_process_uuid}": {"parameters": [{"name": "package_process_uuid", "in": "path", "required": true, "type": "string"}], "get": {"responses": {"404": {"description": "Package process not found."}, "200": {"description": "Success", "schema": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "operationId": "get_packages_status_item", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/pings": {"get": {"responses": {"200": {"description": "Success", "schema": {"$ref": "#/definitions/PingGetReturn"}}}, "operationId": "get_ping", "parameters": [{"name": "X-Fields", "in": "header", "type": "string", "format": "mask", "description": "An optional fields mask"}], "tags": ["v1"]}}, "/v1/projects": {"post": {"responses": {"400": {"description": "Bad project: Could not package given project."}, "200": {"description": "Successfully started packaging."}}, "operationId": "post_projects", "parameters": [{"name": "project", "in": "formData", "type": "file", "required": true, "description": "Uploaded project archive"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (ignored)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "output", "in": "formData", "type": "string", "description": "Output"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "no_subfolder_compression", "in": "formData", "type": "boolean", "description": "Ignore type:\n application/vnd.folder.compressed.zip"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}, "get": {"responses": {"200": {"description": "Success"}}, "summary": "Get a list created packages", "description": "Returns: List of dictionaries: [{'package_name: ,\n 'package_download_link': }, ..]", "operationId": "get_projects", "tags": ["v1"]}}, "/v1/projects/{filename}": {"parameters": [{"name": "filename", "in": "path", "required": true, "type": "string"}], "get": {"responses": {"200": {"description": "Success"}}, "operationId": "get_project_download", "parameters": [{"name": "project", "in": "formData", "type": "file", "required": true, "description": "Uploaded project archive"}, {"name": "callback_url", "in": "formData", "type": "string", "description": "URL called after unpackaging (optional)"}, {"name": "username", "in": "formData", "type": "string", "description": "Username of the uploader (optional)"}, {"name": "format", "in": "formData", "type": "string", "description": "Package format (optional)"}, {"name": "skip_store", "in": "formData", "type": "boolean", "description": "Skip catalog upload\n of contents (ignored)"}, {"name": "skip_validation", "in": "formData", "type": "boolean", "description": "Skip service validation (optional)"}, {"name": "validation_level", "in": "formData", "type": "string", "description": "Set validation level.\n Possible values:\n 's' or 'syntax',\n 'i' or 'integrity',\n 't' or 'topology' ,\n 'skip'", "enum": ["s", "syntax", "i", "integrity", "t", "topology", "skip"], "collectionFormat": "multi"}, {"name": "output", "in": "formData", "type": "string", "description": "Output"}, {"name": "workspace", "in": "formData", "type": "string", "description": "Workspace (ignored for now)"}, {"name": "offline", "in": "formData", "type": "string", "description": "Offline"}, {"name": "no_checksums", "in": "formData", "type": "string", "description": "Do not validate artifact checksums."}, {"name": "no_subfolder_compression", "in": "formData", "type": "boolean", "description": "Ignore type:\n application/vnd.folder.compressed.zip"}], "consumes": ["multipart/form-data"], "tags": ["v1"]}}}, "info": {"title": "5GTANGO tng-package API", "version": "0.1", "description": "5GTANGO tng-package REST API to package/unpacke NFV packages."}, "produces": ["application/json"], "consumes": ["application/json"], "tags": [{"name": "v1", "description": "tng-package API v1"}], "definitions": {"PackagesStatusItemGetReturn": {"required": ["package_process_uuid", "status"], "properties": {"package_process_uuid": {"type": "string", "description": "UUID of started unpackaging process."}, "status": {"type": "string", "description": "Status of the unpacking process: waiting|runnig|failed|done"}, "error_msg": {"type": "string", "description": "More detailed error message."}}, "type": "object"}, "PackagesStatusListGetReturn": {"properties": {"package_processes": {"type": "array", "items": {"$ref": "#/definitions/PackagesStatusItemGetReturn"}}}, "type": "object"}, "PingGetReturn": {"required": ["alive_since"], "properties": {"alive_since": {"type": "string", "description": "system uptime"}}, "type": "object"}}, "responses": {"ParseError": {"description": "When a mask can't be parsed"}, "MaskError": {"description": "When any error occurs on mask"}}, "host": "tng-package.5gtango.eu"} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 8a3b6c6..1189fef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,4 @@ jsonschema coloredlogs requests flask-restplus -mock -pyrfc3339 +pyrfc3339 \ No newline at end of file diff --git a/setup.py b/setup.py index c09a949..e6f93fc 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ setup(name='tngsdk.package', license='Apache License, Version 2.0', - version='5.0.3', + version='5.0.4', url='https://github.com/sonata-nfv/tng-sdk-package', author='Manuel Peuster', author_email='manuel.peuster@uni-paderborn.de', diff --git a/src/tngsdk/package/tests/test_unit_rest.py b/src/tngsdk/package/tests/test_unit_rest.py index 8fe684c..31bc3ae 100644 --- a/src/tngsdk/package/tests/test_unit_rest.py +++ b/src/tngsdk/package/tests/test_unit_rest.py @@ -36,7 +36,7 @@ import time import tempfile import os -from mock import patch +from unittest.mock import patch from requests.exceptions import RequestException from tngsdk.package.rest import app, on_unpackaging_done, on_packaging_done from tngsdk.package.packager import PM diff --git a/src/tngsdk/package/tests/test_unit_storage_tngcat.py b/src/tngsdk/package/tests/test_unit_storage_tngcat.py index 9c45ab6..e0139f5 100644 --- a/src/tngsdk/package/tests/test_unit_storage_tngcat.py +++ b/src/tngsdk/package/tests/test_unit_storage_tngcat.py @@ -32,7 +32,7 @@ import unittest -from mock import patch +from unittest.mock import patch from requests.exceptions import RequestException from requests import get as real_get from tngsdk.package.cli import parse_args