Loading proto/kpi_value.proto→proto/kpi_value_api.proto +1 −1 Original line number Original line Diff line number Diff line Loading @@ -4,7 +4,7 @@ package kpi_value_api; import "context.proto"; import "context.proto"; import "kpi_manager.proto"; import "kpi_manager.proto"; service KpiValueAPI { service KpiValueAPIService { rpc StoreKpiValues (KpiValueList) returns (context.Empty) {} rpc StoreKpiValues (KpiValueList) returns (context.Empty) {} rpc SelectKpiValues (KpiValueFilter) returns (KpiValueList) {} rpc SelectKpiValues (KpiValueFilter) returns (KpiValueList) {} } } Loading src/common/Constants.py +4 −2 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ class ServiceNameEnum(Enum): POLICY = 'policy' POLICY = 'policy' MONITORING = 'monitoring' MONITORING = 'monitoring' KPIMANAGER = 'kpiManager' KPIMANAGER = 'kpiManager' KPIVALUEAPI = 'kpiValueApi' TELEMETRYFRONTEND = 'telemetryfrontend' TELEMETRYFRONTEND = 'telemetryfrontend' DLT = 'dlt' DLT = 'dlt' NBI = 'nbi' NBI = 'nbi' Loading Loading @@ -77,8 +78,6 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.ZTP .value : 5050, ServiceNameEnum.ZTP .value : 5050, ServiceNameEnum.POLICY .value : 6060, ServiceNameEnum.POLICY .value : 6060, ServiceNameEnum.MONITORING .value : 7070, ServiceNameEnum.MONITORING .value : 7070, ServiceNameEnum.KPIMANAGER .value : 7071, ServiceNameEnum.TELEMETRYFRONTEND .value : 7072, ServiceNameEnum.DLT .value : 8080, ServiceNameEnum.DLT .value : 8080, ServiceNameEnum.NBI .value : 9090, ServiceNameEnum.NBI .value : 9090, ServiceNameEnum.L3_CAD .value : 10001, ServiceNameEnum.L3_CAD .value : 10001, Loading @@ -94,6 +93,9 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.E2EORCHESTRATOR .value : 10050, ServiceNameEnum.E2EORCHESTRATOR .value : 10050, ServiceNameEnum.OPTICALCONTROLLER .value : 10060, ServiceNameEnum.OPTICALCONTROLLER .value : 10060, ServiceNameEnum.BGPLS .value : 20030, ServiceNameEnum.BGPLS .value : 20030, ServiceNameEnum.KPIMANAGER .value : 30010, ServiceNameEnum.KPIVALUEAPI .value : 30020, ServiceNameEnum.TELEMETRYFRONTEND .value : 30050, # Used for test and debugging only # Used for test and debugging only ServiceNameEnum.DLT_GATEWAY .value : 50051, ServiceNameEnum.DLT_GATEWAY .value : 50051, Loading src/common/tools/kafka/Variables.py 0 → 100644 +27 −0 Original line number Original line Diff line number Diff line # Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from enum import Enum class KafkaConfig(Enum): SERVER_IP = "127.0.0.1:9092" class KafkaTopic(Enum): REQUEST = 'topic_request' RESPONSE = 'topic_response' RAW = 'topic_raw' LABELED = 'topic_labeled' VALUE = 'topic_value' # create all topics after the deployments (Telemetry and Analytics) No newline at end of file src/kpi_manager/service/KpiManagerService.py +3 −2 Original line number Original line Diff line number Diff line Loading @@ -14,10 +14,11 @@ from common.Constants import ServiceNameEnum from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc from common.Settings import get_service_port_grpc from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server from monitoring.service.NameMapping import NameMapping from common.tools.service.GenericGrpcService import GenericGrpcService from common.tools.service.GenericGrpcService import GenericGrpcService from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl from monitoring.service.NameMapping import NameMapping class KpiManagerService(GenericGrpcService): class KpiManagerService(GenericGrpcService): def __init__(self, name_mapping : NameMapping, cls_name: str = __name__) -> None: def __init__(self, name_mapping : NameMapping, cls_name: str = __name__) -> None: Loading src/kpi_manager/tests/test_kpi_manager.py +2 −2 Original line number Original line Diff line number Diff line Loading @@ -53,7 +53,7 @@ KPIMANAGER_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEn os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(KPIMANAGER_SERVICE_PORT) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(KPIMANAGER_SERVICE_PORT) METRICSDB_HOSTNAME = os.environ.get('METRICSDB_HOSTNAME') # METRICSDB_HOSTNAME = os.environ.get('METRICSDB_HOSTNAME') LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) Loading Loading @@ -230,7 +230,7 @@ def kpi_manager_client(kpi_manager_service : KpiManagerService): # pylint: disab # assert isinstance(response, KpiDescriptorList) # assert isinstance(response, KpiDescriptorList) def test_set_list_of_KPIs(kpi_manager_client): def test_set_list_of_KPIs(kpi_manager_client): LOGGER.info(" >>> test_set_list_of_KPIs: START <<< ") LOGGER.debug(" >>> test_set_list_of_KPIs: START <<< ") KPIs_TO_SEARCH = ["node_in_power_total", "node_in_current_total", "node_out_power_total"] KPIs_TO_SEARCH = ["node_in_power_total", "node_in_current_total", "node_out_power_total"] # adding KPI # adding KPI for kpi in KPIs_TO_SEARCH: for kpi in KPIs_TO_SEARCH: Loading Loading
proto/kpi_value.proto→proto/kpi_value_api.proto +1 −1 Original line number Original line Diff line number Diff line Loading @@ -4,7 +4,7 @@ package kpi_value_api; import "context.proto"; import "context.proto"; import "kpi_manager.proto"; import "kpi_manager.proto"; service KpiValueAPI { service KpiValueAPIService { rpc StoreKpiValues (KpiValueList) returns (context.Empty) {} rpc StoreKpiValues (KpiValueList) returns (context.Empty) {} rpc SelectKpiValues (KpiValueFilter) returns (KpiValueList) {} rpc SelectKpiValues (KpiValueFilter) returns (KpiValueList) {} } } Loading
src/common/Constants.py +4 −2 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ class ServiceNameEnum(Enum): POLICY = 'policy' POLICY = 'policy' MONITORING = 'monitoring' MONITORING = 'monitoring' KPIMANAGER = 'kpiManager' KPIMANAGER = 'kpiManager' KPIVALUEAPI = 'kpiValueApi' TELEMETRYFRONTEND = 'telemetryfrontend' TELEMETRYFRONTEND = 'telemetryfrontend' DLT = 'dlt' DLT = 'dlt' NBI = 'nbi' NBI = 'nbi' Loading Loading @@ -77,8 +78,6 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.ZTP .value : 5050, ServiceNameEnum.ZTP .value : 5050, ServiceNameEnum.POLICY .value : 6060, ServiceNameEnum.POLICY .value : 6060, ServiceNameEnum.MONITORING .value : 7070, ServiceNameEnum.MONITORING .value : 7070, ServiceNameEnum.KPIMANAGER .value : 7071, ServiceNameEnum.TELEMETRYFRONTEND .value : 7072, ServiceNameEnum.DLT .value : 8080, ServiceNameEnum.DLT .value : 8080, ServiceNameEnum.NBI .value : 9090, ServiceNameEnum.NBI .value : 9090, ServiceNameEnum.L3_CAD .value : 10001, ServiceNameEnum.L3_CAD .value : 10001, Loading @@ -94,6 +93,9 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.E2EORCHESTRATOR .value : 10050, ServiceNameEnum.E2EORCHESTRATOR .value : 10050, ServiceNameEnum.OPTICALCONTROLLER .value : 10060, ServiceNameEnum.OPTICALCONTROLLER .value : 10060, ServiceNameEnum.BGPLS .value : 20030, ServiceNameEnum.BGPLS .value : 20030, ServiceNameEnum.KPIMANAGER .value : 30010, ServiceNameEnum.KPIVALUEAPI .value : 30020, ServiceNameEnum.TELEMETRYFRONTEND .value : 30050, # Used for test and debugging only # Used for test and debugging only ServiceNameEnum.DLT_GATEWAY .value : 50051, ServiceNameEnum.DLT_GATEWAY .value : 50051, Loading
src/common/tools/kafka/Variables.py 0 → 100644 +27 −0 Original line number Original line Diff line number Diff line # Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from enum import Enum class KafkaConfig(Enum): SERVER_IP = "127.0.0.1:9092" class KafkaTopic(Enum): REQUEST = 'topic_request' RESPONSE = 'topic_response' RAW = 'topic_raw' LABELED = 'topic_labeled' VALUE = 'topic_value' # create all topics after the deployments (Telemetry and Analytics) No newline at end of file
src/kpi_manager/service/KpiManagerService.py +3 −2 Original line number Original line Diff line number Diff line Loading @@ -14,10 +14,11 @@ from common.Constants import ServiceNameEnum from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc from common.Settings import get_service_port_grpc from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server from monitoring.service.NameMapping import NameMapping from common.tools.service.GenericGrpcService import GenericGrpcService from common.tools.service.GenericGrpcService import GenericGrpcService from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl from monitoring.service.NameMapping import NameMapping class KpiManagerService(GenericGrpcService): class KpiManagerService(GenericGrpcService): def __init__(self, name_mapping : NameMapping, cls_name: str = __name__) -> None: def __init__(self, name_mapping : NameMapping, cls_name: str = __name__) -> None: Loading
src/kpi_manager/tests/test_kpi_manager.py +2 −2 Original line number Original line Diff line number Diff line Loading @@ -53,7 +53,7 @@ KPIMANAGER_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEn os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(KPIMANAGER_SERVICE_PORT) os.environ[get_env_var_name(ServiceNameEnum.KPIMANAGER, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(KPIMANAGER_SERVICE_PORT) METRICSDB_HOSTNAME = os.environ.get('METRICSDB_HOSTNAME') # METRICSDB_HOSTNAME = os.environ.get('METRICSDB_HOSTNAME') LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__) Loading Loading @@ -230,7 +230,7 @@ def kpi_manager_client(kpi_manager_service : KpiManagerService): # pylint: disab # assert isinstance(response, KpiDescriptorList) # assert isinstance(response, KpiDescriptorList) def test_set_list_of_KPIs(kpi_manager_client): def test_set_list_of_KPIs(kpi_manager_client): LOGGER.info(" >>> test_set_list_of_KPIs: START <<< ") LOGGER.debug(" >>> test_set_list_of_KPIs: START <<< ") KPIs_TO_SEARCH = ["node_in_power_total", "node_in_current_total", "node_out_power_total"] KPIs_TO_SEARCH = ["node_in_power_total", "node_in_current_total", "node_out_power_total"] # adding KPI # adding KPI for kpi in KPIs_TO_SEARCH: for kpi in KPIs_TO_SEARCH: Loading