summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-08-17 16:30:19 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-08-17 16:30:19 +0800
commit43fbcbf0ac958e0871caa1e1b7ae4978800b0021 (patch)
tree277f9d3a2985eb7a6fcc97026a1742aa51a03b83
parentcde3ca13b46b82e1dd6f96646f289259e2dbca99 (diff)
Add test case of nf pkg query
Change-Id: I35e5bb9cb7bca4c95d0cbc4f304afff13325edba Issue-Id: VFC-104 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/packages/tests/test_sdc_nf.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/lcm/packages/tests/test_sdc_nf.py b/lcm/packages/tests/test_sdc_nf.py
index 151deeb9..1747be01 100644
--- a/lcm/packages/tests/test_sdc_nf.py
+++ b/lcm/packages/tests/test_sdc_nf.py
@@ -323,7 +323,33 @@ class TestNfPackage(TestCase):
SdcNfPkgDeleteThread(csar_id="3", job_id="2", force_delete=False).run()
self.assert_job_result("2", 255, "NfInst by csar(3) exists, cannot delete.")
"""
-
+
+ def test_nf_pkg_get_all(self):
+ NfPackageModel(uuid="3", nfpackageid="3", vnfdid="4").save()
+
+ resp = self.client.get("/api/nslcm/v1/vnfpackage")
+ self.assertEqual(resp.status_code, status.HTTP_200_OK)
+ self.assertEqual({"csars": [{"csarId":"3", "vnfdId": "4"}]}, resp.data)
+
+ def test_nf_pkg_get_one(self):
+ NfPackageModel(uuid="4", nfpackageid="4", vnfdid="5",
+ vendor="6", vnfdversion="7", vnfversion="8").save()
+ NfInstModel(nfinstid="1", package_id="4", nf_name="3").save()
+
+ resp = self.client.get("/api/nslcm/v1/vnfpackage/4")
+ self.assertEqual(resp.status_code, status.HTTP_200_OK)
+ self.assertEqual({"csarId": "4",
+ "packageInfo": {
+ "vnfdId": "5",
+ "vnfdProvider": "6",
+ "vnfdVersion": "7",
+ "vnfVersion": "8"
+ },
+ "imageInfo": [],
+ "vnfInstanceInfo": [{
+ "vnfInstanceId": "1", "vnfInstanceName": "3"
+ }]}, resp.data)
+