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 ...@@ -34,7 +34,8 @@ from pyramid import testing
from toscaparser.tosca_template import ToscaTemplate from toscaparser.tosca_template import ToscaTemplate
# CLMC-service imports # 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.alertsapi.views import AlertsConfigurationAPI
from clmcservice import ROOT_DIR from clmcservice import ROOT_DIR
...@@ -127,6 +128,11 @@ class TestAlertsConfigurationAPI(object): ...@@ -127,6 +128,11 @@ class TestAlertsConfigurationAPI(object):
""" """
Tests the POST API endpoint of the alerts configuration API responsible for receiving alerts specifications. 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 :param app_config: fixture for setUp/tearDown of the web service registry
""" """
......
...@@ -30,6 +30,7 @@ topology_template: ...@@ -30,6 +30,7 @@ topology_template:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/high-latency - http://companyA.alert-handler.flame.eu/high-latency
- low_requests_policy: - low_requests_policy:
type: eu.ict-flame.policies.StateChange type: eu.ict-flame.policies.StateChange
triggers: triggers:
...@@ -52,3 +53,59 @@ topology_template: ...@@ -52,3 +53,59 @@ topology_template:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests - 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 description: TOSCA Alerts Configuration document
imports: imports:
...@@ -22,32 +22,30 @@ topology_template: ...@@ -22,32 +22,30 @@ topology_template:
threshold: 45 threshold: 45
granularity: 120 granularity: 120
aggregation_method: mean aggregation_method: mean
resource_type: global_tags: # correct field is called resource_type, not global_tags
location: watershed location: watershed
comparison_operator: gt comparison_operator: gt
action: action:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/high-latency - http://companyA.alert-handler.flame.eu/high-latency
- low_requests_policy: - requests_diff_policy:
type: eu.ict-flame.policies.StateChange type: eu.ict-flame.policies.StateChange
triggers: triggers:
low_requests: increase_in_requests:
description: | description: |
This event triggers when the last reported number of requests for a given service function This event triggers when the number of requests has increased relative to the number of requests received
falls behind a given threshold. 120 seconds ago.
event_type: threshold event_type: relative
metric: storage.requests metric: storage.requests
condition: condition:
threshold: 5 threshold: 100
granularity: 60 granularity: 120
aggregation_method: last
resource_type: resource_type:
sf_package: storage sf_package: storage
sf: storage-users sf: storage-users
location: watershed location: watershed
comparison_operator: lt comparison_operator: gte
action: action:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
\ No newline at end of file
- http://companyA.alert-handler.flame.eu/low-requests
\ No newline at end of file
...@@ -52,3 +52,55 @@ topology_template: ...@@ -52,3 +52,55 @@ topology_template:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests - 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
...@@ -46,3 +46,17 @@ topology_template: ...@@ -46,3 +46,17 @@ topology_template:
implementation: implementation:
- http://sfemc.flame.eu/notify - http://sfemc.flame.eu/notify
- http://companyA.alert-handler.flame.eu/low-requests - 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
...@@ -33,3 +33,20 @@ topology_template: ...@@ -33,3 +33,20 @@ topology_template:
action: action:
implementation: implementation:
- http://companyA.alert-handler.flame.eu/low-requests - 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.
Please register or to comment