- volumns = ignore_case_get(self.data, "volumn_storages")
- #create_vim_res(data, do_notify, do_rollback)
- #create_volumns(volumns)
- JobUtil.add_job_status(self.job_id, 35, 'Nf instancing create resource(volumn_storages) finish')
-
- vls = ignore_case_get(self.data, "vls")
- # create_networks(vls)
- JobUtil.add_job_status(self.job_id, 55, 'Nf instancing create resource(networks) finish')
-
- vdus = ignore_case_get(self.data, "vdus")
- # create_vdus(vdus)
- JobUtil.add_job_status(self.job_id, 75, 'Nf instancing create resource(vms) finish')
-
- JobUtil.add_job_status(self.job_id, 20, 'Nf instancing apply grant finish')
- logger.info("[NF instantiation] create resource end")
-
- def check_res_status(self):
- logger.info("[NF instantiation] confirm all vms are active start")
- vnfcs = self.create_res_result['resource_result']['affectedvnfc']
+ adaptor.create_vim_res('', self.do_notify, self.do_rollback)
+
+ JobUtil.add_job_status(self.job_id, 70, '[NF instantiation] create resource finish')
+ logger.info("[NF instantiation] create resource finish")
+
+ # def check_res_status(self):
+ # logger.info("[NF instantiation] confirm all vms are active start")
+ # vnfcs = self.create_res_result['resource_result']['affectedvnfc']
+ # for vnfc in vnfcs:
+ # if 'success' != vnfc['status']:
+ # logger.error("VNFC_STATUS_IS_NOT_ACTIVE[vduid=%s]" % vnfc['vduId'])
+ # raise NFLCMException(msgid="VNFC_STATUS_IS_NOT_ACTIVE[vduid=%s]", args=vnfc['vduId'])
+ #
+ # JobUtil.add_job_status(self.job_id, 80, 'SAVE_VNFC_TO_DB')
+ # vls = self.create_res_result['resource_result']['affectedvirtuallink']
+ # cps = self.create_res_result['resource_result']['affectedcp']
+ #
+ # for vnfc in vnfcs:
+ # if 'failed' == vnfc['status']:
+ # continue
+ # compute_resource = vnfc['computeresource']
+ # vminst = VmInstModel.objects.filter(resouceid=compute_resource['resourceid']).first()
+ # VNFCInstModel.objects.create(
+ # vnfcinstanceid=vnfc['vnfcinstanceid'],
+ # vduid=vnfc['vduid'],
+ # vdutype=vnfc['vdutype'],
+ # nfinstid=self.nf_inst_id,
+ # vmid=vminst.vmid)
+ # for vl in vls:
+ # if 'failed' == vl['status']:
+ # continue
+ # network_resource = vl['networkresource']
+ # subnet_resource = vl['subnetworkresource']
+ # networkinst = NetworkInstModel.objects.filter(resouceid=network_resource['resourceid']).first()
+ # subnetinst = SubNetworkInstModel.objects.filter(resouceid=subnet_resource['resourceid']).first()
+ # VLInstModel.objects.create(
+ # vlinstanceid=vl['virtuallinkinstanceid'],
+ # vldid=vl['virtuallinkdescid'],
+ # ownertype='0',
+ # ownerid=self.nf_inst_id,
+ # relatednetworkid=networkinst.networkid,
+ # relatedsubnetworkid=subnetinst.subnetworkid)
+ # # # for vs in vss:
+ # for cp in cps:
+ # if 'failed' == cp['status']:
+ # continue
+ # port_resource = cp['portresource']
+ # portinst = PortInstModel.objects.filter(resouceid=port_resource['resourceid']).first()
+ # ttt = portinst.portid
+ # CPInstModel.objects.create(
+ # cpinstanceid=cp['cpinstanceid'],
+ # cpdid=cp['cpdid'],
+ # relatedtype='2',
+ # relatedport=portinst.portid,
+ # ownertype=cp['ownertype'],
+ # ownerid=cp['ownerid'],
+ # vlinstanceid=cp['virtuallinkinstanceid'])
+ # # self.add_job(43, 'INST_DPLY_VM_PRGS')
+ # logger.info("[NF instantiation] confirm all vms are active end")
+
+ def lcm_notify(self):
+ logger.info('[NF instantiation] send notify request to nfvo start')
+ reg_info = NfvoRegInfoModel.objects.filter(vnfminstid=self.vnfm_inst_id).first()
+ # vm_info = VmInstModel.objects.filter(nfinstid=self.nf_inst_id)
+ vmlist = []
+ # nfs = NfInstModel.objects.filter(nfinstid=self.nf_inst_id)
+ # nf = nfs[0]
+ # allocate_data = json.loads(nf.initallocatedata)
+ # vmlist = json.loads(nf.predefinedvm)
+ addition_param = {'vmList': vmlist}
+ affected_vnfc = []
+ vnfcs = VNFCInstModel.objects.filter(nfinstid=self.nf_inst_id)