Skip to content
Snippets Groups Projects
Commit f7b3f0c9 authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Updates tosca-parser test data

parent 2f8634bf
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,8 @@ from pyramid import testing
from toscaparser.tosca_template import ToscaTemplate
# CLMC-service imports
from clmcservice.alertsapi.utilities import adjust_tosca_definitions_import, validate_clmc_alerts_specification
from clmcservice.alertsapi.utilities import adjust_tosca_definitions_import
from clmcservice.alertsapi.alerts_specification_schema import validate_clmc_alerts_specification
from clmcservice.alertsapi.views import AlertsConfigurationAPI
from clmcservice import ROOT_DIR
......@@ -127,6 +128,11 @@ class TestAlertsConfigurationAPI(object):
"""
Tests the POST API endpoint of the alerts configuration API responsible for receiving alerts specifications.
Unit test consists of:
* Traverse all valid TOSCA Alerts Specifications in the src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid
* Sending a valid TOSCA Alert Specification to the view responsible for configuring Kapacitor
* Check that Kapacitor alerts, topics and handlers are created with the correct identifier and arguments
:param app_config: fixture for setUp/tearDown of the web service registry
"""
......
......@@ -30,6 +30,7 @@ topology_template:
implementation:
- http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/high-latency
- low_requests_policy:
type: eu.ict-flame.policies.StateChange
triggers:
......@@ -52,3 +53,59 @@ topology_template:
implementation:
- http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests
- requests_diff_policy:
type: eu.ict-flame.policies.StateChange
triggers:
increase_in_requests:
description: |
This event triggers when the number of requests has increased relative to the number of requests received
120 seconds ago.
event_type: relative
metric: storage.requests
condition:
threshold: 100 # requests have increased by at least 100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: gte
action:
implementation:
- http://sfemc.flame.eu/notify
decrease_in_requests:
description: |
This event triggers when the number of requests has decreased relative to the number of requests received
120 seconds ago.
event_type: relative
metric: storage.requests
condition:
threshold: -100 # requests have decreased by at least 100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: lte
action:
implementation:
- http://sfemc.flame.eu/notify
- missing_measurement_policy:
type: eu.ict-flame.policies.StateChange
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: 0 # 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:
sf_package: storage
action:
implementation:
- http://sfemc.flame.eu/notify
\ No newline at end of file
# Fails because it's missing tosca version.
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: TOSCA Alerts Configuration document
imports:
......@@ -22,32 +22,30 @@ topology_template:
threshold: 45
granularity: 120
aggregation_method: mean
resource_type:
global_tags: # correct field is called resource_type, not global_tags
location: watershed
comparison_operator: gt
action:
implementation:
- http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/high-latency
- low_requests_policy:
- requests_diff_policy:
type: eu.ict-flame.policies.StateChange
triggers:
low_requests:
increase_in_requests:
description: |
This event triggers when the last reported number of requests for a given service function
falls behind a given threshold.
event_type: threshold
This event triggers when the number of requests has increased relative to the number of requests received
120 seconds ago.
event_type: relative
metric: storage.requests
condition:
threshold: 5
granularity: 60
aggregation_method: last
threshold: 100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: lt
comparison_operator: gte
action:
implementation:
- http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests
\ No newline at end of file
- http://sfemc.flame.eu/notify
\ No newline at end of file
......@@ -51,4 +51,56 @@ topology_template:
action:
implementation:
- http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests
\ No newline at end of file
- http://companyA.alert-handler.flame.eu/low-requests
- requests_diff_policy:
type: eu.ict-flame.policies.StateChange
triggers:
increase_in_requests:
description: |
This event triggers when the number of requests has increased relative to the number of requests received
120 seconds ago.
event_type: relative
metric: storage.requests
condition:
threshold: 100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: gte
action:
implementation:
- http://sfemc.flame.eu/notify
decrease_in_requests:
description: |
This event triggers when the number of requests has decreased relative to the number of requests received
120 seconds ago.
event_type: relative
metric: storage.requests
condition:
threshold: -100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: lte
action:
implementation:
- http://sfemc.flame.eu/notify
- missing_measurement_policy:
type: eu.ict-flame.policies.StateChange
triggers:
missing_storage_measurements:
description: This event triggers when the number of storage measurements reported falls below the threshold value.
event_type: deadman
metric: storage.*
condition:
threshold: 0
granularity: 60
resource_type:
sf_package: storage
action:
implementation:
- http://sfemc.flame.eu/notify
......@@ -45,4 +45,18 @@ topology_template:
action:
implementation:
- http://sfemc.flame.eu/notify
- 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.StateChange
triggers:
missing_storage_measurements:
event_type: deadman
metric: storage.field
condition:
threshold: 0
granularity: 60
resource_type:
sf_package: storage
action:
implementation:
- http://sfemc.flame.eu/notify
\ No newline at end of file
......@@ -32,4 +32,21 @@ topology_template:
comparison_operator: lt
action:
implementation:
- http://companyA.alert-handler.flame.eu/low-requests
\ No newline at end of file
- http://companyA.alert-handler.flame.eu/low-requests
- requests_diff_policy:
type: eu.ict-flame.policies.StateChange
triggers:
increase_in_requests:
event_type: relative
metric: storage.requests
condition:
threshold: 100
granularity: 120
resource_type:
sf_package: storage
sf: storage-users
location: watershed
comparison_operator: gte
action:
implementation:
- http://sfemc.flame.eu/notify
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment