From 17ba3cb43663cc8e5190d83ba014786421d7cfe3 Mon Sep 17 00:00:00 2001
From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk>
Date: Mon, 8 Oct 2018 12:40:39 +0100
Subject: [PATCH] Replaces the StateChange policy type with Alert policy type

---
 docs/AlertsSpecification.md                   | 15 ++++++------
 .../alertsapi/alerts_specification_schema.py  |  4 ++--
 .../static/flame_clmc_alerts_definitions.yaml |  4 ++--
 .../invalid/alerts_test_config-1.yaml         |  6 ++---
 .../invalid/alerts_test_config-10.yaml        |  6 ++---
 .../invalid/alerts_test_config-11.yaml        |  6 ++---
 .../invalid/alerts_test_config-12.yaml        |  6 ++---
 .../invalid/alerts_test_config-2.yaml         |  4 ++--
 .../invalid/alerts_test_config-3.yaml         |  2 +-
 .../invalid/alerts_test_config-4.yaml         |  2 +-
 .../invalid/alerts_test_config-5.yaml         |  2 +-
 .../invalid/alerts_test_config-6.yaml         |  4 ++--
 .../invalid/alerts_test_config-7.yaml         |  6 ++---
 .../invalid/alerts_test_config-8.yaml         |  6 ++---
 .../invalid/alerts_test_config-9.yaml         |  4 ++--
 .../valid/alerts_test_config-1.yaml           | 24 ++++++++++++++++---
 .../valid/alerts_test_config-2.yaml           | 20 ++++++++++++++--
 .../valid/alerts_test_config-3.yaml           |  6 ++---
 .../valid/alerts_test_config-4.yaml           |  6 ++---
 .../valid/alerts_test_config-5.yaml           |  6 ++---
 .../invalid/alerts_test_config-2.yaml         |  4 ++--
 .../invalid/alerts_test_config-3.yaml         |  4 ++--
 .../invalid/alerts_test_config-4.yaml         |  4 ++--
 .../valid/alerts_test_config-1.yaml           |  8 +++----
 .../valid/alerts_test_config-2.yaml           |  6 ++---
 .../valid/alerts_test_config-3.yaml           |  2 +-
 .../valid/alerts_test_config-4.yaml           |  4 ++--
 .../clmctest/alerts/alerts_test_config.yaml   |  4 ++--
 28 files changed, 105 insertions(+), 70 deletions(-)

diff --git a/docs/AlertsSpecification.md b/docs/AlertsSpecification.md
index 2119f6a..e97729a 100644
--- a/docs/AlertsSpecification.md
+++ b/docs/AlertsSpecification.md
@@ -61,7 +61,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -80,7 +80,7 @@ topology_template:
                 - http://companyA.alert-handler.flame.eu/high-latency
                 
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -103,7 +103,7 @@ topology_template:
                 - http://companyA.alert-handler.flame.eu/low-requests
                 
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
@@ -142,7 +142,7 @@ topology_template:
                 - flame_sfemc
                 
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
@@ -175,14 +175,14 @@ metadata:
 ##### Policies
 
 The ***policies*** section defines a list of policy nodes, each representing a fully qualified configuration for an
-alert within CLMC. The format is the following:
+alert within CLMC. Each policy must be of type eu.ict-flame.policies.Alert. The format is the following:
 
 ```yaml
 topology_template:
 
     policies:
         - <policy_identifier>:
-            type: eu.ict-flame.policies.StateChange
+            type: eu.ict-flame.policies.Alert
             triggers:
                 <event identifier>:
                   description: <optional description for the given event trigger>
@@ -252,7 +252,8 @@ SFEMC URL.
 ##### Event types
 
 * **threshold** - A threshold event type is an alert in which Kapacitor queries InfluxDB on specific metric in a given period of time
-by using a query function such as *mean*, *median*, *mode*, etc. This value is then compared against a given threshold. If the
+by using a query function such as *mean*, *median*, *mode*, etc. If the granularity is less than or equal to 60 seconds, then every measurement
+point is monitored (improving performance), thus, ignoring the aggregation function. This value is then compared against a given threshold. If the
 result of the comparison operation is true, an alert is triggered. For example:
 
     ```yaml
diff --git a/src/service/clmcservice/alertsapi/alerts_specification_schema.py b/src/service/clmcservice/alertsapi/alerts_specification_schema.py
index 952d1c1..ed2a5e7 100644
--- a/src/service/clmcservice/alertsapi/alerts_specification_schema.py
+++ b/src/service/clmcservice/alertsapi/alerts_specification_schema.py
@@ -35,7 +35,7 @@ from schema import Schema, And, Or, Optional, SchemaError
 #         * metadata section must be present (with key-value pairs for sfc and sfci)
 #         * policies section must be present (under the topology_template node)
 #         * each policy must be associated with a triggers node (containing at least 1 trigger)
-#         * each policy is of type eu.ict-flame.policies.StateChange or eu.ict-flame.policies.Alert
+#         * each policy is of type eu.ict-flame.policies.Alert
 #         * each trigger must specify event_type, metric, condition, and at least one handler in action/implementation
 #         * the condition section must specify threshold, granularity, aggregation_method, comparison_operator
 
@@ -81,7 +81,7 @@ ALERTS_SPECIFICATION_SCHEMA = Schema({
         "policies": [
             {
                 str: {
-                    "type": "eu.ict-flame.policies.StateChange",
+                    "type": "eu.ict-flame.policies.Alert",
                     "triggers": And({
                         str: {
                             Optional("description"): str,
diff --git a/src/service/clmcservice/static/flame_clmc_alerts_definitions.yaml b/src/service/clmcservice/static/flame_clmc_alerts_definitions.yaml
index 4553746..51349a7 100644
--- a/src/service/clmcservice/static/flame_clmc_alerts_definitions.yaml
+++ b/src/service/clmcservice/static/flame_clmc_alerts_definitions.yaml
@@ -2,6 +2,6 @@ tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
 
 policy_types:
 
-  eu.ict-flame.policies.StateChange:
+  eu.ict-flame.policies.Alert:
 
-    derived_from: tosca.policies.Update
\ No newline at end of file
+    derived_from: tosca.policies.Root
\ No newline at end of file
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml
index 44e73ab..7812392 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -31,7 +31,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
@@ -51,7 +51,7 @@ topology_template:
               implementation:
               - http://sfemc.flame.eu/notify
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml
index 1710bd0..c2a8550 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -31,7 +31,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           decrease_in_requests:
             description: |
@@ -51,7 +51,7 @@ topology_template:
               implementation:
               - flame_sfemc
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-11.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-11.yaml
index 97db7e9..d9110e5 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-11.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-11.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           decrease_in_requests:
             description: |
@@ -52,7 +52,7 @@ topology_template:
               implementation:
               - http://sfemc.flame.eu/notify
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-12.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-12.yaml
index 15ba25b..818823f 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-12.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-12.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           decrease_in_requests:
             description: |
@@ -52,7 +52,7 @@ topology_template:
               implementation:
               - http://sfemc.flame.eu/notify
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml
index 90e6f0b..da58e71 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
@@ -28,7 +28,7 @@ topology_template:
               implementation:
                 - flame_sfemc
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml
index 7b61aaa..8a89ae9 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml
index 67c403a..6a28842 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml
index ac2bc00..b558ac9 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml
index 9142fe0..7a76886 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml
index 694bed6..312b5e4 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -31,7 +31,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -53,7 +53,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/low-requests
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml
index ed8af91..de10ba0 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml
@@ -13,11 +13,11 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           # should specify at least 1 trigger
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -39,7 +39,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/low-requests
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml
index 4f6f6cb..15e50ed 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml
@@ -11,7 +11,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -29,7 +29,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml
index 7d3a1be..c3b3a22 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ topology_template:
                 - http://companyA.alert-handler.flame.eu/high-latency
 
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -52,4 +52,22 @@ topology_template:
             action:
               implementation:
                 - flame_sfemc
-                - http://companyA.alert-handler.flame.eu/low-requests
\ No newline at end of file
+                - http://companyA.alert-handler.flame.eu/low-requests
+
+    - missing_measurement_policy:
+        type: eu.ict-flame.policies.Alert
+        triggers:
+          missing_storage_measurements:
+            description: This event triggers when the number of storage measurements reported falls below the threshold value.
+            event_type: deadman
+            # deadman trigger instances monitor the whole measurement (storage in this case), so simply put a star for field value
+            # to be compliant with the <measurement>.<field> format
+            metric: storage.*
+            condition:
+              threshold: 10  # if requests are less than or equal to 0 (in other words, no measurements are reported)
+              granularity: 60  # check for for missing data for the last 60 seconds
+              resource_type:
+                flame_sfp: storage
+            action:
+              implementation:
+              - http://companyA.alert-handler.flame.eu/missing_measurements
\ No newline at end of file
diff --git a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml
index 9dc4288..a3ea67c 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml
@@ -12,8 +12,24 @@ metadata:
 topology_template:
 
   policies:
+    - high_latency_policy:
+        type: eu.ict-flame.policies.Alert
+        triggers:
+          high_latency:
+            # optional description - hence, valid
+            event_type: threshold
+            metric: network.latency
+            condition:
+              threshold: 45
+              granularity: 120
+              resource_type:
+                flame_location: watershed
+              comparison_operator: eq
+            action:
+              implementation:
+                - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           decrease_in_requests:
             description: |
@@ -34,7 +50,7 @@ topology_template:
                 - flame_sfemc
 
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
diff --git a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml
index ed21a67..266fa31 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             # optional description - hence, valid
@@ -31,7 +31,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             # optional description - hence, valid
@@ -51,7 +51,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/low-requests
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
diff --git a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml
index 04a8ed3..3993c08 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             # optional description - hence, valid
@@ -32,7 +32,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             # optional description - hence, valid
@@ -49,7 +49,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/low-requests
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
diff --git a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml
index 06dc554..8319504 100644
--- a/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml
+++ b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             # optional description - hence, valid
@@ -31,7 +31,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             # optional description - hence, valid
@@ -48,7 +48,7 @@ topology_template:
                 - flame_sfemc
                 - http://localhost:9999/low-requests  # localhost url is also allowed
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml
index 773f8f9..ad61f4b 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml
@@ -12,7 +12,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -31,7 +31,7 @@ topology_template:
                 - http://sfemc.flame.eu/notify
                 - http://companyA.alert-handler.flame.eu/high-latency
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml
index 94891fe..326d6b5 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml
@@ -12,7 +12,7 @@ metadata:
 topology_template:
 # missing policies section
   - high_latency_policy:
-      type: eu.ict-flame.policies.StateChange
+      type: eu.ict-flame.policies.Alert
       triggers:
         high_latency:
           description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -31,7 +31,7 @@ topology_template:
             - http://sfemc.flame.eu/notify
             - http://companyA.alert-handler.flame.eu/high-latency
   - low_requests_policy:
-      type: eu.ict-flame.policies.StateChange
+      type: eu.ict-flame.policies.Alert
       triggers:
         low_requests:
           description: |
diff --git a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml
index 0e546d5..f1056c6 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml
@@ -13,7 +13,7 @@ metadata:
 alerts:
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ alerts:
                 - http://sfemc.flame.eu/notify
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
diff --git a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml
index 928c25e..5df5321 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -32,7 +32,7 @@ topology_template:
                 - http://sfemc.flame.eu/notify
                 - http://companyA.alert-handler.flame.eu/high-latency
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -54,7 +54,7 @@ topology_template:
                 - http://sfemc.flame.eu/notify
                 - http://companyA.alert-handler.flame.eu/low-requests
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             description: |
@@ -91,7 +91,7 @@ topology_template:
               implementation:
               - http://sfemc.flame.eu/notify
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             description: This event triggers when the number of storage measurements reported falls below the threshold value.
diff --git a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml
index 0b9fb2c..07f1cb6 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
@@ -30,7 +30,7 @@ topology_template:
                 - http://companyA.alert-handler.flame.eu/high-latency
                 - flame_sfemc
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -48,7 +48,7 @@ topology_template:
                 - http://sfemc.flame.eu/notify
                 - http://companyA.alert-handler.flame.eu/low-requests
     - missing_measurement_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           missing_storage_measurements:
             event_type: deadman
diff --git a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml
index 118797e..13f05f8 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - high_latency_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_latency:
             description: This event triggers when the mean network latency in a given location exceeds a given threshold (in ms).
diff --git a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml
index 92a392a..db5a6d2 100644
--- a/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml
+++ b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - low_requests_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           low_requests:
             description: |
@@ -35,7 +35,7 @@ topology_template:
                 - flame_sfemc
                 - http://companyA.alert-handler.flame.eu/low-requests
     - requests_diff_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           increase_in_requests:
             event_type: relative
diff --git a/src/test/clmctest/alerts/alerts_test_config.yaml b/src/test/clmctest/alerts/alerts_test_config.yaml
index fbaeda7..6c422e7 100644
--- a/src/test/clmctest/alerts/alerts_test_config.yaml
+++ b/src/test/clmctest/alerts/alerts_test_config.yaml
@@ -13,7 +13,7 @@ topology_template:
 
   policies:
     - scale_nginx_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           high_requests:
             description: |
@@ -65,7 +65,7 @@ topology_template:
                 - flame_sfemc
                 - http://172.40.231.200:9999/
     - deadman_policy:
-        type: eu.ict-flame.policies.StateChange
+        type: eu.ict-flame.policies.Alert
         triggers:
           no_measurements:
             description: |
-- 
GitLab