summaryrefslogtreecommitdiffstats
path: root/lcm
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-02-11 13:26:48 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-02-11 13:26:48 +0800
commit5e4748fe92313710820ff14f7fbc031538e90908 (patch)
tree3c727ca7d8551504930dacd53f301d216ce7e95d /lcm
parent66fec31207eea8854c5dbaa571c82280eb910ab0 (diff)
Add and read swagger.json file
Change-Id: I64d1ede874e8088691aa25d99189cf3e61770cb4 Issue-Id: GVNFM-5 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
Diffstat (limited to 'lcm')
-rw-r--r--lcm/lcm/nf/vnfs/swagger.json1067
-rw-r--r--lcm/lcm/nf/vnfs/tests/test_vnf_create.py4
-rw-r--r--lcm/lcm/nf/vnfs/urls.py3
-rw-r--r--lcm/lcm/nf/vnfs/views.py12
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py2
5 files changed, 1085 insertions, 3 deletions
diff --git a/lcm/lcm/nf/vnfs/swagger.json b/lcm/lcm/nf/vnfs/swagger.json
new file mode 100644
index 00000000..ce8ae687
--- /dev/null
+++ b/lcm/lcm/nf/vnfs/swagger.json
@@ -0,0 +1,1067 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "VNF Manager LCM Service rest API"
+ },
+ "basePath": "/gvnfmapi/lcm/v1",
+ "tags": [
+ {
+ "name": "lcm Resource"
+ }
+ ],
+ "paths": {
+ "/vnf_instances": {
+ "post": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Create a VNF instance resource",
+ "description": "Create a VNF instance resource",
+ "operationId": "CreateVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to create a VNF instance",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/CreateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "A VNF Instance identifier was created successfully.",
+ "schema": {
+ "$ref": "#/definitions/CreateVnfResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Query multiple VNF instances",
+ "description": "Query multiple VNF instances",
+ "operationId": "QueryMultipleVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/VnfInstanceInfo"
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}": {
+ "delete": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Delete a VNF instance resource",
+ "description": "Delete a VNF instance resource",
+ "operationId": "DeleteVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "The VNF instance resource and the associated VNF identifier were deleted successfully."
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Query a VNF instance",
+ "description": "Query a VNF instance",
+ "operationId": "QuerySingleVnfs",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "$ref": "#/definitions/VnfInstanceInfo"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}/instantiate": {
+ "post": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Instantiate a VNF",
+ "description": "Instantiate a VNF",
+ "operationId": "InstantiateVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to instantiate a VNF",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/InstantiateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "The request is accepted for processing, but the processing has not been completed.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpIdResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}/terminate": {
+ "post": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Terminate a VNF",
+ "description": "Terminate a VNF",
+ "operationId": "TerminateVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to terminate a VNF",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/TerminateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "The request is accepted for processing, but the processing has not been completed.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpIdResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_lc_ops/{vnfLcOpId}&responseId={responseId}": {
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Get VNF operational status",
+ "description": "VNF operational status",
+ "operationId": "QuerySingleVnfLcOp",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfLcOpId",
+ "in": "path",
+ "description": "Identifier of a VNF lifecycle operation occurrence",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "responseId",
+ "in": "path",
+ "description": "Response Identifier",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpOcc"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF lifecycle operation occurrence does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "CreateVnfRequest": {
+ "type": "object",
+ "required": [
+ "vnfdId",
+ "vnfInstanceName"
+ ],
+ "properties": {
+ "vnfdId": {
+ "type": "string",
+ "description": "Identifier that identifies the VNFD which defines the VNF instance to be created."
+ },
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "Human-readable name of the VNF instance to be created."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance to be created."
+ }
+ }
+ },
+ "CreateVnfResponse": {
+ "type": "object",
+ "required": [
+ "vnfInstanceId"
+ ],
+ "properties": {
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "VNF instance identifier just created."
+ }
+ }
+ },
+ "InstantiateVnfRequest": {
+ "type": "object",
+ "required": [
+ "flavourId"
+ ],
+ "properties": {
+ "flavourId": {
+ "type": "string",
+ "description": "Identifier of the VNF deployment flavour to be instantiated."
+ },
+ "instantiationLevelId": {
+ "type": "string",
+ "description": "Identifier of the instantiation level of the deployment flavour to be instantiated. If not present, the default instantiation level as declared in the VNFD is instantiated."
+ },
+ "extVirtualLinks": {
+ "items": {
+ "$ref": "#/definitions/ExtVirtualLinkData"
+ },
+ "description": "Information about external VLs to connect the VNF to."
+ },
+ "localizationLanguage": {
+ "type": "string",
+ "description": "Localization language of the VNF to be instantiated can be declared in the VNFD. The value shall comply with the format defined in IETF RFC 5646 [6]. "
+ },
+ "additionalParams": {
+ "type": "object",
+ "description": "Additional input parameters for the instantiation process, specific to the VNF being instantiated."
+ }
+ }
+ },
+ "TerminateVnfRequest": {
+ "type": "object",
+ "required": [
+ "terminationType"
+ ],
+ "properties": {
+ "terminationType": {
+ "type": "string",
+ "description": "Indicates whether forceful or graceful termination is requested.",
+ "enum": [
+ "FORCEFUL",
+ "GRACEFUL"
+ ]
+ },
+ "gracefulTerminationTimeout": {
+ "type": "integer",
+ "format": "int32",
+ "minimum": "1",
+ "description": "This attribute is only applicable in case of graceful termination. It defines the time to wait for the VNF to be taken out of service before shutting down the VNF and releasing the resources. The unit is seconds. If not given and the \"terminationType\" attribute is set to \"GRACEFUL\", it is expected that the VNFM waits for the successful taking out of service of the VNF, no matter how long it takes, before shutting down the VNF and releasing the resources."
+ }
+ }
+ },
+ "VnfLcOpIdResponse": {
+ "type": "object",
+ "description": "VNF lifecycle operation occurrence identifier response",
+ "required": [
+ "vnfLcOpId"
+ ],
+ "properties": {
+ "vnfLcOpId": {
+ "type": "string",
+ "description": "Identifier of a VNF lifecycle operation occurrence"
+ }
+ }
+ },
+ "ExtVirtualLinkData": {
+ "type": "object",
+ "required": [
+ "resourceId",
+ "extCps"
+ ],
+ "properties": {
+ "extVirtualLinkId": {
+ "type": "string",
+ "description": "Identifier of the VL instance."
+ },
+ "vim": {
+ "$ref": "#/definitions/VimInfo",
+ "description": "Information about the VIM that manages this resource. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable."
+ },
+ "resourceId": {
+ "type": "string",
+ "description": "The network UUID of VIM"
+ },
+ "extCps": {
+ "type": "array",
+ "description": "External CPs of the VNF to be connected to this external VL.",
+ "items": {
+ "$ref": "#/definitions/VnfExtCpData"
+ }
+ }
+ }
+ },
+ "VimInfo": {
+ "type": "object",
+ "required": [
+ "vimInfoId",
+ "vimId",
+ "interfaceInfo",
+ "accessInfo",
+ "interfaceEndpoint"
+ ],
+ "properties": {
+ "vimInfoId": {
+ "type": "string",
+ "description": "The identifier of this VimInfo instance, for the purpose of referencing it from other information elements."
+ },
+ "vimId": {
+ "type": "string",
+ "description": "The identifier of the VIM."
+ },
+ "interfaceInfo": {
+ "$ref": "#/definitions/InterfaceInfo",
+ "description": "Information about the interface to the VIM, including VIM provider type, API version, and protocol type."
+ },
+ "accessInfo": {
+ "$ref": "#/definitions/AccessInfo",
+ "description": "Authentication credentials for accessing the VIM. Examples may include those to support different authentication schemes, e.g., OAuth, Token, etc. "
+ },
+ "interfaceEndpoint": {
+ "type": "string",
+ "description": "Information about the interface endpoint. An example is a URL."
+ }
+ }
+ },
+ "InterfaceInfo": {
+ "type": "object",
+ "required": [
+ "vimType",
+ "apiVersion",
+ "protocolType"
+ ],
+ "properties": {
+ "vimType": {
+ "type": "string",
+ "description": "The type of the VIM."
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "The Version of the api of the VIM."
+ },
+ "protocolType": {
+ "type": "string",
+ "enum": [
+ "http",
+ "https"
+ ]
+ }
+ }
+ },
+ "AccessInfo": {
+ "type": "object",
+ "required": [
+ "tenant",
+ "username",
+ "password"
+ ],
+ "properties": {
+ "tenant": {
+ "type": "string",
+ "description": "Tenant Name of tenant"
+ },
+ "username": {
+ "type": "string",
+ "description": "Username for login"
+ },
+ "password": {
+ "type": "string",
+ "description": "Password of login user"
+ }
+ }
+ },
+ "VnfExtCpData": {
+ "type": "object",
+ "required": [
+ "cpdId"
+ ],
+ "properties": {
+ "cpdId": {
+ "type": "string",
+ "description": "The identifier of the CPD in the VNFD."
+ },
+ "addresses": {
+ "type": "array",
+ "description": "List of (fixed) network addresses that need to be configured on the CP. This attribute shall be present if fixed addresses need to be configured.",
+ "items": {
+ "$ref": "#/definitions/NetworkAddress"
+ }
+ },
+ "numDynamicAddresses": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Number of network addresses to be assigned dynamically. This attribute shall be present if dynamic addresses need to be configured."
+ }
+ }
+ },
+ "NetworkAddress": {
+ "type": "object",
+ "required": [
+ "addressType"
+ ],
+ "properties": {
+ "addressType": {
+ "type": "string",
+ "description": "Describes the type of the address to be assigned to the CP instantiated from the parent CPD.",
+ "enum": [
+ "MAC",
+ "IP"
+ ]
+ },
+ "l2AddressData": {
+ "type": "string",
+ "description": "Provides the information on the MAC addresses to be assigned to the CP(s) instantiated from the parent CPD. Shall be present when the addressType is MAC address."
+ },
+ "l3AddressData": {
+ "$ref": "#/definitions/L3AddressData",
+ "description": "Provides the information on the IP addresses to be assigned to the CP instantiated from the parent CPD. Shall be present when the addressType is IP address."
+ }
+ }
+ },
+ "L3AddressData": {
+ "type": "object",
+ "required": [
+ "iPAddressType",
+ "iPAddress"
+ ],
+ "properties": {
+ "iPAddressType": {
+ "type": "string",
+ "description": "IP address type",
+ "enum": [
+ "IPv4",
+ "IPv6"
+ ]
+ },
+ "iPAddress": {
+ "type": "string",
+ "description": "IP address"
+ }
+ }
+ },
+ "VnfInstanceInfo": {
+ "type": "object",
+ "required": [
+ "vnfInstanceId",
+ "vnfInstanceName",
+ "vnfInstanceDescription",
+ "onboardedVnfPkgInfoId",
+ "vnfdId",
+ "vnfdVersion",
+ "vnfSoftwareVersion",
+ "vnfProvider",
+ "vnfProductName",
+ "instantiationState"
+ ],
+ "properties": {
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "VNF instance identifier."
+ },
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "VNF instance name."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance."
+ },
+ "onboardedVnfPkgInfoId": {
+ "type": "string",
+ "description": "Identifier of information held by the NFVO about the specific VNF Package on which the VNF is based. This identifier was allocated by the NFVO."
+ },
+ "vnfdId": {
+ "type": "string",
+ "description": "Identifier of the VNFD on which the VNF instance is based."
+ },
+ "vnfdVersion": {
+ "type": "string",
+ "description": "Identifies the version of the VNFD. The value is copied from the VNFD."
+ },
+ "vnfSoftwareVersion": {
+ "type": "string",
+ "description": "Software version of the VNF. The value is copied from the VNFD."
+ },
+ "vnfProvider": {
+ "type": "string",
+ "description": "Name of the person or company providing the VNF. The value is copied from the VNFD."
+ },
+ "vnfProductName": {
+ "type": "string",
+ "description": "Name to identify the VNF Product. Such as VNF Application Type. The value is copied from the VNFD."
+ },
+ "instantiationState": {
+ "type": "string",
+ "description": "The instantiation state of the VNF.",
+ "enum": [
+ "NOT_INSTANTIATED",
+ "INSTANTIATED"
+ ]
+ },
+ "vnfConfigurableProperties": {
+ "type": "object",
+ "description": "Current values of the configurable properties of the VNF instance. Configurable properties as declared in the VNFD."
+ },
+ "metadata": {
+ "type": "object",
+ "description": "Additional metadata describing the VNF instance. This attribute can be modified with the Modify VNF information operation."
+ },
+ "extensions": {
+ "type": "object",
+ "description": "VNF-specific attributes. This attribute can be modified with the Modify VNF information operation."
+ },
+ "instantiatedVnfInfo": {
+ "$ref": "#/definitions/InstantiatedVnfInfo",
+ "description": "Information specific to an instantiated VNF instance. This attribute shall be present if the instantiateState attribute value is INSTANTIATED."
+ }
+ }
+ },
+ "InstantiatedVnfInfo": {
+ "type": "object",
+ "required": [
+ "flavourId",
+ "vnfState"
+ ],
+ "properties": {
+ "flavourId": {
+ "type": "string",
+ "description": "Identifier of the VNF deployment flavour to be instantiated."
+ },
+ "vnfState": {
+ "type": "string",
+ "description": "State of the VNF instance",
+ "enum": [
+ "STARTED",
+ "STOPPED"
+ ]
+ },
+ "scaleStatus": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ScaleInfo"
+ },
+ "description": "Scale status of the VNF, one entry per aspect. Represents for every scaling aspect how \"big\" the VNF has been scaled w.r.t. that aspect. This attribute shall be present if the VNF supports scaling."
+ },
+ "extCpInfo": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/CpInfo"
+ },
+ "description": "Information about the external CPs exposed by the VNF instance."
+ },
+ "extVirtualLink": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ExtVirtualLinkInfo"
+ },
+ "description": "Information about the external VLs the VNF instance is connected to."
+ },
+ "monitoringParameters": {
+ "type": "object",
+ "description": "Active monitoring parameters."
+ },
+ "localizationLanguage": {
+ "type": "string",
+ "description": "Localization language of the VNF to be instantiated."
+ },
+ "vimInfo": {
+ "type": "array",
+ "description": "Information about VIM(s) managing resources for the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VimInfo"
+ }
+ },
+ "vnfcResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised compute and storage resource(s) used by the VNFCs of the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VnfcResourceInfo"
+ }
+ },
+ "virtualLinkResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised network resource(s) used by the VLs of the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable. ",
+ "items": {
+ "$ref": "#/definitions/VirtualLinkResourceInfo"
+ }
+ },
+ "virtualStorageResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised storage resource(s) used as storage for the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VirtualStorageResourceInfo"
+ }
+ }
+ }
+ },
+ "ScaleInfo": {
+ "type": "object",
+ "required": [
+ "aspectId",
+ "scaleLevel"
+ ],
+ "properties": {
+ "aspectId": {
+ "type": "string",
+ "description": "Identifier of the scaling aspect."
+ },
+ "scaleLevel": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Indicates the scale level. The minimum value shall be 0 and the maximum value shall be <= maxScaleLevel as described in the VNFD."
+ }
+ }
+ },
+ "CpInfo": {
+ "type": "object",
+ "required": [
+ "cpInstanceId",
+ "cpdId"
+ ],
+ "properties": {
+ "cpInstanceId": {
+ "type": "string",
+ "description": "Identifier of the CP instance."
+ },
+ "cpdId": {
+ "type": "string",
+ "description": "Identifier of the CPD, in the VNFD."
+ },
+ "addresses": {
+ "type": "array",
+ "description": "List of network addresses that have been configured on the CP.",
+ "items": {
+ "$ref": "#/definitions/NetworkAddress"
+ }
+ }
+ }
+ },
+ "ExtVirtualLinkInfo": {
+ "type": "object",
+ "required": [
+ "extVirtualLinkId",
+ "resourceHandle"
+ ],
+ "properties": {
+ "extVirtualLinkId": {
+ "type": "string",
+ "description": "Identifier of the external VL."
+ },
+ "resourceHandle": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Identifier of the resource realizing this VL."
+ },
+ "linkPorts": {
+ "type": "array",
+ "description": "Link ports of this VL.",
+ "items": {
+ "$ref": "#/definitions/VnfLinkPort"
+ }
+ }
+ }
+ },
+ "ResourceHandle": {
+ "type": "object",
+ "required": [
+ "resourceId"
+ ],
+ "properties": {
+ "vimId": {
+ "type": "string",
+ "description": "Identifier of the VimInfo information element defining the VIM who manages the resource. This attribute shall be present if VNF-related resource management in direct mode is applicable. The value refers to a vimInfo item in the VnfInstance."
+ },
+ "resourceProviderId": {
+ "type": "string",
+ "description": "Identifier of the entity responsible for the management of the resource. This attribute shall be present when VNF-related resource management in indirect mode is applicable. "
+ },
+ "resourceId": {
+ "type": "string",
+ "description": "Identifier of the resource in the scope of the VIM or the resource provider."
+ }
+ }
+ },
+ "VnfcResourceInfo": {
+ "type": "object",
+ "required": [
+ "vnfcInstanceId",
+ "vduId",
+ "computeResource",
+ "storageResourceIds"
+ ],
+ "properties": {
+ "vnfcInstanceId": {
+ "type": "string",
+ "description": "Identifier of this VNFC instance."
+ },
+ "vduId": {
+ "type": "string",
+ "description": "Reference to the applicable VDU information element in the VNFD."
+ },
+ "computeResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualCompute resource."
+ },
+ "storageResourceIds": {
+ "type": "array",
+ "description": "Reference(s) to the VirtualStorage resource(s).",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "VirtualStorageResourceInfo": {
+ "type": "object",
+ "required": [
+ "virtualStorageInstanceId",
+ "virtualStorageDescId",
+ "storageResource"
+ ],
+ "properties": {
+ "virtualStorageInstanceId": {
+ "type": "string",
+ "description": "Identifier of this virtual storage resource instance."
+ },
+ "virtualStorageDescId": {
+ "type": "string",
+ "description": "Identifier of the VirtualStorageDesc in the VNFD."
+ },
+ "storageResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualStorage resource."
+ }
+ }
+ },
+ "VirtualLinkResourceInfo": {
+ "type": "object",
+ "required": [
+ "virtualLinkInstanceId",
+ "virtualLinkDescId",
+ "networkResource"
+ ],
+ "properties": {
+ "virtualLinkInstanceId": {
+ "type": "string",
+ "description": "Identifier of this VL instance."
+ },
+ "virtualLinkDescId": {
+ "type": "string",
+ "description": "Identifier of the Virtual Link Descriptor (VLD) in the VNFD."
+ },
+ "networkResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualNetwork resource."
+ }
+ }
+ },
+ "VnfLcOpOcc": {
+ "type": "object",
+ "description": "VNF lifecycle operation response",
+ "required": [
+ "vnfLcOpId",
+ "vnfInstanceId",
+ "lcmOperationType",
+ "startTime",
+ "responseDescriptor"
+ ],
+ "properties": {
+ "vnfLcOpId": {
+ "type": "string",
+ "description": "Identifier of a VNF lifecycle operation occurrence"
+ },
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "Identifier of the VNF instance to which the operation applies"
+ },
+ "lcmOperationType": {
+ "type": "string",
+ "description": "Type of the actual LCM operation represented by this lcm operation occurrence.",
+ "enum": [
+ "INSTANTIATE",
+ "SCALE",
+ "SCALE_TO_LEVEL",
+ "CHANGE_FLAVOUR",
+ "TERMINATE",
+ "HEAL",
+ "OPERATE"
+ ]
+ },
+ "startTime": {
+ "type": "string",
+ "description": "Date-time of the start of the operation. Representation: String formatted according to RFC 3339 [13]."
+ },
+ "responseDescriptor": {
+ "type": "#/definitions/VnfLcOpResponseDescriptor",
+ "description": "Including:responseId,progress,statusstatusDescription,errorCode,responseHistoryList"
+ }
+ }
+ },
+ "VnfLcOpResponseDescriptor": {
+ "type": "object",
+ "description": "VNF lifecycle operation response",
+ "required": [
+ "responseId",
+ "progress",
+ "lcmOperationStatus",
+ "statusDescription",
+ "responseHistoryList"
+ ],
+ "properties": {
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier."
+ },
+ "progress": {
+ "type": "integer",
+ "description": "progress (1-100)."
+ },
+ "lcmOperationStatus": {
+ "type": "string",
+ "description": "Vnf lifecycle operation Status.",
+ "enum": [
+ "STARTING",
+ "PROCESSING",
+ "COMPLETED",
+ "FAILED"
+ ]
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Status Description of a VNF lifecycle operation occurrence"
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Error code."
+ },
+ "responseHistoryList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/VnfLcOpDetail"
+ }
+ }
+ }
+ },
+ "VnfLcOpDetail": {
+ "type": "object",
+ "description": "The Detail of VNF lifecycle operation",
+ "required": [
+ "responseId",
+ "progress",
+ "lcmOperationStatus",
+ "statusDescription"
+ ],
+ "properties": {
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier."
+ },
+ "progress": {
+ "type": "integer",
+ "description": "progress (1-100)."
+ },
+ "lcmOperationStatus": {
+ "type": "string",
+ "description": "Vnf lifecycle operation Status.",
+ "enum": [
+ "STARTING",
+ "PROCESSING",
+ "COMPLETED",
+ "FAILED"
+ ]
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Status Description of a VNF lifecycle operation occurrence"
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Error code."
+ }
+ }
+ },
+ "Error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
index 9fc981c1..00e3aa1d 100644
--- a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
+++ b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py
@@ -88,6 +88,10 @@ class TestNsInstantiate(TestCase):
descp=job_detail)
self.assertEqual(1, len(jobs))
+ def test_swagger_ok(self):
+ response = self.client.get("/gvnfmapi/lcm/v1/swagger.json", format='json')
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
@mock.patch.object(restcall, 'call_req')
def test_create_vnf_identifier(self, mock_call_req):
r1 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200']
diff --git a/lcm/lcm/nf/vnfs/urls.py b/lcm/lcm/nf/vnfs/urls.py
index d07dc4fd..73e3e30a 100644
--- a/lcm/lcm/nf/vnfs/urls.py
+++ b/lcm/lcm/nf/vnfs/urls.py
@@ -16,7 +16,7 @@ from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from lcm.nf.vnfs.views import CreateVnfIdentifier, InstantiateVnf, DeleteVnfIdentifier, QueryMultipleVnf,\
- TerminateVnf, QuerySingleVnf, GetOperationStatus
+ TerminateVnf, QuerySingleVnf, GetOperationStatus, SwaggerJsonView
urlpatterns = patterns('',
url(r'^gvnfmapi/lcm/v1/vnf_instances$', CreateVnfIdentifier.as_view()),
@@ -30,6 +30,7 @@ urlpatterns = patterns('',
url(r'^gvnfmapi/lcm/v1/vnf_instances/(?P<instanceId>[0-9a-zA-Z_-]+)$', QuerySingleVnf.as_view()),
url(r'^gvnfmapi/lcm/v1/vnf_lc_ops/(?P<vnfLcOpId>[0-9a-zA-Z_-]+)&'
r'responseId=(?P<responseId>[0-9a-zA-Z_-]+)$', GetOperationStatus.as_view()),
+ url(r'^gvnfmapi/lcm/v1/swagger.json$', SwaggerJsonView.as_view()),
)
urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/lcm/lcm/nf/vnfs/views.py b/lcm/lcm/nf/vnfs/views.py
index 6dbdb73e..b93ce67c 100644
--- a/lcm/lcm/nf/vnfs/views.py
+++ b/lcm/lcm/nf/vnfs/views.py
@@ -11,8 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+import json
import logging
+import os
import traceback
from rest_framework import status
@@ -80,3 +81,12 @@ class GetOperationStatus(APIView):
def get(self, request):
logger.debug("GetOperationStatus--get::> %s" % request.data)
return Response(data='', status=status.HTTP_202_ACCEPTED)
+
+
+class SwaggerJsonView(APIView):
+ def get(self, request):
+ json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
+ f = open(json_file)
+ json_data = json.JSONDecoder().decode(f.read())
+ f.close()
+ return Response(json_data)
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index bcadce08..601ec6b4 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -50,7 +50,7 @@ class InstVnf(Thread):
self.vnf_inst_failed_handle(e.message)
# self.rollback(e.message)
except:
- self.vnf_inst_failed_handle('unexpected exception')
+ # self.vnf_inst_failed_handle('unexpected exception')
logger.error(traceback.format_exc())
# self.rollback('unexpected exception')