summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-10-31 21:56:34 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-10-31 22:33:15 +0800
commit41b931ef7637d75abdede1064b5e9d5af4d107c4 (patch)
tree4fdbf5d8896c91fffcd34d305cf6178354c8d785
parent430d91f1231ff0d8867720958b4ff96682ba6412 (diff)
Fix vfc-svnfm-driver convert bug
Change-Id: If0a2cf56bd8b097e414d0657a2ea6c4a0b1ffbb0 Issue-ID: VFC-558 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--zte/vmanager/driver/interfaces/tests.py38
-rw-r--r--zte/vmanager/driver/interfaces/views.py4
2 files changed, 25 insertions, 17 deletions
diff --git a/zte/vmanager/driver/interfaces/tests.py b/zte/vmanager/driver/interfaces/tests.py
index 3dde266b..715e2d9a 100644
--- a/zte/vmanager/driver/interfaces/tests.py
+++ b/zte/vmanager/driver/interfaces/tests.py
@@ -80,22 +80,28 @@ class InterfacesTest(TestCase):
u'operationalState': u'Disabled',
u'createTime': u'2016-10-31 16:21:11',
u'size': u'12.1 MB'}}
- packageInfo = {u'usageState': u'NotInUse',
- u'onBoardState': u'onBoarded',
- u'name': u'VFW',
- u'format': u'yaml',
- u'provider': u'ZTE',
- u'vnfdProvider': u'zte',
- u'vnfdId': u'vcpe_vfw_zte_1_0',
- u'deletionPending': False,
- u'version': u'v1.0',
- u'vnfVersion': u'1.0',
- u'vnfdVersion': u'1.0.0',
- u'processState': u'normal',
- u'modifyTime': u'2016-10-31 16:21:32',
- u'downloadUri': u'http://192.168.233.226:80/files/catalog-http/NFAR/ZTE/VFW/v1.0/VFW.csar',
- u'operationalState': u'Disabled',
- u'createTime': u'2016-10-31 16:21:11', u'size': u'12.1 MB'}
+ packageInfo = {
+ "size": "12.1 MB",
+ "usageState": "NotInUse",
+ "onBoardState": "onBoarded",
+ "name": "VFW",
+ "format": "yaml",
+ "packageInfo": {
+ "vnfdModel": json.dumps({"metadata": {"name": "ZTE-MME-FIX-VL"}})
+ },
+ "modifyTime": "2016-10-31 16:21:32",
+ "vnfdProvider": "zte",
+ "vnfdId": "vcpe_vfw_zte_1_0",
+ "deletionPending": False,
+ "version": "v1.0",
+ "vnfVersion": "1.0",
+ "vnfdVersion": "1.0.0",
+ "processState": "normal",
+ "provider": "ZTE",
+ "operationalState": "Disabled",
+ "createTime": "2016-10-31 16:21:11",
+ "downloadUri": "http://192.168.233.226:80/files/catalog-http/NFAR/ZTE/VFW/v1.0/VFW.csar"
+ }
inst_response = {
u'vnfInstanceId': u'8',
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index d3f80fc3..183b4c52 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -126,7 +126,9 @@ def instantiate_vnf(request, *args, **kwargs):
data["NFVOID"] = 1
data["VNFMID"] = vnfm_id
# vnfdId = ignorcase_get(packageInfo, "vnfdId")
- vnfd_name = ignorcase_get(packageInfo, "name")
+ vnfdModel = json.loads(ignorcase_get(packageInfo, "vnfdModel"))
+ metadata = ignorcase_get(vnfdModel, "metadata")
+ vnfd_name = ignorcase_get(metadata, "name")
# TODO convert sdc vnf package to vnf vender package
from urlparse import urlparse
vnfm_ip = urlparse(ignorcase_get(vnfm_info, "url")).netloc.split(':')[0]