fix(configuration): juju related changes and configuration issues
[osm/NBI.git] / osm_nbi / tests / test_descriptor_topics.py
index 7f07d96..b52b6e0 100755 (executable)
@@ -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"]
             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["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": []})
             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
                 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'):
         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": []})
             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")
             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"]
         with self.subTest(i=6, t='Check Input Validation: mgmt-cp'):
             tmp = test_vnfd["mgmt-cp"]
             del test_vnfd["mgmt-cp"]