Merge branch 'v7.0' tag v7.0.1 77/8577/1
authortierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 11 Feb 2020 12:36:24 +0000 (12:36 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 11 Feb 2020 12:36:47 +0000 (12:36 +0000)
Change-Id: I6b715f6e60ef1576ed6c7baf73cb0afa550f23bb
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
1  2 
osm_lcm/lcm.py

diff --combined osm_lcm/lcm.py
@@@ -286,10 -286,6 +286,10 @@@ class Lcm
                  except Exception as e:
                      self.logger.error("Cannot write into '{}' for healthcheck: {}".format(health_check_file, e))
              return
 +        elif topic == "pla":
 +            if command == "placement":
 +                self.ns.update_nsrs_with_pla_result(params)
 +            return
          elif topic == "k8scluster":
              if command == "create" or command == "created":
                  k8scluster_id = params.get("_id")
                  self.lcm_tasks.register("k8srepo", k8srepo_id, order_id, "k8srepo_delete", task)
                  return
          elif topic == "ns":
-             if command == "instantiate" or command == "instantiated":
+             if command == "instantiate":
                  # self.logger.debug("Deploying NS {}".format(nsr_id))
                  nslcmop = params
                  nslcmop_id = nslcmop["_id"]
                  task = asyncio.ensure_future(self.ns.instantiate(nsr_id, nslcmop_id))
                  self.lcm_tasks.register("ns", nsr_id, nslcmop_id, "ns_instantiate", task)
                  return
-             elif command == "terminate" or command == "terminated":
+             elif command == "terminate":
                  # self.logger.debug("Deleting NS {}".format(nsr_id))
                  nslcmop = params
                  nslcmop_id = nslcmop["_id"]
              elif command in ("terminated", "instantiated", "scaled", "actioned"):  # "scaled-cooldown-time"
                  return
          elif topic == "nsi":  # netslice LCM processes (instantiate, terminate, etc)
-             if command == "instantiate" or command == "instantiated":
+             if command == "instantiate":
                  # self.logger.debug("Instantiating Network Slice {}".format(nsilcmop["netsliceInstanceId"]))
                  nsilcmop = params
                  nsilcmop_id = nsilcmop["_id"]  # slice operation id
                  task = asyncio.ensure_future(self.netslice.instantiate(nsir_id, nsilcmop_id))
                  self.lcm_tasks.register("nsi", nsir_id, nsilcmop_id, "nsi_instantiate", task)
                  return
-             elif command == "terminate" or command == "terminated":
+             elif command == "terminate":
                  # self.logger.debug("Terminating Network Slice NS {}".format(nsilcmop["netsliceInstanceId"]))
                  nsilcmop = params
                  nsilcmop_id = nsilcmop["_id"]  # slice operation id
          self.first_start = True
          while self.consecutive_errors < 10:
              try:
 -                topics = ("ns", "vim_account", "wim_account", "sdn", "nsi", "k8scluster", "k8srepo")
 +                topics = ("ns", "vim_account", "wim_account", "sdn", "nsi", "k8scluster", "k8srepo", "pla")
                  topics_admin = ("admin", )
                  await asyncio.gather(
                      self.msg.aioread(topics, self.loop, self.kafka_read_callback),
@@@ -616,7 -612,7 +616,7 @@@ def health_check()
              with open(health_check_file, "r") as f:
                  last_received_ping = f.read()
  
-             if time() - float(last_received_ping) < Lcm.ping_interval_pace + 10:
+             if time() - float(last_received_ping) < 2 * Lcm.ping_interval_pace:  # allow one ping not received every two
                  exit(0)
          except Exception:
              pass
  if __name__ == '__main__':
  
      try:
-         print("SYS.PATH='{}'".format(sys.path))
+         print("SYS.PATH='{}'".format(sys.path))
          # load parameters and configuration
          # -h
          # -c value