Feature 10929: LCM saga, Milestone 1.
[osm/LCM.git] / osm_lcm / tests / test_ns.py
index 56d7ffa..1082648 100644 (file)
@@ -24,6 +24,8 @@ import copy
 from os import getenv
 from osm_lcm import ns
 from osm_common.msgkafka import MsgKafka
+
+from osm_lcm.data_utils.lcm_config import LcmCfg
 from osm_lcm.lcm_utils import TaskRegistry
 from osm_lcm.ng_ro import NgRoClient
 from osm_lcm.data_utils.database.database import Database
@@ -54,7 +56,7 @@ It allows, if some testing ENV are supplied, testing without mocking some extern
     OSMLCM_RO_XXX: configuration of RO
 """
 
-lcm_config = {
+lcm_config_dict = {
     "global": {"loglevel": "DEBUG"},
     "timeout": {},
     "VCA": {  # TODO replace with os.get_env to get other configurations
@@ -66,7 +68,7 @@ lcm_config = {
         "ca_cert": getenv("OSMLCM_VCA_CACERT", None),
         "apiproxy": getenv("OSMLCM_VCA_APIPROXY", "192.168.1.1"),
     },
-    "ro_config": {
+    "RO": {
         "uri": "http://{}:{}/openmano".format(
             getenv("OSMLCM_RO_HOST", "ro"), getenv("OSMLCM_RO_PORT", "9090")
         ),
@@ -76,6 +78,11 @@ lcm_config = {
         "ng": True,
     },
 }
+
+lcm_config = LcmCfg()
+lcm_config.set_from_dict(lcm_config_dict)
+lcm_config.transform()
+
 nsr_id = descriptors.test_ids["TEST-A"]["ns"]
 nslcmop_id = descriptors.test_ids["TEST-A"]["update"]
 vnfr_id = "6421c7c9-d865-4fb4-9a13-d4275d243e01"
@@ -295,7 +302,7 @@ class TestMyNS(asynctest.TestCase):
         # Mock RO
         if not getenv("OSMLCMTEST_RO_NOMOCK"):
             self.my_ns.RO = asynctest.Mock(
-                NgRoClient(self.loop, **lcm_config["ro_config"])
+                NgRoClient(self.loop, **lcm_config.RO.to_dict())
             )
             # 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=[])