summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2017-11-14 09:55:57 +0000
committerGerrit Code Review <gerrit@onap.org>2017-11-14 09:55:57 +0000
commit72f7b1a361eb208cfc4fac6556f9dd025234a07a (patch)
tree14fcc776536faff33486f4ae9e3b2ab4be5a9a3b
parentdbbb41554934907c5756aebc0f81a6f572305010 (diff)
parent6122e08b378c387b37c71f13f7efbb068125240e (diff)
Merge "Fix vfc-catalog convert bug"
-rw-r--r--catalog/packages/ns_package.py1
-rw-r--r--catalog/packages/tests/test_ns.py4
-rw-r--r--catalog/pub/utils/toscaparser/nsdmodel.py4
3 files changed, 6 insertions, 3 deletions
diff --git a/catalog/packages/ns_package.py b/catalog/packages/ns_package.py
index 5474a472..4b7ec927 100644
--- a/catalog/packages/ns_package.py
+++ b/catalog/packages/ns_package.py
@@ -174,6 +174,7 @@ class NsPackage(object):
package_info["nsdProvider"] = csars[0].nsdDesginer
package_info["nsdVersion"] = csars[0].nsdVersion
package_info["csarName"] = csars[0].nsPackageUri
+ package_info["nsdModel"] = csars[0].nsdModel
package_info["downloadUrl"] = "http://%s:%s/%s/%s/%s" % (
REG_TO_MSB_REG_PARAM["nodes"][0]["ip"],
REG_TO_MSB_REG_PARAM["nodes"][0]["port"],
diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py
index ceb5ac31..d4c6ce99 100644
--- a/catalog/packages/tests/test_ns.py
+++ b/catalog/packages/tests/test_ns.py
@@ -478,7 +478,8 @@ class TestNsPackage(TestCase):
self.assertEqual(expect_data, resp.data)
def test_ns_pkg_get_one(self):
- NSPackageModel(nsPackageId="14", nsdId="2", nsdDesginer="3", nsdVersion="4", nsPackageUri="14.csar").save()
+ NSPackageModel(nsPackageId="14", nsdId="2", nsdDesginer="3", nsdVersion="4",
+ nsPackageUri="14.csar", nsdModel="").save()
resp = self.client.get("/api/catalog/v1/nspackages/14")
self.assertEqual(resp.status_code, status.HTTP_200_OK)
expect_data = {
@@ -489,6 +490,7 @@ class TestNsPackage(TestCase):
"nsdProvider": "3",
"nsdVersion": "4",
"csarName": "14.csar",
+ "nsdModel": "",
"downloadUrl": "http://127.0.0.1:8806/static/catalog/14/14.csar"
}
}
diff --git a/catalog/pub/utils/toscaparser/nsdmodel.py b/catalog/pub/utils/toscaparser/nsdmodel.py
index e4291884..fa8b8410 100644
--- a/catalog/pub/utils/toscaparser/nsdmodel.py
+++ b/catalog/pub/utils/toscaparser/nsdmodel.py
@@ -89,8 +89,8 @@ class EtsiNsdInfoModel(BaseInfoModel):
for key in vnf['properties'].iterkeys():
if key.endswith('_version'):
vnf['properties'].update(version=vnf['properties'].pop(key))
- # if key.endswith('_id'):
- # vnf['properties'].update(id=vnf['properties'].pop(key))
+ if key.endswith('_id'):
+ vnf['properties'].update(id=vnf['properties'].pop(key))
if key.endswith('_csarProvider'):
vnf['properties'].update(csarProvider=vnf['properties'].pop(key))
if key.endswith('_csarVersion'):