diff options
author | 2017-09-23 09:04:28 +0800 | |
---|---|---|
committer | 2017-09-23 09:04:28 +0800 | |
commit | 8b96df4bb188bb8f46ef8258a2d39dbc2d581ff9 (patch) | |
tree | 131eec7dec8cd9fa4eb0a4d681d5ba5e7db763ac | |
parent | ffc1d2dd06c2a6488a616abed9bc85b030bbccc2 (diff) |
Update retValue for ns pkg list
Add csarName item
Change-Id: I0fd880f6e845fd957780b8d6544e8e91b3fcd477
Issue-Id: VFC-433
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | catalog/packages/ns_package.py | 6 | ||||
-rw-r--r-- | catalog/packages/tests/test_ns.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/catalog/packages/ns_package.py b/catalog/packages/ns_package.py index ea5e3896..bdd7bdc7 100644 --- a/catalog/packages/ns_package.py +++ b/catalog/packages/ns_package.py @@ -137,7 +137,7 @@ class NsPackage(object): nsdDesginer=nsd["metadata"].get("vendor", "undefined"), nsdDescription=nsd["metadata"].get("description", ""), nsdVersion=nsd["metadata"].get("version", "undefined"), - nsPackageUri="%s/%s" % (csar_id, csar_name), + nsPackageUri=csar_name, sdcCsarId=csar_id, localFilePath=local_file_name, nsdModel=nsd_json @@ -169,10 +169,12 @@ 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" % ( + package_info["csarName"] = csars[0].nsPackageUri + 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"], CATALOG_URL_PATH, + csar_id, csars[0].nsPackageUri) return [0, {"csarId": csar_id, "packageInfo": package_info}] diff --git a/catalog/packages/tests/test_ns.py b/catalog/packages/tests/test_ns.py index f1da3551..de4555e1 100644 --- a/catalog/packages/tests/test_ns.py +++ b/catalog/packages/tests/test_ns.py @@ -464,11 +464,12 @@ class TestNsPackage(TestCase): resp = self.client.get("/api/catalog/v1/nspackages") self.assertEqual(resp.status_code, status.HTTP_200_OK) - self.assertEqual({"csars": [{"csarId":"13", "nsdId": "2"}]}, resp.data) + self.assertEqual({"csars": [{"csarId":"13", "nsdId": "2", + "nsdProvider": "3", "nsdVersion": "4"}]}, resp.data) def test_ns_pkg_get_one(self): NSPackageModel(nsPackageId="14", nsdId="2", nsdDesginer="3", - nsdVersion="4", nsPackageUri="14/14.csar").save() + nsdVersion="4", nsPackageUri="14.csar").save() resp = self.client.get("/api/catalog/v1/nspackages/14") self.assertEqual(resp.status_code, status.HTTP_200_OK) @@ -477,6 +478,7 @@ class TestNsPackage(TestCase): "nsdId": "2", "nsdProvider": "3", "nsdVersion": "4", + "csarName": "14.csar", "downloadUrl": "http://127.0.0.1:8806/static/catalog/14/14.csar" }}, resp.data) |