X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=lcm%2Flcm%2Fnf%2Fvnfs%2Fvnf_create%2Fcreate_vnf_identifier.py;h=a91c8d02bf13c2f73e2a9a2235ab9fcb8bef0a57;hb=413288222272a379b87ff89aee95f2333e025da1;hp=3a420639d8f6677720228d82ea42399952fcc921;hpb=cae3299b6c58d67510467f7587f7315ef3f4f7d9;p=vfc%2Fgvnfm%2Fvnflcm.git diff --git a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py index 3a420639..a91c8d02 100644 --- a/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py +++ b/lcm/lcm/nf/vnfs/vnf_create/create_vnf_identifier.py @@ -15,6 +15,7 @@ import json import logging import uuid +from lcm.pub.aaiapi.aai import create_vnf from lcm.pub.database.models import NfInstModel from lcm.pub.exceptions import NFLCMException from lcm.pub.msapi.catalog import query_rawdata_from_catalog @@ -47,12 +48,12 @@ class CreateVnf: nf_inst_id = str(uuid.uuid4()) try: self.package_info = get_packageinfo_by_vnfdid(self.vnfd_id) - for val in self.package_info: + for val in ignore_case_get(self.package_info, "csars"): if self.vnfd_id == ignore_case_get(val, "vnfdId"): self.package_id = ignore_case_get(val, "csarId") break - raw_data = query_rawdata_from_catalog(self.package_id, self.data) + raw_data = query_rawdata_from_catalog(self.package_id) self.vnfd = toscautil.convert_vnfd_model(raw_data["rawData"]) # convert to inner json self.vnfd = json.JSONDecoder().decode(self.vnfd) @@ -66,6 +67,16 @@ class CreateVnf: version=version, vendor=vendor, netype=netype, vnfd_model=vnfd_model, status='NOT_INSTANTIATED', nf_desc=self.description, vnfdid=self.vnfd_id, vnfSoftwareVersion=vnfsoftwareversion, create_time=now_time()) + data = { + "vnf-id": nf_inst_id, + "vnf-name": self.vnf_instance_mame, + "vnf-type": "INFRA", + "in-maint": "true", + "is-closed-loop-disabled": "false" + } + create_vnf(nf_inst_id, data) + except NFLCMException as e: + logger.debug('Create VNF instance[%s] to AAI failed' % nf_inst_id) except: NfInstModel.objects.create(nfinstid=nf_inst_id, nf_name=self.vnf_instance_mame, package_id='', version='', vendor='', netype='', vnfd_model='',