summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-03-28 11:34:36 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-03-28 11:34:36 +0800
commit37feb131a0d7dc25522ff52150d215ac284dd4bd (patch)
treec13b12dc1c8f96bc89da3ab5e6a8a8d0137aceb7
parent3a3c17eab2bc490b9468c6ff0c0a248081ecab9f (diff)
Find some bugs and modify the codes
Change-Id: Id4c023d66a63579bda682d6cfefec3341f3eaf6e Issue-Id: GVNFM-44 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py16
-rw-r--r--lcm/lcm/pub/database/models.py2
-rw-r--r--lcm/lcm/pub/utils/values.py3
3 files changed, 12 insertions, 9 deletions
diff --git a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
index 3078dbda..4489f608 100644
--- a/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
+++ b/lcm/lcm/nf/vnfs/vnf_create/inst_vnf.py
@@ -26,7 +26,7 @@ from lcm.pub.msapi.gvnfmdriver import apply_grant_to_nfvo, notify_lcm_to_nfvo, g
from lcm.pub.utils import toscautil
from lcm.pub.utils.jobutil import JobUtil
from lcm.pub.utils.timeutil import now_time
-from lcm.pub.utils.values import ignore_case_get, get_none, get_boolean
+from lcm.pub.utils.values import ignore_case_get, get_none, get_boolean, get_integer
from lcm.pub.vimapi import adaptor
logger = logging.getLogger(__name__)
@@ -118,7 +118,7 @@ class InstVnf(Thread):
res_index += 1
logger.info('content_args=%s' % content_args)
- apply_result = apply_grant_to_nfvo(content_args)
+ apply_result = apply_grant_to_nfvo(json.dumps(content_args))
vim_info = ignore_case_get(apply_result, "vim")
for vdu in ignore_case_get(self.vnfd_info, "vdus"):
@@ -197,7 +197,7 @@ class InstVnf(Thread):
'affectedCp': affected_cp
}
logger.info('content_args=%s' % content_args)
- resp = notify_lcm_to_nfvo(content_args)
+ resp = notify_lcm_to_nfvo(json.dumps(content_args))
logger.info('[NF instantiation] get lcm response %s' % resp)
logger.info('[NF instantiation] send notify request to nfvo end')
@@ -291,11 +291,11 @@ class InstVnf(Thread):
vimid=ignore_case_get(ret, "vimId"),
resouceid=ignore_case_get(ret, "id"),
tenant=ignore_case_get(ret, "tenantId"),
- vcpu=ignore_case_get(ret, "vcpu"),
- memory=ignore_case_get(ret, "memory"),
- disk=ignore_case_get(ret, "disk"),
- ephemeral=ignore_case_get(ret, "ephemeral"),
- swap=ignore_case_get(ret, "swap"),
+ vcpu=get_integer(ignore_case_get(ret, "vcpu")),
+ memory=get_integer(ignore_case_get(ret, "memory")),
+ disk=get_integer(ignore_case_get(ret, "disk")),
+ ephemeral=get_integer(ignore_case_get(ret, "ephemeral")),
+ swap=get_integer(ignore_case_get(ret, "swap")),
isPublic=get_boolean(ignore_case_get(ret, "isPublic")),
extraspecs=ignore_case_get(ret, "extraSpecs"),
is_predefined=ignore_case_get(ret, "returnCode"),
diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py
index 0108e836..826ba748 100644
--- a/lcm/lcm/pub/database/models.py
+++ b/lcm/lcm/pub/database/models.py
@@ -164,7 +164,7 @@ class FlavourInstModel(models.Model):
ephemeral = models.IntegerField(db_column='EPHEMERAL', null=True)
swap = models.IntegerField(db_column='SWAP', null=True)
isPublic = models.IntegerField(db_column='ISPUBLIC', null=True)
- extraspecs = models.CharField(db_column='EXTRASPECS', max_length=255)
+ extraspecs = models.TextField(db_column='EXTRASPECS', max_length=4096)
instid = models.CharField(db_column='INSTID', max_length=255)
create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True)
is_predefined = models.IntegerField(db_column='ISPREDEFINED', default=0, null=True)
diff --git a/lcm/lcm/pub/utils/values.py b/lcm/lcm/pub/utils/values.py
index 19b198ee..4b7855c0 100644
--- a/lcm/lcm/pub/utils/values.py
+++ b/lcm/lcm/pub/utils/values.py
@@ -31,3 +31,6 @@ def get_none(val, def_val=""):
def get_boolean(val, def_val=0):
return 1 if val else 0
+
+def get_integer(val, def_val=0):
+ return val if val else 0 \ No newline at end of file