summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/lcm/nf/biz/instantiate_vnf.py4
-rw-r--r--lcm/lcm/nf/biz/query_vnf.py3
-rw-r--r--lcm/lcm/nf/const.py121
-rw-r--r--lcm/lcm/nf/serializers/address_range.py25
-rw-r--r--lcm/lcm/nf/serializers/cp_protocol_data.py32
-rw-r--r--lcm/lcm/nf/serializers/ext_link_port_data.py29
-rw-r--r--lcm/lcm/nf/serializers/ext_managed_virtual_link_data.py48
-rw-r--r--lcm/lcm/nf/serializers/ext_virtual_link_data.py55
-rw-r--r--lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py (renamed from lcm/lcm/swagger/views.py)20
-rw-r--r--lcm/lcm/nf/serializers/instantiate_vnf_request.py62
-rw-r--r--lcm/lcm/nf/serializers/ip_addresse.py44
-rw-r--r--lcm/lcm/nf/serializers/ip_over_ethernet_address_data.py31
-rw-r--r--lcm/lcm/nf/serializers/vnf_ext_cp_config.py38
-rw-r--r--lcm/lcm/nf/serializers/vnf_ext_cp_data.py30
-rw-r--r--lcm/lcm/nf/serializers/vnf_instance.py6
-rw-r--r--lcm/lcm/nf/tests/test_instantiate_vnf.py4
-rw-r--r--lcm/lcm/nf/tests/test_query_vnf.py14
-rw-r--r--lcm/lcm/nf/views/instantiate_vnf_view.py4
-rw-r--r--lcm/lcm/swagger/swagger.json1067
-rw-r--r--lcm/lcm/swagger/tests.py30
-rw-r--r--lcm/lcm/swagger/urls.py1
21 files changed, 490 insertions, 1178 deletions
diff --git a/lcm/lcm/nf/biz/instantiate_vnf.py b/lcm/lcm/nf/biz/instantiate_vnf.py
index f47746db..87d4f40d 100644
--- a/lcm/lcm/nf/biz/instantiate_vnf.py
+++ b/lcm/lcm/nf/biz/instantiate_vnf.py
@@ -100,7 +100,7 @@ class InstantiateVnf(Thread):
if not is_exist:
NfvoRegInfoModel.objects.create(
nfvoid=self.nf_inst_id,
- vnfminstid=ignore_case_get(self.data, "vnfmId"),
+ # vnfminstid=ignore_case_get(self.data, "vnfmId"),
apiurl=self.vim_id)
JobUtil.add_job_status(self.job_id, 15, 'Nf instancing pre-check finish')
logger.info("Nf instancing pre-check finish")
@@ -216,7 +216,7 @@ class InstantiateVnf(Thread):
def vnf_inst_failed_handle(self, error_msg):
logger.error('VNF instantiation failed, detail message: %s' % error_msg)
- NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='FAILED', lastuptime=now_time())
+ NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time())
JobUtil.add_job_status(self.job_id, 255, error_msg)
def do_notify(self, res_type, ret):
diff --git a/lcm/lcm/nf/biz/query_vnf.py b/lcm/lcm/nf/biz/query_vnf.py
index f3b2997e..bd4a1e3a 100644
--- a/lcm/lcm/nf/biz/query_vnf.py
+++ b/lcm/lcm/nf/biz/query_vnf.py
@@ -99,9 +99,10 @@ class QueryVnf:
"vnfPkgId": vnf.package_id,
"vnfdVersion": vnf.version,
"vnfProvider": vnf.vendor,
+ "instantiationState": vnf.status,
"instantiatedVnfInfo": {
"flavourId": vnf.flavour_id,
- "vnfState": vnf.status,
+ "vnfState": "STARTED",
"scaleStatus": [],
"extCpInfo": [],
"extVirtualLinkInfo": [],
diff --git a/lcm/lcm/nf/const.py b/lcm/lcm/nf/const.py
index 5f84b4f3..33ba6548 100644
--- a/lcm/lcm/nf/const.py
+++ b/lcm/lcm/nf/const.py
@@ -25,74 +25,85 @@ RESOURCE_MAP = {'Storage': 'volumn', 'Network': 'network', 'SubNetwork': 'subnet
inst_req_data = {
"flavourId": "flavour_1",
"instantiationLevelId": "instantiationLevel_1",
- "vnfmId": "vnfm_1",
"extVirtualLinks": [
{
- "vlInstanceId": "1",
- "vim": {
- "vimInfoId": "1",
- "vimId": "1",
- "interfaceInfo": {
- "vimType": "vim",
- "apiVersion": "v2",
- "protocolType": "http"
- },
- "accessInfo": {
- "tenant": "tenant_vCPE",
- "username": "vCPE",
- "password": "vCPE_321"
- },
- "interfaceEndpoint": "http://10.43.21.105:80/"
- },
- "resourceId": "1246",
+ "id": "extVirtualLink_1",
+ "vimConnectionId": "vimConnection_1",
+ "resourceProviderId": "resourceProvider_1",
+ "resourceId": "resource_1",
"extCps": [
{
- "cpdId": "11",
- "addresses": [
+ "cpdId": "cpd_1",
+ "cpConfig": [
{
- "addressType": "MAC",
- "l2AddressData": "00:f3:43:20:a2:a3"
- },
- {
- "addressType": "IP",
- "l3AddressData": {
- "iPAddressType": "IPv4",
- "iPAddress": "192.168.104.2"
- }
+ "cpInstanceId": "cpInstance_1",
+ "linkPortId": "linkPort_1",
+ "cpProtocolData": [
+ {
+ "layerProtocol": "IP_OVER_ETHERNET",
+ "ipOverEthernet": {
+ "macAddress": "00:f3:43:20:a2:a3",
+ "ipAddresses": [
+ {
+ "type": "IPV4",
+ "fixedAddresses": ["192.168.104.2", ],
+ "numDynamicAddresses": 0,
+ "addressRange": None,
+ "subnetId": "subnet_1",
+ }
+ ]
+ }
+ }
+ ]
}
- ],
- "numDynamicAddresses": 0
+ ]
+ }
+ ],
+ "extLinkPorts": [
+ {
+ "id": "extLinkPort_1",
+ "resourceHandle": {
+ "vimConnectionId": "vimConnection_1",
+ "resourceProviderId": "resourceProvider_1",
+ "resourceId": "resource_1",
+ "vimLevelResourceType": "vimLevelResourceType_1",
+ }
}
]
- },
+ }
+ ],
+ "extManagedVirtualLinks": [
{
- "vlInstanceId": '55',
- "resourceId": '55_network',
- "resourceSubnetId": '55_subnet',
- "cpdId": 'cpId1',
- "vim": {
- "vimId": '55_vimid'
- }
+ "id": 'extManagedVirtualLink_1',
+ "virtualLinkDescId": 'virtualLinkDesc_1',
+ "vimConnectionId": 'vimConnection_1',
+ "resourceProviderId": 'resourceProvider_1',
+ "resourceId": 'resource_1',
+ }
+ ],
+ "vimConnectionInfo": [
+ {
+ "id": 'vimConnection_1',
+ "vimId": 'vim_1',
+ "vimType": 'vim',
+ "interfaceInfo": {
+ "apiVersion": "apiVersion_1",
+ "protocolType": "http"
+ },
+ "accessInfo": {
+ "tenant": "tenant_vCPE",
+ "username": "vCPE",
+ "password": "vCPE_321",
+ },
+ "extra": None,
}
],
"localizationLanguage": "en_US",
"additionalParams": {
- "vimId": "vim_1",
- "inputs": {
- "key1": "test1",
- "key2": "test2"
- },
- "extVirtualLinks": [
- {
- "vlInstanceId": '55',
- "resourceId": '55_network',
- "resourceSubnetId": '55_subnet',
- "cpdId": 'cpId1',
- "vim": {
- "vimId": '55_vimid'
- }
- }
- ]
+ # "inputs": {
+ "key1": "test1",
+ "key2": "test2"
+ # }
}
}
diff --git a/lcm/lcm/nf/serializers/address_range.py b/lcm/lcm/nf/serializers/address_range.py
new file mode 100644
index 00000000..20c40a3d
--- /dev/null
+++ b/lcm/lcm/nf/serializers/address_range.py
@@ -0,0 +1,25 @@
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class AddressRangeSerializer(serializers.Serializer):
+ minAddress = serializers.CharField(
+ help_text="Lowest IP address belonging to the range.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ maxAddress = serializers.CharField(
+ help_text="Highest IP address belonging to the range.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
diff --git a/lcm/lcm/nf/serializers/cp_protocol_data.py b/lcm/lcm/nf/serializers/cp_protocol_data.py
new file mode 100644
index 00000000..495e35f0
--- /dev/null
+++ b/lcm/lcm/nf/serializers/cp_protocol_data.py
@@ -0,0 +1,32 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from ip_over_ethernet_address_data import IpOverEthernetAddressDataSerializer
+
+
+class CpProtocolDataSerializer(serializers.Serializer):
+ layerProtocol = serializers.ChoiceField(
+ help_text="Identifier of layer(s) and protocol(s).",
+ choices=["IP_OVER_ETHERNET"],
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ ipOverEthernet = IpOverEthernetAddressDataSerializer(
+ help_text="Network address data for IP over Ethernet to assign to the extCP instance. \
+ Shall be present if layerProtocol is equal to IP_OVER_ETHERNET, \
+ and shall be absent otherwise.",
+ required=False,
+ allow_null=True,)
diff --git a/lcm/lcm/nf/serializers/ext_link_port_data.py b/lcm/lcm/nf/serializers/ext_link_port_data.py
new file mode 100644
index 00000000..c6dafdd4
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ext_link_port_data.py
@@ -0,0 +1,29 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from resource_handle import ResourceHandleSerializer
+
+
+class ExtLinkPortDataSerializer(serializers.Serializer):
+ id = serializers.CharField(
+ help_text="Identifier of this link port as provided by the entity that has created the link port.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ resourceHandle = ResourceHandleSerializer(
+ help_text="Reference to the virtualised resource realizing this link port.",
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf/serializers/ext_managed_virtual_link_data.py b/lcm/lcm/nf/serializers/ext_managed_virtual_link_data.py
new file mode 100644
index 00000000..6d9f3111
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ext_managed_virtual_link_data.py
@@ -0,0 +1,48 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+
+class ExtManagedVirtualLinkDataSerizlizer(serializers.Serializer):
+ id = serializers.CharField(
+ help_text="The identifier of the external VL instance. \
+ The identifier is assigned by the NFV-MANO entity that manages this VL instance.",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ virtualLinkDescId = serializers.CharField(
+ help_text="The identifier of the VLD in the VNFD for this VL.",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ vimConnectionId = serializers.CharField(
+ help_text="Identifier of the VIM connection to manage this resource. \
+ This attribute shall only be supported and present \
+ if VNF-related resource management in direct mode is applicable.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ resourceProviderId = serializers.CharField(
+ help_text="Identifies the entity responsible for the management of this resource. \
+ This attribute shall only be supported and present \
+ if VNF-related resource management in indirect mode is applicable.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ resourceId = serializers.CharField(
+ help_text="The identifier of the resource in the scope of the VIM or the resource provider.",
+ max_length=255,
+ required=True,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/ext_virtual_link_data.py b/lcm/lcm/nf/serializers/ext_virtual_link_data.py
new file mode 100644
index 00000000..83d5012f
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ext_virtual_link_data.py
@@ -0,0 +1,55 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from vnf_ext_cp_data import VnfExtCpDataSerializer
+from ext_link_port_data import ExtLinkPortDataSerializer
+
+
+class ExtVirtualLinkDataSerizlizer(serializers.Serializer):
+ id = serializers.CharField(
+ help_text="The identifier of the external VL instance. \
+ The identifier is assigned by the NFV-MANO entity that manages this VL instance.",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ vimConnectionId = serializers.CharField(
+ help_text="Identifier of the VIM connection to manage this resource. \
+ This attribute shall only be supported and present if VNF-related resource management in direct mode is applicable.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ resourceProviderId = serializers.CharField(
+ help_text="Identifies the entity responsible for the management of this resource. \
+ This attribute shall only be supported and present if VNF-related resource management in indirect mode is applicable.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ resourceId = serializers.CharField(
+ help_text="The identifier of the resource in the scope of the VIM or the resource provider.",
+ max_length=255,
+ required=True,
+ allow_null=False)
+ extCps = VnfExtCpDataSerializer(
+ help_text="External CPs of the VNF to be connected to this external VL.",
+ many=True,
+ required=True,
+ allow_null=False)
+ extLinkPorts = ExtLinkPortDataSerializer(
+ help_text="Externally provided link ports to be used to connect external connection points to this external VL. \
+ If this attribute is not present, the VNFM shall create the link port on the external VL.",
+ many=True,
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/swagger/views.py b/lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py
index 400d6dd1..17b9c0db 100644
--- a/lcm/lcm/swagger/views.py
+++ b/lcm/lcm/nf/serializers/inst_or_teri_vnf_response.py
@@ -11,16 +11,14 @@
# 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 os
-import json
-from rest_framework.views import APIView
-from rest_framework.response import Response
-class SwaggerView(APIView):
- def get(self, request, format=None):
- 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)
+from rest_framework import serializers
+
+
+class InstOrTeriVnfResponseSerializer(serializers.Serializer):
+ jobId = serializers.CharField(
+ help_text="jobId",
+ required=True,
+ max_length=255,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/instantiate_vnf_request.py b/lcm/lcm/nf/serializers/instantiate_vnf_request.py
new file mode 100644
index 00000000..2c3547d2
--- /dev/null
+++ b/lcm/lcm/nf/serializers/instantiate_vnf_request.py
@@ -0,0 +1,62 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from ext_virtual_link_data import ExtVirtualLinkDataSerizlizer
+from ext_managed_virtual_link_data import ExtManagedVirtualLinkDataSerizlizer
+from vim_connection_info import VimConnectionInfoSerializer
+
+
+class InstantiateVnfRequestSerializer(serializers.Serializer):
+ flavourId = serializers.CharField(
+ help_text="Identifier of the VNF deployment flavour to be instantiated.",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ instantiationLevelId = serializers.CharField(
+ help_text="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.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ extVirtualLinks = ExtVirtualLinkDataSerizlizer(
+ help_text="Information about external VLs to connect the VNF to.",
+ many=True,
+ required=False,
+ allow_null=True)
+ extManagedVirtualLinks = ExtManagedVirtualLinkDataSerizlizer(
+ help_text="Information about internal VLs that are managed by the NFVO.",
+ many=True,
+ required=False,
+ allow_null=True)
+ vimConnectionInfo = VimConnectionInfoSerializer(
+ help_text="Information about VIM connections to be used for managing the resources for the VNF instance, \
+ or refer to external / externally-managed virtual links.",
+ many=True,
+ required=False,
+ allow_null=True)
+ localizationLanguage = serializers.CharField(
+ help_text="Localization language of the VNF to be instantiated. \
+ The value shall comply with the format defined in IETF RFC 5646.",
+ max_length=255,
+ required=False,
+ allow_null=True)
+ additionalParams = serializers.DictField(
+ help_text="Additional input parameters for the instantiation process, \
+ specific to the VNF being instantiated, \
+ as declared in the VNFD as part of InstantiateVnfOpConfig.",
+ child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/ip_addresse.py b/lcm/lcm/nf/serializers/ip_addresse.py
new file mode 100644
index 00000000..f273c423
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ip_addresse.py
@@ -0,0 +1,44 @@
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+from address_range import AddressRangeSerializer
+
+
+class IpAddresseSerializer(serializers.Serializer):
+ type = serializers.ChoiceField(
+ help_text="The type of the IP addresses.",
+ choices=["IPV4", "IPV6"],
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ fixedAddresses = serializers.ListSerializer(
+ help_text="Fixed addresses to assign.",
+ child=serializers.CharField(help_text="IpAddress"),
+ required=False,
+ allow_null=True)
+ numDynamicAddresses = serializers.IntegerField(
+ help_text="Number of dynamic addresses to assign.",
+ required=False,
+ allow_null=True)
+ addressRange = AddressRangeSerializer(
+ help_text="An IP address range to be used, e.g. in case of egress connections. \
+ In case this attribute is present, IP addresses from the range will be used.",
+ required=False,
+ allow_null=True, )
+ subnetId = serializers.CharField(
+ help_text="Subnet defined by the identifier of the subnet resource in the VIM. \
+ In case this attribute is present, IP addresses from that subnet will be assigned; \
+ otherwise, IP addresses not bound to a subnet will be assigned.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
diff --git a/lcm/lcm/nf/serializers/ip_over_ethernet_address_data.py b/lcm/lcm/nf/serializers/ip_over_ethernet_address_data.py
new file mode 100644
index 00000000..562d5fb9
--- /dev/null
+++ b/lcm/lcm/nf/serializers/ip_over_ethernet_address_data.py
@@ -0,0 +1,31 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+from ip_addresse import IpAddresseSerializer
+
+
+class IpOverEthernetAddressDataSerializer(serializers.Serializer):
+ macAddress = serializers.CharField(
+ help_text="MAC address. If this attribute is not present, \
+ it shall be chosen by the VIM.",
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ ipAddresses = IpAddresseSerializer(
+ help_text="List of IP addresses to assign to the CP instance. \
+ Each entry represents IP address data for fixed or dynamic IP address assignment per subnet.",
+ many=True,
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/vnf_ext_cp_config.py b/lcm/lcm/nf/serializers/vnf_ext_cp_config.py
new file mode 100644
index 00000000..b9fedf0a
--- /dev/null
+++ b/lcm/lcm/nf/serializers/vnf_ext_cp_config.py
@@ -0,0 +1,38 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from cp_protocol_data import CpProtocolDataSerializer
+
+
+class VnfExtCpConfigSerializer(serializers.Serializer):
+ cpInstanceId = serializers.CharField(
+ help_text="Identifier of the external CP instance to which this set of configuration parameters is requested to be applied. \
+ Shall be present if this instance has already been created.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ linkPortId = serializers.CharField(
+ help_text="Identifier of a pre-configured link port to which the external CP will be associated.",
+ max_length=255,
+ required=False,
+ allow_null=True,
+ allow_blank=True)
+ cpProtocolData = CpProtocolDataSerializer(
+ help_text="Parameters for configuring the network protocols on the link port that connects the CP to a VL.",
+ many=True,
+ required=False,
+ allow_null=True)
diff --git a/lcm/lcm/nf/serializers/vnf_ext_cp_data.py b/lcm/lcm/nf/serializers/vnf_ext_cp_data.py
new file mode 100644
index 00000000..987569c9
--- /dev/null
+++ b/lcm/lcm/nf/serializers/vnf_ext_cp_data.py
@@ -0,0 +1,30 @@
+# Copyright 2018 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from rest_framework import serializers
+
+from vnf_ext_cp_config import VnfExtCpConfigSerializer
+
+
+class VnfExtCpDataSerializer(serializers.Serializer):
+ cpdId = serializers.CharField(
+ help_text="The identifier of the CPD in the VNFD.",
+ required=True,
+ allow_null=False,
+ allow_blank=False)
+ cpConfig = VnfExtCpConfigSerializer(
+ help_text="List of instance data that need to be configured on the CP instances created from the respective CPD.",
+ many=True,
+ required=True,
+ allow_null=False)
diff --git a/lcm/lcm/nf/serializers/vnf_instance.py b/lcm/lcm/nf/serializers/vnf_instance.py
index bd453629..c7ff8890 100644
--- a/lcm/lcm/nf/serializers/vnf_instance.py
+++ b/lcm/lcm/nf/serializers/vnf_instance.py
@@ -95,9 +95,9 @@ class VnfInstanceSerializer(serializers.Serializer):
instantiationState = serializers.ChoiceField(
help_text="The instantiation state of the VNF.",
choices=["NOT_INSTANTIATED", "INSTANTIATED"],
- required=False,
- allow_null=True,
- allow_blank=True)
+ required=True,
+ allow_null=False,
+ allow_blank=False)
instantiatedVnfInfo = InstantiatedVnfInfoSerializer(
help_text="Information specific to an instantiated VNF instance. \
This attribute shall be present if the instantiateState attribute value is INSTANTIATED",
diff --git a/lcm/lcm/nf/tests/test_instantiate_vnf.py b/lcm/lcm/nf/tests/test_instantiate_vnf.py
index 7cf2646f..e7604990 100644
--- a/lcm/lcm/nf/tests/test_instantiate_vnf.py
+++ b/lcm/lcm/nf/tests/test_instantiate_vnf.py
@@ -36,7 +36,7 @@ class TestNFInstantiate(TestCase):
self.client = APIClient()
self.grant_result = {
"vimid": 'vimid_1',
- "tenant": 'tenantname_1'
+ "tenant": 'tenantname_1',
}
def tearDown(self):
@@ -50,7 +50,7 @@ class TestNFInstantiate(TestCase):
@mock.patch.object(InstantiateVnf, 'run')
def test_instantiate_vnf(self, mock_run):
- NfInstModel(nfinstid='12', nf_name='VNF1').save()
+ NfInstModel(nfinstid='12', nf_name='VNF1', status="UN_INSTANTIATED").save()
mock_run.re.return_value = None
response = self.client.post("/api/vnflcm/v1/vnf_instances/12/instantiate", data=inst_req_data, format='json')
self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code)
diff --git a/lcm/lcm/nf/tests/test_query_vnf.py b/lcm/lcm/nf/tests/test_query_vnf.py
index e092223b..ccb40c05 100644
--- a/lcm/lcm/nf/tests/test_query_vnf.py
+++ b/lcm/lcm/nf/tests/test_query_vnf.py
@@ -27,8 +27,9 @@ class ResourceTest(TestCase):
"id": "1",
"vnfInstanceName": "VNF1",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -54,8 +55,9 @@ class ResourceTest(TestCase):
"id": "1",
"vnfInstanceName": "VNF1",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -80,8 +82,9 @@ class ResourceTest(TestCase):
"id": "2",
"vnfInstanceName": "VNF2",
"vnfProvider": None,
+ "instantiationState": "INSTANTIATED",
"instantiatedVnfInfo": {
- "vnfState": None,
+ "vnfState": "STARTED",
"extCpInfo": [],
"virtualStorageResourceInfo": [
{
@@ -109,7 +112,7 @@ class ResourceTest(TestCase):
def test_get_vnf(self):
vnf_inst_id = "1"
- NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1').save()
+ NfInstModel(nfinstid=vnf_inst_id, nf_name='VNF1', status='INSTANTIATED').save()
StorageInstModel(storageid='s02',
vimid='vim01',
resouceid='resource01',
@@ -122,7 +125,8 @@ class ResourceTest(TestCase):
def test_get_vnfs(self):
for i in range(1, 3):
NfInstModel(nfinstid='%s' % i,
- nf_name='VNF%s' % i).save()
+ nf_name='VNF%s' % i,
+ status='INSTANTIATED').save()
StorageInstModel(storageid='s0%s' % i,
vimid='vim0%s' % i,
resouceid='resource0%s' % i,
diff --git a/lcm/lcm/nf/views/instantiate_vnf_view.py b/lcm/lcm/nf/views/instantiate_vnf_view.py
index 3e9c334d..fec85d10 100644
--- a/lcm/lcm/nf/views/instantiate_vnf_view.py
+++ b/lcm/lcm/nf/views/instantiate_vnf_view.py
@@ -21,7 +21,9 @@ from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
-from lcm.nf.serializers.serializers import InstOrTeriVnfResponseSerializer, InstantiateVnfRequestSerializer
+# from lcm.nf.serializers.serializers import InstantiateVnfRequestSerializer, InstOrTeriVnfResponseSerializer
+from lcm.nf.serializers.instantiate_vnf_request import InstantiateVnfRequestSerializer
+from lcm.nf.serializers.inst_or_teri_vnf_response import InstOrTeriVnfResponseSerializer
from lcm.pub.exceptions import NFLCMException
from lcm.pub.utils.jobutil import JobUtil
diff --git a/lcm/lcm/swagger/swagger.json b/lcm/lcm/swagger/swagger.json
deleted file mode 100644
index f098d282..00000000
--- a/lcm/lcm/swagger/swagger.json
+++ /dev/null
@@ -1,1067 +0,0 @@
-{
- "swagger": "2.0",
- "info": {
- "version": "1.0.0",
- "title": "VNF Manager LCM Service rest API"
- },
- "basePath": "/api/vnflcm/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}": {
- "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": "query",
- "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"
- }
- }
- }
- }
-}
diff --git a/lcm/lcm/swagger/tests.py b/lcm/lcm/swagger/tests.py
deleted file mode 100644
index f65f6990..00000000
--- a/lcm/lcm/swagger/tests.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2017 ZTE Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import unittest
-
-from django.test import Client
-from rest_framework import status
-
-
-class SwaggerViewTest(unittest.TestCase):
- def setUp(self):
- self.client = Client()
-
- def tearDown(self):
- pass
-
- def test_swagger(self):
- response = self.client.get("/api/vnflcm/v1/swagger.json")
- self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
diff --git a/lcm/lcm/swagger/urls.py b/lcm/lcm/swagger/urls.py
index b521a334..14ebc194 100644
--- a/lcm/lcm/swagger/urls.py
+++ b/lcm/lcm/swagger/urls.py
@@ -35,7 +35,6 @@ SchemaView = get_schema_view(
)
urlpatterns = [
- # url(r'^api/vnflcm/v1/swagger.json$', views.SwaggerView.as_view()),
url(r'^api/vnflcm/v1/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
url(r'^api/vnflcm/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^api/vnflcm/v1/redoc$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc')