Skip to content
Snippets Groups Projects
Commit 22bf3dc0 authored by Konstantinos Poulakakis's avatar Konstantinos Poulakakis
Browse files

Automation: make more dynamic the thresholds criteria.

parent 665c47c1
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!238Automation component skeleton
......@@ -153,7 +153,9 @@ class AutomationServiceServicerImpl(AutomationServiceServicer):
analyzer.input_kpi_ids.append(kpi_id_tx)
analyzer.output_kpi_ids.append(kpi_id_lat)
_threshold_dict = {'min_latency_E2E': (0, service.service_constraints[0].sla_latency.e2e_latency_ms)}
thresholdStr = service.service_constraints[0].custom.constraint_type
_threshold_dict = {thresholdStr: (0, int(service.service_constraints[0].custom.constraint_value))}
analyzer.parameters['thresholds'] = json.dumps(_threshold_dict)
analyzer.parameters['window_size'] = "60s"
analyzer.parameters['window_slider'] = "30s"
......
......@@ -28,7 +28,7 @@ from service.client.ServiceClient import ServiceClient
from .Objects import CONTEXT_ID, CONTEXTS, DEVICES, LINKS, TOPOLOGIES, SERVICES
from common.proto.context_pb2 import ConfigActionEnum, Device, DeviceId,\
DeviceOperationalStatusEnum
from common.tools.object_factory.Constraint import json_constraint_sla_latency
from common.tools.object_factory.Constraint import json_constraint_custom
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
......@@ -63,5 +63,5 @@ def test_rules_entry(
service_p4 = copy.deepcopy(service)
service_client.CreateService(Service(**service_p4))
service_p4['service_endpoint_ids'].extend(endpoints)
service_p4['service_constraints'].extend([json_constraint_sla_latency(3)])
service_p4['service_constraints'].extend([json_constraint_custom('min_latency_E2E','2')])
service_client.UpdateService(Service(**service_p4))
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