X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Ftests%2Ftest_descriptor_topics.py;h=0b1d800b03e4b194a02e1461faf28228ce27657d;hp=7f07d965edf21593fdbedacd53b4a250b7232a25;hb=f576eb9b45f9b1e12adbc503681a2194b8ec85aa;hpb=41a52059cbcadb9bb7baebb38ff9503a362ea8e8;ds=sidebyside diff --git a/osm_nbi/tests/test_descriptor_topics.py b/osm_nbi/tests/test_descriptor_topics.py index 7f07d96..0b1d800 100755 --- a/osm_nbi/tests/test_descriptor_topics.py +++ b/osm_nbi/tests/test_descriptor_topics.py @@ -112,9 +112,21 @@ class Test_VnfdTopic(TestCase): self.assertEqual(db_args[1]["_admin"]["projects_read"], [test_pid], "Wrong read-only project list") self.assertEqual(db_args[1]["_admin"]["projects_write"], [test_pid], "Wrong read-write project list") tmp1 = test_vnfd["vdu"][0]["cloud-init-file"] - tmp2 = test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"] + tmp2 = test_vnfd["df"][ + 0 + ]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][ + 0 + ]["execution-environment-list"][ + 0 + ]["juju"] del test_vnfd["vdu"][0]["cloud-init-file"] - del test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"] + del test_vnfd["df"][ + 0 + ]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][ + 0 + ]["execution-environment-list"][ + 0 + ]["juju"] try: self.db.get_one.side_effect = [{"_id": did, "_admin": deepcopy(db_vnfd_content["_admin"])}, None] self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []}) @@ -145,7 +157,13 @@ class Test_VnfdTopic(TestCase): compare_desc(self, test_vnfd, db_args[2], "VNFD") finally: test_vnfd["vdu"][0]["cloud-init-file"] = tmp1 - test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"] = tmp2 + test_vnfd["df"][ + 0 + ]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][ + 0 + ]["execution-environment-list"][ + 0 + ]["juju"] = tmp2 self.db.get_one.side_effect = lambda table, filter, fail_on_empty=None, fail_on_more=None: \ {"_id": did, "_admin": deepcopy(db_vnfd_content["_admin"])} with self.subTest(i=2, t='Check Pyangbind Validation: additional properties'): @@ -182,10 +200,17 @@ class Test_VnfdTopic(TestCase): del test_vnfd["vdu"][0]["cloud-init-file"] with self.assertRaises(EngineException, msg="Accepted non-existent charm in VNF configuration") as e: self.topic.upload_content(fake_session, did, test_vnfd, {}, {"Content-Type": []}) + print(str(e.exception)) self.assertEqual(e.exception.http_code, HTTPStatus.BAD_REQUEST, "Wrong HTTP status code") self.assertIn(norm("{} defined in vnf[id={}] but not present in package".format("charm", test_vnfd["id"])), norm(str(e.exception)), "Wrong exception text") - del test_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][0]["juju"] + del test_vnfd["df"][ + 0 + ]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"][ + 0 + ]["execution-environment-list"][ + 0 + ]["juju"] with self.subTest(i=6, t='Check Input Validation: mgmt-cp'): tmp = test_vnfd["mgmt-cp"] del test_vnfd["mgmt-cp"] @@ -401,8 +426,8 @@ class Test_VnfdTopic(TestCase): self.assertEqual(db_gl_calls[0][0][0], "vnfrs", "Wrong DB topic") # self.assertEqual(db_gl_calls[0][0][1]["vnfd-id"], did, "Wrong DB VNFD ID") # Filter changed after call self.assertEqual(db_gl_calls[1][0][0], "nsds", "Wrong DB topic") - self.assertEqual(db_gl_calls[1][0][1]["constituent-vnfd.ANYINDEX.vnfd-id-ref"], db_vnfd_content["id"], - "Wrong DB NSD constituent-vnfd id-ref") + self.assertEqual(db_gl_calls[1][0][1]["vnfd-id"], db_vnfd_content["id"], + "Wrong DB NSD vnfd-id") self.db.set_one.assert_not_called() fs_del_calls = self.fs.file_delete.call_args_list @@ -413,14 +438,14 @@ class Test_VnfdTopic(TestCase): with self.assertRaises(EngineException, msg="Accepted VNFD in use by VNFR") as e: self.topic.delete(fake_session, did) self.assertEqual(e.exception.http_code, HTTPStatus.CONFLICT, "Wrong HTTP status code") - self.assertIn("there is at least one vnf using this descriptor", norm(str(e.exception)), + self.assertIn("there is at least one vnf instance using this descriptor", norm(str(e.exception)), "Wrong exception text") with self.subTest(i=3, t='Conflict on Delete - VNFD in use by NSD'): self.db.get_list.side_effect = [[], [{"_id": str(uuid4()), "name": "fake-nsd"}]] with self.assertRaises(EngineException, msg="Accepted VNFD in use by NSD") as e: self.topic.delete(fake_session, did) self.assertEqual(e.exception.http_code, HTTPStatus.CONFLICT, "Wrong HTTP status code") - self.assertIn("there is at least one nsd referencing this descriptor", norm(str(e.exception)), + self.assertIn("there is at least one ns package referencing this descriptor", norm(str(e.exception)), "Wrong exception text") with self.subTest(i=4, t='Non-existent VNFD'): excp_msg = "Not found any {} with filter='{}'".format("VNFD", {"_id": did}) @@ -780,11 +805,11 @@ class Test_NsdTopic(TestCase): norm(str(e.exception)), "Wrong exception text") finally: del df['virtual-link-profile'] - with self.subTest(i=6, t='Check Descriptor Dependencies: constituent-vnfd[vnfd-id-ref]'): + with self.subTest(i=6, t='Check Descriptor Dependencies: vnfd-id[]'): self.db.get_one.side_effect = [{"_id": did, "_admin": db_nsd_content["_admin"]}, None] self.db.get_list.return_value = [] try: - with self.assertRaises(EngineException, msg="Accepted wrong constituent VNFD ID reference") as e: + with self.assertRaises(EngineException, msg="Accepted wrong VNFD ID reference") as e: self.topic.upload_content(fake_session, did, test_nsd, {}, {"Content-Type": []}) self.assertEqual(e.exception.http_code, HTTPStatus.CONFLICT, "Wrong HTTP status code") self.assertIn(norm("'vnfd-id'='{}' references a non existing vnfd".format(test_nsd['vnfd-id'][0])), @@ -894,7 +919,7 @@ class Test_NsdTopic(TestCase): with self.assertRaises(EngineException, msg="Accepted NSD in use by NSR") as e: self.topic.delete(fake_session, did) self.assertEqual(e.exception.http_code, HTTPStatus.CONFLICT, "Wrong HTTP status code") - self.assertIn("there is at least one ns using this descriptor", norm(str(e.exception)), + self.assertIn("there is at least one ns instance using this descriptor", norm(str(e.exception)), "Wrong exception text") with self.subTest(i=3, t='Conflict on Delete - NSD in use by NST'): self.db.get_list.side_effect = [[], [{"_id": str(uuid4()), "name": "fake-nst"}]]