summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2017-09-22 12:58:55 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 12:58:55 +0000
commitffc1d2dd06c2a6488a616abed9bc85b030bbccc2 (patch)
treeca5eb7ff0ccd3920b416612131c8c9b3d54a0a39
parentd22aa03168fb05f67b7b2c880657507d4ee55abf (diff)
parent4cd350df26370bd88abc9b627241becd06509993 (diff)
Merge "Update return value of vnf pkg list"
-rw-r--r--catalog/packages/nf_package.py8
-rw-r--r--catalog/packages/tests/test_nf.py7
2 files changed, 11 insertions, 4 deletions
diff --git a/catalog/packages/nf_package.py b/catalog/packages/nf_package.py
index f065d36f..92ad5258 100644
--- a/catalog/packages/nf_package.py
+++ b/catalog/packages/nf_package.py
@@ -19,7 +19,8 @@ import sys
import threading
import traceback
-from catalog.pub.config.config import CATALOG_ROOT_PATH
+from catalog.pub.config.config import CATALOG_ROOT_PATH, CATALOG_URL_PATH
+from catalog.pub.config.config import REG_TO_MSB_REG_PARAM
from catalog.pub.database.models import VnfPackageModel
from catalog.pub.exceptions import CatalogException
from catalog.pub.msapi import sdc
@@ -210,6 +211,11 @@ class NfPackage(object):
pkg_info["vnfdProvider"] = nf_pkg[0].vnfVendor
pkg_info["vnfdVersion"] = nf_pkg[0].vnfdVersion
pkg_info["vnfVersion"] = nf_pkg[0].vnfSoftwareVersion
+ pkg_info["downloadUrl"] = "http://%s:%s/%s/%s" % (
+ REG_TO_MSB_REG_PARAM["nodes"][0]["ip"],
+ REG_TO_MSB_REG_PARAM["nodes"][0]["port"],
+ CATALOG_URL_PATH,
+ nf_pkg[0].vnfPackageUri)
return [0, {"csarId": csar_id,
"packageInfo": pkg_info,
diff --git a/catalog/packages/tests/test_nf.py b/catalog/packages/tests/test_nf.py
index 8547d04d..7940f629 100644
--- a/catalog/packages/tests/test_nf.py
+++ b/catalog/packages/tests/test_nf.py
@@ -317,8 +317,8 @@ class TestNfPackage(TestCase):
self.assertEqual({"csars": [{"csarId":"3", "vnfdId": "4"}]}, resp.data)
def test_nf_pkg_get_one(self):
- VnfPackageModel(vnfPackageId="4", vnfdId="5",
- vnfVendor="6", vnfdVersion="7", vnfSoftwareVersion="8").save()
+ VnfPackageModel(vnfPackageId="4", vnfdId="5", vnfVendor="6",
+ vnfdVersion="7", vnfSoftwareVersion="8", vnfPackageUri="4/4.csar").save()
resp = self.client.get("/api/catalog/v1/vnfpackages/4")
self.assertEqual(resp.status_code, status.HTTP_200_OK)
@@ -327,6 +327,7 @@ class TestNfPackage(TestCase):
"vnfdId": "5",
"vnfdProvider": "6",
"vnfdVersion": "7",
- "vnfVersion": "8"
+ "vnfVersion": "8",
+ "downloadUrl": "http://127.0.0.1:8806/static/catalog/4/4.csar"
},
"imageInfo": []}, resp.data) \ No newline at end of file