diff options
author | 2017-09-22 19:15:18 +0800 | |
---|---|---|
committer | 2017-09-22 12:23:01 +0000 | |
commit | 4cd350df26370bd88abc9b627241becd06509993 (patch) | |
tree | 48d172d3007cc88fbf57ad0bf432e8f0883c9aca | |
parent | 01d5634868823378484715fbcc161d912b98b7c7 (diff) |
Update return value of vnf pkg list
Add vnf pkg downloadUrl
Change-Id: Ic525528a759f46c95b998767273eb13267ad09c4
Issue-Id: VFC-434
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | catalog/packages/nf_package.py | 8 | ||||
-rw-r--r-- | catalog/packages/tests/test_nf.py | 7 |
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 |