X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm.py;h=3b8da7d982cf1d9ce615235b501899b36bfddec2;hb=8069ce54d91918c53ec3bf9f8fd4eee8b6aacb93;hp=8f66055883d3ef2be8446db22e05732c2bd335a0;hpb=29cfa602d40ff4d3e7f611414cf66d4cc62a2be6;p=osm%2FLCM.git diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index 8f66055..3b8da7d 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -23,14 +23,12 @@ import logging import logging.handlers import getopt import sys -import ROclient -import ns -import vim_sdn -import netslice + +from osm_lcm import ROclient, ns, vim_sdn, netslice from time import time, sleep -from lcm_utils import versiontuple, LcmException, TaskRegistry, LcmExceptionExit +from osm_lcm.lcm_utils import versiontuple, LcmException, TaskRegistry, LcmExceptionExit +from osm_lcm import version as lcm_version, version_date as lcm_version_date -# from osm_lcm import version as lcm_version, version_date as lcm_version_date, ROclient from osm_common import dbmemory, dbmongo, fslocal, msglocal, msgkafka from osm_common import version as common_version from osm_common.dbbase import DbException @@ -42,12 +40,12 @@ from n2vc import version as n2vc_version __author__ = "Alfonso Tierno" -min_RO_version = [0, 6, 3] +min_RO_version = "0.6.3" min_n2vc_version = "0.0.2" min_common_version = "0.1.19" # uncomment if LCM is installed as library and installed, and get them from __init__.py -lcm_version = '0.1.41' -lcm_version_date = '2019-06-19' +# lcm_version = '0.1.41' +# lcm_version_date = '2019-06-19' health_check_file = path.expanduser("~") + "/time_last_ping" # TODO find better location for this file @@ -71,8 +69,6 @@ class Lcm: self.consecutive_errors = 0 self.first_start = False - # contains created tasks/futures to be able to cancel - self.lcm_tasks = TaskRegistry() # logging self.logger = logging.getLogger('lcm') # get id @@ -174,6 +170,9 @@ class Lcm: self.logger.critical(str(e), exc_info=True) raise LcmException(str(e)) + # contains created tasks/futures to be able to cancel + self.lcm_tasks = TaskRegistry(self.worker_id, self.db, self.logger) + self.ns = ns.NsLcm(self.db, self.msg, self.fs, self.lcm_tasks, self.ro_config, self.vca_config, self.loop) self.netslice = netslice.NetsliceLcm(self.db, self.msg, self.fs, self.lcm_tasks, self.ro_config, self.vca_config, self.loop) @@ -185,7 +184,7 @@ class Lcm: try: RO = ROclient.ROClient(self.loop, **self.ro_config) RO_version = await RO.get_version() - if RO_version < min_RO_version: + if versiontuple(RO_version) < versiontuple(min_RO_version): raise LcmException("Not compatible osm/RO version '{}.{}.{}'. Needed '{}.{}.{}' or higher".format( *RO_version, *min_RO_version )) @@ -358,7 +357,7 @@ class Lcm: return elif command == "delete": self.lcm_tasks.cancel(topic, vim_id) - task = asyncio.ensure_future(self.vim.delete(vim_id, order_id)) + task = asyncio.ensure_future(self.vim.delete(params, order_id)) self.lcm_tasks.register("vim_account", vim_id, order_id, "vim_delete", task) return elif command == "show": @@ -377,7 +376,7 @@ class Lcm: return elif command == "delete": self.lcm_tasks.cancel(topic, wim_id) - task = asyncio.ensure_future(self.wim.delete(wim_id, order_id)) + task = asyncio.ensure_future(self.wim.delete(params, order_id)) self.lcm_tasks.register("wim_account", wim_id, order_id, "wim_delete", task) return elif command == "show": @@ -396,7 +395,7 @@ class Lcm: return elif command == "delete": self.lcm_tasks.cancel(topic, _sdn_id) - task = asyncio.ensure_future(self.sdn.delete(_sdn_id, order_id)) + task = asyncio.ensure_future(self.sdn.delete(params, order_id)) self.lcm_tasks.register("sdn", _sdn_id, order_id, "sdn_delete", task) return elif command == "edit":