From 38b1e333645e51d3e89fda813e46dc9b77081d7f Mon Sep 17 00:00:00 2001 From: Waleed Akbar <wakbar@cttc.es> Date: Tue, 9 Jul 2024 12:23:41 +0000 Subject: [PATCH] KPI Manager "Add Descriptor" and "Delete Descriptor" working fine. --- proto/analytics_frontend.proto | 16 +++--- proto/device.proto | 6 +- ...kpi_manager.proto => kpi_management.proto} | 3 +- proto/monitoring.proto | 14 ++--- proto/optical_attack_detector.proto | 4 +- proto/policy_condition.proto | 4 +- proto/telemetry_frontend.proto | 22 +++----- scripts/run_tests_locally-kpi-DB.sh | 2 +- scripts/run_tests_locally-kpi-manager.sh | 2 +- .../Dockerfile | 10 ++-- src/{kpi_manager => kpi_management}/README.md | 18 +++--- .../__init__.py | 0 .../kpi_manager}/__init__.py | 0 .../kpi_manager/client/KpiManagerClient.py | 4 +- .../kpi_manager/client}/__init__.py | 0 .../kpi_manager}/database/__init__.py | 0 .../database/service}/KpiEngine.py | 0 .../kpi_manager/database/service}/KpiModel.py | 35 +++++++++--- .../kpi_manager/database/service}/Kpi_DB.py | 6 +- .../kpi_manager/database/service}/__init__.py | 0 .../kpi_manager/database/tests}/KpiDBtests.py | 7 +-- .../kpi_manager/service/KpiManagerService.py | 6 +- .../service/KpiManagerServiceServicerImpl.py | 29 +++++----- .../kpi_manager/service/__init__.py | 14 +++++ .../kpi_manager/tests/test_kpi_manager.py | 56 ++++++++++++------- .../kpi_manager/tests/test_messages.py | 30 ++++++++++ src/kpi_management/kpi_value_api/__init__.py | 14 +++++ .../kpi_value_api/client/__init__.py | 14 +++++ .../kpi_value_api/service/__init__.py | 14 +++++ .../kpi_value_writer/__init__.py | 14 +++++ .../service/KpiValueComposer.py | 4 +- .../kpi_value_writer}/service/KpiWriter.py | 0 .../kpi_value_writer/service/__init__.py | 14 +++++ .../requirements.in | 0 src/kpi_management/service/__init__.py | 14 +++++ .../service/__main__.py | 0 .../service/database/__init__.py | 14 +++++ .../service/database/__main__.py | 0 .../tests/KPI_configs.json | 0 src/kpi_management/tests/__init__.py | 14 +++++ .../tests/test_kpi_composer.py | 0 .../tests/test_kpi_writer.py | 0 .../tests/test_messages.py | 0 src/monitoring/client/MonitoringClient.py | 2 +- 44 files changed, 293 insertions(+), 113 deletions(-) rename proto/{kpi_manager.proto => kpi_management.proto} (99%) rename src/{kpi_manager => kpi_management}/Dockerfile (91%) rename src/{kpi_manager => kpi_management}/README.md (57%) rename src/{kpi_manager => kpi_management}/__init__.py (100%) rename src/{kpi_manager/client => kpi_management/kpi_manager}/__init__.py (100%) rename src/{ => kpi_management}/kpi_manager/client/KpiManagerClient.py (95%) rename src/{kpi_manager/service => kpi_management/kpi_manager/client}/__init__.py (100%) rename src/{kpi_manager/service => kpi_management/kpi_manager}/database/__init__.py (100%) rename src/{kpi_manager/service/database => kpi_management/kpi_manager/database/service}/KpiEngine.py (100%) rename src/{kpi_manager/service/database => kpi_management/kpi_manager/database/service}/KpiModel.py (56%) rename src/{kpi_manager/service/database => kpi_management/kpi_manager/database/service}/Kpi_DB.py (96%) rename src/{kpi_manager/tests => kpi_management/kpi_manager/database/service}/__init__.py (100%) rename src/{kpi_manager/service/database => kpi_management/kpi_manager/database/tests}/KpiDBtests.py (83%) rename src/{ => kpi_management}/kpi_manager/service/KpiManagerService.py (78%) rename src/{ => kpi_management}/kpi_manager/service/KpiManagerServiceServicerImpl.py (84%) create mode 100644 src/kpi_management/kpi_manager/service/__init__.py rename src/{ => kpi_management}/kpi_manager/tests/test_kpi_manager.py (83%) create mode 100644 src/kpi_management/kpi_manager/tests/test_messages.py create mode 100644 src/kpi_management/kpi_value_api/__init__.py create mode 100644 src/kpi_management/kpi_value_api/client/__init__.py create mode 100644 src/kpi_management/kpi_value_api/service/__init__.py create mode 100644 src/kpi_management/kpi_value_writer/__init__.py rename src/{kpi_manager => kpi_management/kpi_value_writer}/service/KpiValueComposer.py (97%) rename src/{kpi_manager => kpi_management/kpi_value_writer}/service/KpiWriter.py (100%) create mode 100644 src/kpi_management/kpi_value_writer/service/__init__.py rename src/{kpi_manager => kpi_management}/requirements.in (100%) create mode 100644 src/kpi_management/service/__init__.py rename src/{kpi_manager => kpi_management}/service/__main__.py (100%) create mode 100644 src/kpi_management/service/database/__init__.py rename src/{kpi_manager => kpi_management}/service/database/__main__.py (100%) rename src/{kpi_manager => kpi_management}/tests/KPI_configs.json (100%) create mode 100644 src/kpi_management/tests/__init__.py rename src/{kpi_manager => kpi_management}/tests/test_kpi_composer.py (100%) rename src/{kpi_manager => kpi_management}/tests/test_kpi_writer.py (100%) rename src/{kpi_manager => kpi_management}/tests/test_messages.py (100%) diff --git a/proto/analytics_frontend.proto b/proto/analytics_frontend.proto index 6af761ae5..070d0b957 100644 --- a/proto/analytics_frontend.proto +++ b/proto/analytics_frontend.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package device; import "context.proto"; -import "kpi_manager.proto"; +import "kpi_management.proto"; import "kpi_sample_types.proto"; service AnalyticsFrontendService { @@ -21,12 +21,12 @@ enum AnalyzerMode { } message Analyzer { - repeated kpi_manager.KpiId kpi_id = 1; // The KPI Ids to be processed by the analyzer - AnalyzerMode mode = 2; // Operation mode of the analyzer - float batch_min_duration_s = 3; // In batch mode, min duration to collect before executing batch - float batch_max_duration_s = 4; // In batch mode, max duration collected to execute the batch - uint batch_min_size = 5; // In batch mode, min number of samples to collect before executing batch - uint batch_max_size = 6; // In batch mode, max number of samples collected to execute the batch + repeated kpi_management.KpiId kpi_id = 1; // The KPI Ids to be processed by the analyzer + AnalyzerMode mode = 2; // Operation mode of the analyzer + float batch_min_duration_s = 3; // In batch mode, min duration to collect before executing batch + float batch_max_duration_s = 4; // In batch mode, max duration collected to execute the batch + uint64 batch_min_size = 5; // In batch mode, min number of samples to collect before executing batch + uint64 batch_max_size = 6; // In batch mode, max number of samples collected to execute the batch } message AnalyzerFilter { @@ -34,7 +34,7 @@ message AnalyzerFilter { // An empty list means: any value is accepted. // All fields empty means: list all Analyzers repeated AnalyzerId analyzer_id = 1; - repeated kpi_manager.KpiId kpi_id = 2; + repeated kpi_management.KpiId kpi_id = 2; repeated kpi_sample_types.KpiSampleType kpi_sample_type = 3; repeated context.DeviceId device_id = 4; repeated context.EndPointId endpoint_id = 5; diff --git a/proto/device.proto b/proto/device.proto index 98cca8ce9..519bdeae9 100644 --- a/proto/device.proto +++ b/proto/device.proto @@ -17,7 +17,7 @@ package device; import "context.proto"; //import "monitoring.proto"; -import "kpi_manager.proto"; +import "kpi_management.proto"; service DeviceService { rpc AddDevice (context.Device ) returns (context.DeviceId ) {} @@ -28,8 +28,8 @@ service DeviceService { } message MonitoringSettings { - kpi_manager.KpiId kpi_id = 1; - kpi_manager.KpiDescriptor kpi_descriptor = 2; + kpi_management.KpiId kpi_id = 1; + kpi_management.KpiDescriptor kpi_descriptor = 2; float sampling_duration_s = 3; float sampling_interval_s = 4; } diff --git a/proto/kpi_manager.proto b/proto/kpi_management.proto similarity index 99% rename from proto/kpi_manager.proto rename to proto/kpi_management.proto index ad48eb84f..a2a8f9d72 100644 --- a/proto/kpi_manager.proto +++ b/proto/kpi_management.proto @@ -13,7 +13,7 @@ // limitations under the License. syntax = "proto3"; -package kpi_manager; +package kpi_management; import "context.proto"; import "kpi_sample_types.proto"; @@ -25,7 +25,6 @@ service KpiManagerService{ rpc SelectKpiDescriptor (KpiDescriptorFilter) returns (KpiDescriptorList ) {} // Stable and final } - message KpiId { context.Uuid kpi_id = 1; } diff --git a/proto/monitoring.proto b/proto/monitoring.proto index 2706988aa..e316fbdc1 100755 --- a/proto/monitoring.proto +++ b/proto/monitoring.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package monitoring; import "context.proto"; -import "kpi_manager.proto"; +import "kpi_management.proto"; //import "kpi_sample_types.proto"; service MonitoringService { @@ -43,14 +43,14 @@ service MonitoringService { message MonitorKpiRequest { - kpi_manager.KpiId kpi_id = 1; + kpi_management.KpiId kpi_id = 1; float monitoring_window_s = 2; float sampling_rate_s = 3; // Pending add field to reflect Available Device Protocols } message KpiQuery { - repeated kpi_manager.KpiId kpi_ids = 1; + repeated kpi_management.KpiId kpi_ids = 1; float monitoring_window_s = 2; uint32 last_n_samples = 3; // used when you want something like "get the last N many samples context.Timestamp start_timestamp = 4; // used when you want something like "get the samples since X date/time" @@ -64,7 +64,7 @@ message RawKpi { // cell } message RawKpiList { // column - kpi_manager.KpiId kpi_id = 1; + kpi_management.KpiId kpi_id = 1; repeated RawKpi raw_kpis = 2; } @@ -75,7 +75,7 @@ message RawKpiTable { // table message Kpi { - kpi_manager.KpiId kpi_id = 1; + kpi_management.KpiId kpi_id = 1; context.Timestamp timestamp = 2; KpiValue kpi_value = 3; } @@ -109,7 +109,7 @@ message KpiList { message SubsDescriptor{ SubscriptionID subs_id = 1; - kpi_manager.KpiId kpi_id = 2; + kpi_management.KpiId kpi_id = 2; float sampling_duration_s = 3; float sampling_interval_s = 4; context.Timestamp start_timestamp = 5; // used when you want something like "get the samples since X date/time" @@ -134,7 +134,7 @@ message AlarmDescriptor { AlarmID alarm_id = 1; string alarm_description = 2; string name = 3; - kpi_manager.KpiId kpi_id = 4; + kpi_management.KpiId kpi_id = 4; KpiValueRange kpi_value_range = 5; context.Timestamp timestamp = 6; } diff --git a/proto/optical_attack_detector.proto b/proto/optical_attack_detector.proto index 0d3ed58de..61f93c299 100644 --- a/proto/optical_attack_detector.proto +++ b/proto/optical_attack_detector.proto @@ -18,7 +18,7 @@ package optical_attack_detector; import "context.proto"; //import "monitoring.proto"; -import "kpi_manager.proto"; +import "kpi_management.proto"; service OpticalAttackDetectorService { @@ -29,5 +29,5 @@ service OpticalAttackDetectorService { message DetectionRequest { context.ServiceId service_id = 1; - kpi_manager.KpiId kpi_id = 2; + kpi_management.KpiId kpi_id = 2; } diff --git a/proto/policy_condition.proto b/proto/policy_condition.proto index c0af929ef..8f1211208 100644 --- a/proto/policy_condition.proto +++ b/proto/policy_condition.proto @@ -16,11 +16,11 @@ syntax = "proto3"; package policy; import "monitoring.proto"; -import "kpi_manager.proto"; +import "kpi_management.proto"; // Condition message PolicyRuleCondition { - kpi_manager.KpiId kpiId = 1; + kpi_management.KpiId kpiId = 1; NumericalOperator numericalOperator = 2; monitoring.KpiValue kpiValue = 3; } diff --git a/proto/telemetry_frontend.proto b/proto/telemetry_frontend.proto index 48bfd7a0e..ffc851a4c 100644 --- a/proto/telemetry_frontend.proto +++ b/proto/telemetry_frontend.proto @@ -2,8 +2,7 @@ syntax = "proto3"; package device; import "context.proto"; -import "kpi_manager.proto"; -import "kpi_sample_types.proto"; +import "kpi_management.proto"; service TelemetryFrontendService { rpc StartCollector (Collector ) returns (CollectorId ) {} @@ -16,25 +15,18 @@ message CollectorId { } message Collector { - CollectorId collector_id = 1; // The Collector ID - kpi_manager.KpiId kpi_id = 2; // The KPI Id to be associated to the collected samples - float duration_s = 3; // Terminate data collection after duration[seconds]; duration==0 means indefinitely - float interval_s = 4; // Interval between collected samples + CollectorId collector_id = 1; // The Collector ID + kpi_management.KpiId kpi_id = 2; // The KPI Id to be associated to the collected samples + float duration_s = 3; // Terminate data collection after duration[seconds]; duration==0 means indefinitely + float interval_s = 4; // Interval between collected samples } message CollectorFilter { // Collector that fulfill the filter are those that match ALL the following fields. // An empty list means: any value is accepted. // All fields empty means: list all Collectors - repeated CollectorId collector_id = 1; - repeated kpi_manager.KpiId kpi_id = 2; - // repeated kpi_sample_types.KpiSampleType kpi_sample_type = 3; - // repeated context.DeviceId device_id = 4; - // repeated context.EndPointId endpoint_id = 5; - // repeated context.ServiceId service_id = 6; - // repeated context.SliceId slice_id = 7; - // repeated context.ConnectionId connection_id = 8; - // repeated context.LinkId link_id = 9; + repeated CollectorId collector_id = 1; + repeated kpi_management.KpiId kpi_id = 2; } message CollectorList { diff --git a/scripts/run_tests_locally-kpi-DB.sh b/scripts/run_tests_locally-kpi-DB.sh index aa9767620..75d922061 100755 --- a/scripts/run_tests_locally-kpi-DB.sh +++ b/scripts/run_tests_locally-kpi-DB.sh @@ -25,4 +25,4 @@ cd $PROJECTDIR/src RCFILE=$PROJECTDIR/coverage/.coveragerc python3 -m pytest --log-level=INFO --log-cli-level=INFO --verbose \ - kpi_manager/service/database/KpiDBtests.py \ No newline at end of file + kpi_management/kpi_manager/database/tests/KpiDBtests.py \ No newline at end of file diff --git a/scripts/run_tests_locally-kpi-manager.sh b/scripts/run_tests_locally-kpi-manager.sh index be69980e0..17c0c02ac 100755 --- a/scripts/run_tests_locally-kpi-manager.sh +++ b/scripts/run_tests_locally-kpi-manager.sh @@ -25,4 +25,4 @@ cd $PROJECTDIR/src RCFILE=$PROJECTDIR/coverage/.coveragerc python3 -m pytest --log-level=INFO --log-cli-level=INFO --verbose \ - kpi_manager/tests/test_kpi_manager.py \ No newline at end of file + kpi_management/kpi_manager/tests/test_kpi_manager.py \ No newline at end of file diff --git a/src/kpi_manager/Dockerfile b/src/kpi_management/Dockerfile similarity index 91% rename from src/kpi_manager/Dockerfile rename to src/kpi_management/Dockerfile index d3d962b9f..0369fc0c8 100644 --- a/src/kpi_manager/Dockerfile +++ b/src/kpi_management/Dockerfile @@ -54,9 +54,9 @@ RUN rm *.proto RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \; # Create component sub-folders, get specific Python packages -RUN mkdir -p /var/teraflow/kpi_manager -WORKDIR /var/teraflow/kpi_manager -COPY src/kpi_manager/requirements.in requirements.in +RUN mkdir -p /var/teraflow/kpi_management +WORKDIR /var/teraflow/kpi_management +COPY src/kpi_management/requirements.in requirements.in RUN pip-compile --quiet --output-file=requirements.txt requirements.in RUN python3 -m pip install -r requirements.txt @@ -65,7 +65,7 @@ WORKDIR /var/teraflow COPY src/context/. context/ COPY src/device/. device/ COPY src/monitoring/. monitoring/ -COPY src/kpi_manager/. kpi_manager/ +COPY src/kpi_management/. kpi_management/ # Start the service -ENTRYPOINT ["python", "-m", "kpi_manager.service"] +ENTRYPOINT ["python", "-m", "kpi_management.service"] diff --git a/src/kpi_manager/README.md b/src/kpi_management/README.md similarity index 57% rename from src/kpi_manager/README.md rename to src/kpi_management/README.md index 88c52bb4f..b73f0e8af 100644 --- a/src/kpi_manager/README.md +++ b/src/kpi_management/README.md @@ -1,19 +1,21 @@ -# How to locally run and test KPI Manager service +# How to locally run and test KPI management service + +## ----- Update Required (Files structure has been changed) ----- ### Pre-requisets -The following requirements should be fulfilled before the execuation of KPI Manager service. +The following requirements should be fulfilled before the execuation of KPI management service. -1. verify that [kpi_manager.proto](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/proto/kpi_manager.proto) file exists and grpcs file are generated sucessfully. -2. virtual enviornment exist with all the required packages listed in ["requirements.in"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_manager/requirements.in) are installed sucessfully. +1. verify that [kpi_management.proto](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/proto/kpi_management.proto) file exists and grpcs file are generated sucessfully. +2. virtual enviornment exist with all the required packages listed in ["requirements.in"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_management/requirements.in) are installed sucessfully. 3. verify the creation of required database and table. -[KPI DB test](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_manager/service/database/KpiDBtests.py) python file enlist the functions to create tables and database. -[KPI Engine](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_manager/service/database/KpiEngine.py) contains the DB string, update the string as per your deployment. +[KPI DB test](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_management/service/database/KpiDBtests.py) python file enlist the functions to create tables and database. +[KPI Engine](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_management/service/database/KpiEngine.py) contains the DB string, update the string as per your deployment. ### Messages format templates -["Messages"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_manager/tests/test_messages.py) python file enlist the basic gRPC messages format used during the testing. +["Messages"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_management/tests/test_messages.py) python file enlist the basic gRPC messages format used during the testing. ### Test file -["KPI manager test"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_manager/tests/test_kpi_manager.py) python file enlist the different tests conducted during the experiment. +["KPI management test"](https://labs.etsi.org/rep/tfs/controller/-/blob/feat/71-cttc-separation-of-monitoring/src/kpi_management/tests/test_kpi_management.py) python file enlist the different tests conducted during the experiment. ### Flow of execution (Kpi Maanager Service functions) 1. Call the `create_database()` and `create_tables()` functions from `Kpi_DB` class to create the required database and table if they don't exist. diff --git a/src/kpi_manager/__init__.py b/src/kpi_management/__init__.py similarity index 100% rename from src/kpi_manager/__init__.py rename to src/kpi_management/__init__.py diff --git a/src/kpi_manager/client/__init__.py b/src/kpi_management/kpi_manager/__init__.py similarity index 100% rename from src/kpi_manager/client/__init__.py rename to src/kpi_management/kpi_manager/__init__.py diff --git a/src/kpi_manager/client/KpiManagerClient.py b/src/kpi_management/kpi_manager/client/KpiManagerClient.py similarity index 95% rename from src/kpi_manager/client/KpiManagerClient.py rename to src/kpi_management/kpi_manager/client/KpiManagerClient.py index 30b1720fb..140381d3a 100755 --- a/src/kpi_manager/client/KpiManagerClient.py +++ b/src/kpi_management/kpi_manager/client/KpiManagerClient.py @@ -19,8 +19,8 @@ from common.Settings import get_service_host, get_service_port_grpc from common.proto.context_pb2 import Empty from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.client.RetryDecorator import retry, delay_exponential -from common.proto.kpi_manager_pb2_grpc import KpiManagerServiceStub -from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList +from common.proto.kpi_management_pb2_grpc import KpiManagerServiceStub +from common.proto.kpi_management_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList LOGGER = logging.getLogger(__name__) MAX_RETRIES = 10 diff --git a/src/kpi_manager/service/__init__.py b/src/kpi_management/kpi_manager/client/__init__.py similarity index 100% rename from src/kpi_manager/service/__init__.py rename to src/kpi_management/kpi_manager/client/__init__.py diff --git a/src/kpi_manager/service/database/__init__.py b/src/kpi_management/kpi_manager/database/__init__.py similarity index 100% rename from src/kpi_manager/service/database/__init__.py rename to src/kpi_management/kpi_manager/database/__init__.py diff --git a/src/kpi_manager/service/database/KpiEngine.py b/src/kpi_management/kpi_manager/database/service/KpiEngine.py similarity index 100% rename from src/kpi_manager/service/database/KpiEngine.py rename to src/kpi_management/kpi_manager/database/service/KpiEngine.py diff --git a/src/kpi_manager/service/database/KpiModel.py b/src/kpi_management/kpi_manager/database/service/KpiModel.py similarity index 56% rename from src/kpi_manager/service/database/KpiModel.py rename to src/kpi_management/kpi_manager/database/service/KpiModel.py index 5bfc5525b..846f738f9 100644 --- a/src/kpi_manager/service/database/KpiModel.py +++ b/src/kpi_management/kpi_manager/database/service/KpiModel.py @@ -31,14 +31,14 @@ class Kpi(Base): __tablename__ = 'kpi' kpi_id = Column(UUID(as_uuid=False), primary_key=True) - kpi_description = Column(Text, unique=True) - kpi_sample_type = Column(Integer) - device_id = Column(String) - endpoint_id = Column(String) - service_id = Column(String) - slice_id = Column(String) - connection_id = Column(String) - link_id = Column(String) + kpi_description = Column(Text, nullable=False) + kpi_sample_type = Column(Integer, nullable=False) + device_id = Column(String, nullable=False) + endpoint_id = Column(String, nullable=False) + service_id = Column(String, nullable=False) + slice_id = Column(String, nullable=False) + connection_id = Column(String, nullable=False) + link_id = Column(String, nullable=False) # helps in logging the information def __repr__(self): @@ -47,3 +47,22 @@ class Kpi(Base): f"endpoint_id='{self.endpoint_id}', service_id='{self.service_id}', " f"slice_id='{self.slice_id}', connection_id='{self.connection_id}', " f"link_id='{self.link_id}')>") + + @classmethod + def create_row_from_kpiDescriptor(cls, request): + """ + Create an instance of Kpi from a request object. + Args: request: The request object containing the data. + Returns: An instance of Kpi initialized with data from the request. + """ + return cls( + kpi_id=request.kpi_id.kpi_id.uuid, + kpi_description=request.kpi_description, + kpi_sample_type=request.kpi_sample_type, + device_id=request.device_id.device_uuid.uuid, + endpoint_id=request.endpoint_id.endpoint_uuid.uuid, + service_id=request.service_id.service_uuid.uuid, + slice_id=request.slice_id.slice_uuid.uuid, + connection_id=request.connection_id.connection_uuid.uuid, + link_id=request.link_id.link_uuid.uuid + ) \ No newline at end of file diff --git a/src/kpi_manager/service/database/Kpi_DB.py b/src/kpi_management/kpi_manager/database/service/Kpi_DB.py similarity index 96% rename from src/kpi_manager/service/database/Kpi_DB.py rename to src/kpi_management/kpi_manager/database/service/Kpi_DB.py index eafa38aad..847e4b70a 100644 --- a/src/kpi_manager/service/database/Kpi_DB.py +++ b/src/kpi_management/kpi_manager/database/service/Kpi_DB.py @@ -17,8 +17,8 @@ import sqlalchemy import sqlalchemy_utils from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base -from kpi_manager.service.database.KpiEngine import KpiEngine -from kpi_manager.service.database.KpiModel import Kpi +from kpi_management.kpi_manager.database.service.KpiEngine import KpiEngine +from kpi_management.kpi_manager.database.service.KpiModel import Kpi LOGGER = logging.getLogger(__name__) DB_NAME = "kpi" @@ -31,7 +31,7 @@ class Kpi_DB: return False self.db_name = DB_NAME # self.drop_database(self.db_engine) # added to test - # self.create_database(self.db_engine) # to add database + # self.create_database(self.db_engine) # to add database self.Session = sessionmaker(bind=self.db_engine) @staticmethod diff --git a/src/kpi_manager/tests/__init__.py b/src/kpi_management/kpi_manager/database/service/__init__.py similarity index 100% rename from src/kpi_manager/tests/__init__.py rename to src/kpi_management/kpi_manager/database/service/__init__.py diff --git a/src/kpi_manager/service/database/KpiDBtests.py b/src/kpi_management/kpi_manager/database/tests/KpiDBtests.py similarity index 83% rename from src/kpi_manager/service/database/KpiDBtests.py rename to src/kpi_management/kpi_manager/database/tests/KpiDBtests.py index 022a7633d..24313e138 100644 --- a/src/kpi_manager/service/database/KpiDBtests.py +++ b/src/kpi_management/kpi_manager/database/tests/KpiDBtests.py @@ -14,15 +14,10 @@ import logging -from kpi_manager.service.database.Kpi_DB import Kpi_DB +from kpi_management.kpi_manager.database.service.Kpi_DB import Kpi_DB LOGGER = logging.getLogger(__name__) - -def test_create_db_object(): - LOGGER.info('>>> test_create_db_object : START<<< ') - kpiDBobj = Kpi_DB() - def test_verify_Tables(): LOGGER.info('>>> test_verify_Tables : START <<< ') kpiDBobj = Kpi_DB() diff --git a/src/kpi_manager/service/KpiManagerService.py b/src/kpi_management/kpi_manager/service/KpiManagerService.py similarity index 78% rename from src/kpi_manager/service/KpiManagerService.py rename to src/kpi_management/kpi_manager/service/KpiManagerService.py index dbbcec2cf..d4a8a8104 100755 --- a/src/kpi_manager/service/KpiManagerService.py +++ b/src/kpi_management/kpi_manager/service/KpiManagerService.py @@ -14,11 +14,9 @@ from common.Constants import ServiceNameEnum from common.Settings import get_service_port_grpc -# from common.proto.monitoring_pb2_grpc import add_MonitoringServiceServicer_to_server -from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server +from common.proto.kpi_management_pb2_grpc import add_KpiManagerServiceServicer_to_server from common.tools.service.GenericGrpcService import GenericGrpcService -from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl -# from monitoring.service.MonitoringServiceServicerImpl import MonitoringServiceServicerImpl +from kpi_management.kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl from monitoring.service.NameMapping import NameMapping class KpiManagerService(GenericGrpcService): diff --git a/src/kpi_manager/service/KpiManagerServiceServicerImpl.py b/src/kpi_management/kpi_manager/service/KpiManagerServiceServicerImpl.py similarity index 84% rename from src/kpi_manager/service/KpiManagerServiceServicerImpl.py rename to src/kpi_management/kpi_manager/service/KpiManagerServiceServicerImpl.py index 4b2e9fc3f..3d96c98dd 100644 --- a/src/kpi_manager/service/KpiManagerServiceServicerImpl.py +++ b/src/kpi_management/kpi_manager/service/KpiManagerServiceServicerImpl.py @@ -17,13 +17,13 @@ import logging, grpc import sqlalchemy, sqlalchemy_utils from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method from common.proto.context_pb2 import Empty -from common.proto.kpi_manager_pb2_grpc import KpiManagerServiceServicer -from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList +from common.proto.kpi_management_pb2_grpc import KpiManagerServiceServicer +from common.proto.kpi_management_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList from monitoring.service.NameMapping import NameMapping # from monitoring.service import ManagementDBTools -from kpi_manager.service.database.Kpi_DB import Kpi_DB -from kpi_manager.service.database.KpiModel import Kpi as KpiModel +from kpi_management.kpi_manager.database.service.Kpi_DB import Kpi_DB +from kpi_management.kpi_manager.database.service.KpiModel import Kpi as KpiModel # from telemetry.database.TelemetryModel import Kpi as KpiModel from common.proto.context_pb2 import DeviceId, LinkId, ServiceId, SliceId,\ ConnectionId, EndPointId @@ -44,16 +44,17 @@ class KpiManagerServiceServicerImpl(KpiManagerServiceServicer): response = KpiId() LOGGER.info("Received gRPC message object: {:}".format(request)) try: - kpi_to_insert = KpiModel() - kpi_to_insert.kpi_id = request.kpi_id.kpi_id.uuid - kpi_to_insert.kpi_description = request.kpi_description - kpi_to_insert.kpi_sample_type = request.kpi_sample_type - kpi_to_insert.device_id = request.device_id.device_uuid.uuid - kpi_to_insert.endpoint_id = request.endpoint_id.endpoint_uuid.uuid - kpi_to_insert.service_id = request.service_id.service_uuid.uuid - kpi_to_insert.slice_id = request.slice_id.slice_uuid.uuid - kpi_to_insert.connection_id = request.connection_id.connection_uuid.uuid - kpi_to_insert.link_id = request.link_id.link_uuid.uuid + # kpi_to_insert = KpiModel() + # kpi_to_insert.kpi_id = request.kpi_id.kpi_id.uuid + # kpi_to_insert.kpi_description = request.kpi_description + # kpi_to_insert.kpi_sample_type = request.kpi_sample_type + # kpi_to_insert.device_id = request.device_id.device_uuid.uuid + # kpi_to_insert.endpoint_id = request.endpoint_id.endpoint_uuid.uuid + # kpi_to_insert.service_id = request.service_id.service_uuid.uuid + # kpi_to_insert.slice_id = request.slice_id.slice_uuid.uuid + # kpi_to_insert.connection_id = request.connection_id.connection_uuid.uuid + # kpi_to_insert.link_id = request.link_id.link_uuid.uuid + kpi_to_insert = KpiModel.create_row_from_kpiDescriptor(request) if(self.Kpi_DBobj.add_row_to_db(kpi_to_insert)): response.kpi_id.uuid = request.kpi_id.kpi_id.uuid # LOGGER.info("Added Row: {:}".format(response)) diff --git a/src/kpi_management/kpi_manager/service/__init__.py b/src/kpi_management/kpi_manager/service/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_manager/service/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/tests/test_kpi_manager.py b/src/kpi_management/kpi_manager/tests/test_kpi_manager.py similarity index 83% rename from src/kpi_manager/tests/test_kpi_manager.py rename to src/kpi_management/kpi_manager/tests/test_kpi_manager.py index 680847005..ca5f6af6f 100755 --- a/src/kpi_manager/tests/test_kpi_manager.py +++ b/src/kpi_management/kpi_manager/tests/test_kpi_manager.py @@ -23,17 +23,17 @@ from typing import Union from common.proto.context_pb2 import ConfigActionEnum, Context, ContextId, DeviceOperationalStatusEnum, EventTypeEnum, DeviceEvent, Device, Empty, Topology, TopologyId from common.Constants import ServiceNameEnum -from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum +# from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum from common.Settings import ( ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_service_port_grpc) from common.tests.MockServicerImpl_Context import MockServicerImpl_Context from common.proto.context_pb2_grpc import add_ContextServiceServicer_to_server -from common.proto.kpi_sample_types_pb2 import KpiSampleType -from common.tools.object_factory.Context import json_context, json_context_id -from common.tools.object_factory.Topology import json_topology, json_topology_id +# from common.proto.kpi_sample_types_pb2 import KpiSampleType +# from common.tools.object_factory.Context import json_context, json_context_id +# from common.tools.object_factory.Topology import json_topology, json_topology_id # from common.proto.monitoring_pb2 import KpiId, KpiDescriptor, SubsDescriptor, SubsList, AlarmID, \ # AlarmDescriptor, AlarmList, KpiDescriptorList, SubsResponse, AlarmResponse, RawKpiTable #, Kpi, KpiList -from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList +from common.proto.kpi_management_pb2 import KpiId, KpiDescriptor, KpiDescriptorFilter, KpiDescriptorList from common.tools.service.GenericGrpcService import GenericGrpcService from context.client.ContextClient import ContextClient @@ -43,17 +43,16 @@ from device.service.driver_api.DriverInstanceCache import DriverInstanceCache from device.service.DeviceService import DeviceService from device.client.DeviceClient import DeviceClient -from kpi_manager.tests.test_messages import create_kpi_descriptor_request, create_kpi_id_request, \ - create_kpi_filter_request_a, create_kpi_descriptor_request_a +from kpi_management.kpi_manager.tests.test_messages import create_kpi_descriptor_request # from monitoring.service.MonitoringService import MonitoringService -from kpi_manager.service.KpiManagerService import KpiManagerService +from kpi_management.kpi_manager.service.KpiManagerService import KpiManagerService # from monitoring.client.MonitoringClient import MonitoringClient -from kpi_manager.client.KpiManagerClient import KpiManagerClient +from kpi_management.kpi_manager.client.KpiManagerClient import KpiManagerClient -from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl +from kpi_management.kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl -from monitoring.service.ManagementDBTools import ManagementDB -from monitoring.service.MetricsDBTools import MetricsDB +# from monitoring.service.ManagementDBTools import ManagementDB +# from monitoring.service.MetricsDBTools import MetricsDB from monitoring.service.NameMapping import NameMapping os.environ['DEVICE_EMULATED_ONLY'] = 'TRUE' @@ -210,17 +209,36 @@ def kpi_manager_client(kpi_manager_service : KpiManagerService): # pylint: disab # Tests Implementation of Kpi Manager ########################### -# ---------- 2nd Iteration Tests ----------------- +# ---------- 3rd Iteration Tests ---------------- def test_SetKpiDescriptor(kpi_manager_client): LOGGER.info(" >>> test_SetKpiDescriptor: START <<< ") - with open("kpi_manager/tests/KPI_configs.json", 'r') as file: - data = json.load(file) - _descriptors = data.get('KPIs', []) - for _descritor_name in _descriptors: - response = kpi_manager_client.SetKpiDescriptor(create_kpi_descriptor_request_a(_descritor_name)) - LOGGER.info("Response gRPC message object: {:}".format(response)) + response = kpi_manager_client.SetKpiDescriptor(create_kpi_descriptor_request()) + LOGGER.info("Response gRPC message object: {:}".format(response)) assert isinstance(response, KpiId) +def test_DeleteKpiDescriptor(kpi_manager_client): + LOGGER.info(" >>> test_DeleteKpiDescriptor: START <<< ") + # adding KPI + response = kpi_manager_client.SetKpiDescriptor(create_kpi_descriptor_request()) + # deleting KPI + del_response = kpi_manager_client.DeleteKpiDescriptor(response) + # verifing KPI + kpi_manager_client.GetKpiDescriptor(response) + LOGGER.info("Response of delete method gRPC message object: {:}".format(del_response)) + assert isinstance(del_response, Empty) + + +# ---------- 2nd Iteration Tests ----------------- +# def test_SetKpiDescriptor(kpi_manager_client): +# LOGGER.info(" >>> test_SetKpiDescriptor: START <<< ") +# with open("kpi_manager/tests/KPI_configs.json", 'r') as file: +# data = json.load(file) +# _descriptors = data.get('KPIs', []) +# for _descritor_name in _descriptors: +# response = kpi_manager_client.SetKpiDescriptor(create_kpi_descriptor_request_a(_descritor_name)) +# LOGGER.info("Response gRPC message object: {:}".format(response)) +# assert isinstance(response, KpiId) + # def test_GetKpiDescriptor(kpi_manager_client): # LOGGER.info(" >>> test_GetKpiDescriptor: START <<< ") # response = kpi_manager_client.GetKpiDescriptor(create_kpi_id_request()) diff --git a/src/kpi_management/kpi_manager/tests/test_messages.py b/src/kpi_management/kpi_manager/tests/test_messages.py new file mode 100644 index 000000000..7c2933b7a --- /dev/null +++ b/src/kpi_management/kpi_manager/tests/test_messages.py @@ -0,0 +1,30 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + +import uuid +from common.proto import kpi_management_pb2 +from common.proto.kpi_sample_types_pb2 import KpiSampleType + +def create_kpi_descriptor_request(descriptor_name: str = "Test_name"): + _create_kpi_request = kpi_management_pb2.KpiDescriptor() + _create_kpi_request.kpi_id.kpi_id.uuid = str(uuid.uuid4()) + _create_kpi_request.kpi_description = descriptor_name + _create_kpi_request.kpi_sample_type = KpiSampleType.KPISAMPLETYPE_PACKETS_RECEIVED + _create_kpi_request.device_id.device_uuid.uuid = 'DEV1' # pylint: disable=maybe-no-member + _create_kpi_request.service_id.service_uuid.uuid = 'SERV1' # pylint: disable=maybe-no-member + _create_kpi_request.slice_id.slice_uuid.uuid = 'SLC1' # pylint: disable=maybe-no-member + _create_kpi_request.endpoint_id.endpoint_uuid.uuid = 'END1' # pylint: disable=maybe-no-member + _create_kpi_request.connection_id.connection_uuid.uuid = 'CON1' # pylint: disable=maybe-no-member + _create_kpi_request.link_id.link_uuid.uuid = 'LNK1' # pylint: disable=maybe-no-member + return _create_kpi_request \ No newline at end of file diff --git a/src/kpi_management/kpi_value_api/__init__.py b/src/kpi_management/kpi_value_api/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_value_api/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_management/kpi_value_api/client/__init__.py b/src/kpi_management/kpi_value_api/client/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_value_api/client/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_management/kpi_value_api/service/__init__.py b/src/kpi_management/kpi_value_api/service/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_value_api/service/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_management/kpi_value_writer/__init__.py b/src/kpi_management/kpi_value_writer/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_value_writer/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/service/KpiValueComposer.py b/src/kpi_management/kpi_value_writer/service/KpiValueComposer.py similarity index 97% rename from src/kpi_manager/service/KpiValueComposer.py rename to src/kpi_management/kpi_value_writer/service/KpiValueComposer.py index bb2b6ebf3..61e558121 100644 --- a/src/kpi_manager/service/KpiValueComposer.py +++ b/src/kpi_management/kpi_value_writer/service/KpiValueComposer.py @@ -20,8 +20,8 @@ import threading from confluent_kafka import KafkaError from confluent_kafka import Producer as KafkaProducer from confluent_kafka import Consumer as KafkaConsumer -from kpi_manager.service.database.Kpi_DB import Kpi_DB -from kpi_manager.service.database.KpiModel import Kpi as KpiModel +from kpi_management.service.database.Kpi_DB import Kpi_DB +from kpi_management.service.database.KpiModel import Kpi as KpiModel LOGGER = logging.getLogger(__name__) # KAFKA_SERVER_IP = '10.152.183.175:30092' diff --git a/src/kpi_manager/service/KpiWriter.py b/src/kpi_management/kpi_value_writer/service/KpiWriter.py similarity index 100% rename from src/kpi_manager/service/KpiWriter.py rename to src/kpi_management/kpi_value_writer/service/KpiWriter.py diff --git a/src/kpi_management/kpi_value_writer/service/__init__.py b/src/kpi_management/kpi_value_writer/service/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/kpi_value_writer/service/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/requirements.in b/src/kpi_management/requirements.in similarity index 100% rename from src/kpi_manager/requirements.in rename to src/kpi_management/requirements.in diff --git a/src/kpi_management/service/__init__.py b/src/kpi_management/service/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/service/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/service/__main__.py b/src/kpi_management/service/__main__.py similarity index 100% rename from src/kpi_manager/service/__main__.py rename to src/kpi_management/service/__main__.py diff --git a/src/kpi_management/service/database/__init__.py b/src/kpi_management/service/database/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/service/database/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/service/database/__main__.py b/src/kpi_management/service/database/__main__.py similarity index 100% rename from src/kpi_manager/service/database/__main__.py rename to src/kpi_management/service/database/__main__.py diff --git a/src/kpi_manager/tests/KPI_configs.json b/src/kpi_management/tests/KPI_configs.json similarity index 100% rename from src/kpi_manager/tests/KPI_configs.json rename to src/kpi_management/tests/KPI_configs.json diff --git a/src/kpi_management/tests/__init__.py b/src/kpi_management/tests/__init__.py new file mode 100644 index 000000000..1549d9811 --- /dev/null +++ b/src/kpi_management/tests/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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. + diff --git a/src/kpi_manager/tests/test_kpi_composer.py b/src/kpi_management/tests/test_kpi_composer.py similarity index 100% rename from src/kpi_manager/tests/test_kpi_composer.py rename to src/kpi_management/tests/test_kpi_composer.py diff --git a/src/kpi_manager/tests/test_kpi_writer.py b/src/kpi_management/tests/test_kpi_writer.py similarity index 100% rename from src/kpi_manager/tests/test_kpi_writer.py rename to src/kpi_management/tests/test_kpi_writer.py diff --git a/src/kpi_manager/tests/test_messages.py b/src/kpi_management/tests/test_messages.py similarity index 100% rename from src/kpi_manager/tests/test_messages.py rename to src/kpi_management/tests/test_messages.py diff --git a/src/monitoring/client/MonitoringClient.py b/src/monitoring/client/MonitoringClient.py index 493e96ca8..0486b8083 100644 --- a/src/monitoring/client/MonitoringClient.py +++ b/src/monitoring/client/MonitoringClient.py @@ -20,7 +20,7 @@ from common.Settings import get_service_host, get_service_port_grpc from common.tools.client.RetryDecorator import retry, delay_exponential from common.tools.grpc.Tools import grpc_message_to_json_string from common.proto.context_pb2 import Empty -from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorList +from common.proto.kpi_management_pb2 import KpiId, KpiDescriptor, KpiDescriptorList from common.proto.monitoring_pb2 import Kpi, MonitorKpiRequest, \ KpiQuery, KpiList, SubsDescriptor, SubscriptionID, SubsList, \ SubsResponse, AlarmDescriptor, AlarmID, AlarmList, AlarmResponse, AlarmSubscription, RawKpiTable -- GitLab