Commits (15)
#!/bin/bash
# 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.
PROJECTDIR=`pwd`
cd $PROJECTDIR/src
RCFILE=$PROJECTDIR/coverage/.coveragerc
coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \
kpi_manager/tests/test_unitary.py
# python3 kpi_manager/tests/test_unitary.py
\ No newline at end of file
...@@ -18,16 +18,20 @@ ...@@ -18,16 +18,20 @@
cd $(dirname $0) cd $(dirname $0)
echo "BUILD context" echo "BUILD context"
context/genproto.sh # context/genproto.sh # genproto.sh file doesn't exist
docker build -t "context:develop" -f context/Dockerfile --quiet . docker build -t "context:develop" -f context/Dockerfile --quiet .
docker build -t "context:test" -f context/tests/Dockerfile --quiet . # docker build -t "context:test" -f context/tests/Dockerfile --quiet . # Dockerfile doesn't exist
cd monitoring # genproto.sh file doesn't exist
./genproto.sh # cd monitoring
cd .. # ./genproto.sh
# cd ..
echo "BUILD monitoring" echo "BUILD monitoring"
docker build -t "monitoring:dockerfile" -f monitoring/Dockerfile . docker build -t "monitoring:dockerfile" -f monitoring/Dockerfile .
echo "BUILD kpi manager"
docker build -t "kpi_manager:dockerfile" -f kpi_manager/Dockerfile .
echo "Prune unused images" echo "Prune unused images"
docker image prune --force docker image prune --force
...@@ -74,7 +74,7 @@ DEFAULT_SERVICE_GRPC_PORTS = { ...@@ -74,7 +74,7 @@ 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.KPIMANGER .value : 7071, ServiceNameEnum.KPIMANAGER .value : 7071,
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,
......
# 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.
FROM python:3.9-slim
# Install dependencies
RUN apt-get --yes --quiet --quiet update && \
apt-get --yes --quiet --quiet install wget g++ git && \
rm -rf /var/lib/apt/lists/*
# Set Python to show logs as they occur
ENV PYTHONUNBUFFERED=0
# Download the gRPC health probe
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe
# Get generic Python packages
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install --upgrade setuptools wheel
RUN python3 -m pip install --upgrade pip-tools
# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
WORKDIR /var/teraflow
COPY common_requirements.in common_requirements.in
RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in
RUN python3 -m pip install -r common_requirements.txt
# Add common files into working directory
WORKDIR /var/teraflow/common
COPY src/common/. ./
RUN rm -rf proto
# Create proto sub-folder, copy .proto files, and generate Python code
RUN mkdir -p /var/teraflow/common/proto
WORKDIR /var/teraflow/common/proto
RUN touch __init__.py
COPY proto/*.proto ./
RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto
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 pip-compile --quiet --output-file=requirements.txt requirements.in
RUN python3 -m pip install -r requirements.txt
# Add component files into working directory
WORKDIR /var/teraflow
COPY src/context/. context/
COPY src/device/. device/
COPY src/monitoring/. monitoring/
COPY src/kpi_manager/. kpi_manager/
# Start the service
ENTRYPOINT ["python", "-m", "kpi_manager.service"]
File mode changed from 100644 to 100755
# 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.
anytree==2.8.0
APScheduler==3.10.1
influx-line-protocol==0.1.4
psycopg2-binary==2.9.3
python-dateutil==2.8.2
python-json-logger==2.0.2
questdb==1.0.1
requests==2.27.1
xmltodict==0.12.0
# grpc_health_probe==0.2.0 #getting error on this library
\ No newline at end of file
...@@ -12,106 +12,20 @@ ...@@ -12,106 +12,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import logging, os, grpc
from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method
from common.proto.context_pb2 import Empty
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.monitoring_pb2_grpc import add_MonitoringServiceServicer_to_server
from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server from common.proto.kpi_manager_pb2_grpc import add_KpiManagerServiceServicer_to_server
from common.proto.kpi_manager_pb2_grpc import KpiManagerServiceServicer
from monitoring.service.NameMapping import NameMapping
from common.proto.kpi_manager_pb2 import kpiDescriptor, KpiId, KpiDescriptorList
from monitoring.service import ManagementDBTools
from common.tools.service.GenericGrpcService import GenericGrpcService from common.tools.service.GenericGrpcService import GenericGrpcService
from kpi_manager.service.KpiManagerServiceServicerImpl import KpiManagerServiceServicerImpl
# from monitoring.service.MonitoringServiceServicerImpl import MonitoringServiceServicerImpl
from monitoring.service.NameMapping import NameMapping
LOGGER = logging.getLogger(__name__) class KpiManagerService(GenericGrpcService):
def __init__(self, name_mapping : NameMapping, cls_name: str = __name__) -> None:
METRICS_POOL = MetricsPool('Monitoring', 'RPC') port = get_service_port_grpc(ServiceNameEnum.KPIMANAGER)
super().__init__(port, cls_name=cls_name)
class KpiManagerServer(KpiManagerServiceServicer): self.kpiManagerService_servicer = KpiManagerServiceServicerImpl(name_mapping)
def __init__(self, cls_name: str = __name__):
LOGGER.info('Init KpiManagerService')
port = get_service_port_grpc(ServiceNameEnum.KPIMANAGER) # port updated
GenericGrpcService(port, cls_name = cls_name) # class inheretence was removed
# Init sqlite monitoring db
self.management_db = ManagementDBTools.ManagementDB('monitoring.db') # why monitoring.db here???
LOGGER.info('MetricsDB initialized --- KPI Manager Service')
def install_servicers(self): def install_servicers(self):
# There is no need to create the "MonitoringServiceServicerImpl" instance because actual class add_KpiManagerServiceServicer_to_server(self.kpiManagerService_servicer, self.server)
# implementation exists in the same class.
add_KpiManagerServiceServicer_to_server(KpiManagerServer(), self.server)
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def SetKpi(
self, request: KpiDescriptor, grpc_context: grpc.ServicerContext
) -> KpiId:
response = KpiId()
kpi_description = request.kpi_description
kpi_sample_type = request.kpi_sample_type
kpi_device_id = request.device_id.device_uuid.uuid
kpi_endpoint_id = request.endpoint_id.endpoint_uuid.uuid
kpi_service_id = request.service_id.service_uuid.uuid
kpi_slice_id = request.slice_id.slice_uuid.uuid
kpi_connection_id = request.connection_id.connection_uuid.uuid
kpi_link_id = request.link_id.link_uuid.uuid
if request.kpi_id.kpi_id.uuid != "":
response.kpi_id.uuid = request.kpi_id.kpi_id.uuid
# Here the code to modify an existing kpi
else:
data = self.management_db.insert_KPI(
kpi_description, kpi_sample_type, kpi_device_id, kpi_endpoint_id,
kpi_service_id, kpi_slice_id, kpi_connection_id, kpi_link_id)
response.kpi_id.uuid = str(data)
return response
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def DeleteKpi(self, request: KpiId, grpc_context: grpc.ServicerContext) -> Empty:
kpi_id = int(request.kpi_id.uuid)
kpi = self.management_db.get_KPI(kpi_id)
if kpi:
self.management_db.delete_KPI(kpi_id)
else:
LOGGER.info('DeleteKpi error: KpiID({:s}): not found in database'.format(str(kpi_id)))
return Empty()
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def GetKpiDescriptor(self, request: KpiId, grpc_context: grpc.ServicerContext) -> KpiDescriptor:
kpi_id = request.kpi_id.uuid
kpi_db = self.management_db.get_KPI(int(kpi_id))
kpiDescriptor = KpiDescriptor()
if kpi_db is None:
LOGGER.info('GetKpiDescriptor error: KpiID({:s}): not found in database'.format(str(kpi_id)))
else:
kpiDescriptor.kpi_description = kpi_db[1]
kpiDescriptor.kpi_sample_type = kpi_db[2]
kpiDescriptor.device_id.device_uuid.uuid = str(kpi_db[3])
kpiDescriptor.endpoint_id.endpoint_uuid.uuid = str(kpi_db[4])
kpiDescriptor.service_id.service_uuid.uuid = str(kpi_db[5])
kpiDescriptor.slice_id.slice_uuid.uuid = str(kpi_db[6])
kpiDescriptor.connection_id.connection_uuid.uuid = str(kpi_db[7])
kpiDescriptor.link_id.link_uuid.uuid = str(kpi_db[8])
return kpiDescriptor
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def GetKpiDescriptorList(self, request: Empty, grpc_context: grpc.ServicerContext) -> KpiDescriptorList:
kpi_descriptor_list = KpiDescriptorList()
data = self.management_db.get_KPIS()
LOGGER.debug(f"data: {data}")
for item in data:
kpi_descriptor = KpiDescriptor()
kpi_descriptor.kpi_id.kpi_id.uuid = str(item[0])
kpi_descriptor.kpi_description = item[1]
kpi_descriptor.kpi_sample_type = item[2]
kpi_descriptor.device_id.device_uuid.uuid = str(item[3])
kpi_descriptor.endpoint_id.endpoint_uuid.uuid = str(item[4])
kpi_descriptor.service_id.service_uuid.uuid = str(item[5])
kpi_descriptor.slice_id.slice_uuid.uuid = str(item[6])
kpi_descriptor.connection_id.connection_uuid.uuid = str(item[7])
kpi_descriptor.link_id.link_uuid.uuid = str(item[8])
kpi_descriptor_list.kpi_descriptor_list.append(kpi_descriptor)
return kpi_descriptor_list
\ No newline at end of file
# 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 logging, grpc
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, KpiDescriptorList
from monitoring.service.NameMapping import NameMapping
from monitoring.service import ManagementDBTools
LOGGER = logging.getLogger(__name__)
METRICS_POOL = MetricsPool('Monitoring', 'RPC')
class KpiManagerServiceServicerImpl(KpiManagerServiceServicer):
def __init__(self, name_mapping : NameMapping):
LOGGER.info('Init KpiManagerService')
# Init sqlite monitoring db
self.management_db = ManagementDBTools.ManagementDB('monitoring.db') # why monitoring.db here???
LOGGER.info('MetricsDB initialized --- KPI Manager Service')
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def SetKpi(
self, request: KpiDescriptor, grpc_context: grpc.ServicerContext
) -> KpiId:
response = KpiId()
kpi_description = request.kpi_description
kpi_sample_type = request.kpi_sample_type
kpi_device_id = request.device_id.device_uuid.uuid
kpi_endpoint_id = request.endpoint_id.endpoint_uuid.uuid
kpi_service_id = request.service_id.service_uuid.uuid
kpi_slice_id = request.slice_id.slice_uuid.uuid
kpi_connection_id = request.connection_id.connection_uuid.uuid
kpi_link_id = request.link_id.link_uuid.uuid
if request.kpi_id.kpi_id.uuid != "":
response.kpi_id.uuid = request.kpi_id.kpi_id.uuid
# Here the code to modify an existing kpi
else:
data = self.management_db.insert_KPI(
kpi_description, kpi_sample_type, kpi_device_id, kpi_endpoint_id,
kpi_service_id, kpi_slice_id, kpi_connection_id, kpi_link_id)
response.kpi_id.uuid = str(data)
return response
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def DeleteKpi(self, request: KpiId, grpc_context: grpc.ServicerContext) -> Empty:
kpi_id = int(request.kpi_id.uuid)
kpi = self.management_db.get_KPI(kpi_id)
if kpi:
self.management_db.delete_KPI(kpi_id)
else:
LOGGER.info('DeleteKpi error: KpiID({:s}): not found in database'.format(str(kpi_id)))
return Empty()
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def GetKpiDescriptor(self, request: KpiId, grpc_context: grpc.ServicerContext) -> KpiDescriptor:
kpi_id = request.kpi_id.uuid
kpi_db = self.management_db.get_KPI(int(kpi_id))
kpiDescriptor = KpiDescriptor()
if kpi_db is None:
LOGGER.info('GetKpiDescriptor error: KpiID({:s}): not found in database'.format(str(kpi_id)))
else:
kpiDescriptor.kpi_description = kpi_db[1]
kpiDescriptor.kpi_sample_type = kpi_db[2]
kpiDescriptor.device_id.device_uuid.uuid = str(kpi_db[3])
kpiDescriptor.endpoint_id.endpoint_uuid.uuid = str(kpi_db[4])
kpiDescriptor.service_id.service_uuid.uuid = str(kpi_db[5])
kpiDescriptor.slice_id.slice_uuid.uuid = str(kpi_db[6])
kpiDescriptor.connection_id.connection_uuid.uuid = str(kpi_db[7])
kpiDescriptor.link_id.link_uuid.uuid = str(kpi_db[8])
return kpiDescriptor
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def GetKpiDescriptorList(self, request: Empty, grpc_context: grpc.ServicerContext) -> KpiDescriptorList:
kpi_descriptor_list = KpiDescriptorList()
data = self.management_db.get_KPIS()
LOGGER.debug(f"data: {data}")
for item in data:
kpi_descriptor = KpiDescriptor()
kpi_descriptor.kpi_id.kpi_id.uuid = str(item[0])
kpi_descriptor.kpi_description = item[1]
kpi_descriptor.kpi_sample_type = item[2]
kpi_descriptor.device_id.device_uuid.uuid = str(item[3])
kpi_descriptor.endpoint_id.endpoint_uuid.uuid = str(item[4])
kpi_descriptor.service_id.service_uuid.uuid = str(item[5])
kpi_descriptor.slice_id.slice_uuid.uuid = str(item[6])
kpi_descriptor.connection_id.connection_uuid.uuid = str(item[7])
kpi_descriptor.link_id.link_uuid.uuid = str(item[8])
kpi_descriptor_list.kpi_descriptor_list.append(kpi_descriptor)
return kpi_descriptor_list
\ No newline at end of file
# 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.
# 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 logging, signal, sys, threading, time
from prometheus_client import start_http_server
from common.Constants import ServiceNameEnum
from common.Settings import (
ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port,
wait_for_environment_variables)
from common.proto import monitoring_pb2
from monitoring.service.EventTools import EventsDeviceCollector # import updated
from monitoring.service.NameMapping import NameMapping # import updated
# from .MonitoringService import MonitoringService
from .KpiManagerService import KpiManagerService
terminate = threading.Event()
LOGGER = None
def signal_handler(signal, frame): # pylint: disable=redefined-outer-name
LOGGER.warning('Terminate signal received')
terminate.set()
def start_kpi_manager(name_mapping : NameMapping):
LOGGER.info('Start Monitoring...',)
events_collector = EventsDeviceCollector(name_mapping)
events_collector.start()
# TODO: redesign this method to be more clear and clean
# Iterate while terminate is not set
while not terminate.is_set():
list_new_kpi_ids = events_collector.listen_events()
# Monitor Kpis
if bool(list_new_kpi_ids):
for kpi_id in list_new_kpi_ids:
# Create Monitor Kpi Requests
monitor_kpi_request = monitoring_pb2.MonitorKpiRequest()
monitor_kpi_request.kpi_id.CopyFrom(kpi_id)
monitor_kpi_request.monitoring_window_s = 86400
monitor_kpi_request.sampling_rate_s = 10
events_collector._monitoring_client.MonitorKpi(monitor_kpi_request)
time.sleep(0.5) # let other tasks run; do not overload CPU
else:
# Terminate is set, looping terminates
LOGGER.warning("Stopping execution...")
events_collector.start()
def main():
global LOGGER # pylint: disable=global-statement
log_level = get_log_level()
logging.basicConfig(level=log_level)
LOGGER = logging.getLogger(__name__)
wait_for_environment_variables([
get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST ),
get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC),
get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_HOST ),
get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC),
])
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
LOGGER.info('Starting...')
# Start metrics server
metrics_port = get_metrics_port()
start_http_server(metrics_port)
name_mapping = NameMapping()
# Starting monitoring service
# grpc_service = MonitoringService(name_mapping)
# grpc_service.start()
# start_monitoring(name_mapping)
grpc_service = KpiManagerService(name_mapping)
grpc_service.start()
start_kpi_manager(name_mapping)
# Wait for Ctrl+C or termination signal
while not terminate.wait(timeout=1.0): pass
LOGGER.info('Terminating...')
grpc_service.stop()
LOGGER.info('Bye')
return 0
if __name__ == '__main__':
sys.exit(main())
File mode changed from 100644 to 100755
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# import sys
# sys.path.append('.')
import os, pytest import os, pytest
import logging, json import logging, json
......
...@@ -20,8 +20,9 @@ from common.Settings import get_service_host, get_service_port_grpc ...@@ -20,8 +20,9 @@ from common.Settings import get_service_host, get_service_port_grpc
from common.tools.client.RetryDecorator import retry, delay_exponential from common.tools.client.RetryDecorator import retry, delay_exponential
from common.tools.grpc.Tools import grpc_message_to_json_string from common.tools.grpc.Tools import grpc_message_to_json_string
from common.proto.context_pb2 import Empty from common.proto.context_pb2 import Empty
from common.proto.monitoring_pb2 import Kpi, KpiDescriptor, KpiId, MonitorKpiRequest, \ from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorList
KpiDescriptorList, KpiQuery, KpiList, SubsDescriptor, SubscriptionID, SubsList, \ from common.proto.monitoring_pb2 import Kpi, MonitorKpiRequest, \
KpiQuery, KpiList, SubsDescriptor, SubscriptionID, SubsList, \
SubsResponse, AlarmDescriptor, AlarmID, AlarmList, AlarmResponse, AlarmSubscription, RawKpiTable SubsResponse, AlarmDescriptor, AlarmID, AlarmList, AlarmResponse, AlarmSubscription, RawKpiTable
from common.proto.monitoring_pb2_grpc import MonitoringServiceStub from common.proto.monitoring_pb2_grpc import MonitoringServiceStub
......
...@@ -20,8 +20,8 @@ from common.proto.context_pb2 import Empty ...@@ -20,8 +20,8 @@ from common.proto.context_pb2 import Empty
from common.proto.device_pb2 import MonitoringSettings from common.proto.device_pb2 import MonitoringSettings
from common.proto.kpi_sample_types_pb2 import KpiSampleType from common.proto.kpi_sample_types_pb2 import KpiSampleType
from common.proto.monitoring_pb2_grpc import MonitoringServiceServicer from common.proto.monitoring_pb2_grpc import MonitoringServiceServicer
from common.proto.monitoring_pb2 import AlarmResponse, AlarmDescriptor, AlarmList, SubsList, KpiId, \ from common.proto.monitoring_pb2 import AlarmResponse, AlarmDescriptor, AlarmList, SubsList, \
KpiDescriptor, KpiList, KpiQuery, SubsDescriptor, SubscriptionID, AlarmID, KpiDescriptorList, \ KpiQuery, SubsDescriptor, SubscriptionID, AlarmID, KpiList,\
MonitorKpiRequest, Kpi, AlarmSubscription, SubsResponse, RawKpiTable, RawKpi, RawKpiList MonitorKpiRequest, Kpi, AlarmSubscription, SubsResponse, RawKpiTable, RawKpi, RawKpiList
from common.tools.timestamp.Converters import timestamp_string_to_float, timestamp_utcnow_to_float from common.tools.timestamp.Converters import timestamp_string_to_float, timestamp_utcnow_to_float
from device.client.DeviceClient import DeviceClient from device.client.DeviceClient import DeviceClient
...@@ -30,6 +30,8 @@ from monitoring.service.AlarmManager import AlarmManager ...@@ -30,6 +30,8 @@ from monitoring.service.AlarmManager import AlarmManager
from monitoring.service.NameMapping import NameMapping from monitoring.service.NameMapping import NameMapping
from monitoring.service.SubscriptionManager import SubscriptionManager from monitoring.service.SubscriptionManager import SubscriptionManager
from common.proto.kpi_manager_pb2 import KpiId, KpiDescriptor, KpiDescriptorList
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
METRICSDB_HOSTNAME = os.environ.get("METRICSDB_HOSTNAME") METRICSDB_HOSTNAME = os.environ.get("METRICSDB_HOSTNAME")
......
...@@ -15,4 +15,5 @@ ...@@ -15,4 +15,5 @@
docker network create -d bridge teraflowbridge docker network create -d bridge teraflowbridge
docker run -d -p 7070:7070 --name monitoring --network=teraflowbridge monitoring:dockerfile # docker run -d -p 7070:7070 --name monitoring --network=teraflowbridge monitoring:dockerfile
docker run -d -p 7071:7071 --name kpi_manager --network=teraflowbridge kpi_manager:dockerfile
\ No newline at end of file