aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFu Jinhua <fu.jinhua@zte.com.cn>2017-09-22 11:13:49 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 11:13:49 +0000
commitd22aa03168fb05f67b7b2c880657507d4ee55abf (patch)
tree6575905edc945583ed4c1a715aad8beaedda0520
parent3258608c3b4d84800092f030b9cf8bd7c38a8099 (diff)
parent01d5634868823378484715fbcc161d912b98b7c7 (diff)
Merge "Update return value of ns pkg list"
-rw-r--r--catalog/packages/ns_package.py11
-rw-r--r--catalog/packages/tests/test_ns.py6
2 files changed, 12 insertions, 5 deletions
diff --git a/catalog/packages/ns_package.py b/catalog/packages/ns_package.py
index 2b88a755..ea5e3896 100644
--- a/catalog/packages/ns_package.py
+++ b/catalog/packages/ns_package.py
@@ -18,7 +18,8 @@ import os
import sys
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 NSPackageModel, VnfPackageModel
from catalog.pub.exceptions import CatalogException
from catalog.pub.msapi import sdc
@@ -168,9 +169,13 @@ class NsPackage(object):
package_info["nsdId"] = csars[0].nsdId
package_info["nsdProvider"] = csars[0].nsdDesginer
package_info["nsdVersion"] = csars[0].nsdVersion
+ package_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,
+ csars[0].nsPackageUri)
- return [0, {"csarId": csar_id,
- "packageInfo": package_info}]
+ return [0, {"csarId": csar_id, "packageInfo": package_info}]
def delete_catalog(self, csar_id):
local_path = os.path.join(CATALOG_ROOT_PATH, csar_id)
diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py
index 3f855afa..f1da3551 100644
--- a/catalog/packages/tests/test_ns.py
+++ b/catalog/packages/tests/test_ns.py
@@ -467,7 +467,8 @@ class TestNsPackage(TestCase):
self.assertEqual({"csars": [{"csarId":"13", "nsdId": "2"}]}, resp.data)
def test_ns_pkg_get_one(self):
- NSPackageModel(nsPackageId="14", nsdId="2", nsdDesginer="3", nsdVersion="4").save()
+ NSPackageModel(nsPackageId="14", nsdId="2", nsdDesginer="3",
+ nsdVersion="4", nsPackageUri="14/14.csar").save()
resp = self.client.get("/api/catalog/v1/nspackages/14")
self.assertEqual(resp.status_code, status.HTTP_200_OK)
@@ -475,7 +476,8 @@ class TestNsPackage(TestCase):
"packageInfo": {
"nsdId": "2",
"nsdProvider": "3",
- "nsdVersion": "4"
+ "nsdVersion": "4",
+ "downloadUrl": "http://127.0.0.1:8806/static/catalog/14/14.csar"
}}, resp.data)