diff options
-rw-r--r-- | lcm/lcm/nf/vnfs/tests/test_vnf_create.py | 416 | ||||
-rw-r--r-- | lcm/lcm/nf/vnfs/views.py | 24 | ||||
-rw-r--r-- | lcm/lcm/nf/vnfs/vnf_create/__init__.py | 13 | ||||
-rw-r--r-- | lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py | 68 | ||||
-rw-r--r-- | lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py (renamed from lcm/lcm/nf/vnfs/create_vnfs.py) | 38 | ||||
-rw-r--r-- | lcm/lcm/pub/database/models.py | 49 | ||||
-rw-r--r-- | lcm/lcm/pub/exceptions.py | 2 |
7 files changed, 526 insertions, 84 deletions
diff --git a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py index c514e102..5537f191 100644 --- a/lcm/lcm/nf/vnfs/tests/test_vnf_create.py +++ b/lcm/lcm/nf/vnfs/tests/test_vnf_create.py @@ -15,10 +15,63 @@ import json import uuid +import mock from django.test import TestCase, Client from rest_framework import status -from lcm.pub.database.models import VnfInstModel +from lcm.nf.vnfs.views import InstantiateVnf +from lcm.nf.vnfs.vnf_create.create_vnf_identifier import CreateVnf +from lcm.nf.vnfs.vnf_create.inst_vnf import InstVnf +from lcm.pub.database.models import NfInstModel, JobStatusModel +from lcm.pub.utils import restcall +from lcm.pub.utils.jobutil import JobUtil + +inst_req_data = { + "flavourId": "flavour_1", + "instantiationLevelId": "instantiationLevel_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", + "extCps": [ + { + "cpdId": "11", + "addresses": [ + { + "addressType": "MAC", + "l2AddressData": "00:f3:43:20:a2:a3" + }, + { + "addressType": "IP", + "l3AddressData": { + "iPAddressType": "IPv4", + "iPAddress": "192.168.104.2" + } + } + ], + "numDynamicAddresses": 0 + } + ] + } + ], + "localizationLanguage": "en_US", + "additionalParams": {} +} class TestNsInstantiate(TestCase): @@ -29,62 +82,323 @@ class TestNsInstantiate(TestCase): def tearDown(self): pass - def test_create_vnf_identifier(self): + def assert_job_result(self, job_id, job_progress, job_detail): + jobs = JobStatusModel.objects.filter( + jobid=job_id, + progress=job_progress, + descp=job_detail) + self.assertEqual(1, len(jobs)) + + @mock.patch.object(restcall, 'call_req') + def test_create_vnf_identifier(self, mock_call_req): + r1 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200'] + mock_call_req.side_effect = [r1] data = { - "vnfdId": "zte_vFW_51610", + "vnfdId": "111", "vnfInstanceName": "vFW_01", "vnfInstanceDescription": " vFW in Nanjing TIC Edge"} response = self.client.post("/gvnfmapi/lcm/v1/vnf_instances", data=data, format='json') self.failUnlessEqual(status.HTTP_201_CREATED, response.status_code) context = json.loads(response.content) - self.assertTrue(VnfInstModel.objects.filter(id=context['vnfInstanceId']).exists()) + self.assertTrue(NfInstModel.objects.filter(nfinstid=context['vnfInstanceId']).exists()) def test_instantiate_vnf(self): - data = { - "flavourId": "flavour_1", - "instantiationLevelId": "instantiationLevel_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", - "extCps": [ - { - "cpdId": "11", - "addresses": [ - { - "addressType": "MAC", - "l2AddressData": "00:f3:43:20:a2:a3" - }, - { - "addressType": "IP", - "l3AddressData": { - "iPAddressType": "IPv4", - "iPAddress": "192.168.104.2" - } - } - ], - "numDynamicAddresses": 0 - } - ] - } - ], - "localizationLanguage": "en_US", - "additionalParams": {} - } - response = self.client.post("/gvnfmapi/lcm/v1/vnf_instances/12/instantiate", data=data, format='json') + response = self.client.post("/gvnfmapi/lcm/v1/vnf_instances/12/instantiate", data={}, format='json') self.failUnlessEqual(status.HTTP_202_ACCEPTED, response.status_code) + + def test_instantiate_vnf_when_instid_not_exist(self): + self.nf_inst_id = str(uuid.uuid4()) + self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id) + JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY") + data = inst_req_data + InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run() + self.assert_job_result(self.job_id, 255, "VNF nf_inst_id is not exist.") + + + @mock.patch.object(restcall, 'call_req') + def test_instantiate_vnf_success(self, mock_call_req): + r1 = [0, json.JSONEncoder().encode(vnfd_model_dict), '200'] + mock_call_req.side_effect = [r1] + create_data = { + "vnfdId": "111", + "vnfInstanceName": "vFW_01", + "vnfInstanceDescription": " vFW in Nanjing TIC Edge"} + self.nf_inst_id = CreateVnf(create_data).do_biz() + self.job_id = JobUtil.create_job('NF', 'CREATE', self.nf_inst_id) + JobUtil.add_job_status(self.job_id, 0, "INST_VNF_READY") + data = inst_req_data + InstVnf(data, nf_inst_id=self.nf_inst_id, job_id=self.job_id).run() + self.assert_job_result(self.job_id, 100, "Instantiate Vnf success.") + +vnfd_model_dict = { + 'local_storages': [], + 'vdus': [ + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'2'}, + 'local_storages': [], + 'vdu_id': u'vdu_omm.001', + 'image_file': u'opencos_sss_omm_img_release_20150723-1-disk1', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'omm.001', + 'manual_scale_select_vim': False}, + 'description': u'singleommvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'4'}, + 'local_storages': [], + 'vdu_id': u'vdu_1', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'1', + 'manual_scale_select_vim': False}, + 'description': u'ompvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'14'}, + 'local_storages': [], + 'vdu_id': u'vdu_2', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'2', + 'manual_scale_select_vim': False}, + 'description': u'ompvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'14'}, + 'local_storages': [], + 'vdu_id': u'vdu_3', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'3', + 'manual_scale_select_vim': False}, + 'description': u'ompvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'4'}, + 'local_storages': [], + 'vdu_id': u'vdu_10', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'10', + 'manual_scale_select_vim': False}, + 'description': u'ppvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'14'}, + 'local_storages': [], + 'vdu_id': u'vdu_11', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'11', + 'manual_scale_select_vim': False}, + 'description': u'ppvm'}, + { + 'volumn_storages': [], + 'nfv_compute': { + 'mem_size': '', + 'num_cpus': u'14'}, + 'local_storages': [], + 'vdu_id': u'vdu_12', + 'image_file': u'sss', + 'dependencies': [], + 'vls': [], + 'cps': [], + 'properties': { + 'key_vdu': '', + 'support_scaling': False, + 'vdu_type': '', + 'name': '', + 'storage_policy': '', + 'location_info': { + 'vimId': '', + 'availability_zone': '', + 'region': '', + 'dc': '', + 'host': '', + 'tenant': ''}, + 'inject_data_list': [], + 'watchdog': { + 'action': '', + 'enabledelay': ''}, + 'local_affinity_antiaffinity_rule': {}, + 'template_id': u'12', + 'manual_scale_select_vim': False}, + 'description': u'ppvm'}], + 'volumn_storages': [], + 'policies': { + 'scaling': { + 'targets': {}, + 'policy_id': u'policy_scale_sss-vnf-template', + 'properties': { + 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'}, + 'description': ''}}, + 'image_files': [ + { + 'description': '', + 'properties': { + 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk', + 'checksum': '', + 'disk_format': u'VMDK', + 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk', + 'container_type': 'vm', + 'version': '', + 'hypervisor_type': 'kvm'}, + 'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'}, + { + 'description': '', + 'properties': { + 'name': u'sss.vmdk', + 'checksum': '', + 'disk_format': u'VMDK', + 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk', + 'container_type': 'vm', + 'version': '', + 'hypervisor_type': 'kvm'}, + 'image_file_id': u'sss'}], + 'vls': [], + 'cps': [], + 'metadata': { + 'vendor': u'zte', + 'is_shared': False, + 'description': '', + 'domain_type': u'CN', + 'version': u'v4.14.10', + 'vmnumber_overquota_alarm': False, + 'cross_dc': False, + 'vnf_type': u'SSS', + 'vnfd_version': u'V00000001', + 'id': u'sss-vnf-template', + 'name': u'sss-vnf-template'}}
\ No newline at end of file diff --git a/lcm/lcm/nf/vnfs/views.py b/lcm/lcm/nf/vnfs/views.py index a1caefa2..d1818a5a 100644 --- a/lcm/lcm/nf/vnfs/views.py +++ b/lcm/lcm/nf/vnfs/views.py @@ -13,15 +13,14 @@ # limitations under the License. import logging -import uuid from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView -from lcm.pub.database.models import VnfInstModel +from lcm.nf.vnfs.vnf_create.create_vnf_identifier import CreateVnf +from lcm.nf.vnfs.vnf_create.inst_vnf import InstVnf from lcm.pub.utils.jobutil import JobUtil -from lcm.pub.utils.timeutil import now_time from lcm.pub.utils.values import ignore_case_get logger = logging.getLogger(__name__) @@ -30,15 +29,14 @@ logger = logging.getLogger(__name__) class CreateVnfIdentifier(APIView): def post(self, request): logger.debug("CreateVnfIdentifier--post::> %s" % request.data) - self.vnfd_id = ignore_case_get(request.data, "vnfdId") - self.vnf_instance_mame = ignore_case_get(request.data, "vnfInstanceName") - self.description = ignore_case_get(request.data, "vnfInstanceDescription") - self.nf_inst_id = str(uuid.uuid4()) - VnfInstModel(id=self.nf_inst_id, name=self.vnf_instance_mame, vnfd_id=self.vnfd_id, - description=self.description, status='empty', create_time=now_time(), lastuptime=now_time()).save() - vnf_inst = VnfInstModel.objects.get(id=self.nf_inst_id) - logger.debug('id is [%s],name is [%s],vnfd_id is [%s],description is [%s],create_time is [%s],lastuptime is [%s],' % - (vnf_inst.id, vnf_inst.name, vnf_inst.vnfd_id, vnf_inst.description, vnf_inst.create_time, vnf_inst.lastuptime)) + data = {} + data["vnfdId"] = ignore_case_get(request.data, "vnfdId") + data["vnfInstanceName"] = ignore_case_get(request.data, "vnfInstanceName") + data["vnfInstanceDescription"] = ignore_case_get(request.data, "vnfInstanceDescription") + try: + self.nf_inst_id = CreateVnf(data).do_biz() + except Exception as e: + return Response(data={'error': '%s' % e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) rsp = {"vnfInstanceId": self.nf_inst_id} return Response(data=rsp, status=status.HTTP_201_CREATED) @@ -55,7 +53,7 @@ class InstantiateVnf(APIView): job_id = JobUtil.create_job('NF', 'CREATE', nf_inst_id) JobUtil.add_job_status(job_id, 0, "INST_VNF_READY") - # CreateVnfs(data, nf_inst_id, job_id).start() + InstVnf(data, nf_inst_id, job_id).start() rsp = {"jobId": job_id} return Response(data=rsp, status=status.HTTP_202_ACCEPTED) diff --git a/lcm/lcm/nf/vnfs/vnf_create/__init__.py b/lcm/lcm/nf/vnfs/vnf_create/__init__.py new file mode 100644 index 00000000..c7b6818e --- /dev/null +++ b/lcm/lcm/nf/vnfs/vnf_create/__init__.py @@ -0,0 +1,13 @@ +# 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. diff --git a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py new file mode 100644 index 00000000..bb7f80a7 --- /dev/null +++ b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py @@ -0,0 +1,68 @@ +# 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 json +import logging +import uuid + +from lcm.pub.database.models import NfInstModel +from lcm.pub.exceptions import NFLCMException +from lcm.pub.utils.restcall import req_by_msb +from lcm.pub.utils.timeutil import now_time +from lcm.pub.utils.values import ignore_case_get + +logger = logging.getLogger(__name__) +# Query vnfd_rawdata by vnfdid +def vnfd_rawdata_get(vnfdid): + ret = req_by_msb("openoapi/nslcm/v1/vnfpackage/%s" % vnfdid, "GET") + return ret + +class CreateVnf: + def __init__(self, data): + self.data = data + + def do_biz(self): + logger.debug("CreateVnfIdentifier--CreateVnf::> %s" % self.data) + self.vnfd_id = ignore_case_get(self.data, "vnfdId") + self.vnf_instance_mame = ignore_case_get(self.data, "vnfInstanceName") + self.description = ignore_case_get(self.data, "vnfInstanceDescription") + is_exist = NfInstModel.objects.filter(nf_name=self.vnf_instance_mame).exists() + logger.debug("check_ns_inst_name_exist::is_exist=%s" % is_exist) + if is_exist: + raise NFLCMException('VNF is already exist.') + + #get rawdata by vnfd_id + ret = vnfd_rawdata_get(self.vnfd_id) + if ret[0] != 0: + raise NFLCMException('Get vnfd_raw_data failed.') + dst_plan = json.JSONDecoder().decode(ret[1]) + self.vnfd_version = dst_plan['metadata']['vnfd_version'] + self.vendor = dst_plan['metadata']['vendor'] + self.producttype = dst_plan['metadata']['domain_type'] + self.netype = dst_plan['metadata']['vnf_type'] + self.vnfd_model = dst_plan + self.vnfSoftwareVersion = dst_plan['metadata']['version'] + + self.nf_inst_id = str(uuid.uuid4()) + NfInstModel.objects.create(nfinstid=self.nf_inst_id, mnfinstid=self.nf_inst_id, nf_name=self.vnf_instance_mame, + package_id='todo', vnfm_inst_id='todo', version=self.vnfd_version, vendor=self.vendor, + producttype=self.producttype,netype=self.netype, vnfd_model=self.vnfd_model, + instantiationState='NOT_INSTANTIATED', nf_desc=self.description, vnfdid=self.vnfd_id, + vnfSoftwareVersion=self.vnfSoftwareVersion, vnfConfigurableProperties='todo', + localizationLanguage='EN_US',create_time=now_time()) + is_exist = NfInstModel.objects.filter(nf_name=self.vnf_instance_mame).exists() + logger.debug("check_ns_inst_name_exist::is_exist=%s" % is_exist) + vnf_inst = NfInstModel.objects.get(nfinstid=self.nf_inst_id) + logger.debug('id is [%s],name is [%s],vnfd_id is [%s],description is [%s],create_time is [%s]' % + (vnf_inst.nfinstid, vnf_inst.nf_name, vnf_inst.vnfdid, vnf_inst.nf_desc, vnf_inst.create_time)) + return self.nf_inst_id
\ No newline at end of file diff --git a/lcm/lcm/nf/vnfs/create_vnfs.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py index 0dc5216c..cf67fad8 100644 --- a/lcm/lcm/nf/vnfs/create_vnfs.py +++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py @@ -16,27 +16,31 @@ import logging import traceback from threading import Thread +import time + +from lcm.pub.database.models import NfInstModel, JobStatusModel from lcm.pub.exceptions import NFLCMException +from lcm.pub.utils.jobutil import JobUtil logger = logging.getLogger(__name__) -class CreateVnfs(Thread): +class InstVnf(Thread): def __init__(self, data, nf_inst_id, job_id): - super(CreateVnfs, self).__init__() + super(InstVnf, self).__init__() self.data = data self.nf_inst_id = nf_inst_id self.job_id = job_id def run(self): try: - args = {} - self.inst_pre(args) - self.apply_grant(args) - self.apply_res(args) - self.check_res_status(args) - self.wait_inst_finish(args) - self.lcm_notify(args) + self.inst_pre(self.nf_inst_id) + + # self.apply_grant(args) + # self.apply_res(args) + # self.check_res_status(args) + # self.wait_inst_finish(args) + # self.lcm_notify(args) except NFLCMException as e: self.inst_exception(e.message) pass @@ -47,8 +51,20 @@ class CreateVnfs(Thread): def inst_pre(self, args): try: logger.info('inst_pre, args=%s' % args) - # InstPreTask(args).do_biz() - return {'result': '100', 'sessionid': '', 'msg': 'Nf instancing preprocess finish', 'context': {}} + is_exist = NfInstModel.objects.filter(nfinstid=self.nf_inst_id).exists() + logger.debug("check_ns_inst_name_exist::is_exist=%s" % is_exist) + if not is_exist: + JobUtil.add_job_status(self.job_id, 255, "VNF nf_inst_id is not exist.") + raise NFLCMException('VNF nf_inst_id is not exist.') + + vnf_inst = NfInstModel.objects.get(nfinstid=self.nf_inst_id) + if vnf_inst.instantiationState != 'NOT_INSTANTIATED': + JobUtil.add_job_status(self.job_id, 255, "VNF instantiationState is not NOT_INSTANTIATED.") + raise NFLCMException('VNF instantiationState is not NOT_INSTANTIATED.') + + JobUtil.add_job_status(self.job_id, 100, "Instantiate Vnf success.") + is_exist = JobStatusModel.objects.filter(jobid=self.job_id).exists() + logger.debug("check_ns_inst_name_exist::is_exist=%s" % is_exist) except Exception as e: logger.error('Nf instancing preprocess exception=%s' % e.message) logger.error(traceback.format_exc()) diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py index 898bc53b..1fdf21f3 100644 --- a/lcm/lcm/pub/database/models.py +++ b/lcm/lcm/pub/database/models.py @@ -14,17 +14,50 @@ from django.db import models -class VnfInstModel(models.Model): +class NfInstModel(models.Model): class Meta: - db_table = 'GVNFM_VNFINST' + db_table = 'NFINST' - id = models.CharField(db_column='ID', primary_key=True, max_length=200) - name = models.CharField(db_column='NAME', max_length=200) - vnfd_id = models.CharField(db_column='VNFDID', max_length=200) - description = models.CharField(db_column='DESCRIPTION', max_length=255, null=True, blank=True) - status = models.CharField(db_column='STATUS', max_length=200, null=True, blank=True) + nfinstid = models.CharField(db_column='NFINSTID', max_length=200, primary_key=True) + mnfinstid = models.CharField(db_column='M_NFINSTID', max_length=200, blank=True, null=True) + nf_name = models.CharField(db_column='NFNAME', max_length=100, blank=True, null=True) #CreateVnfRequest.vnfInstanceName + template_id = models.CharField(db_column='TEMPLATEID', max_length=200, blank=True, null=True) + vnf_id = models.CharField(db_column='VNFID', max_length=200, blank=True, null=True) + package_id = models.CharField(db_column='PACKAGEID', max_length=200, blank=True, null=True) + vnfm_inst_id = models.CharField(db_column='VNFMINSTID', max_length=200, blank=True, null=True) + multivim = models.IntegerField(db_column='MULTIVIM', default=0) + ns_inst_id = models.CharField(db_column='NSINSTID', max_length=200, blank=True, null=True) + status = models.CharField(db_column='STATUS', max_length=20, blank=True, null=True) + flavour_id = models.CharField(db_column='FLAVOURID', max_length=200, blank=True, null=True) #InstantiateVnfRequest.flavourId + vnf_level = models.CharField(db_column='VNFLEVEL', max_length=200, blank=True, null=True) #InstantiateVnfRequest.instantiationLevelId + location = models.CharField(db_column='LOCATION', max_length=200, blank=True, null=True) + deploy_environment = models.CharField(db_column='DEPLOYENVIRONMENT', max_length=100, blank=True, null=True) + max_vm = models.IntegerField(db_column='MAXVM', blank=True, null=True) + max_cpu = models.IntegerField(db_column='MAXCPU', blank=True, null=True) + max_ram = models.IntegerField(db_column='MAXRAM', blank=True, null=True) + max_hd = models.IntegerField(db_column='MAXHD', blank=True, null=True) + max_shd = models.IntegerField(db_column='MAXSHD', blank=True, null=True) + max_net = models.IntegerField(db_column='MAXNET', blank=True, null=True) + version = models.CharField(db_column='VERSION', max_length=255, null=True) + vendor = models.CharField(db_column='VENDOR', max_length=255, null=True, blank=True) + producttype = models.CharField(db_column='PRODUCTTYPE', max_length=255, null=True) + netype = models.CharField(db_column='NETYPE', max_length=255, null=True) + vnfd_model = models.TextField(db_column='VNFDMODEL', max_length=20000, blank=True, null=True) + input_params = models.TextField(db_column='INPUTPARAMS', max_length=2000, blank=True, null=True) #InstantiateVnfRequest.additionalParams + scale_params = models.TextField(db_column='SCALEPARAMS', max_length=2000, null=True, blank=True) create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True) - lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, null=True, blank=True) + lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, blank=True, null=True) + extension = models.TextField(db_column='EXTENSION', max_length=65535, blank=True, null=True) + initallocatedata = models.TextField(db_column='INITALLOCATEDATA', max_length=20000, blank=True, null=True) + predefinedvm = models.TextField(db_column='PREDEFINEDVM', max_length=65535, blank=True, null=True) + vnfextendtype = models.CharField(db_column='VNFEXTENDTYPE', max_length=255, null=True) + + instantiationState = models.CharField(db_column='INSTANTIATIONSTATE', max_length=200, blank=True, null=True) + nf_desc = models.CharField(db_column='VNFINSTANCEDESC', max_length=200, blank=True, null=True) + vnfdid = models.CharField(db_column='VNFDID', max_length=200, blank=True, null=True) + vnfSoftwareVersion = models.CharField(db_column='VNFSOFTWAREVER', max_length=200, blank=True, null=True) + vnfConfigurableProperties = models.TextField(db_column='VNFCONFIGURABLEPROPERTIES', max_length=20000, blank=True, null=True) + localizationLanguage = models.CharField(db_column='LOCALIZATIONLANGUAGE', max_length=255, null=True) class JobModel(models.Model): class Meta: diff --git a/lcm/lcm/pub/exceptions.py b/lcm/lcm/pub/exceptions.py index 274c0d06..ac7b0c6d 100644 --- a/lcm/lcm/pub/exceptions.py +++ b/lcm/lcm/pub/exceptions.py @@ -14,4 +14,4 @@ class NFLCMException(Exception): - pass + pass
\ No newline at end of file |