summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-02-13 19:05:34 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-02-13 19:05:34 +0800
commit5cdc75f82d1aab0294ef8b56b7963b2075a9ebbd (patch)
tree059afa53eac6ffe96fb03447023c0901b3027d8a
parenta42d2a3242d937de294209f994204c8ab048a0c8 (diff)
call vim dirver adapter create res
Change-Id: Icbb807cd2c1688152b47742905621e49b1944225 Issue-Id: GVNFM-30 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py83
1 files changed, 83 insertions, 0 deletions
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index 6cbfeace..c2da9cc2 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -280,6 +280,89 @@ class InstVnf(Thread):
JobUtil.add_job_status(self.job_id, 255, error_msg)
# JobUtil.add_job_status(self.job_id, 255, 'VNF instantiation failed, detail message: %s' % error_msg, 0)
+ def do_notify(res_type, progress, ret):
+ # logger.info('add job, progress=%s, msgid=%s, args=%s' % (progress, msgid, args_))
+ progress = 20 + int(progress/2) #20-70
+ if res_type == adaptor.RES_VOLUME:
+ logger.info('Create vloumns!')
+
+ # if ret['rescode'] == 0:#new create
+ # self.inst_resource['volumn'].append({"vim_id": "1"}, {"res_id": "2"})
+ self.inst_resource['volumn'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create vloumns!')
+ StorageInstModel.objects.create(
+ storageid='1',
+ vimid='1',
+ resouceid='1',
+ name='40G',
+ tenant='admin',
+ insttype=0,
+ instid=self.nf_inst_id)
+ elif res_type == adaptor.RES_NETWORK:
+ logger.info('Create networks!')
+ # self.inst_resource['network'] = ret
+ self.inst_resource['network'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create networks!')
+ NetworkInstModel.objects.create(
+ networkid='1',
+ vimid='1',
+ resouceid='1',
+ name='pnet_network',
+ tenant='admin',
+ insttype=0,
+ instid=self.nf_inst_id)
+ elif res_type == adaptor.RES_SUBNET:
+ logger.info('Create subnets!')
+ # self.inst_resource['subnet'] = ret
+ self.inst_resource['subnet'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create subnets!')
+ SubNetworkInstModel.objects.create(
+ subnetworkid='1',
+ vimid='1',
+ resouceid='1',
+ networkid='1',
+ name='sub_pnet',
+ tenant='admin',
+ insttype=0,
+ instid=self.nf_inst_id)
+ elif res_type == adaptor.RES_PORT:
+ logger.info('Create ports!')
+ # self.inst_resource['port'] = ret
+ self.inst_resource['port'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create ports!')
+ PortInstModel.objects.create(
+ portid='1',
+ networkid='1',
+ subnetworkid='1',
+ vimid='1',
+ resouceid='1',
+ name='aaa_pnet_cp',
+ tenant='admin',
+ insttype=0,
+ instid=self.nf_inst_id)
+ elif res_type == adaptor.RES_FLAVOR:
+ logger.info('Create flavors!')
+ # self.inst_resource['flavor'] = ret
+ self.inst_resource['flavor'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create flavors!')
+ FlavourInstModel.objects.create(
+ falavourid='1',
+ name='1',
+ vcpu='1',
+ extraspecs='1',
+ instid=self.nf_inst_id)
+ elif res_type == adaptor.RES_VM:
+ logger.info('Create vms!')
+ self.inst_resource['vm'].append({"vim_id": "1"}, {"res_id": "2"})
+ JobUtil.add_job_status(self.job_id, progress, 'Create vms!')
+ VmInstModel.objects.create(
+ vmid="1",
+ vimid="1",
+ resouceid="11",
+ insttype=0,
+ instid=self.nf_inst_id,
+ vmname="test_01",
+ operationalstate=1)
def do_rollback(self, progress, msgid, args_=None):
# logger.info('add job, progress=%s, msgid=%s, args=%s' % (progress, msgid, args_))