Bug 1830 fixed
[osm/LCM.git] / osm_lcm / ns.py
index 6ec52c8..fda6722 100644 (file)
@@ -904,7 +904,7 @@ class NsLcm(LcmBase):
                     )
                     vdur = next((vdur for vdur in target_vnf.get("vdur", ())), None)
                     if not vdur:
-                        return
+                        continue
                     for a_index, a_vld in enumerate(target["ns"]["vld"]):
                         target_vld = find_in_list(
                             get_iterable(vdur, "interfaces"),
@@ -2597,13 +2597,12 @@ class NsLcm(LcmBase):
                     operation = alarm_descriptor["operation"]
                     rel_operator = self.rel_operation_types.get(operation, "<=")
                     metric_selector = f'{metric_name}{{ns_id="{nsr_id}", vnf_member_index="{vnf_member_index}", vdu_id="{vdu_id}"}}'
-                    expression = (
-                        f"avg({metric_selector}) {rel_operator} {metric_threshold}"
-                    )
+                    expression = f"{metric_selector} {rel_operator} {metric_threshold}"
                     labels = {
                         "ns_id": nsr_id,
                         "vnf_member_index": vnf_member_index,
                         "vdu_id": vdu_id,
+                        "vdu_name": "{{ $labels.vdu_name }}",
                     }
                     prom_cfg = {
                         "alert": alert_name,
@@ -2617,12 +2616,9 @@ class NsLcm(LcmBase):
                             "actions" in alarm_descriptor
                             and action_type in alarm_descriptor["actions"]
                         ):
-                            for url in alarm_descriptor["actions"][action_type]:
-                                if "webhook" in alarm_action:
-                                    alarm_action["webhook"].append(url["url"])
-                                else:
-                                    alarm_action["webhook"] = [url["url"]]
-
+                            alarm_action[action_type] = alarm_descriptor["actions"][
+                                action_type
+                            ]
                     alert = {
                         "uuid": uuid,
                         "name": alert_name,
@@ -3224,6 +3220,12 @@ class NsLcm(LcmBase):
                             "nsr_id": nsr_id,
                             "nslcmop_id": nslcmop_id,
                             "operationState": nslcmop_operation_state,
+                            "startTime": db_nslcmop["startTime"],
+                            "links": db_nslcmop["links"],
+                            "operationParams": {
+                                "nsInstanceId": nsr_id,
+                                "nsdId": db_nsr["nsd-id"],
+                            },
                         },
                     )
                 except Exception as e:
@@ -7717,10 +7719,11 @@ class NsLcm(LcmBase):
                         f"Timeout waiting KDU with name={kdu_name} and index={kdu_index} to be intantiated"
                     )
 
-        # TODO get_service
         if ee_id is not None:
-            _, _, service = ee_id.partition(".")  # remove prefix   "namespace."
-            host_name = "{}-{}".format(service, ee_config_descriptor["metric-service"])
+            _, namespace, helm_id = get_ee_id_parts(
+                ee_id
+            )  # get namespace and EE gRPC service name
+            host_name = f'{helm_id}-{ee_config_descriptor["metric-service"]}.{namespace}.svc'  # svc_name.namespace.svc
             host_port = "80"
             vnfr_id = vnfr_id.replace("-", "")
             variables = {