X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm.py;h=731488cf92119bedcd0bd77d06a4bedfec478fd8;hb=80bcf1c9208bd3229beb295a66a98e0cc3c3d150;hp=6202b328b2f977dc0b8676e80647605ac9c499c4;hpb=40365e81b483a1670ae2bd13f1b0b284e4b1af87;p=osm%2FLCM.git diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index 6202b32..731488c 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -29,7 +29,7 @@ import logging.handlers import getopt import sys -from osm_lcm import ns, prometheus, vim_sdn, netslice +from osm_lcm import ns, vim_sdn, netslice from osm_lcm.ng_ro import NgRoException, NgRoClient from osm_lcm.ROclient import ROClient, ROClientException @@ -215,20 +215,6 @@ class Lcm: # contains created tasks/futures to be able to cancel self.lcm_tasks = TaskRegistry(self.worker_id, self.logger) - if self.config.get("tsdb") and self.config["tsdb"].get("driver"): - if self.config["tsdb"]["driver"] == "prometheus": - self.prometheus = prometheus.Prometheus( - self.config["tsdb"], self.worker_id, self.loop - ) - else: - raise LcmException( - "Invalid configuration param '{}' at '[tsdb]':'driver'".format( - config["tsdb"]["driver"] - ) - ) - else: - self.prometheus = None - async def check_RO_version(self): tries = 14 last_error = None @@ -453,6 +439,14 @@ class Lcm: task = asyncio.ensure_future(self.ns.action(nsr_id, nslcmop_id)) self.lcm_tasks.register("ns", nsr_id, nslcmop_id, "ns_action", task) return + elif command == "update": + # self.logger.debug("Update NS {}".format(nsr_id)) + nslcmop = params + nslcmop_id = nslcmop["_id"] + nsr_id = nslcmop["nsInstanceId"] + task = asyncio.ensure_future(self.ns.update(nsr_id, nslcmop_id)) + self.lcm_tasks.register("ns", nsr_id, nslcmop_id, "ns_update", task) + return elif command == "scale": # self.logger.debug("Update NS {}".format(nsr_id)) nslcmop = params @@ -461,6 +455,13 @@ class Lcm: task = asyncio.ensure_future(self.ns.scale(nsr_id, nslcmop_id)) self.lcm_tasks.register("ns", nsr_id, nslcmop_id, "ns_scale", task) return + elif command == "migrate": + nslcmop = params + nslcmop_id = nslcmop["_id"] + nsr_id = nslcmop["nsInstanceId"] + task = asyncio.ensure_future(self.ns.migrate(nsr_id, nslcmop_id)) + self.lcm_tasks.register("ns", nsr_id, nslcmop_id, "ns_migrate", task) + return elif command == "show": nsr_id = params try: @@ -488,6 +489,8 @@ class Lcm: "instantiated", "scaled", "actioned", + "updated", + "migrated", ): # "scaled-cooldown-time" return elif topic == "nsi": # netslice LCM processes (instantiate, terminate, etc) @@ -685,9 +688,7 @@ class Lcm: # check RO version self.loop.run_until_complete(self.check_RO_version()) - self.ns = ns.NsLcm( - self.msg, self.lcm_tasks, self.config, self.loop, self.prometheus - ) + self.ns = ns.NsLcm(self.msg, self.lcm_tasks, self.config, self.loop) self.netslice = netslice.NetsliceLcm( self.msg, self.lcm_tasks, self.config, self.loop, self.ns ) @@ -702,13 +703,10 @@ class Lcm: self.msg, self.lcm_tasks, self.config, self.loop ) - # configure tsdb prometheus - if self.prometheus: - self.loop.run_until_complete(self.prometheus.start()) - self.loop.run_until_complete( asyncio.gather(self.kafka_read(), self.kafka_ping()) ) + # TODO # self.logger.debug("Terminating cancelling creation tasks") # self.lcm_tasks.cancel("ALL", "create")