X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Ftests%2Ftest_ns.py;h=3befd6bd4e2875cc371a5ef770e0d2a1b174f887;hb=acde94fe034c55a740a5ec883a2bab71a31c0b7c;hp=57398d837441c52628e9ef3a00f5994d4d89dbeb;hpb=626e0150294da773c136d444d000e1a8b4521dea;p=osm%2FLCM.git diff --git a/osm_lcm/tests/test_ns.py b/osm_lcm/tests/test_ns.py index 57398d8..3befd6b 100644 --- a/osm_lcm/tests/test_ns.py +++ b/osm_lcm/tests/test_ns.py @@ -12,7 +12,7 @@ # under the License. # # For those usages not covered by the Apache License, Version 2.0 please -# contact: esousa@whitestack.com or alfonso.tiernosepulveda@telefonica.com +# contact: alfonso.tiernosepulveda@telefonica.com ## @@ -51,21 +51,23 @@ It allows, if some testing ENV are supplied, testing without mocking some extern OSMLCM_RO_XXX: configuration of RO """ - -vca_config = { # TODO replace with os.get_env to get other configurations - "host": getenv("OSMLCM_VCA_HOST", "vca"), - "port": getenv("OSMLCM_VCA_PORT", 17070), - "user": getenv("OSMLCM_VCA_USER", "admin"), - "secret": getenv("OSMLCM_VCA_SECRET", "vca"), - "pubkey": getenv("OSMLCM_VCA_PUBKEY", None), - 'cacert': getenv("OSMLCM_VCA_CACERT", None) -} - -ro_config = { - "endpoint_url": "http://{}:{}/openmano".format(getenv("OSMLCM_RO_HOST", "ro"), getenv("OSMLCM_RO_PORT", "9090")), - "tenant": getenv("OSMLCM_RO_TENANT", "osm"), - "logger_name": "lcm.ROclient", - "loglevel": "DEBUG", +lcm_config = { + "timeout": {}, + "VCA": { # TODO replace with os.get_env to get other configurations + "host": getenv("OSMLCM_VCA_HOST", "vca"), + "port": getenv("OSMLCM_VCA_PORT", 17070), + "user": getenv("OSMLCM_VCA_USER", "admin"), + "secret": getenv("OSMLCM_VCA_SECRET", "vca"), + "public_key": getenv("OSMLCM_VCA_PUBKEY", None), + 'ca_cert': getenv("OSMLCM_VCA_CACERT", None) + }, + "ro_config": { + "endpoint_url": "http://{}:{}/openmano".format(getenv("OSMLCM_RO_HOST", "ro"), + getenv("OSMLCM_RO_PORT", "9090")), + "tenant": getenv("OSMLCM_RO_TENANT", "osm"), + "logger_name": "lcm.ROclient", + "loglevel": "DEBUG", + } } @@ -166,7 +168,8 @@ class TestMyNS(asynctest.TestCase): self.lcm_tasks.lookfor_related.return_value = ("", []) # Create NsLCM class - self.my_ns = NsLcm(self.db, self.msg, self.fs, self.lcm_tasks, ro_config, vca_config, self.loop) + self.my_ns = NsLcm(self.db, self.msg, self.fs, self.lcm_tasks, lcm_config, self.loop) + self.my_ns._wait_dependent_n2vc = asynctest.CoroutineMock() # Mock logging if not getenv("OSMLCMTEST_LOGGING_NOMOCK"): @@ -198,7 +201,7 @@ class TestMyNS(asynctest.TestCase): # Mock RO if not getenv("OSMLCMTEST_RO_NOMOCK"): - # self.my_ns.RO = asynctest.Mock(ROclient.ROClient(self.loop, **ro_config)) + # self.my_ns.RO = asynctest.Mock(ROclient.ROClient(self.loop, **lcm_config["ro_config"])) # TODO first time should be empty list, following should return a dict self.my_ns.RO.get_list = asynctest.CoroutineMock(self.my_ns.RO.get_list, return_value=[]) self.my_ns.RO.create = asynctest.CoroutineMock(self.my_ns.RO.create, side_effect=self._ro_create()) @@ -472,11 +475,13 @@ class TestMyNS(asynctest.TestCase): db_nsr = self.db.get_list("nsrs")[1] db_vnfr = self.db.get_list("vnfrs")[2] db_vnfrs = {"multikdu": db_vnfr} + db_vnfd = self.db.get_list("vnfds")[1] + db_vnfds = {db_vnfd["_id"]: db_vnfd} nsr_id = db_nsr["_id"] # nslcmop_id = self.db.get_list("nslcmops")[1]["_id"] logging_text = "KDU" self.my_ns.k8sclusterhelm.install = asynctest.CoroutineMock(return_value="k8s_id") - await self.my_ns.deploy_kdus(logging_text, nsr_id, db_nsr, db_vnfrs) + await self.my_ns.deploy_kdus(logging_text, nsr_id, db_nsr, db_vnfrs, db_vnfds) db_nsr = self.db.get_list("nsrs")[1] self.assertIn("K8s", db_nsr["_admin"]["deployed"], "K8s entry not created at '_admin.deployed'") self.assertIsInstance(db_nsr["_admin"]["deployed"]["K8s"], list, "K8s entry is not of type list")