diff options
author | 2017-09-23 09:07:55 +0800 | |
---|---|---|
committer | 2017-09-23 09:07:55 +0800 | |
commit | b5250240f5c8faddf449e850ef1bff7091ae3044 (patch) | |
tree | b8137f22a3e13328bfbd0bb8d81153dd89723a93 | |
parent | 8b96df4bb188bb8f46ef8258a2d39dbc2d581ff9 (diff) |
Update retValue for vnf pkg list
Add csarName item
Change-Id: Ibb0a9efd4af3f20a88a5d3946dca4d887b06603f
Issue-Id: VFC-434
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | catalog/packages/nf_package.py | 6 | ||||
-rw-r--r-- | catalog/packages/tests/test_nf.py | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/catalog/packages/nf_package.py b/catalog/packages/nf_package.py index 92ad5258..f86f679e 100644 --- a/catalog/packages/nf_package.py +++ b/catalog/packages/nf_package.py @@ -132,7 +132,7 @@ class NfDistributeThread(threading.Thread): vnfSoftwareVersion=vnfd["metadata"].get("version", "undefined"), vnfdModel=vnfd_json, localFilePath=local_file_name, - vnfPackageUri="%s/%s" % (self.csar_id, csar_name) + vnfPackageUri=csar_name ).save() JobUtil.add_job_status(self.job_id, 100, "CSAR(%s) distribute successfully." % self.csar_id) @@ -211,10 +211,12 @@ 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" % ( + pkg_info["csarName"] = nf_pkg[0].vnfPackageUri + pkg_info["downloadUrl"] = "http://%s:%s/%s/%s/%s" % ( REG_TO_MSB_REG_PARAM["nodes"][0]["ip"], REG_TO_MSB_REG_PARAM["nodes"][0]["port"], CATALOG_URL_PATH, + csar_id, nf_pkg[0].vnfPackageUri) return [0, {"csarId": csar_id, diff --git a/catalog/packages/tests/test_nf.py b/catalog/packages/tests/test_nf.py index 7940f629..fd2cc7db 100644 --- a/catalog/packages/tests/test_nf.py +++ b/catalog/packages/tests/test_nf.py @@ -318,7 +318,7 @@ class TestNfPackage(TestCase): def test_nf_pkg_get_one(self): VnfPackageModel(vnfPackageId="4", vnfdId="5", vnfVendor="6", - vnfdVersion="7", vnfSoftwareVersion="8", vnfPackageUri="4/4.csar").save() + vnfdVersion="7", vnfSoftwareVersion="8", vnfPackageUri="4.csar").save() resp = self.client.get("/api/catalog/v1/vnfpackages/4") self.assertEqual(resp.status_code, status.HTTP_200_OK) @@ -328,6 +328,7 @@ class TestNfPackage(TestCase): "vnfdProvider": "6", "vnfdVersion": "7", "vnfVersion": "8", + "csarName": "4.csar", "downloadUrl": "http://127.0.0.1:8806/static/catalog/4/4.csar" }, "imageInfo": []}, resp.data)
\ No newline at end of file |