diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3ebeb086738c2c28cb580412c067af3ebda098b..1e35c2cb390fdc44a4d3f1da0ffdfc32e5d96c07 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,9 @@ include: - local: '/src/context/.gitlab-ci.yml' - local: '/src/device/.gitlab-ci.yml' - local: '/src/service/.gitlab-ci.yml' + - local: '/src/dbscanserving/.gitlab-ci.yml' + - local: '/src/opticalattackmitigator/.gitlab-ci.yml' + - local: '/src/opticalcentralizedattackdetector/.gitlab-ci.yml' #- local: '/src/tester_integration/.gitlab-ci.yml' #- local: '/src/tester_functional/.gitlab-ci.yml' #- local: '/src/automation/.gitlab-ci.yml' diff --git a/deploy_in_kubernetes.sh b/deploy_in_kubernetes.sh index 7c62909952165cb6dbc5e27c443b26336e7b1a4e..d98fb41e6a64907ffeabaa69dea915217939346e 100755 --- a/deploy_in_kubernetes.sh +++ b/deploy_in_kubernetes.sh @@ -10,7 +10,7 @@ REGISTRY_IMAGE="" #REGISTRY_IMAGE="http://my-container-registry.local/" # Set the list of components you want to build images for, and deploy. -COMPONENTS="context device automation policy service compute monitoring centralizedattackdetector" +COMPONENTS="context device automation policy service compute monitoring centralizedattackdetector dbscanserving opticalattackmitigator opticalcentralizedattackdetector" # TODO: include opticalcentralizedattackdetector # Set the tag you want to use for your images. IMAGE_TAG="tf-dev" diff --git a/install_development_dependencies.sh b/install_development_dependencies.sh index cceee4e309be8f534ad7e74078d18cc1f4775603..f995c4a748c792a0d0e86d200e8d0af27c8c000e 100755 --- a/install_development_dependencies.sh +++ b/install_development_dependencies.sh @@ -7,7 +7,7 @@ pip install --upgrade pip setuptools wheel pip-tools pylint pytest pytest-benchm echo "" > requirements.in #TODO: include here your component -COMPONENTS="compute context device monitoring centralizedattackdetector" +COMPONENTS="compute context device monitoring centralizedattackdetector opticalcentralizedattackdetector opticalattackmitigator dbscanserving" # compiling dependencies from all components for component in $COMPONENTS diff --git a/manifests/dbscanservingservice.yaml b/manifests/dbscanservingservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ca8982db25f0fe94588418dc67787f63babc9826 --- /dev/null +++ b/manifests/dbscanservingservice.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dbscanservingservice +spec: + selector: + matchLabels: + app: dbscanservingservice + template: + metadata: + labels: + app: dbscanservingservice + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: registry.gitlab.com/teraflow-h2020/controller/dbscanserving:latest + imagePullPolicy: Always + ports: + - containerPort: 10006 + env: + - name: LOG_LEVEL + value: "DEBUG" + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10006"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10006"] + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: dbscanservingservice +spec: + type: ClusterIP + selector: + app: dbscanservingservice + ports: + - name: grpc + port: 10006 + targetPort: 10006 +--- +apiVersion: v1 +kind: Service +metadata: + name: dbscanservingservice-public + labels: + app: dbscanservingservice +spec: + type: NodePort + selector: + app: dbscanservingservice + ports: + - name: http + protocol: TCP + port: 10006 + targetPort: 10006 +--- diff --git a/manifests/opticalattackmitigatorservice.yaml b/manifests/opticalattackmitigatorservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1cc03ba0575edcc66e1cf3f9b57fd161a763a696 --- /dev/null +++ b/manifests/opticalattackmitigatorservice.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: opticalattackmitigatorservice +spec: + selector: + matchLabels: + app: opticalattackmitigatorservice + template: + metadata: + labels: + app: opticalattackmitigatorservice + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: registry.gitlab.com/teraflow-h2020/controller/opticalattackmitigator:latest + imagePullPolicy: Always + ports: + - containerPort: 10007 + env: + - name: LOG_LEVEL + value: "DEBUG" + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10007"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10007"] + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: opticalattackmitigatorservice +spec: + type: ClusterIP + selector: + app: opticalattackmitigatorservice + ports: + - name: grpc + port: 10007 + targetPort: 10007 +--- +apiVersion: v1 +kind: Service +metadata: + name: opticalattackmitigatorservice-public + labels: + app: opticalattackmitigatorservice +spec: + type: NodePort + selector: + app: opticalattackmitigatorservice + ports: + - name: http + protocol: TCP + port: 10007 + targetPort: 10007 +--- diff --git a/manifests/opticalcentralizedattackdetectorservice.yaml b/manifests/opticalcentralizedattackdetectorservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d3ceb3ea49ac1421e14faf00dbb81b1fdaff5537 --- /dev/null +++ b/manifests/opticalcentralizedattackdetectorservice.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: opticalcentralizedattackdetectorservice +spec: + selector: + matchLabels: + app: opticalcentralizedattackdetectorservice + template: + metadata: + labels: + app: opticalcentralizedattackdetectorservice + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: registry.gitlab.com/teraflow-h2020/controller/opticalcentralizedattackdetector:latest + imagePullPolicy: Always + ports: + - containerPort: 10005 + envFrom: + - secretRef: + name: monitoring-secrets + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10005"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10005"] + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 700m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: opticalcentralizedattackdetectorservice +spec: + type: ClusterIP + selector: + app: opticalcentralizedattackdetectorservice + ports: + - name: grpc + port: 10005 + targetPort: 10005 +--- +apiVersion: v1 +kind: Service +metadata: + name: opticalcentralizedattackdetectorservice-public + labels: + app: opticalcentralizedattackdetectorservice +spec: + type: NodePort + selector: + app: opticalcentralizedattackdetectorservice + ports: + - name: grpc + protocol: TCP + port: 10005 + targetPort: 10005 +--- diff --git a/proto/dbscanserving.proto b/proto/dbscanserving.proto new file mode 100644 index 0000000000000000000000000000000000000000..f2c63b15a00481290cfd46ab73940d2f399e01d5 --- /dev/null +++ b/proto/dbscanserving.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package dbscanserving; + +enum Metric { + EUCLIDEAN = 0; +} + +message Sample { + repeated float features = 1; +} + +message DetectionRequest { + float eps = 1; + int32 min_samples = 2; + Metric metric = 3; + int32 num_samples = 4; + int32 num_features = 5; + repeated Sample samples = 6; + int32 identifier = 7; +} + +message DetectionResponse { + repeated int32 cluster_indices = 1; +} + +service Detector { + rpc Detect (DetectionRequest) returns (DetectionResponse); +} diff --git a/proto/optical_attack_mitigator.proto b/proto/optical_attack_mitigator.proto new file mode 100644 index 0000000000000000000000000000000000000000..d75a845dd10f605d6894a610f3f82bbef27b8297 --- /dev/null +++ b/proto/optical_attack_mitigator.proto @@ -0,0 +1,24 @@ +// protocol buffers documentation: https://developers.google.com/protocol-buffers/docs/proto3 +syntax = "proto3"; +package optical_attack_mitigator; + +import "context.proto"; + +service AttackMitigator { + rpc NotifyAttack (AttackDescription) returns (AttackResponse) {} +} + +message AttackDescription { + context.Uuid cs_id = 1; + int32 attack_id = 2; + float confidence = 3; + string attack_description = 4; +} + +message AttackResponse { + context.Uuid cs_id = 1; + int32 attack_id = 2; + string attack_description = 3; + int32 response_strategy_id = 4; + string response_strategy_description = 5; +} diff --git a/proto/optical_centralized_attack_detector.proto b/proto/optical_centralized_attack_detector.proto new file mode 100644 index 0000000000000000000000000000000000000000..99cc1ce6fabc662de078f58985eae2d4eeb3d24c --- /dev/null +++ b/proto/optical_centralized_attack_detector.proto @@ -0,0 +1,18 @@ +// protocol buffers documentation: https://developers.google.com/protocol-buffers/docs/proto3 +syntax = "proto3"; +package centralized_attack_detector; + +import "context.proto"; +import "monitoring.proto"; + +service OpticalCentralizedAttackDetectorService { + rpc NotifyServiceUpdate (context.Service ) returns (context.Empty) {} + + // rpc that triggers the attack detection loop + rpc DetectAttack (context.Empty ) returns (context.Empty) {} + + // rpc called by the distributed component to report KPIs + rpc ReportSummarizedKpi (monitoring.KpiList) returns (context.Empty) {} + + rpc ReportKpi (monitoring.KpiList) returns (context.Empty) {} +} diff --git a/proto/uml/context.png b/proto/uml/context.png index f573796944eb14557fc7db0d2b339a56f1cb4d93..57a2493cf8596d1f4e70f2e3056d1a9d71432aee 100644 Binary files a/proto/uml/context.png and b/proto/uml/context.png differ diff --git a/proto/uml/dbscanserving.png b/proto/uml/dbscanserving.png new file mode 100644 index 0000000000000000000000000000000000000000..d00792952b0b9eced9291b7b5595aec5e8268220 Binary files /dev/null and b/proto/uml/dbscanserving.png differ diff --git a/proto/uml/kpi_sample_types.png b/proto/uml/kpi_sample_types.png index f6ebb076aaf0215c410aaa1b8b0156fb0621d8e2..dfd0720034fa71fc4cbc44a903e32f4d40712e19 100644 Binary files a/proto/uml/kpi_sample_types.png and b/proto/uml/kpi_sample_types.png differ diff --git a/proto/uml/optical_attack_mitigator.png b/proto/uml/optical_attack_mitigator.png new file mode 100644 index 0000000000000000000000000000000000000000..e790794872c76de73ebecf006c612841c33ea3b5 Binary files /dev/null and b/proto/uml/optical_attack_mitigator.png differ diff --git a/run_tests_locally.sh b/run_tests_locally.sh index af814640022beeafacf930e50222e14fadd6b82c..c3db583af420a63072a1122ee5fb8d2a3565fb0a 100755 --- a/run_tests_locally.sh +++ b/run_tests_locally.sh @@ -2,7 +2,7 @@ PROJECTDIR=`pwd` -cd $(dirname $0)/src +cd $PROJECTDIR/src RCFILE=$PROJECTDIR/coverage/.coveragerc COVERAGEFILE=$PROJECTDIR/coverage/.coverage @@ -49,6 +49,15 @@ coverage run --rcfile=$RCFILE --append -m pytest -s --log-level=INFO --verbose \ coverage run --rcfile=$RCFILE --append -m pytest -s --log-level=INFO --verbose \ l3_attackmitigator/tests/test_unitary.py +coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ + opticalcentralizedattackdetector/tests/test_unitary.py + +coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ + dbscanserving/tests/test_unitary.py + +coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ + opticalattackmitigator/tests/test_unitary.py + coverage run --rcfile=$RCFILE --append -m pytest --log-level=INFO --verbose \ service/tests/test_unitary.py diff --git a/src/dbscanserving/.gitlab-ci.yml b/src/dbscanserving/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..de704cf861f82e8e3a976461db6658d7ad2e888a --- /dev/null +++ b/src/dbscanserving/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# build, tag and push the Docker image to the gitlab registry +build dbscanserving: + variables: + IMAGE_NAME: 'dbscanserving' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: build + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ + - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + # after_script: + # - docker rmi $(docker images --quiet --filter=dangling=true) + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAME.yaml + - .gitlab-ci.yml + +# apply unit test to the dbscanserving component +unit test dbscanserving: + variables: + IMAGE_NAME: 'dbscanserving' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: unit_test + needs: + - build dbscanserving + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi + - if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME image is not in the system"; fi + script: + - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker run --name $IMAGE_NAME -d -p 10006:10006 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG + - sleep 5 + - docker ps -a + - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" + after_script: + #- docker rm -f $IMAGE_NAME + - docker network rm teraflowbridge + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAMEservice.yaml + - .gitlab-ci.yml + + +# Deployment of the dbscanserving service in Kubernetes Cluster +deploy dbscanserving: + variables: + IMAGE_NAME: 'dbscanserving' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: deploy + needs: + - unit test dbscanserving + # - integ_test execute + script: + - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml' + - kubectl version + - kubectl get all + - kubectl apply -f "manifests/$IMAGE_NAME.yaml" + - kubectl get all + # environment: + # name: test + # url: https://example.com + # kubernetes: + # namespace: test + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + when: manual + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + when: manual \ No newline at end of file diff --git a/src/dbscanserving/Config.py b/src/dbscanserving/Config.py new file mode 100644 index 0000000000000000000000000000000000000000..ec89bbb0f8b37539e06f9cc101c0f461a3bc2a82 --- /dev/null +++ b/src/dbscanserving/Config.py @@ -0,0 +1,12 @@ +import logging + +# General settings +LOG_LEVEL = logging.DEBUG + +# gRPC settings +GRPC_SERVICE_PORT = 10006 +GRPC_MAX_WORKERS = 10 +GRPC_GRACE_PERIOD = 60 + +# Prometheus settings +METRICS_PORT = 9192 diff --git a/src/dbscanserving/Dockerfile b/src/dbscanserving/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..aa62cbe93cb008085762abbe0ddaae5a31f0fb73 --- /dev/null +++ b/src/dbscanserving/Dockerfile @@ -0,0 +1,34 @@ +FROM python:3-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ && \ + 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 setuptools wheel pip-tools + +# Set working directory +WORKDIR /var/teraflow + +# Create module sub-folders +RUN mkdir -p /var/teraflow/dbscanserving + +# Get Python packages per module +COPY dbscanserving/requirements.in dbscanserving/requirements.in +RUN pip-compile --output-file=dbscanserving/requirements.txt dbscanserving/requirements.in +RUN python3 -m pip install -r dbscanserving/requirements.txt + +COPY common/. common +COPY dbscanserving/. dbscanserving + +# Start dbscanserving service +ENTRYPOINT ["python", "-m", "dbscanserving.service"] diff --git a/src/dbscanserving/__init__.py b/src/dbscanserving/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/dbscanserving/client/DbscanServingClient.py b/src/dbscanserving/client/DbscanServingClient.py new file mode 100644 index 0000000000000000000000000000000000000000..4d6614b5dc44c2b916fb298217fef4a8f1b8e72c --- /dev/null +++ b/src/dbscanserving/client/DbscanServingClient.py @@ -0,0 +1,33 @@ +import grpc, logging +from common.tools.client.RetryDecorator import retry, delay_exponential +from dbscanserving.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse +from dbscanserving.proto.dbscanserving_pb2_grpc import DetectorStub + +LOGGER = logging.getLogger(__name__) +MAX_RETRIES = 15 +DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) + +class DbscanServingClient: + def __init__(self, address, port): + self.endpoint = '{:s}:{:s}'.format(str(address), str(port)) + LOGGER.debug('Creating channel to {:s}...'.format(str(self.endpoint))) + self.channel = None + self.stub = None + self.connect() + LOGGER.debug('Channel created') + + def connect(self): + self.channel = grpc.insecure_channel(self.endpoint) + self.stub = DetectorStub(self.channel) + + def close(self): + if(self.channel is not None): self.channel.close() + self.channel = None + self.stub = None + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def Detect(self, request : DetectionRequest) -> DetectionResponse: + LOGGER.debug('Detect request: {:s}'.format(str(request))) + response = self.stub.Detect(request) + LOGGER.debug('Detect result: {:s}'.format(str(response))) + return response diff --git a/src/dbscanserving/client/__init__.py b/src/dbscanserving/client/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/dbscanserving/genproto.sh b/src/dbscanserving/genproto.sh new file mode 100755 index 0000000000000000000000000000000000000000..d44156c2f327fe2344cb17d59fa51b3ead9bc43b --- /dev/null +++ b/src/dbscanserving/genproto.sh @@ -0,0 +1,30 @@ +#!/bin/bash -eu +# +# Copyright 2018 Google LLC +# +# 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. + +#!/bin/bash -e + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +rm -rf proto/*.py +rm -rf proto/__pycache__ +touch proto/__init__.py + +# building current service protos +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto dbscanserving.proto + +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/dbscanserving_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/dbscanserving_pb2_grpc.py diff --git a/src/dbscanserving/proto/__init__.py b/src/dbscanserving/proto/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/dbscanserving/proto/dbscanserving_pb2.py b/src/dbscanserving/proto/dbscanserving_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..b5e464db4db39c2d3f6a5530c5d702e4bf25b8a0 --- /dev/null +++ b/src/dbscanserving/proto/dbscanserving_pb2.py @@ -0,0 +1,252 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: dbscanserving.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='dbscanserving.proto', + package='dbscanserving', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x13\x64\x62scanserving.proto\x12\rdbscanserving\"\x1a\n\x06Sample\x12\x10\n\x08\x66\x65\x61tures\x18\x01 \x03(\x02\"\xd6\x01\n\x10\x44\x65tectionRequest\x12\x0b\n\x03\x65ps\x18\x01 \x01(\x02\x12\x13\n\x0bmin_samples\x18\x02 \x01(\x05\x12%\n\x06metric\x18\x03 \x01(\x0e\x32\x15.dbscanserving.Metric\x12\x13\n\x0bnum_samples\x18\x04 \x01(\x05\x12\x14\n\x0cnum_features\x18\x05 \x01(\x05\x12&\n\x07samples\x18\x06 \x03(\x0b\x32\x15.dbscanserving.Sample\x12\x17\n\nidentifier\x18\x07 \x01(\x05H\x00\x88\x01\x01\x42\r\n\x0b_identifier\",\n\x11\x44\x65tectionResponse\x12\x17\n\x0f\x63luster_indices\x18\x01 \x03(\x05*\x17\n\x06Metric\x12\r\n\tEUCLIDEAN\x10\x00\x32W\n\x08\x44\x65tector\x12K\n\x06\x44\x65tect\x12\x1f.dbscanserving.DetectionRequest\x1a .dbscanserving.DetectionResponseb\x06proto3' +) + +_METRIC = _descriptor.EnumDescriptor( + name='Metric', + full_name='dbscanserving.Metric', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='EUCLIDEAN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=329, + serialized_end=352, +) +_sym_db.RegisterEnumDescriptor(_METRIC) + +Metric = enum_type_wrapper.EnumTypeWrapper(_METRIC) +EUCLIDEAN = 0 + + + +_SAMPLE = _descriptor.Descriptor( + name='Sample', + full_name='dbscanserving.Sample', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='features', full_name='dbscanserving.Sample.features', index=0, + number=1, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=38, + serialized_end=64, +) + + +_DETECTIONREQUEST = _descriptor.Descriptor( + name='DetectionRequest', + full_name='dbscanserving.DetectionRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='eps', full_name='dbscanserving.DetectionRequest.eps', index=0, + number=1, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='min_samples', full_name='dbscanserving.DetectionRequest.min_samples', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metric', full_name='dbscanserving.DetectionRequest.metric', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='num_samples', full_name='dbscanserving.DetectionRequest.num_samples', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='num_features', full_name='dbscanserving.DetectionRequest.num_features', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='samples', full_name='dbscanserving.DetectionRequest.samples', index=5, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='identifier', full_name='dbscanserving.DetectionRequest.identifier', index=6, + number=7, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='_identifier', full_name='dbscanserving.DetectionRequest._identifier', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=67, + serialized_end=281, +) + + +_DETECTIONRESPONSE = _descriptor.Descriptor( + name='DetectionResponse', + full_name='dbscanserving.DetectionResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='cluster_indices', full_name='dbscanserving.DetectionResponse.cluster_indices', index=0, + number=1, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=283, + serialized_end=327, +) + +_DETECTIONREQUEST.fields_by_name['metric'].enum_type = _METRIC +_DETECTIONREQUEST.fields_by_name['samples'].message_type = _SAMPLE +_DETECTIONREQUEST.oneofs_by_name['_identifier'].fields.append( + _DETECTIONREQUEST.fields_by_name['identifier']) +_DETECTIONREQUEST.fields_by_name['identifier'].containing_oneof = _DETECTIONREQUEST.oneofs_by_name['_identifier'] +DESCRIPTOR.message_types_by_name['Sample'] = _SAMPLE +DESCRIPTOR.message_types_by_name['DetectionRequest'] = _DETECTIONREQUEST +DESCRIPTOR.message_types_by_name['DetectionResponse'] = _DETECTIONRESPONSE +DESCRIPTOR.enum_types_by_name['Metric'] = _METRIC +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Sample = _reflection.GeneratedProtocolMessageType('Sample', (_message.Message,), { + 'DESCRIPTOR' : _SAMPLE, + '__module__' : 'dbscanserving_pb2' + # @@protoc_insertion_point(class_scope:dbscanserving.Sample) + }) +_sym_db.RegisterMessage(Sample) + +DetectionRequest = _reflection.GeneratedProtocolMessageType('DetectionRequest', (_message.Message,), { + 'DESCRIPTOR' : _DETECTIONREQUEST, + '__module__' : 'dbscanserving_pb2' + # @@protoc_insertion_point(class_scope:dbscanserving.DetectionRequest) + }) +_sym_db.RegisterMessage(DetectionRequest) + +DetectionResponse = _reflection.GeneratedProtocolMessageType('DetectionResponse', (_message.Message,), { + 'DESCRIPTOR' : _DETECTIONRESPONSE, + '__module__' : 'dbscanserving_pb2' + # @@protoc_insertion_point(class_scope:dbscanserving.DetectionResponse) + }) +_sym_db.RegisterMessage(DetectionResponse) + + + +_DETECTOR = _descriptor.ServiceDescriptor( + name='Detector', + full_name='dbscanserving.Detector', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=354, + serialized_end=441, + methods=[ + _descriptor.MethodDescriptor( + name='Detect', + full_name='dbscanserving.Detector.Detect', + index=0, + containing_service=None, + input_type=_DETECTIONREQUEST, + output_type=_DETECTIONRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_DETECTOR) + +DESCRIPTOR.services_by_name['Detector'] = _DETECTOR + +# @@protoc_insertion_point(module_scope) diff --git a/src/dbscanserving/proto/dbscanserving_pb2_grpc.py b/src/dbscanserving/proto/dbscanserving_pb2_grpc.py new file mode 100644 index 0000000000000000000000000000000000000000..895ced1484df2101bb055f28b6a6d3631e7e68da --- /dev/null +++ b/src/dbscanserving/proto/dbscanserving_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import dbscanserving_pb2 as dbscanserving__pb2 + + +class DetectorStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Detect = channel.unary_unary( + '/dbscanserving.Detector/Detect', + request_serializer=dbscanserving__pb2.DetectionRequest.SerializeToString, + response_deserializer=dbscanserving__pb2.DetectionResponse.FromString, + ) + + +class DetectorServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Detect(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_DetectorServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Detect': grpc.unary_unary_rpc_method_handler( + servicer.Detect, + request_deserializer=dbscanserving__pb2.DetectionRequest.FromString, + response_serializer=dbscanserving__pb2.DetectionResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'dbscanserving.Detector', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class Detector(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Detect(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/dbscanserving.Detector/Detect', + dbscanserving__pb2.DetectionRequest.SerializeToString, + dbscanserving__pb2.DetectionResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/dbscanserving/requirements.in b/src/dbscanserving/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..b4272e5c4e709f5893c0e750d263fc24b7be4f7d --- /dev/null +++ b/src/dbscanserving/requirements.in @@ -0,0 +1,6 @@ +grpcio-health-checking +prometheus-client +pytest +pytest-benchmark +grpcio +scikit-learn \ No newline at end of file diff --git a/src/dbscanserving/requirements.txt b/src/dbscanserving/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..4f9bee9891129ad09e4281180e1aee2858df0c29 --- /dev/null +++ b/src/dbscanserving/requirements.txt @@ -0,0 +1,52 @@ +# +# This file is autogenerated by pip-compile with python 3.9 +# To update, run: +# +# pip-compile --output-file=requirements.txt requirements.in +# +attrs==21.2.0 + # via pytest +grpcio==1.42.0 + # via + # -r requirements.in + # grpcio-health-checking +grpcio-health-checking==1.42.0 + # via -r requirements.in +iniconfig==1.1.1 + # via pytest +joblib==1.1.0 + # via scikit-learn +numpy==1.21.4 + # via + # scikit-learn + # scipy +packaging==21.3 + # via pytest +pluggy==1.0.0 + # via pytest +prometheus-client==0.12.0 + # via -r requirements.in +protobuf==3.19.1 + # via grpcio-health-checking +py==1.11.0 + # via pytest +py-cpuinfo==8.0.0 + # via pytest-benchmark +pyparsing==3.0.6 + # via packaging +pytest==6.2.5 + # via + # -r requirements.in + # pytest-benchmark +pytest-benchmark==3.4.1 + # via -r requirements.in +scikit-learn==1.0.1 + # via -r requirements.in +scipy==1.7.3 + # via scikit-learn +six==1.16.0 + # via grpcio +threadpoolctl==3.0.0 + # via scikit-learn +toml==0.10.2 + # via pytest diff --git a/src/dbscanserving/service/DbscanService.py b/src/dbscanserving/service/DbscanService.py new file mode 100644 index 0000000000000000000000000000000000000000..43336ab089b6848971cda4e79e4da7aa26c1ca65 --- /dev/null +++ b/src/dbscanserving/service/DbscanService.py @@ -0,0 +1,56 @@ +import grpc +import logging +from concurrent import futures +from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH +from grpc_health.v1.health_pb2 import HealthCheckResponse +from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server +from dbscanserving.proto.dbscanserving_pb2_grpc import add_DetectorServicer_to_server +from dbscanserving.service.DbscanServiceServicerImpl import DbscanServiceServicerImpl +from dbscanserving.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD + +BIND_ADDRESS = '0.0.0.0' +LOGGER = logging.getLogger(__name__) + +class DbscanService: + def __init__( + self, address=BIND_ADDRESS, port=GRPC_SERVICE_PORT, max_workers=GRPC_MAX_WORKERS, + grace_period=GRPC_GRACE_PERIOD): + + self.address = address + self.port = port + self.endpoint = None + self.max_workers = max_workers + self.grace_period = grace_period + self.dbscan_servicer = None + self.health_servicer = None + self.pool = None + self.server = None + + def start(self): + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(self.port)) + LOGGER.debug('Starting Service (tentative endpoint: {:s}, max_workers: {:s})...'.format( + str(self.endpoint), str(self.max_workers))) + + self.pool = futures.ThreadPoolExecutor(max_workers=self.max_workers) + self.server = grpc.server(self.pool) # , interceptors=(tracer_interceptor,)) + + self.dbscan_servicer = DbscanServiceServicerImpl() + add_DetectorServicer_to_server(self.dbscan_servicer, self.server) + + self.health_servicer = HealthServicer( + experimental_non_blocking=True, experimental_thread_pool=futures.ThreadPoolExecutor(max_workers=1)) + add_HealthServicer_to_server(self.health_servicer, self.server) + + port = self.server.add_insecure_port(self.endpoint) + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(port)) + LOGGER.info('Listening on {:s}...'.format(self.endpoint)) + self.server.start() + self.health_servicer.set(OVERALL_HEALTH, HealthCheckResponse.SERVING) # pylint: disable=maybe-no-member + + LOGGER.debug('Service started') + + def stop(self): + LOGGER.debug('Stopping service (grace period {:s} seconds)...'.format(str(self.grace_period))) + self.health_servicer.enter_graceful_shutdown() + self.server.stop(self.grace_period) + LOGGER.debug('Service stopped') diff --git a/src/dbscanserving/service/DbscanServiceServicerImpl.py b/src/dbscanserving/service/DbscanServiceServicerImpl.py new file mode 100644 index 0000000000000000000000000000000000000000..251b3eb1ad4c5e51eb80207ce5036351ea65572f --- /dev/null +++ b/src/dbscanserving/service/DbscanServiceServicerImpl.py @@ -0,0 +1,32 @@ +import os, grpc, logging +from sklearn.cluster import DBSCAN +from common.rpc_method_wrapper.Decorator import create_metrics, safe_and_metered_rpc_method +from dbscanserving.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse +from dbscanserving.proto.dbscanserving_pb2_grpc import DetectorServicer + +LOGGER = logging.getLogger(__name__) + +SERVICE_NAME = 'DbscanServing' +METHOD_NAMES = ['Detect'] +METRICS = create_metrics(SERVICE_NAME, METHOD_NAMES) + + +class DbscanServiceServicerImpl(DetectorServicer): + + def __init__(self): + LOGGER.debug('Creating Servicer...') + LOGGER.debug('Servicer Created') + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def Detect(self, request : DetectionRequest, context : grpc.ServicerContext) -> DetectionResponse: + if request.num_samples != len(request.samples): + context.set_details("The sample dimension declared does not match with the number of samples received.") + LOGGER.debug(f"The sample dimension declared does not match with the number of samples received. Declared: {request.num_samples} - Received: {len(request.samples)}") + context.set_code(grpc.StatusCode.INVALID_ARGUMENT) + return DetectionResponse() + # TODO: implement the validation of the features dimension + clusters = DBSCAN(eps=request.eps, min_samples=request.min_samples).fit_predict([[x for x in sample.features] for sample in request.samples]) + response = DetectionResponse() + for cluster in clusters: + response.cluster_indices.append(cluster) + return response diff --git a/src/dbscanserving/service/__init__.py b/src/dbscanserving/service/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/dbscanserving/service/__main__.py b/src/dbscanserving/service/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..bc3f1c681fe88d723d36a28bff64c0e6b04fd089 --- /dev/null +++ b/src/dbscanserving/service/__main__.py @@ -0,0 +1,50 @@ +import os, logging, signal, sys, time, threading, multiprocessing +from prometheus_client import start_http_server +from common.Settings import get_setting +from dbscanserving.Config import ( + GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, METRICS_PORT) +from dbscanserving.service.DbscanService import DbscanService + +terminate = threading.Event() +LOGGER = None + +def signal_handler(signal, frame): # pylint: disable=redefined-outer-name + LOGGER.warning('Terminate signal received') + terminate.set() + +def main(): + global LOGGER # pylint: disable=global-statement + + service_port = get_setting('DBSCANSERVICE_SERVICE_PORT_GRPC', default=GRPC_SERVICE_PORT) + max_workers = get_setting('MAX_WORKERS', default=GRPC_MAX_WORKERS ) + grace_period = get_setting('GRACE_PERIOD', default=GRPC_GRACE_PERIOD) + log_level = get_setting('LOG_LEVEL', default=LOG_LEVEL ) + metrics_port = get_setting('METRICS_PORT', default=METRICS_PORT ) + + logging.basicConfig(level=log_level) + LOGGER = logging.getLogger(__name__) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + LOGGER.info('Starting...') + + # Start metrics server + start_http_server(metrics_port) + + # Starting CentralizedCybersecurity service + grpc_service = DbscanService( + port=service_port, max_workers=max_workers, grace_period=grace_period) + grpc_service.start() + + # Wait for Ctrl+C or termination signal + while not terminate.wait(timeout=0.1): pass + + LOGGER.info('Terminating...') + grpc_service.stop() + + LOGGER.info('Bye') + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/src/dbscanserving/tests/__init__.py b/src/dbscanserving/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/dbscanserving/tests/test_unitary.py b/src/dbscanserving/tests/test_unitary.py new file mode 100644 index 0000000000000000000000000000000000000000..061d2f07d2e1a6876318214a909a26140c98197d --- /dev/null +++ b/src/dbscanserving/tests/test_unitary.py @@ -0,0 +1,116 @@ +import random, logging, pytest, numpy +from dbscanserving.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD +from dbscanserving.client.DbscanServingClient import DbscanServingClient +from dbscanserving.service.DbscanService import DbscanService +from dbscanserving.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse, Sample + +port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +@pytest.fixture(scope='session') +def dbscanserving_service(): + _service = DbscanService( + port=port, max_workers=GRPC_MAX_WORKERS, grace_period=GRPC_GRACE_PERIOD) + _service.start() + yield _service + _service.stop() + +@pytest.fixture(scope='session') +def dbscanserving_client(): + _client = DbscanServingClient(address='127.0.0.1', port=port) + yield _client + _client.close() + +def test_detection_correct(dbscanserving_service, dbscanserving_client: DbscanServingClient): + request: DetectionRequest = DetectionRequest() + + request.num_samples = 310 + request.num_features = 100 + request.eps = 100.5 + request.min_samples = 50 + + for _ in range(200): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(0., 10.)) + request.samples.append(grpc_sample) + + for _ in range(100): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(50., 60.)) + request.samples.append(grpc_sample) + + for _ in range(10): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(5000., 6000.)) + request.samples.append(grpc_sample) + + response: DetectionResponse = dbscanserving_client.Detect(request) + assert len(response.cluster_indices) == 310 + +def test_detection_incorrect(dbscanserving_service, dbscanserving_client: DbscanServingClient): + request: DetectionRequest = DetectionRequest() + + request.num_samples = 210 + request.num_features = 100 + request.eps = 100.5 + request.min_samples = 50 + + for _ in range(200): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(0., 10.)) + request.samples.append(grpc_sample) + + for _ in range(100): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(50., 60.)) + request.samples.append(grpc_sample) + + for _ in range(10): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(5000., 6000.)) + request.samples.append(grpc_sample) + + with pytest.raises(Exception): + response: DetectionResponse = dbscanserving_client.Detect(request) + +def test_detection_clusters(dbscanserving_service, dbscanserving_client: DbscanServingClient): + request: DetectionRequest = DetectionRequest() + + request.num_samples = 310 + request.num_features = 100 + request.eps = 100.5 + request.min_samples = 50 + + for _ in range(200): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(0., 10.)) + request.samples.append(grpc_sample) + + for _ in range(100): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(50., 60.)) + request.samples.append(grpc_sample) + + for _ in range(10): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(5000., 6000.)) + request.samples.append(grpc_sample) + + response: DetectionResponse = dbscanserving_client.Detect(request) + for v in response.cluster_indices[:200]: + assert v == 0 + for v in response.cluster_indices[200:300]: + assert v == 1 + for v in response.cluster_indices[300:]: + assert v == -1 diff --git a/src/opticalattackmitigator/.gitlab-ci.yml b/src/opticalattackmitigator/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..47a25be3c9c93c008821b1015fe66d1e06a75920 --- /dev/null +++ b/src/opticalattackmitigator/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# build, tag and push the Docker image to the gitlab registry +build opticalattackmitigator: + variables: + IMAGE_NAME: 'opticalattackmitigator' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: build + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ + - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + # after_script: + # - docker rmi $(docker images --quiet --filter=dangling=true) + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAME.yaml + - .gitlab-ci.yml + +# apply unit test to the opticalattackmitigator component +unit test opticalattackmitigator: + variables: + IMAGE_NAME: 'opticalattackmitigator' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: unit_test + needs: + - build opticalattackmitigator + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi + - if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME image is not in the system"; fi + script: + - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker run --name $IMAGE_NAME -d -p 10007:10007 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG + - sleep 5 + - docker ps -a + - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" + after_script: + #- docker rm -f $IMAGE_NAME + - docker network rm teraflowbridge + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAMEservice.yaml + - .gitlab-ci.yml + + +# Deployment of the opticalattackmitigator service in Kubernetes Cluster +deploy opticalattackmitigator: + variables: + IMAGE_NAME: 'opticalattackmitigator' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: deploy + needs: + - unit test opticalattackmitigator + # - integ_test execute + script: + - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml' + - kubectl version + - kubectl get all + - kubectl apply -f "manifests/$IMAGE_NAME.yaml" + - kubectl get all + # environment: + # name: test + # url: https://example.com + # kubernetes: + # namespace: test + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + when: manual + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + when: manual \ No newline at end of file diff --git a/src/opticalattackmitigator/Config.py b/src/opticalattackmitigator/Config.py new file mode 100644 index 0000000000000000000000000000000000000000..64785206cff4f3b5049d78e15a8d8ac0b82caf9b --- /dev/null +++ b/src/opticalattackmitigator/Config.py @@ -0,0 +1,12 @@ +import logging + +# General settings +LOG_LEVEL = logging.DEBUG + +# gRPC settings +GRPC_SERVICE_PORT = 10007 +GRPC_MAX_WORKERS = 10 +GRPC_GRACE_PERIOD = 60 + +# Prometheus settings +METRICS_PORT = 9192 diff --git a/src/opticalattackmitigator/Dockerfile b/src/opticalattackmitigator/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..126786edd5466fbfdfadef1af804aba540f0bd3a --- /dev/null +++ b/src/opticalattackmitigator/Dockerfile @@ -0,0 +1,35 @@ +FROM python:3-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ && \ + 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 setuptools wheel pip-tools + +# Set working directory +WORKDIR /var/teraflow + +# Create module sub-folders +RUN mkdir -p /var/teraflow/opticalattackmitigator + +# Get Python packages per module +COPY opticalattackmitigator/requirements.in opticalattackmitigator/requirements.in +RUN pip-compile --output-file=opticalattackmitigator/requirements.txt opticalattackmitigator/requirements.in +RUN python3 -m pip install -r opticalattackmitigator/requirements.txt + +# Add files into working directory +COPY common/. common +COPY opticalattackmitigator/. opticalattackmitigator + +# Start opticalattackmitigator service +ENTRYPOINT ["python", "-m", "opticalattackmitigator.service"] diff --git a/src/opticalattackmitigator/__init__.py b/src/opticalattackmitigator/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalattackmitigator/client/OpticalAttackMitigatorClient.py b/src/opticalattackmitigator/client/OpticalAttackMitigatorClient.py new file mode 100644 index 0000000000000000000000000000000000000000..f303dcc3fc8593b20b0a0ab1a7f6d46a724edec1 --- /dev/null +++ b/src/opticalattackmitigator/client/OpticalAttackMitigatorClient.py @@ -0,0 +1,33 @@ +import grpc, logging +from common.tools.client.RetryDecorator import retry, delay_exponential +from opticalattackmitigator.proto.optical_attack_mitigator_pb2 import AttackDescription, AttackResponse +from opticalattackmitigator.proto.optical_attack_mitigator_pb2_grpc import AttackMitigatorStub + +LOGGER = logging.getLogger(__name__) +MAX_RETRIES = 15 +DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) + +class OpticalAttackMitigatorClient: + def __init__(self, address, port): + self.endpoint = '{:s}:{:s}'.format(str(address), str(port)) + LOGGER.debug('Creating channel to {:s}...'.format(str(self.endpoint))) + self.channel = None + self.stub = None + self.connect() + LOGGER.debug('Channel created') + + def connect(self): + self.channel = grpc.insecure_channel(self.endpoint) + self.stub = AttackMitigatorStub(self.channel) + + def close(self): + if(self.channel is not None): self.channel.close() + self.channel = None + self.stub = None + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def NotifyAttack(self, request : AttackDescription) -> AttackResponse: + LOGGER.debug('NotifyAttack request: {:s}'.format(str(request))) + response = self.stub.NotifyAttack(request) + LOGGER.debug('NotifyAttack result: {:s}'.format(str(response))) + return response diff --git a/src/opticalattackmitigator/client/__init__.py b/src/opticalattackmitigator/client/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalattackmitigator/genproto.sh b/src/opticalattackmitigator/genproto.sh new file mode 100755 index 0000000000000000000000000000000000000000..9f0651441172ee902f16faedf65c6c0c54fba9a7 --- /dev/null +++ b/src/opticalattackmitigator/genproto.sh @@ -0,0 +1,40 @@ +#!/bin/bash -eu +# +# Copyright 2018 Google LLC +# +# 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. + +#!/bin/bash -e + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +rm -rf proto/*.py +rm -rf proto/__pycache__ +touch proto/__init__.py + +# building protos of services used +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto context.proto +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto kpi_sample_types.proto + +rm proto/context_pb2_grpc.py +rm proto/kpi_sample_types_pb2_grpc.py + +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/kpi_sample_types_pb2.py + +# building current service protos +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto optical_attack_mitigator.proto + +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/optical_attack_mitigator_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/optical_attack_mitigator_pb2_grpc.py diff --git a/src/opticalattackmitigator/proto/__init__.py b/src/opticalattackmitigator/proto/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalattackmitigator/proto/context_pb2.py b/src/opticalattackmitigator/proto/context_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..43d80f01d7ee513ff2d91abb704e9e95cf12f0b6 --- /dev/null +++ b/src/opticalattackmitigator/proto/context_pb2.py @@ -0,0 +1,2545 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: context.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import kpi_sample_types_pb2 as kpi__sample__types__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='context.proto', + package='context', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\x1a\x16kpi_sample_types.proto\"\x07\n\x05\x45mpty\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"F\n\x05\x45vent\x12\x11\n\ttimestamp\x18\x01 \x01(\x01\x12*\n\nevent_type\x18\x02 \x01(\x0e\x32\x16.context.EventTypeEnum\"0\n\tContextId\x12#\n\x0c\x63ontext_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\xb6\x01\n\x07\x43ontext\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12)\n\x0ctopology_ids\x18\x02 \x03(\x0b\x32\x13.context.TopologyId\x12\'\n\x0bservice_ids\x18\x03 \x03(\x0b\x32\x12.context.ServiceId\x12/\n\ncontroller\x18\x04 \x01(\x0b\x32\x1b.context.TeraFlowController\"8\n\rContextIdList\x12\'\n\x0b\x63ontext_ids\x18\x01 \x03(\x0b\x32\x12.context.ContextId\"1\n\x0b\x43ontextList\x12\"\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x10.context.Context\"U\n\x0c\x43ontextEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\ncontext_id\x18\x02 \x01(\x0b\x32\x12.context.ContextId\"Z\n\nTopologyId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12$\n\rtopology_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"~\n\x08Topology\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12%\n\ndevice_ids\x18\x02 \x03(\x0b\x32\x11.context.DeviceId\x12!\n\x08link_ids\x18\x03 \x03(\x0b\x32\x0f.context.LinkId\";\n\x0eTopologyIdList\x12)\n\x0ctopology_ids\x18\x01 \x03(\x0b\x32\x13.context.TopologyId\"5\n\x0cTopologyList\x12%\n\ntopologies\x18\x01 \x03(\x0b\x32\x11.context.Topology\"X\n\rTopologyEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12(\n\x0btopology_id\x18\x02 \x01(\x0b\x32\x13.context.TopologyId\".\n\x08\x44\x65viceId\x12\"\n\x0b\x64\x65vice_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x9a\x02\n\x06\x44\x65vice\x12$\n\tdevice_id\x18\x01 \x01(\x0b\x32\x11.context.DeviceId\x12\x13\n\x0b\x64\x65vice_type\x18\x02 \x01(\t\x12,\n\rdevice_config\x18\x03 \x01(\x0b\x32\x15.context.DeviceConfig\x12G\n\x19\x64\x65vice_operational_status\x18\x04 \x01(\x0e\x32$.context.DeviceOperationalStatusEnum\x12\x31\n\x0e\x64\x65vice_drivers\x18\x05 \x03(\x0e\x32\x19.context.DeviceDriverEnum\x12+\n\x10\x64\x65vice_endpoints\x18\x06 \x03(\x0b\x32\x11.context.EndPoint\"9\n\x0c\x44\x65viceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"5\n\x0c\x44\x65viceIdList\x12%\n\ndevice_ids\x18\x01 \x03(\x0b\x32\x11.context.DeviceId\".\n\nDeviceList\x12 \n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x0f.context.Device\"R\n\x0b\x44\x65viceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\"*\n\x06LinkId\x12 \n\tlink_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"X\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12.\n\x11link_endpoint_ids\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\"/\n\nLinkIdList\x12!\n\x08link_ids\x18\x01 \x03(\x0b\x32\x0f.context.LinkId\"(\n\x08LinkList\x12\x1c\n\x05links\x18\x01 \x03(\x0b\x32\r.context.Link\"L\n\tLinkEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12 \n\x07link_id\x18\x02 \x01(\x0b\x32\x0f.context.LinkId\"X\n\tServiceId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12#\n\x0cservice_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"\xa6\x02\n\x07Service\x12&\n\nservice_id\x18\x01 \x01(\x0b\x32\x12.context.ServiceId\x12.\n\x0cservice_type\x18\x02 \x01(\x0e\x32\x18.context.ServiceTypeEnum\x12\x31\n\x14service_endpoint_ids\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12\x30\n\x13service_constraints\x18\x04 \x03(\x0b\x32\x13.context.Constraint\x12.\n\x0eservice_status\x18\x05 \x01(\x0b\x32\x16.context.ServiceStatus\x12.\n\x0eservice_config\x18\x06 \x01(\x0b\x32\x16.context.ServiceConfig\"C\n\rServiceStatus\x12\x32\n\x0eservice_status\x18\x01 \x01(\x0e\x32\x1a.context.ServiceStatusEnum\":\n\rServiceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"8\n\rServiceIdList\x12\'\n\x0bservice_ids\x18\x01 \x03(\x0b\x32\x12.context.ServiceId\"1\n\x0bServiceList\x12\"\n\x08services\x18\x01 \x03(\x0b\x32\x10.context.Service\"U\n\x0cServiceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\nservice_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\"\x82\x01\n\nEndPointId\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\x12$\n\rendpoint_uuid\x18\x03 \x01(\x0b\x32\r.context.Uuid\"\x86\x01\n\x08\x45ndPoint\x12(\n\x0b\x65ndpoint_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x15\n\rendpoint_type\x18\x02 \x01(\t\x12\x39\n\x10kpi_sample_types\x18\x03 \x03(\x0e\x32\x1f.kpi_sample_types.KpiSampleType\"e\n\nConfigRule\x12)\n\x06\x61\x63tion\x18\x01 \x01(\x0e\x32\x19.context.ConfigActionEnum\x12\x14\n\x0cresource_key\x18\x02 \x01(\t\x12\x16\n\x0eresource_value\x18\x03 \x01(\t\"?\n\nConstraint\x12\x17\n\x0f\x63onstraint_type\x18\x01 \x01(\t\x12\x18\n\x10\x63onstraint_value\x18\x02 \x01(\t\"6\n\x0c\x43onnectionId\x12&\n\x0f\x63onnection_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x8d\x01\n\nConnection\x12,\n\rconnection_id\x18\x01 \x01(\x0b\x32\x15.context.ConnectionId\x12.\n\x12related_service_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\x12!\n\x04path\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\"A\n\x10\x43onnectionIdList\x12-\n\x0e\x63onnection_ids\x18\x01 \x03(\x0b\x32\x15.context.ConnectionId\":\n\x0e\x43onnectionList\x12(\n\x0b\x63onnections\x18\x01 \x03(\x0b\x32\x13.context.Connection\"^\n\x12TeraFlowController\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\r\"U\n\x14\x41uthenticationResult\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x15\n\rauthenticated\x18\x02 \x01(\x08*j\n\rEventTypeEnum\x12\x17\n\x13\x45VENTTYPE_UNDEFINED\x10\x00\x12\x14\n\x10\x45VENTTYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENTTYPE_UPDATE\x10\x02\x12\x14\n\x10\x45VENTTYPE_REMOVE\x10\x03*\xc5\x01\n\x10\x44\x65viceDriverEnum\x12\x1a\n\x16\x44\x45VICEDRIVER_UNDEFINED\x10\x00\x12\x1b\n\x17\x44\x45VICEDRIVER_OPENCONFIG\x10\x01\x12\x1e\n\x1a\x44\x45VICEDRIVER_TRANSPORT_API\x10\x02\x12\x13\n\x0f\x44\x45VICEDRIVER_P4\x10\x03\x12&\n\"DEVICEDRIVER_IETF_NETWORK_TOPOLOGY\x10\x04\x12\x1b\n\x17\x44\x45VICEDRIVER_ONF_TR_352\x10\x05*\x8f\x01\n\x1b\x44\x65viceOperationalStatusEnum\x12%\n!DEVICEOPERATIONALSTATUS_UNDEFINED\x10\x00\x12$\n DEVICEOPERATIONALSTATUS_DISABLED\x10\x01\x12#\n\x1f\x44\x45VICEOPERATIONALSTATUS_ENABLED\x10\x02*\x81\x01\n\x0fServiceTypeEnum\x12\x17\n\x13SERVICETYPE_UNKNOWN\x10\x00\x12\x14\n\x10SERVICETYPE_L3NM\x10\x01\x12\x14\n\x10SERVICETYPE_L2NM\x10\x02\x12)\n%SERVICETYPE_TAPI_CONNECTIVITY_SERVICE\x10\x03*\x88\x01\n\x11ServiceStatusEnum\x12\x1b\n\x17SERVICESTATUS_UNDEFINED\x10\x00\x12\x19\n\x15SERVICESTATUS_PLANNED\x10\x01\x12\x18\n\x14SERVICESTATUS_ACTIVE\x10\x02\x12!\n\x1dSERVICESTATUS_PENDING_REMOVAL\x10\x03*]\n\x10\x43onfigActionEnum\x12\x1a\n\x16\x43ONFIGACTION_UNDEFINED\x10\x00\x12\x14\n\x10\x43ONFIGACTION_SET\x10\x01\x12\x17\n\x13\x43ONFIGACTION_DELETE\x10\x02\x32\xa5\r\n\x0e\x43ontextService\x12:\n\x0eListContextIds\x12\x0e.context.Empty\x1a\x16.context.ContextIdList\"\x00\x12\x36\n\x0cListContexts\x12\x0e.context.Empty\x1a\x14.context.ContextList\"\x00\x12\x34\n\nGetContext\x12\x12.context.ContextId\x1a\x10.context.Context\"\x00\x12\x34\n\nSetContext\x12\x10.context.Context\x1a\x12.context.ContextId\"\x00\x12\x35\n\rRemoveContext\x12\x12.context.ContextId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetContextEvents\x12\x0e.context.Empty\x1a\x15.context.ContextEvent\"\x00\x30\x01\x12@\n\x0fListTopologyIds\x12\x12.context.ContextId\x1a\x17.context.TopologyIdList\"\x00\x12=\n\x0eListTopologies\x12\x12.context.ContextId\x1a\x15.context.TopologyList\"\x00\x12\x37\n\x0bGetTopology\x12\x13.context.TopologyId\x1a\x11.context.Topology\"\x00\x12\x37\n\x0bSetTopology\x12\x11.context.Topology\x1a\x13.context.TopologyId\"\x00\x12\x37\n\x0eRemoveTopology\x12\x13.context.TopologyId\x1a\x0e.context.Empty\"\x00\x12?\n\x11GetTopologyEvents\x12\x0e.context.Empty\x1a\x16.context.TopologyEvent\"\x00\x30\x01\x12\x38\n\rListDeviceIds\x12\x0e.context.Empty\x1a\x15.context.DeviceIdList\"\x00\x12\x34\n\x0bListDevices\x12\x0e.context.Empty\x1a\x13.context.DeviceList\"\x00\x12\x31\n\tGetDevice\x12\x11.context.DeviceId\x1a\x0f.context.Device\"\x00\x12\x31\n\tSetDevice\x12\x0f.context.Device\x1a\x11.context.DeviceId\"\x00\x12\x33\n\x0cRemoveDevice\x12\x11.context.DeviceId\x1a\x0e.context.Empty\"\x00\x12;\n\x0fGetDeviceEvents\x12\x0e.context.Empty\x1a\x14.context.DeviceEvent\"\x00\x30\x01\x12\x34\n\x0bListLinkIds\x12\x0e.context.Empty\x1a\x13.context.LinkIdList\"\x00\x12\x30\n\tListLinks\x12\x0e.context.Empty\x1a\x11.context.LinkList\"\x00\x12+\n\x07GetLink\x12\x0f.context.LinkId\x1a\r.context.Link\"\x00\x12+\n\x07SetLink\x12\r.context.Link\x1a\x0f.context.LinkId\"\x00\x12/\n\nRemoveLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x12\x37\n\rGetLinkEvents\x12\x0e.context.Empty\x1a\x12.context.LinkEvent\"\x00\x30\x01\x12>\n\x0eListServiceIds\x12\x12.context.ContextId\x1a\x16.context.ServiceIdList\"\x00\x12:\n\x0cListServices\x12\x12.context.ContextId\x1a\x14.context.ServiceList\"\x00\x12\x34\n\nGetService\x12\x12.context.ServiceId\x1a\x10.context.Service\"\x00\x12\x34\n\nSetService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x35\n\rRemoveService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetServiceEvents\x12\x0e.context.Empty\x1a\x15.context.ServiceEvent\"\x00\x30\x01\x62\x06proto3' + , + dependencies=[kpi__sample__types__pb2.DESCRIPTOR,]) + +_EVENTTYPEENUM = _descriptor.EnumDescriptor( + name='EventTypeEnum', + full_name='context.EventTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_CREATE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_UPDATE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_REMOVE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3552, + serialized_end=3658, +) +_sym_db.RegisterEnumDescriptor(_EVENTTYPEENUM) + +EventTypeEnum = enum_type_wrapper.EnumTypeWrapper(_EVENTTYPEENUM) +_DEVICEDRIVERENUM = _descriptor.EnumDescriptor( + name='DeviceDriverEnum', + full_name='context.DeviceDriverEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_OPENCONFIG', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_TRANSPORT_API', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_P4', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_IETF_NETWORK_TOPOLOGY', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_ONF_TR_352', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3661, + serialized_end=3858, +) +_sym_db.RegisterEnumDescriptor(_DEVICEDRIVERENUM) + +DeviceDriverEnum = enum_type_wrapper.EnumTypeWrapper(_DEVICEDRIVERENUM) +_DEVICEOPERATIONALSTATUSENUM = _descriptor.EnumDescriptor( + name='DeviceOperationalStatusEnum', + full_name='context.DeviceOperationalStatusEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_DISABLED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_ENABLED', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3861, + serialized_end=4004, +) +_sym_db.RegisterEnumDescriptor(_DEVICEOPERATIONALSTATUSENUM) + +DeviceOperationalStatusEnum = enum_type_wrapper.EnumTypeWrapper(_DEVICEOPERATIONALSTATUSENUM) +_SERVICETYPEENUM = _descriptor.EnumDescriptor( + name='ServiceTypeEnum', + full_name='context.ServiceTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L3NM', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L2NM', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_TAPI_CONNECTIVITY_SERVICE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4007, + serialized_end=4136, +) +_sym_db.RegisterEnumDescriptor(_SERVICETYPEENUM) + +ServiceTypeEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICETYPEENUM) +_SERVICESTATUSENUM = _descriptor.EnumDescriptor( + name='ServiceStatusEnum', + full_name='context.ServiceStatusEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PLANNED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_ACTIVE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PENDING_REMOVAL', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4139, + serialized_end=4275, +) +_sym_db.RegisterEnumDescriptor(_SERVICESTATUSENUM) + +ServiceStatusEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICESTATUSENUM) +_CONFIGACTIONENUM = _descriptor.EnumDescriptor( + name='ConfigActionEnum', + full_name='context.ConfigActionEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_SET', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_DELETE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4277, + serialized_end=4370, +) +_sym_db.RegisterEnumDescriptor(_CONFIGACTIONENUM) + +ConfigActionEnum = enum_type_wrapper.EnumTypeWrapper(_CONFIGACTIONENUM) +EVENTTYPE_UNDEFINED = 0 +EVENTTYPE_CREATE = 1 +EVENTTYPE_UPDATE = 2 +EVENTTYPE_REMOVE = 3 +DEVICEDRIVER_UNDEFINED = 0 +DEVICEDRIVER_OPENCONFIG = 1 +DEVICEDRIVER_TRANSPORT_API = 2 +DEVICEDRIVER_P4 = 3 +DEVICEDRIVER_IETF_NETWORK_TOPOLOGY = 4 +DEVICEDRIVER_ONF_TR_352 = 5 +DEVICEOPERATIONALSTATUS_UNDEFINED = 0 +DEVICEOPERATIONALSTATUS_DISABLED = 1 +DEVICEOPERATIONALSTATUS_ENABLED = 2 +SERVICETYPE_UNKNOWN = 0 +SERVICETYPE_L3NM = 1 +SERVICETYPE_L2NM = 2 +SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3 +SERVICESTATUS_UNDEFINED = 0 +SERVICESTATUS_PLANNED = 1 +SERVICESTATUS_ACTIVE = 2 +SERVICESTATUS_PENDING_REMOVAL = 3 +CONFIGACTION_UNDEFINED = 0 +CONFIGACTION_SET = 1 +CONFIGACTION_DELETE = 2 + + + +_EMPTY = _descriptor.Descriptor( + name='Empty', + full_name='context.Empty', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=50, + serialized_end=57, +) + + +_UUID = _descriptor.Descriptor( + name='Uuid', + full_name='context.Uuid', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='uuid', full_name='context.Uuid.uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=59, + serialized_end=79, +) + + +_EVENT = _descriptor.Descriptor( + name='Event', + full_name='context.Event', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='timestamp', full_name='context.Event.timestamp', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='event_type', full_name='context.Event.event_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=81, + serialized_end=151, +) + + +_CONTEXTID = _descriptor.Descriptor( + name='ContextId', + full_name='context.ContextId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_uuid', full_name='context.ContextId.context_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=153, + serialized_end=201, +) + + +_CONTEXT = _descriptor.Descriptor( + name='Context', + full_name='context.Context', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.Context.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_ids', full_name='context.Context.topology_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_ids', full_name='context.Context.service_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='controller', full_name='context.Context.controller', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=204, + serialized_end=386, +) + + +_CONTEXTIDLIST = _descriptor.Descriptor( + name='ContextIdList', + full_name='context.ContextIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_ids', full_name='context.ContextIdList.context_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=388, + serialized_end=444, +) + + +_CONTEXTLIST = _descriptor.Descriptor( + name='ContextList', + full_name='context.ContextList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contexts', full_name='context.ContextList.contexts', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=446, + serialized_end=495, +) + + +_CONTEXTEVENT = _descriptor.Descriptor( + name='ContextEvent', + full_name='context.ContextEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.ContextEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='context_id', full_name='context.ContextEvent.context_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=497, + serialized_end=582, +) + + +_TOPOLOGYID = _descriptor.Descriptor( + name='TopologyId', + full_name='context.TopologyId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.TopologyId.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_uuid', full_name='context.TopologyId.topology_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=584, + serialized_end=674, +) + + +_TOPOLOGY = _descriptor.Descriptor( + name='Topology', + full_name='context.Topology', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.Topology.topology_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_ids', full_name='context.Topology.device_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_ids', full_name='context.Topology.link_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=676, + serialized_end=802, +) + + +_TOPOLOGYIDLIST = _descriptor.Descriptor( + name='TopologyIdList', + full_name='context.TopologyIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_ids', full_name='context.TopologyIdList.topology_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=804, + serialized_end=863, +) + + +_TOPOLOGYLIST = _descriptor.Descriptor( + name='TopologyList', + full_name='context.TopologyList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topologies', full_name='context.TopologyList.topologies', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=865, + serialized_end=918, +) + + +_TOPOLOGYEVENT = _descriptor.Descriptor( + name='TopologyEvent', + full_name='context.TopologyEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.TopologyEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.TopologyEvent.topology_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=920, + serialized_end=1008, +) + + +_DEVICEID = _descriptor.Descriptor( + name='DeviceId', + full_name='context.DeviceId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_uuid', full_name='context.DeviceId.device_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1010, + serialized_end=1056, +) + + +_DEVICE = _descriptor.Descriptor( + name='Device', + full_name='context.Device', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_id', full_name='context.Device.device_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_type', full_name='context.Device.device_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_config', full_name='context.Device.device_config', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_operational_status', full_name='context.Device.device_operational_status', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_drivers', full_name='context.Device.device_drivers', index=4, + number=5, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_endpoints', full_name='context.Device.device_endpoints', index=5, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1059, + serialized_end=1341, +) + + +_DEVICECONFIG = _descriptor.Descriptor( + name='DeviceConfig', + full_name='context.DeviceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.DeviceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1343, + serialized_end=1400, +) + + +_DEVICEIDLIST = _descriptor.Descriptor( + name='DeviceIdList', + full_name='context.DeviceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_ids', full_name='context.DeviceIdList.device_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1402, + serialized_end=1455, +) + + +_DEVICELIST = _descriptor.Descriptor( + name='DeviceList', + full_name='context.DeviceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='devices', full_name='context.DeviceList.devices', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1457, + serialized_end=1503, +) + + +_DEVICEEVENT = _descriptor.Descriptor( + name='DeviceEvent', + full_name='context.DeviceEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.DeviceEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_id', full_name='context.DeviceEvent.device_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1505, + serialized_end=1587, +) + + +_LINKID = _descriptor.Descriptor( + name='LinkId', + full_name='context.LinkId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_uuid', full_name='context.LinkId.link_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1589, + serialized_end=1631, +) + + +_LINK = _descriptor.Descriptor( + name='Link', + full_name='context.Link', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_id', full_name='context.Link.link_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_endpoint_ids', full_name='context.Link.link_endpoint_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1633, + serialized_end=1721, +) + + +_LINKIDLIST = _descriptor.Descriptor( + name='LinkIdList', + full_name='context.LinkIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_ids', full_name='context.LinkIdList.link_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1723, + serialized_end=1770, +) + + +_LINKLIST = _descriptor.Descriptor( + name='LinkList', + full_name='context.LinkList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='links', full_name='context.LinkList.links', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1772, + serialized_end=1812, +) + + +_LINKEVENT = _descriptor.Descriptor( + name='LinkEvent', + full_name='context.LinkEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.LinkEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_id', full_name='context.LinkEvent.link_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1814, + serialized_end=1890, +) + + +_SERVICEID = _descriptor.Descriptor( + name='ServiceId', + full_name='context.ServiceId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.ServiceId.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_uuid', full_name='context.ServiceId.service_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1892, + serialized_end=1980, +) + + +_SERVICE = _descriptor.Descriptor( + name='Service', + full_name='context.Service', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_id', full_name='context.Service.service_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_type', full_name='context.Service.service_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_endpoint_ids', full_name='context.Service.service_endpoint_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_constraints', full_name='context.Service.service_constraints', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_status', full_name='context.Service.service_status', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_config', full_name='context.Service.service_config', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1983, + serialized_end=2277, +) + + +_SERVICESTATUS = _descriptor.Descriptor( + name='ServiceStatus', + full_name='context.ServiceStatus', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_status', full_name='context.ServiceStatus.service_status', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2279, + serialized_end=2346, +) + + +_SERVICECONFIG = _descriptor.Descriptor( + name='ServiceConfig', + full_name='context.ServiceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.ServiceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2348, + serialized_end=2406, +) + + +_SERVICEIDLIST = _descriptor.Descriptor( + name='ServiceIdList', + full_name='context.ServiceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_ids', full_name='context.ServiceIdList.service_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2408, + serialized_end=2464, +) + + +_SERVICELIST = _descriptor.Descriptor( + name='ServiceList', + full_name='context.ServiceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='services', full_name='context.ServiceList.services', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2466, + serialized_end=2515, +) + + +_SERVICEEVENT = _descriptor.Descriptor( + name='ServiceEvent', + full_name='context.ServiceEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.ServiceEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_id', full_name='context.ServiceEvent.service_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2517, + serialized_end=2602, +) + + +_ENDPOINTID = _descriptor.Descriptor( + name='EndPointId', + full_name='context.EndPointId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.EndPointId.topology_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_id', full_name='context.EndPointId.device_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_uuid', full_name='context.EndPointId.endpoint_uuid', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2605, + serialized_end=2735, +) + + +_ENDPOINT = _descriptor.Descriptor( + name='EndPoint', + full_name='context.EndPoint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoint_id', full_name='context.EndPoint.endpoint_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_type', full_name='context.EndPoint.endpoint_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='kpi_sample_types', full_name='context.EndPoint.kpi_sample_types', index=2, + number=3, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2738, + serialized_end=2872, +) + + +_CONFIGRULE = _descriptor.Descriptor( + name='ConfigRule', + full_name='context.ConfigRule', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='action', full_name='context.ConfigRule.action', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='resource_key', full_name='context.ConfigRule.resource_key', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='resource_value', full_name='context.ConfigRule.resource_value', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2874, + serialized_end=2975, +) + + +_CONSTRAINT = _descriptor.Descriptor( + name='Constraint', + full_name='context.Constraint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='constraint_type', full_name='context.Constraint.constraint_type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='constraint_value', full_name='context.Constraint.constraint_value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2977, + serialized_end=3040, +) + + +_CONNECTIONID = _descriptor.Descriptor( + name='ConnectionId', + full_name='context.ConnectionId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_uuid', full_name='context.ConnectionId.connection_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3042, + serialized_end=3096, +) + + +_CONNECTION = _descriptor.Descriptor( + name='Connection', + full_name='context.Connection', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='context.Connection.connection_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='related_service_id', full_name='context.Connection.related_service_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='path', full_name='context.Connection.path', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3099, + serialized_end=3240, +) + + +_CONNECTIONIDLIST = _descriptor.Descriptor( + name='ConnectionIdList', + full_name='context.ConnectionIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_ids', full_name='context.ConnectionIdList.connection_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3242, + serialized_end=3307, +) + + +_CONNECTIONLIST = _descriptor.Descriptor( + name='ConnectionList', + full_name='context.ConnectionList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connections', full_name='context.ConnectionList.connections', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3309, + serialized_end=3367, +) + + +_TERAFLOWCONTROLLER = _descriptor.Descriptor( + name='TeraFlowController', + full_name='context.TeraFlowController', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.TeraFlowController.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='ip_address', full_name='context.TeraFlowController.ip_address', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='port', full_name='context.TeraFlowController.port', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3369, + serialized_end=3463, +) + + +_AUTHENTICATIONRESULT = _descriptor.Descriptor( + name='AuthenticationResult', + full_name='context.AuthenticationResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.AuthenticationResult.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='authenticated', full_name='context.AuthenticationResult.authenticated', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3465, + serialized_end=3550, +) + +_EVENT.fields_by_name['event_type'].enum_type = _EVENTTYPEENUM +_CONTEXTID.fields_by_name['context_uuid'].message_type = _UUID +_CONTEXT.fields_by_name['context_id'].message_type = _CONTEXTID +_CONTEXT.fields_by_name['topology_ids'].message_type = _TOPOLOGYID +_CONTEXT.fields_by_name['service_ids'].message_type = _SERVICEID +_CONTEXT.fields_by_name['controller'].message_type = _TERAFLOWCONTROLLER +_CONTEXTIDLIST.fields_by_name['context_ids'].message_type = _CONTEXTID +_CONTEXTLIST.fields_by_name['contexts'].message_type = _CONTEXT +_CONTEXTEVENT.fields_by_name['event'].message_type = _EVENT +_CONTEXTEVENT.fields_by_name['context_id'].message_type = _CONTEXTID +_TOPOLOGYID.fields_by_name['context_id'].message_type = _CONTEXTID +_TOPOLOGYID.fields_by_name['topology_uuid'].message_type = _UUID +_TOPOLOGY.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_TOPOLOGY.fields_by_name['device_ids'].message_type = _DEVICEID +_TOPOLOGY.fields_by_name['link_ids'].message_type = _LINKID +_TOPOLOGYIDLIST.fields_by_name['topology_ids'].message_type = _TOPOLOGYID +_TOPOLOGYLIST.fields_by_name['topologies'].message_type = _TOPOLOGY +_TOPOLOGYEVENT.fields_by_name['event'].message_type = _EVENT +_TOPOLOGYEVENT.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_DEVICEID.fields_by_name['device_uuid'].message_type = _UUID +_DEVICE.fields_by_name['device_id'].message_type = _DEVICEID +_DEVICE.fields_by_name['device_config'].message_type = _DEVICECONFIG +_DEVICE.fields_by_name['device_operational_status'].enum_type = _DEVICEOPERATIONALSTATUSENUM +_DEVICE.fields_by_name['device_drivers'].enum_type = _DEVICEDRIVERENUM +_DEVICE.fields_by_name['device_endpoints'].message_type = _ENDPOINT +_DEVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_DEVICEIDLIST.fields_by_name['device_ids'].message_type = _DEVICEID +_DEVICELIST.fields_by_name['devices'].message_type = _DEVICE +_DEVICEEVENT.fields_by_name['event'].message_type = _EVENT +_DEVICEEVENT.fields_by_name['device_id'].message_type = _DEVICEID +_LINKID.fields_by_name['link_uuid'].message_type = _UUID +_LINK.fields_by_name['link_id'].message_type = _LINKID +_LINK.fields_by_name['link_endpoint_ids'].message_type = _ENDPOINTID +_LINKIDLIST.fields_by_name['link_ids'].message_type = _LINKID +_LINKLIST.fields_by_name['links'].message_type = _LINK +_LINKEVENT.fields_by_name['event'].message_type = _EVENT +_LINKEVENT.fields_by_name['link_id'].message_type = _LINKID +_SERVICEID.fields_by_name['context_id'].message_type = _CONTEXTID +_SERVICEID.fields_by_name['service_uuid'].message_type = _UUID +_SERVICE.fields_by_name['service_id'].message_type = _SERVICEID +_SERVICE.fields_by_name['service_type'].enum_type = _SERVICETYPEENUM +_SERVICE.fields_by_name['service_endpoint_ids'].message_type = _ENDPOINTID +_SERVICE.fields_by_name['service_constraints'].message_type = _CONSTRAINT +_SERVICE.fields_by_name['service_status'].message_type = _SERVICESTATUS +_SERVICE.fields_by_name['service_config'].message_type = _SERVICECONFIG +_SERVICESTATUS.fields_by_name['service_status'].enum_type = _SERVICESTATUSENUM +_SERVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_SERVICEIDLIST.fields_by_name['service_ids'].message_type = _SERVICEID +_SERVICELIST.fields_by_name['services'].message_type = _SERVICE +_SERVICEEVENT.fields_by_name['event'].message_type = _EVENT +_SERVICEEVENT.fields_by_name['service_id'].message_type = _SERVICEID +_ENDPOINTID.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_ENDPOINTID.fields_by_name['device_id'].message_type = _DEVICEID +_ENDPOINTID.fields_by_name['endpoint_uuid'].message_type = _UUID +_ENDPOINT.fields_by_name['endpoint_id'].message_type = _ENDPOINTID +_ENDPOINT.fields_by_name['kpi_sample_types'].enum_type = kpi__sample__types__pb2._KPISAMPLETYPE +_CONFIGRULE.fields_by_name['action'].enum_type = _CONFIGACTIONENUM +_CONNECTIONID.fields_by_name['connection_uuid'].message_type = _UUID +_CONNECTION.fields_by_name['connection_id'].message_type = _CONNECTIONID +_CONNECTION.fields_by_name['related_service_id'].message_type = _SERVICEID +_CONNECTION.fields_by_name['path'].message_type = _ENDPOINTID +_CONNECTIONIDLIST.fields_by_name['connection_ids'].message_type = _CONNECTIONID +_CONNECTIONLIST.fields_by_name['connections'].message_type = _CONNECTION +_TERAFLOWCONTROLLER.fields_by_name['context_id'].message_type = _CONTEXTID +_AUTHENTICATIONRESULT.fields_by_name['context_id'].message_type = _CONTEXTID +DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY +DESCRIPTOR.message_types_by_name['Uuid'] = _UUID +DESCRIPTOR.message_types_by_name['Event'] = _EVENT +DESCRIPTOR.message_types_by_name['ContextId'] = _CONTEXTID +DESCRIPTOR.message_types_by_name['Context'] = _CONTEXT +DESCRIPTOR.message_types_by_name['ContextIdList'] = _CONTEXTIDLIST +DESCRIPTOR.message_types_by_name['ContextList'] = _CONTEXTLIST +DESCRIPTOR.message_types_by_name['ContextEvent'] = _CONTEXTEVENT +DESCRIPTOR.message_types_by_name['TopologyId'] = _TOPOLOGYID +DESCRIPTOR.message_types_by_name['Topology'] = _TOPOLOGY +DESCRIPTOR.message_types_by_name['TopologyIdList'] = _TOPOLOGYIDLIST +DESCRIPTOR.message_types_by_name['TopologyList'] = _TOPOLOGYLIST +DESCRIPTOR.message_types_by_name['TopologyEvent'] = _TOPOLOGYEVENT +DESCRIPTOR.message_types_by_name['DeviceId'] = _DEVICEID +DESCRIPTOR.message_types_by_name['Device'] = _DEVICE +DESCRIPTOR.message_types_by_name['DeviceConfig'] = _DEVICECONFIG +DESCRIPTOR.message_types_by_name['DeviceIdList'] = _DEVICEIDLIST +DESCRIPTOR.message_types_by_name['DeviceList'] = _DEVICELIST +DESCRIPTOR.message_types_by_name['DeviceEvent'] = _DEVICEEVENT +DESCRIPTOR.message_types_by_name['LinkId'] = _LINKID +DESCRIPTOR.message_types_by_name['Link'] = _LINK +DESCRIPTOR.message_types_by_name['LinkIdList'] = _LINKIDLIST +DESCRIPTOR.message_types_by_name['LinkList'] = _LINKLIST +DESCRIPTOR.message_types_by_name['LinkEvent'] = _LINKEVENT +DESCRIPTOR.message_types_by_name['ServiceId'] = _SERVICEID +DESCRIPTOR.message_types_by_name['Service'] = _SERVICE +DESCRIPTOR.message_types_by_name['ServiceStatus'] = _SERVICESTATUS +DESCRIPTOR.message_types_by_name['ServiceConfig'] = _SERVICECONFIG +DESCRIPTOR.message_types_by_name['ServiceIdList'] = _SERVICEIDLIST +DESCRIPTOR.message_types_by_name['ServiceList'] = _SERVICELIST +DESCRIPTOR.message_types_by_name['ServiceEvent'] = _SERVICEEVENT +DESCRIPTOR.message_types_by_name['EndPointId'] = _ENDPOINTID +DESCRIPTOR.message_types_by_name['EndPoint'] = _ENDPOINT +DESCRIPTOR.message_types_by_name['ConfigRule'] = _CONFIGRULE +DESCRIPTOR.message_types_by_name['Constraint'] = _CONSTRAINT +DESCRIPTOR.message_types_by_name['ConnectionId'] = _CONNECTIONID +DESCRIPTOR.message_types_by_name['Connection'] = _CONNECTION +DESCRIPTOR.message_types_by_name['ConnectionIdList'] = _CONNECTIONIDLIST +DESCRIPTOR.message_types_by_name['ConnectionList'] = _CONNECTIONLIST +DESCRIPTOR.message_types_by_name['TeraFlowController'] = _TERAFLOWCONTROLLER +DESCRIPTOR.message_types_by_name['AuthenticationResult'] = _AUTHENTICATIONRESULT +DESCRIPTOR.enum_types_by_name['EventTypeEnum'] = _EVENTTYPEENUM +DESCRIPTOR.enum_types_by_name['DeviceDriverEnum'] = _DEVICEDRIVERENUM +DESCRIPTOR.enum_types_by_name['DeviceOperationalStatusEnum'] = _DEVICEOPERATIONALSTATUSENUM +DESCRIPTOR.enum_types_by_name['ServiceTypeEnum'] = _SERVICETYPEENUM +DESCRIPTOR.enum_types_by_name['ServiceStatusEnum'] = _SERVICESTATUSENUM +DESCRIPTOR.enum_types_by_name['ConfigActionEnum'] = _CONFIGACTIONENUM +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { + 'DESCRIPTOR' : _EMPTY, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Empty) + }) +_sym_db.RegisterMessage(Empty) + +Uuid = _reflection.GeneratedProtocolMessageType('Uuid', (_message.Message,), { + 'DESCRIPTOR' : _UUID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Uuid) + }) +_sym_db.RegisterMessage(Uuid) + +Event = _reflection.GeneratedProtocolMessageType('Event', (_message.Message,), { + 'DESCRIPTOR' : _EVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Event) + }) +_sym_db.RegisterMessage(Event) + +ContextId = _reflection.GeneratedProtocolMessageType('ContextId', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextId) + }) +_sym_db.RegisterMessage(ContextId) + +Context = _reflection.GeneratedProtocolMessageType('Context', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Context) + }) +_sym_db.RegisterMessage(Context) + +ContextIdList = _reflection.GeneratedProtocolMessageType('ContextIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextIdList) + }) +_sym_db.RegisterMessage(ContextIdList) + +ContextList = _reflection.GeneratedProtocolMessageType('ContextList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextList) + }) +_sym_db.RegisterMessage(ContextList) + +ContextEvent = _reflection.GeneratedProtocolMessageType('ContextEvent', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextEvent) + }) +_sym_db.RegisterMessage(ContextEvent) + +TopologyId = _reflection.GeneratedProtocolMessageType('TopologyId', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyId) + }) +_sym_db.RegisterMessage(TopologyId) + +Topology = _reflection.GeneratedProtocolMessageType('Topology', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGY, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Topology) + }) +_sym_db.RegisterMessage(Topology) + +TopologyIdList = _reflection.GeneratedProtocolMessageType('TopologyIdList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyIdList) + }) +_sym_db.RegisterMessage(TopologyIdList) + +TopologyList = _reflection.GeneratedProtocolMessageType('TopologyList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyList) + }) +_sym_db.RegisterMessage(TopologyList) + +TopologyEvent = _reflection.GeneratedProtocolMessageType('TopologyEvent', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyEvent) + }) +_sym_db.RegisterMessage(TopologyEvent) + +DeviceId = _reflection.GeneratedProtocolMessageType('DeviceId', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceId) + }) +_sym_db.RegisterMessage(DeviceId) + +Device = _reflection.GeneratedProtocolMessageType('Device', (_message.Message,), { + 'DESCRIPTOR' : _DEVICE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Device) + }) +_sym_db.RegisterMessage(Device) + +DeviceConfig = _reflection.GeneratedProtocolMessageType('DeviceConfig', (_message.Message,), { + 'DESCRIPTOR' : _DEVICECONFIG, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceConfig) + }) +_sym_db.RegisterMessage(DeviceConfig) + +DeviceIdList = _reflection.GeneratedProtocolMessageType('DeviceIdList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceIdList) + }) +_sym_db.RegisterMessage(DeviceIdList) + +DeviceList = _reflection.GeneratedProtocolMessageType('DeviceList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceList) + }) +_sym_db.RegisterMessage(DeviceList) + +DeviceEvent = _reflection.GeneratedProtocolMessageType('DeviceEvent', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceEvent) + }) +_sym_db.RegisterMessage(DeviceEvent) + +LinkId = _reflection.GeneratedProtocolMessageType('LinkId', (_message.Message,), { + 'DESCRIPTOR' : _LINKID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkId) + }) +_sym_db.RegisterMessage(LinkId) + +Link = _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), { + 'DESCRIPTOR' : _LINK, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Link) + }) +_sym_db.RegisterMessage(Link) + +LinkIdList = _reflection.GeneratedProtocolMessageType('LinkIdList', (_message.Message,), { + 'DESCRIPTOR' : _LINKIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkIdList) + }) +_sym_db.RegisterMessage(LinkIdList) + +LinkList = _reflection.GeneratedProtocolMessageType('LinkList', (_message.Message,), { + 'DESCRIPTOR' : _LINKLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkList) + }) +_sym_db.RegisterMessage(LinkList) + +LinkEvent = _reflection.GeneratedProtocolMessageType('LinkEvent', (_message.Message,), { + 'DESCRIPTOR' : _LINKEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkEvent) + }) +_sym_db.RegisterMessage(LinkEvent) + +ServiceId = _reflection.GeneratedProtocolMessageType('ServiceId', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceId) + }) +_sym_db.RegisterMessage(ServiceId) + +Service = _reflection.GeneratedProtocolMessageType('Service', (_message.Message,), { + 'DESCRIPTOR' : _SERVICE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Service) + }) +_sym_db.RegisterMessage(Service) + +ServiceStatus = _reflection.GeneratedProtocolMessageType('ServiceStatus', (_message.Message,), { + 'DESCRIPTOR' : _SERVICESTATUS, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceStatus) + }) +_sym_db.RegisterMessage(ServiceStatus) + +ServiceConfig = _reflection.GeneratedProtocolMessageType('ServiceConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVICECONFIG, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceConfig) + }) +_sym_db.RegisterMessage(ServiceConfig) + +ServiceIdList = _reflection.GeneratedProtocolMessageType('ServiceIdList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceIdList) + }) +_sym_db.RegisterMessage(ServiceIdList) + +ServiceList = _reflection.GeneratedProtocolMessageType('ServiceList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceList) + }) +_sym_db.RegisterMessage(ServiceList) + +ServiceEvent = _reflection.GeneratedProtocolMessageType('ServiceEvent', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceEvent) + }) +_sym_db.RegisterMessage(ServiceEvent) + +EndPointId = _reflection.GeneratedProtocolMessageType('EndPointId', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINTID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.EndPointId) + }) +_sym_db.RegisterMessage(EndPointId) + +EndPoint = _reflection.GeneratedProtocolMessageType('EndPoint', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.EndPoint) + }) +_sym_db.RegisterMessage(EndPoint) + +ConfigRule = _reflection.GeneratedProtocolMessageType('ConfigRule', (_message.Message,), { + 'DESCRIPTOR' : _CONFIGRULE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConfigRule) + }) +_sym_db.RegisterMessage(ConfigRule) + +Constraint = _reflection.GeneratedProtocolMessageType('Constraint', (_message.Message,), { + 'DESCRIPTOR' : _CONSTRAINT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Constraint) + }) +_sym_db.RegisterMessage(Constraint) + +ConnectionId = _reflection.GeneratedProtocolMessageType('ConnectionId', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionId) + }) +_sym_db.RegisterMessage(ConnectionId) + +Connection = _reflection.GeneratedProtocolMessageType('Connection', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTION, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Connection) + }) +_sym_db.RegisterMessage(Connection) + +ConnectionIdList = _reflection.GeneratedProtocolMessageType('ConnectionIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionIdList) + }) +_sym_db.RegisterMessage(ConnectionIdList) + +ConnectionList = _reflection.GeneratedProtocolMessageType('ConnectionList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionList) + }) +_sym_db.RegisterMessage(ConnectionList) + +TeraFlowController = _reflection.GeneratedProtocolMessageType('TeraFlowController', (_message.Message,), { + 'DESCRIPTOR' : _TERAFLOWCONTROLLER, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TeraFlowController) + }) +_sym_db.RegisterMessage(TeraFlowController) + +AuthenticationResult = _reflection.GeneratedProtocolMessageType('AuthenticationResult', (_message.Message,), { + 'DESCRIPTOR' : _AUTHENTICATIONRESULT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.AuthenticationResult) + }) +_sym_db.RegisterMessage(AuthenticationResult) + + + +_CONTEXTSERVICE = _descriptor.ServiceDescriptor( + name='ContextService', + full_name='context.ContextService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=4373, + serialized_end=6074, + methods=[ + _descriptor.MethodDescriptor( + name='ListContextIds', + full_name='context.ContextService.ListContextIds', + index=0, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListContexts', + full_name='context.ContextService.ListContexts', + index=1, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetContext', + full_name='context.ContextService.GetContext', + index=2, + containing_service=None, + input_type=_CONTEXTID, + output_type=_CONTEXT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetContext', + full_name='context.ContextService.SetContext', + index=3, + containing_service=None, + input_type=_CONTEXT, + output_type=_CONTEXTID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveContext', + full_name='context.ContextService.RemoveContext', + index=4, + containing_service=None, + input_type=_CONTEXTID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetContextEvents', + full_name='context.ContextService.GetContextEvents', + index=5, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListTopologyIds', + full_name='context.ContextService.ListTopologyIds', + index=6, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListTopologies', + full_name='context.ContextService.ListTopologies', + index=7, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopology', + full_name='context.ContextService.GetTopology', + index=8, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_TOPOLOGY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetTopology', + full_name='context.ContextService.SetTopology', + index=9, + containing_service=None, + input_type=_TOPOLOGY, + output_type=_TOPOLOGYID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveTopology', + full_name='context.ContextService.RemoveTopology', + index=10, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopologyEvents', + full_name='context.ContextService.GetTopologyEvents', + index=11, + containing_service=None, + input_type=_EMPTY, + output_type=_TOPOLOGYEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListDeviceIds', + full_name='context.ContextService.ListDeviceIds', + index=12, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListDevices', + full_name='context.ContextService.ListDevices', + index=13, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDevice', + full_name='context.ContextService.GetDevice', + index=14, + containing_service=None, + input_type=_DEVICEID, + output_type=_DEVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetDevice', + full_name='context.ContextService.SetDevice', + index=15, + containing_service=None, + input_type=_DEVICE, + output_type=_DEVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveDevice', + full_name='context.ContextService.RemoveDevice', + index=16, + containing_service=None, + input_type=_DEVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDeviceEvents', + full_name='context.ContextService.GetDeviceEvents', + index=17, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListLinkIds', + full_name='context.ContextService.ListLinkIds', + index=18, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListLinks', + full_name='context.ContextService.ListLinks', + index=19, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLink', + full_name='context.ContextService.GetLink', + index=20, + containing_service=None, + input_type=_LINKID, + output_type=_LINK, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetLink', + full_name='context.ContextService.SetLink', + index=21, + containing_service=None, + input_type=_LINK, + output_type=_LINKID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveLink', + full_name='context.ContextService.RemoveLink', + index=22, + containing_service=None, + input_type=_LINKID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLinkEvents', + full_name='context.ContextService.GetLinkEvents', + index=23, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListServiceIds', + full_name='context.ContextService.ListServiceIds', + index=24, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListServices', + full_name='context.ContextService.ListServices', + index=25, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetService', + full_name='context.ContextService.GetService', + index=26, + containing_service=None, + input_type=_SERVICEID, + output_type=_SERVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetService', + full_name='context.ContextService.SetService', + index=27, + containing_service=None, + input_type=_SERVICE, + output_type=_SERVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveService', + full_name='context.ContextService.RemoveService', + index=28, + containing_service=None, + input_type=_SERVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetServiceEvents', + full_name='context.ContextService.GetServiceEvents', + index=29, + containing_service=None, + input_type=_EMPTY, + output_type=_SERVICEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_CONTEXTSERVICE) + +DESCRIPTOR.services_by_name['ContextService'] = _CONTEXTSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalattackmitigator/proto/kpi_sample_types_pb2.py b/src/opticalattackmitigator/proto/kpi_sample_types_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..ea7fd2f82757d4c3db02d7e2c7817e2787b0b490 --- /dev/null +++ b/src/opticalattackmitigator/proto/kpi_sample_types_pb2.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: kpi_sample_types.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='kpi_sample_types.proto', + package='kpi_sample_types', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x16kpi_sample_types.proto\x12\x10kpi_sample_types*\xbe\x01\n\rKpiSampleType\x12\x19\n\x15KPISAMPLETYPE_UNKNOWN\x10\x00\x12%\n!KPISAMPLETYPE_PACKETS_TRANSMITTED\x10\x65\x12\"\n\x1eKPISAMPLETYPE_PACKETS_RECEIVED\x10\x66\x12$\n\x1fKPISAMPLETYPE_BYTES_TRANSMITTED\x10\xc9\x01\x12!\n\x1cKPISAMPLETYPE_BYTES_RECEIVED\x10\xca\x01\x62\x06proto3' +) + +_KPISAMPLETYPE = _descriptor.EnumDescriptor( + name='KpiSampleType', + full_name='kpi_sample_types.KpiSampleType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='KPISAMPLETYPE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='KPISAMPLETYPE_PACKETS_TRANSMITTED', index=1, number=101, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='KPISAMPLETYPE_PACKETS_RECEIVED', index=2, number=102, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='KPISAMPLETYPE_BYTES_TRANSMITTED', index=3, number=201, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='KPISAMPLETYPE_BYTES_RECEIVED', index=4, number=202, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=45, + serialized_end=235, +) +_sym_db.RegisterEnumDescriptor(_KPISAMPLETYPE) + +KpiSampleType = enum_type_wrapper.EnumTypeWrapper(_KPISAMPLETYPE) +KPISAMPLETYPE_UNKNOWN = 0 +KPISAMPLETYPE_PACKETS_TRANSMITTED = 101 +KPISAMPLETYPE_PACKETS_RECEIVED = 102 +KPISAMPLETYPE_BYTES_TRANSMITTED = 201 +KPISAMPLETYPE_BYTES_RECEIVED = 202 + + +DESCRIPTOR.enum_types_by_name['KpiSampleType'] = _KPISAMPLETYPE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2.py b/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..651c1b8e9cff9db06021a4b45934f3676a9f9f5e --- /dev/null +++ b/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2.py @@ -0,0 +1,189 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: optical_attack_mitigator.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import context_pb2 as context__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='optical_attack_mitigator.proto', + package='optical_attack_mitigator', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x1eoptical_attack_mitigator.proto\x12\x18optical_attack_mitigator\x1a\rcontext.proto\"t\n\x11\x41ttackDescription\x12\x1c\n\x05\x63s_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\x12\x11\n\tattack_id\x18\x02 \x01(\x05\x12\x12\n\nconfidence\x18\x03 \x01(\x02\x12\x1a\n\x12\x61ttack_description\x18\x04 \x01(\t\"\xa2\x01\n\x0e\x41ttackResponse\x12\x1c\n\x05\x63s_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\x12\x11\n\tattack_id\x18\x02 \x01(\x05\x12\x1a\n\x12\x61ttack_description\x18\x03 \x01(\t\x12\x1c\n\x14response_strategy_id\x18\x04 \x01(\x05\x12%\n\x1dresponse_strategy_description\x18\x05 \x01(\t2z\n\x0f\x41ttackMitigator\x12g\n\x0cNotifyAttack\x12+.optical_attack_mitigator.AttackDescription\x1a(.optical_attack_mitigator.AttackResponse\"\x00\x62\x06proto3' + , + dependencies=[context__pb2.DESCRIPTOR,]) + + + + +_ATTACKDESCRIPTION = _descriptor.Descriptor( + name='AttackDescription', + full_name='optical_attack_mitigator.AttackDescription', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='cs_id', full_name='optical_attack_mitigator.AttackDescription.cs_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='attack_id', full_name='optical_attack_mitigator.AttackDescription.attack_id', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='confidence', full_name='optical_attack_mitigator.AttackDescription.confidence', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='attack_description', full_name='optical_attack_mitigator.AttackDescription.attack_description', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=75, + serialized_end=191, +) + + +_ATTACKRESPONSE = _descriptor.Descriptor( + name='AttackResponse', + full_name='optical_attack_mitigator.AttackResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='cs_id', full_name='optical_attack_mitigator.AttackResponse.cs_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='attack_id', full_name='optical_attack_mitigator.AttackResponse.attack_id', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='attack_description', full_name='optical_attack_mitigator.AttackResponse.attack_description', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='response_strategy_id', full_name='optical_attack_mitigator.AttackResponse.response_strategy_id', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='response_strategy_description', full_name='optical_attack_mitigator.AttackResponse.response_strategy_description', index=4, + number=5, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=194, + serialized_end=356, +) + +_ATTACKDESCRIPTION.fields_by_name['cs_id'].message_type = context__pb2._UUID +_ATTACKRESPONSE.fields_by_name['cs_id'].message_type = context__pb2._UUID +DESCRIPTOR.message_types_by_name['AttackDescription'] = _ATTACKDESCRIPTION +DESCRIPTOR.message_types_by_name['AttackResponse'] = _ATTACKRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +AttackDescription = _reflection.GeneratedProtocolMessageType('AttackDescription', (_message.Message,), { + 'DESCRIPTOR' : _ATTACKDESCRIPTION, + '__module__' : 'optical_attack_mitigator_pb2' + # @@protoc_insertion_point(class_scope:optical_attack_mitigator.AttackDescription) + }) +_sym_db.RegisterMessage(AttackDescription) + +AttackResponse = _reflection.GeneratedProtocolMessageType('AttackResponse', (_message.Message,), { + 'DESCRIPTOR' : _ATTACKRESPONSE, + '__module__' : 'optical_attack_mitigator_pb2' + # @@protoc_insertion_point(class_scope:optical_attack_mitigator.AttackResponse) + }) +_sym_db.RegisterMessage(AttackResponse) + + + +_ATTACKMITIGATOR = _descriptor.ServiceDescriptor( + name='AttackMitigator', + full_name='optical_attack_mitigator.AttackMitigator', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=358, + serialized_end=480, + methods=[ + _descriptor.MethodDescriptor( + name='NotifyAttack', + full_name='optical_attack_mitigator.AttackMitigator.NotifyAttack', + index=0, + containing_service=None, + input_type=_ATTACKDESCRIPTION, + output_type=_ATTACKRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_ATTACKMITIGATOR) + +DESCRIPTOR.services_by_name['AttackMitigator'] = _ATTACKMITIGATOR + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2_grpc.py b/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2_grpc.py new file mode 100644 index 0000000000000000000000000000000000000000..2f12816a1f909e073ece0ad5a4b3d8fda4235d89 --- /dev/null +++ b/src/opticalattackmitigator/proto/optical_attack_mitigator_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import optical_attack_mitigator_pb2 as optical__attack__mitigator__pb2 + + +class AttackMitigatorStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.NotifyAttack = channel.unary_unary( + '/optical_attack_mitigator.AttackMitigator/NotifyAttack', + request_serializer=optical__attack__mitigator__pb2.AttackDescription.SerializeToString, + response_deserializer=optical__attack__mitigator__pb2.AttackResponse.FromString, + ) + + +class AttackMitigatorServicer(object): + """Missing associated documentation comment in .proto file.""" + + def NotifyAttack(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_AttackMitigatorServicer_to_server(servicer, server): + rpc_method_handlers = { + 'NotifyAttack': grpc.unary_unary_rpc_method_handler( + servicer.NotifyAttack, + request_deserializer=optical__attack__mitigator__pb2.AttackDescription.FromString, + response_serializer=optical__attack__mitigator__pb2.AttackResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'optical_attack_mitigator.AttackMitigator', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class AttackMitigator(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def NotifyAttack(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/optical_attack_mitigator.AttackMitigator/NotifyAttack', + optical__attack__mitigator__pb2.AttackDescription.SerializeToString, + optical__attack__mitigator__pb2.AttackResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/opticalattackmitigator/requirements.in b/src/opticalattackmitigator/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..00acd77fe30ca10ffe3af04f7cf7ced2cb9256f8 --- /dev/null +++ b/src/opticalattackmitigator/requirements.in @@ -0,0 +1,9 @@ +grpcio-health-checking +grpcio +prometheus-client +pytest +pytest-benchmark +redis +# from the monitoring component +influxdb +python-json-logger diff --git a/src/opticalattackmitigator/service/OpticalAttackMitigatorService.py b/src/opticalattackmitigator/service/OpticalAttackMitigatorService.py new file mode 100644 index 0000000000000000000000000000000000000000..fc2e86067b437bb4facd1e6608f48439fbf2a03e --- /dev/null +++ b/src/opticalattackmitigator/service/OpticalAttackMitigatorService.py @@ -0,0 +1,58 @@ +import grpc +import logging +from concurrent import futures +from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH +from grpc_health.v1.health_pb2 import HealthCheckResponse +from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server +from opticalattackmitigator.proto.optical_attack_mitigator_pb2_grpc import ( + add_AttackMitigatorServicer_to_server) +from opticalattackmitigator.service.OpticalAttackMitigatorServiceServicerImpl import ( + OpticalAttackMitigatorServiceServicerImpl) +from opticalattackmitigator.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD + +BIND_ADDRESS = '0.0.0.0' +LOGGER = logging.getLogger(__name__) + +class OpticalAttackMitigatorService: + def __init__( + self, address=BIND_ADDRESS, port=GRPC_SERVICE_PORT, max_workers=GRPC_MAX_WORKERS, + grace_period=GRPC_GRACE_PERIOD): + + self.address = address + self.port = port + self.endpoint = None + self.max_workers = max_workers + self.grace_period = grace_period + self.attack_mitigator_servicer = None + self.health_servicer = None + self.pool = None + self.server = None + + def start(self): + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(self.port)) + LOGGER.debug('Starting Service (tentative endpoint: {:s}, max_workers: {:s})...'.format( + str(self.endpoint), str(self.max_workers))) + + self.pool = futures.ThreadPoolExecutor(max_workers=self.max_workers) + self.server = grpc.server(self.pool) # , interceptors=(tracer_interceptor,)) + + self.attack_mitigator_servicer = OpticalAttackMitigatorServiceServicerImpl() + add_AttackMitigatorServicer_to_server(self.attack_mitigator_servicer, self.server) + + self.health_servicer = HealthServicer( + experimental_non_blocking=True, experimental_thread_pool=futures.ThreadPoolExecutor(max_workers=1)) + add_HealthServicer_to_server(self.health_servicer, self.server) + + port = self.server.add_insecure_port(self.endpoint) + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(port)) + LOGGER.info('Listening on {:s}...'.format(self.endpoint)) + self.server.start() + self.health_servicer.set(OVERALL_HEALTH, HealthCheckResponse.SERVING) # pylint: disable=maybe-no-member + + LOGGER.debug('Service started') + + def stop(self): + LOGGER.debug('Stopping service (grace period {:s} seconds)...'.format(str(self.grace_period))) + self.health_servicer.enter_graceful_shutdown() + self.server.stop(self.grace_period) + LOGGER.debug('Service stopped') diff --git a/src/opticalattackmitigator/service/OpticalAttackMitigatorServiceServicerImpl.py b/src/opticalattackmitigator/service/OpticalAttackMitigatorServiceServicerImpl.py new file mode 100644 index 0000000000000000000000000000000000000000..d7cbc6b0956f26fb87e7d2567cc1c9065482cfd4 --- /dev/null +++ b/src/opticalattackmitigator/service/OpticalAttackMitigatorServiceServicerImpl.py @@ -0,0 +1,26 @@ +import os, grpc, logging, random +from influxdb import InfluxDBClient +from common.rpc_method_wrapper.Decorator import create_metrics, safe_and_metered_rpc_method +from opticalattackmitigator.proto.optical_attack_mitigator_pb2_grpc import ( + AttackMitigatorServicer) +from opticalattackmitigator.proto.optical_attack_mitigator_pb2 import AttackDescription, AttackResponse + +LOGGER = logging.getLogger(__name__) + +SERVICE_NAME = 'OpticalAttackMitigator' +METHOD_NAMES = ['NotifyAttack'] +METRICS = create_metrics(SERVICE_NAME, METHOD_NAMES) + + +class OpticalAttackMitigatorServiceServicerImpl(AttackMitigatorServicer): + + def __init__(self): + LOGGER.debug('Creating Servicer...') + LOGGER.debug('Servicer Created') + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def NotifyAttack(self, request : AttackDescription, context : grpc.ServicerContext) -> AttackResponse: + LOGGER.debug(f"NotifyAttack: {request}") + response: AttackResponse = AttackResponse() + response.response_strategy_description = 'The AttackMitigator has received the attack description.' + return response diff --git a/src/opticalattackmitigator/service/__init__.py b/src/opticalattackmitigator/service/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalattackmitigator/service/__main__.py b/src/opticalattackmitigator/service/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..bcbf4e3e4c9c74ef25e6d95f6d70edf5fba25c68 --- /dev/null +++ b/src/opticalattackmitigator/service/__main__.py @@ -0,0 +1,50 @@ +import os, logging, signal, sys, time, threading, multiprocessing +from prometheus_client import start_http_server +from common.Settings import get_setting +from opticalattackmitigator.Config import ( + GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, METRICS_PORT) +from opticalattackmitigator.service.OpticalAttackMitigatorService import OpticalAttackMitigatorService + +terminate = threading.Event() +LOGGER = None + +def signal_handler(signal, frame): # pylint: disable=redefined-outer-name + LOGGER.warning('Terminate signal received') + terminate.set() + +def main(): + global LOGGER # pylint: disable=global-statement + + service_port = get_setting('OPTICALATTACKMITIGATORSERVICE_SERVICE_PORT_GRPC', default=GRPC_SERVICE_PORT) + max_workers = get_setting('MAX_WORKERS', default=GRPC_MAX_WORKERS ) + grace_period = get_setting('GRACE_PERIOD', default=GRPC_GRACE_PERIOD) + log_level = get_setting('LOG_LEVEL', default=LOG_LEVEL ) + metrics_port = get_setting('METRICS_PORT', default=METRICS_PORT ) + + logging.basicConfig(level=log_level) + LOGGER = logging.getLogger(__name__) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + LOGGER.info('Starting...') + + # Start metrics server + start_http_server(metrics_port) + + # Starting CentralizedCybersecurity service + grpc_service = OpticalAttackMitigatorService( + port=service_port, max_workers=max_workers, grace_period=grace_period) + grpc_service.start() + + # Wait for Ctrl+C or termination signal + while not terminate.wait(timeout=0.1): pass + + LOGGER.info('Terminating...') + grpc_service.stop() + + LOGGER.info('Bye') + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/src/opticalattackmitigator/tests/__init__.py b/src/opticalattackmitigator/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalattackmitigator/tests/test_unitary.py b/src/opticalattackmitigator/tests/test_unitary.py new file mode 100644 index 0000000000000000000000000000000000000000..afcb1a699186fb10408cfdc4309fc790fa91c198 --- /dev/null +++ b/src/opticalattackmitigator/tests/test_unitary.py @@ -0,0 +1,28 @@ +import logging, pytest +from opticalattackmitigator.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD +from opticalattackmitigator.client.OpticalAttackMitigatorClient import OpticalAttackMitigatorClient +from opticalattackmitigator.service.OpticalAttackMitigatorService import OpticalAttackMitigatorService +from opticalattackmitigator.proto.optical_attack_mitigator_pb2 import AttackDescription, AttackResponse + +port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +@pytest.fixture(scope='session') +def optical_attack_mitigator_service(): + _service = OpticalAttackMitigatorService( + port=port, max_workers=GRPC_MAX_WORKERS, grace_period=GRPC_GRACE_PERIOD) + _service.start() + yield _service + _service.stop() + +@pytest.fixture(scope='session') +def optical_attack_mitigator_client(optical_attack_mitigator_service): + _client = OpticalAttackMitigatorClient(address='127.0.0.1', port=port) + yield _client + _client.close() + +def test_call_service(optical_attack_mitigator_client: OpticalAttackMitigatorClient): + request = AttackDescription() + optical_attack_mitigator_client.NotifyAttack(request) diff --git a/src/opticalcentralizedattackdetector/.gitlab-ci.yml b/src/opticalcentralizedattackdetector/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..11a2c97e6b1944584d5aa48774f7f7a85b8e902c --- /dev/null +++ b/src/opticalcentralizedattackdetector/.gitlab-ci.yml @@ -0,0 +1,83 @@ +# build, tag and push the Docker image to the gitlab registry +build opticalcentralizedattackdetector: + variables: + IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: build + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile ./src/ + - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + # after_script: + # - docker rmi $(docker images --quiet --filter=dangling=true) + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAME.yaml + - .gitlab-ci.yml + +# apply unit test to the opticalcentralizedattackdetector component +unit test opticalcentralizedattackdetector: + variables: + IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: unit_test + needs: + - build opticalcentralizedattackdetector + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - if docker network list | grep teraflowbridge; then echo "teraflowbridge is already created"; else docker network create -d bridge teraflowbridge; fi + - if docker container ls | grep $IMAGE_NAME; then docker rm -f $IMAGE_NAME; else echo "$IMAGE_NAME image is not in the system"; fi + script: + - docker pull "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" + - docker run --name $IMAGE_NAME -d -p 10005:10005 --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG + - sleep 5 + - docker ps -a + - docker exec -i $IMAGE_NAME bash -c "pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py" + after_script: + #- docker rm -f $IMAGE_NAME + - docker network rm teraflowbridge + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + - changes: + - src/$IMAGE_NAME/**/*.{py,in,yml} + - src/$IMAGE_NAME/Dockerfile + - src/$IMAGE_NAME/tests/*.py + - src/$IMAGE_NAME/tests/Dockerfile + - manifests/$IMAGE_NAMEservice.yaml + - .gitlab-ci.yml + + +# Deployment of the opticalcentralizedattackdetector service in Kubernetes Cluster +deploy opticalcentralizedattackdetector: + variables: + IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) + stage: deploy + needs: + - unit test opticalcentralizedattackdetector + # - integ_test execute + script: + - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml' + - kubectl version + - kubectl get all + - kubectl apply -f "manifests/$IMAGE_NAME.yaml" + - kubectl get all + # environment: + # name: test + # url: https://example.com + # kubernetes: + # namespace: test + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)' + when: manual + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "develop"' + when: manual \ No newline at end of file diff --git a/src/opticalcentralizedattackdetector/Config.py b/src/opticalcentralizedattackdetector/Config.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6b7aa5651566fb2305f08baec7c6f33872fd36 --- /dev/null +++ b/src/opticalcentralizedattackdetector/Config.py @@ -0,0 +1,26 @@ +import logging + +# General settings +LOG_LEVEL = logging.DEBUG + +# gRPC settings +GRPC_SERVICE_PORT = 10005 +GRPC_MAX_WORKERS = 10 +GRPC_GRACE_PERIOD = 60 + +# service settings +MONITORING_INTERVAL = 2 # monitoring interval in seconds +#TODO: adjust the addresses below for the specific case +MONITORING_SERVICE_ADDRESS = 'monitoring' # address/name of the monitoring service +# MONITORING_SERVICE_ADDRESS = '10.99.41.20' # address/name of the monitoring service +CONTEXT_SERVICE_ADDRESS = 'contextservice' # address/name of the monitoring service +# CONTEXT_SERVICE_ADDRESS = '10.107.199.65' # address/name of the monitoring service +SERVICE_SERVICE_ADDRESS = 'serviceservice' # address/name of the service service +# SERVICE_SERVICE_ADDRESS = '10.99.234.88' # address/name of the service service +# INFERENCE_SERVICE_ADDRESS = '10.108.113.78' # address/name of the inference service +INFERENCE_SERVICE_ADDRESS = 'dbscanservingservice' # address/name of the inference service +# ATTACK_MITIGATOR_SERVICE_ADDRESS = '10.96.248.167' +ATTACK_MITIGATOR_SERVICE_ADDRESS = 'opticalattackmitigatorservice' + +# Prometheus settings +METRICS_PORT = 9192 diff --git a/src/opticalcentralizedattackdetector/Dockerfile b/src/opticalcentralizedattackdetector/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..43f7b9457fe1413ca9d9dc520433f184717d0c2a --- /dev/null +++ b/src/opticalcentralizedattackdetector/Dockerfile @@ -0,0 +1,42 @@ +FROM python:3-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ && \ + 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 setuptools wheel pip-tools + +# Set working directory +WORKDIR /var/teraflow + +# Create module sub-folders +RUN mkdir -p /var/teraflow/opticalcentralizedattackdetector + +# Get Python packages per module +COPY opticalcentralizedattackdetector/requirements.in opticalcentralizedattackdetector/requirements.in +RUN pip-compile --output-file=opticalcentralizedattackdetector/requirements.txt opticalcentralizedattackdetector/requirements.in +RUN python3 -m pip install -r opticalcentralizedattackdetector/requirements.txt + +# Add files into working directory +COPY common/. common +COPY context/. context +COPY monitoring/. monitoring +COPY service/. service +COPY dbscanserving/. dbscanserving +COPY opticalattackmitigator/. opticalattackmitigator +COPY opticalcentralizedattackdetector/. opticalcentralizedattackdetector + +ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + +# Start opticalcentralizedattackdetector service +ENTRYPOINT ["python", "-m", "opticalcentralizedattackdetector.service"] diff --git a/src/opticalcentralizedattackdetector/__init__.py b/src/opticalcentralizedattackdetector/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalcentralizedattackdetector/client/OpticalCentralizedAttackDetectorClient.py b/src/opticalcentralizedattackdetector/client/OpticalCentralizedAttackDetectorClient.py new file mode 100644 index 0000000000000000000000000000000000000000..c28507581d99c1df47e92eead1fce6ab1c7db3a7 --- /dev/null +++ b/src/opticalcentralizedattackdetector/client/OpticalCentralizedAttackDetectorClient.py @@ -0,0 +1,55 @@ +import grpc, logging +from common.tools.client.RetryDecorator import retry, delay_exponential +from opticalcentralizedattackdetector.proto.context_pb2 import Empty, Service +from opticalcentralizedattackdetector.proto.monitoring_pb2 import KpiList +from opticalcentralizedattackdetector.proto.optical_centralized_attack_detector_pb2_grpc import OpticalCentralizedAttackDetectorServiceStub + +LOGGER = logging.getLogger(__name__) +MAX_RETRIES = 15 +DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) + +class OpticalCentralizedAttackDetectorClient: + def __init__(self, address, port): + self.endpoint = '{:s}:{:s}'.format(str(address), str(port)) + LOGGER.debug('Creating channel to {:s}...'.format(str(self.endpoint))) + self.channel = None + self.stub = None + self.connect() + LOGGER.debug('Channel created') + + def connect(self): + self.channel = grpc.insecure_channel(self.endpoint) + self.stub = OpticalCentralizedAttackDetectorServiceStub(self.channel) + + def close(self): + if(self.channel is not None): self.channel.close() + self.channel = None + self.stub = None + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def NotifyServiceUpdate(self, request : Service) -> Empty: + LOGGER.debug('NotifyServiceUpdate request: {:s}'.format(str(request))) + response = self.stub.NotifyServiceUpdate(request) + LOGGER.debug('NotifyServiceUpdate result: {:s}'.format(str(response))) + return response + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def DetectAttack(self, request : Empty) -> Empty: + LOGGER.debug('DetectAttack request: {:s}'.format(str(request))) + response = self.stub.DetectAttack(request) + LOGGER.debug('DetectAttack result: {:s}'.format(str(response))) + return response + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def ReportSummarizedKpi(self, request : KpiList) -> Empty: + LOGGER.debug('ReportSummarizedKpi request: {:s}'.format(str(request))) + response = self.stub.ReportSummarizedKpi(request) + LOGGER.debug('ReportSummarizedKpi result: {:s}'.format(str(response))) + return response + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def ReportKpi(self, request : KpiList) -> Empty: + LOGGER.debug('ReportKpi request: {:s}'.format(str(request))) + response = self.stub.ReportKpi(request) + LOGGER.debug('ReportKpi result: {:s}'.format(str(response))) + return response diff --git a/src/opticalcentralizedattackdetector/client/__init__.py b/src/opticalcentralizedattackdetector/client/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalcentralizedattackdetector/genproto.sh b/src/opticalcentralizedattackdetector/genproto.sh new file mode 100755 index 0000000000000000000000000000000000000000..76df9bf83af19ac8f1528c750b7d7f11e0a97cf3 --- /dev/null +++ b/src/opticalcentralizedattackdetector/genproto.sh @@ -0,0 +1,46 @@ +#!/bin/bash -eu +# +# Copyright 2018 Google LLC +# +# 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. + +#!/bin/bash -e + +# Make folder containing the script the root folder for its execution +cd $(dirname $0) + +rm -rf proto/*.py +rm -rf proto/__pycache__ +touch proto/__init__.py + +# building protos of services used +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto context.proto +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto service.proto +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto monitoring.proto +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto kpi_sample_types.proto + +rm proto/context_pb2_grpc.py +rm proto/service_pb2_grpc.py +rm proto/monitoring_pb2_grpc.py +rm proto/kpi_sample_types_pb2_grpc.py + +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/service_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/monitoring_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/kpi_sample_types_pb2.py + +# building current service protos +python -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto optical_centralized_attack_detector.proto + +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/optical_centralized_attack_detector_pb2.py +sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/optical_centralized_attack_detector_pb2_grpc.py diff --git a/src/opticalcentralizedattackdetector/proto/__init__.py b/src/opticalcentralizedattackdetector/proto/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalcentralizedattackdetector/proto/context_pb2.py b/src/opticalcentralizedattackdetector/proto/context_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..658c58897615b33a435c7004d05b0a291abf95b7 --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/context_pb2.py @@ -0,0 +1,2545 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: context.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import kpi_sample_types_pb2 as kpi__sample__types__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='context.proto', + package='context', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\rcontext.proto\x12\x07\x63ontext\x1a\x16kpi_sample_types.proto\"\x07\n\x05\x45mpty\"\x14\n\x04Uuid\x12\x0c\n\x04uuid\x18\x01 \x01(\t\"F\n\x05\x45vent\x12\x11\n\ttimestamp\x18\x01 \x01(\x01\x12*\n\nevent_type\x18\x02 \x01(\x0e\x32\x16.context.EventTypeEnum\"0\n\tContextId\x12#\n\x0c\x63ontext_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\xb6\x01\n\x07\x43ontext\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12)\n\x0ctopology_ids\x18\x02 \x03(\x0b\x32\x13.context.TopologyId\x12\'\n\x0bservice_ids\x18\x03 \x03(\x0b\x32\x12.context.ServiceId\x12/\n\ncontroller\x18\x04 \x01(\x0b\x32\x1b.context.TeraFlowController\"8\n\rContextIdList\x12\'\n\x0b\x63ontext_ids\x18\x01 \x03(\x0b\x32\x12.context.ContextId\"1\n\x0b\x43ontextList\x12\"\n\x08\x63ontexts\x18\x01 \x03(\x0b\x32\x10.context.Context\"U\n\x0c\x43ontextEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\ncontext_id\x18\x02 \x01(\x0b\x32\x12.context.ContextId\"Z\n\nTopologyId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12$\n\rtopology_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"~\n\x08Topology\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12%\n\ndevice_ids\x18\x02 \x03(\x0b\x32\x11.context.DeviceId\x12!\n\x08link_ids\x18\x03 \x03(\x0b\x32\x0f.context.LinkId\";\n\x0eTopologyIdList\x12)\n\x0ctopology_ids\x18\x01 \x03(\x0b\x32\x13.context.TopologyId\"5\n\x0cTopologyList\x12%\n\ntopologies\x18\x01 \x03(\x0b\x32\x11.context.Topology\"X\n\rTopologyEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12(\n\x0btopology_id\x18\x02 \x01(\x0b\x32\x13.context.TopologyId\".\n\x08\x44\x65viceId\x12\"\n\x0b\x64\x65vice_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x9a\x02\n\x06\x44\x65vice\x12$\n\tdevice_id\x18\x01 \x01(\x0b\x32\x11.context.DeviceId\x12\x13\n\x0b\x64\x65vice_type\x18\x02 \x01(\t\x12,\n\rdevice_config\x18\x03 \x01(\x0b\x32\x15.context.DeviceConfig\x12G\n\x19\x64\x65vice_operational_status\x18\x04 \x01(\x0e\x32$.context.DeviceOperationalStatusEnum\x12\x31\n\x0e\x64\x65vice_drivers\x18\x05 \x03(\x0e\x32\x19.context.DeviceDriverEnum\x12+\n\x10\x64\x65vice_endpoints\x18\x06 \x03(\x0b\x32\x11.context.EndPoint\"9\n\x0c\x44\x65viceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"5\n\x0c\x44\x65viceIdList\x12%\n\ndevice_ids\x18\x01 \x03(\x0b\x32\x11.context.DeviceId\".\n\nDeviceList\x12 \n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x0f.context.Device\"R\n\x0b\x44\x65viceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\"*\n\x06LinkId\x12 \n\tlink_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"X\n\x04Link\x12 \n\x07link_id\x18\x01 \x01(\x0b\x32\x0f.context.LinkId\x12.\n\x11link_endpoint_ids\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\"/\n\nLinkIdList\x12!\n\x08link_ids\x18\x01 \x03(\x0b\x32\x0f.context.LinkId\"(\n\x08LinkList\x12\x1c\n\x05links\x18\x01 \x03(\x0b\x32\r.context.Link\"L\n\tLinkEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12 \n\x07link_id\x18\x02 \x01(\x0b\x32\x0f.context.LinkId\"X\n\tServiceId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12#\n\x0cservice_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"\xa6\x02\n\x07Service\x12&\n\nservice_id\x18\x01 \x01(\x0b\x32\x12.context.ServiceId\x12.\n\x0cservice_type\x18\x02 \x01(\x0e\x32\x18.context.ServiceTypeEnum\x12\x31\n\x14service_endpoint_ids\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12\x30\n\x13service_constraints\x18\x04 \x03(\x0b\x32\x13.context.Constraint\x12.\n\x0eservice_status\x18\x05 \x01(\x0b\x32\x16.context.ServiceStatus\x12.\n\x0eservice_config\x18\x06 \x01(\x0b\x32\x16.context.ServiceConfig\"C\n\rServiceStatus\x12\x32\n\x0eservice_status\x18\x01 \x01(\x0e\x32\x1a.context.ServiceStatusEnum\":\n\rServiceConfig\x12)\n\x0c\x63onfig_rules\x18\x01 \x03(\x0b\x32\x13.context.ConfigRule\"8\n\rServiceIdList\x12\'\n\x0bservice_ids\x18\x01 \x03(\x0b\x32\x12.context.ServiceId\"1\n\x0bServiceList\x12\"\n\x08services\x18\x01 \x03(\x0b\x32\x10.context.Service\"U\n\x0cServiceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12&\n\nservice_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\"\x82\x01\n\nEndPointId\x12(\n\x0btopology_id\x18\x01 \x01(\x0b\x32\x13.context.TopologyId\x12$\n\tdevice_id\x18\x02 \x01(\x0b\x32\x11.context.DeviceId\x12$\n\rendpoint_uuid\x18\x03 \x01(\x0b\x32\r.context.Uuid\"K\n\x08\x45ndPoint\x12(\n\x0b\x65ndpoint_id\x18\x01 \x01(\x0b\x32\x13.context.EndPointId\x12\x15\n\rendpoint_type\x18\x02 \x01(\t\"\x9f\x01\n\nConfigRule\x12)\n\x06\x61\x63tion\x18\x01 \x01(\x0e\x32\x19.context.ConfigActionEnum\x12\x14\n\x0cresource_key\x18\x02 \x01(\t\x12\x16\n\x0eresource_value\x18\x03 \x01(\t\x12\x38\n\x0fkpi_sample_type\x18\x04 \x01(\x0e\x32\x1f.kpi_sample_types.KpiSampleType\"?\n\nConstraint\x12\x17\n\x0f\x63onstraint_type\x18\x01 \x01(\t\x12\x18\n\x10\x63onstraint_value\x18\x02 \x01(\t\"6\n\x0c\x43onnectionId\x12&\n\x0f\x63onnection_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\x8d\x01\n\nConnection\x12,\n\rconnection_id\x18\x01 \x01(\x0b\x32\x15.context.ConnectionId\x12.\n\x12related_service_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\x12!\n\x04path\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\"A\n\x10\x43onnectionIdList\x12-\n\x0e\x63onnection_ids\x18\x01 \x03(\x0b\x32\x15.context.ConnectionId\":\n\x0e\x43onnectionList\x12(\n\x0b\x63onnections\x18\x01 \x03(\x0b\x32\x13.context.Connection\"^\n\x12TeraFlowController\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x0c\n\x04port\x18\x03 \x01(\r\"U\n\x14\x41uthenticationResult\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12\x15\n\rauthenticated\x18\x02 \x01(\x08*j\n\rEventTypeEnum\x12\x17\n\x13\x45VENTTYPE_UNDEFINED\x10\x00\x12\x14\n\x10\x45VENTTYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENTTYPE_UPDATE\x10\x02\x12\x14\n\x10\x45VENTTYPE_REMOVE\x10\x03*\xc5\x01\n\x10\x44\x65viceDriverEnum\x12\x1a\n\x16\x44\x45VICEDRIVER_UNDEFINED\x10\x00\x12\x1b\n\x17\x44\x45VICEDRIVER_OPENCONFIG\x10\x01\x12\x1e\n\x1a\x44\x45VICEDRIVER_TRANSPORT_API\x10\x02\x12\x13\n\x0f\x44\x45VICEDRIVER_P4\x10\x03\x12&\n\"DEVICEDRIVER_IETF_NETWORK_TOPOLOGY\x10\x04\x12\x1b\n\x17\x44\x45VICEDRIVER_ONF_TR_352\x10\x05*\x8f\x01\n\x1b\x44\x65viceOperationalStatusEnum\x12%\n!DEVICEOPERATIONALSTATUS_UNDEFINED\x10\x00\x12$\n DEVICEOPERATIONALSTATUS_DISABLED\x10\x01\x12#\n\x1f\x44\x45VICEOPERATIONALSTATUS_ENABLED\x10\x02*\x81\x01\n\x0fServiceTypeEnum\x12\x17\n\x13SERVICETYPE_UNKNOWN\x10\x00\x12\x14\n\x10SERVICETYPE_L3NM\x10\x01\x12\x14\n\x10SERVICETYPE_L2NM\x10\x02\x12)\n%SERVICETYPE_TAPI_CONNECTIVITY_SERVICE\x10\x03*\x88\x01\n\x11ServiceStatusEnum\x12\x1b\n\x17SERVICESTATUS_UNDEFINED\x10\x00\x12\x19\n\x15SERVICESTATUS_PLANNED\x10\x01\x12\x18\n\x14SERVICESTATUS_ACTIVE\x10\x02\x12!\n\x1dSERVICESTATUS_PENDING_REMOVAL\x10\x03*]\n\x10\x43onfigActionEnum\x12\x1a\n\x16\x43ONFIGACTION_UNDEFINED\x10\x00\x12\x14\n\x10\x43ONFIGACTION_SET\x10\x01\x12\x17\n\x13\x43ONFIGACTION_DELETE\x10\x02\x32\xa5\r\n\x0e\x43ontextService\x12:\n\x0eListContextIds\x12\x0e.context.Empty\x1a\x16.context.ContextIdList\"\x00\x12\x36\n\x0cListContexts\x12\x0e.context.Empty\x1a\x14.context.ContextList\"\x00\x12\x34\n\nGetContext\x12\x12.context.ContextId\x1a\x10.context.Context\"\x00\x12\x34\n\nSetContext\x12\x10.context.Context\x1a\x12.context.ContextId\"\x00\x12\x35\n\rRemoveContext\x12\x12.context.ContextId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetContextEvents\x12\x0e.context.Empty\x1a\x15.context.ContextEvent\"\x00\x30\x01\x12@\n\x0fListTopologyIds\x12\x12.context.ContextId\x1a\x17.context.TopologyIdList\"\x00\x12=\n\x0eListTopologies\x12\x12.context.ContextId\x1a\x15.context.TopologyList\"\x00\x12\x37\n\x0bGetTopology\x12\x13.context.TopologyId\x1a\x11.context.Topology\"\x00\x12\x37\n\x0bSetTopology\x12\x11.context.Topology\x1a\x13.context.TopologyId\"\x00\x12\x37\n\x0eRemoveTopology\x12\x13.context.TopologyId\x1a\x0e.context.Empty\"\x00\x12?\n\x11GetTopologyEvents\x12\x0e.context.Empty\x1a\x16.context.TopologyEvent\"\x00\x30\x01\x12\x38\n\rListDeviceIds\x12\x0e.context.Empty\x1a\x15.context.DeviceIdList\"\x00\x12\x34\n\x0bListDevices\x12\x0e.context.Empty\x1a\x13.context.DeviceList\"\x00\x12\x31\n\tGetDevice\x12\x11.context.DeviceId\x1a\x0f.context.Device\"\x00\x12\x31\n\tSetDevice\x12\x0f.context.Device\x1a\x11.context.DeviceId\"\x00\x12\x33\n\x0cRemoveDevice\x12\x11.context.DeviceId\x1a\x0e.context.Empty\"\x00\x12;\n\x0fGetDeviceEvents\x12\x0e.context.Empty\x1a\x14.context.DeviceEvent\"\x00\x30\x01\x12\x34\n\x0bListLinkIds\x12\x0e.context.Empty\x1a\x13.context.LinkIdList\"\x00\x12\x30\n\tListLinks\x12\x0e.context.Empty\x1a\x11.context.LinkList\"\x00\x12+\n\x07GetLink\x12\x0f.context.LinkId\x1a\r.context.Link\"\x00\x12+\n\x07SetLink\x12\r.context.Link\x1a\x0f.context.LinkId\"\x00\x12/\n\nRemoveLink\x12\x0f.context.LinkId\x1a\x0e.context.Empty\"\x00\x12\x37\n\rGetLinkEvents\x12\x0e.context.Empty\x1a\x12.context.LinkEvent\"\x00\x30\x01\x12>\n\x0eListServiceIds\x12\x12.context.ContextId\x1a\x16.context.ServiceIdList\"\x00\x12:\n\x0cListServices\x12\x12.context.ContextId\x1a\x14.context.ServiceList\"\x00\x12\x34\n\nGetService\x12\x12.context.ServiceId\x1a\x10.context.Service\"\x00\x12\x34\n\nSetService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x35\n\rRemoveService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x12=\n\x10GetServiceEvents\x12\x0e.context.Empty\x1a\x15.context.ServiceEvent\"\x00\x30\x01\x62\x06proto3' + , + dependencies=[kpi__sample__types__pb2.DESCRIPTOR,]) + +_EVENTTYPEENUM = _descriptor.EnumDescriptor( + name='EventTypeEnum', + full_name='context.EventTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_CREATE', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_UPDATE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EVENTTYPE_REMOVE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3551, + serialized_end=3657, +) +_sym_db.RegisterEnumDescriptor(_EVENTTYPEENUM) + +EventTypeEnum = enum_type_wrapper.EnumTypeWrapper(_EVENTTYPEENUM) +_DEVICEDRIVERENUM = _descriptor.EnumDescriptor( + name='DeviceDriverEnum', + full_name='context.DeviceDriverEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_OPENCONFIG', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_TRANSPORT_API', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_P4', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_IETF_NETWORK_TOPOLOGY', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEDRIVER_ONF_TR_352', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3660, + serialized_end=3857, +) +_sym_db.RegisterEnumDescriptor(_DEVICEDRIVERENUM) + +DeviceDriverEnum = enum_type_wrapper.EnumTypeWrapper(_DEVICEDRIVERENUM) +_DEVICEOPERATIONALSTATUSENUM = _descriptor.EnumDescriptor( + name='DeviceOperationalStatusEnum', + full_name='context.DeviceOperationalStatusEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_DISABLED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='DEVICEOPERATIONALSTATUS_ENABLED', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=3860, + serialized_end=4003, +) +_sym_db.RegisterEnumDescriptor(_DEVICEOPERATIONALSTATUSENUM) + +DeviceOperationalStatusEnum = enum_type_wrapper.EnumTypeWrapper(_DEVICEOPERATIONALSTATUSENUM) +_SERVICETYPEENUM = _descriptor.EnumDescriptor( + name='ServiceTypeEnum', + full_name='context.ServiceTypeEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L3NM', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_L2NM', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICETYPE_TAPI_CONNECTIVITY_SERVICE', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4006, + serialized_end=4135, +) +_sym_db.RegisterEnumDescriptor(_SERVICETYPEENUM) + +ServiceTypeEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICETYPEENUM) +_SERVICESTATUSENUM = _descriptor.EnumDescriptor( + name='ServiceStatusEnum', + full_name='context.ServiceStatusEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PLANNED', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_ACTIVE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SERVICESTATUS_PENDING_REMOVAL', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4138, + serialized_end=4274, +) +_sym_db.RegisterEnumDescriptor(_SERVICESTATUSENUM) + +ServiceStatusEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICESTATUSENUM) +_CONFIGACTIONENUM = _descriptor.EnumDescriptor( + name='ConfigActionEnum', + full_name='context.ConfigActionEnum', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_UNDEFINED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_SET', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='CONFIGACTION_DELETE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=4276, + serialized_end=4369, +) +_sym_db.RegisterEnumDescriptor(_CONFIGACTIONENUM) + +ConfigActionEnum = enum_type_wrapper.EnumTypeWrapper(_CONFIGACTIONENUM) +EVENTTYPE_UNDEFINED = 0 +EVENTTYPE_CREATE = 1 +EVENTTYPE_UPDATE = 2 +EVENTTYPE_REMOVE = 3 +DEVICEDRIVER_UNDEFINED = 0 +DEVICEDRIVER_OPENCONFIG = 1 +DEVICEDRIVER_TRANSPORT_API = 2 +DEVICEDRIVER_P4 = 3 +DEVICEDRIVER_IETF_NETWORK_TOPOLOGY = 4 +DEVICEDRIVER_ONF_TR_352 = 5 +DEVICEOPERATIONALSTATUS_UNDEFINED = 0 +DEVICEOPERATIONALSTATUS_DISABLED = 1 +DEVICEOPERATIONALSTATUS_ENABLED = 2 +SERVICETYPE_UNKNOWN = 0 +SERVICETYPE_L3NM = 1 +SERVICETYPE_L2NM = 2 +SERVICETYPE_TAPI_CONNECTIVITY_SERVICE = 3 +SERVICESTATUS_UNDEFINED = 0 +SERVICESTATUS_PLANNED = 1 +SERVICESTATUS_ACTIVE = 2 +SERVICESTATUS_PENDING_REMOVAL = 3 +CONFIGACTION_UNDEFINED = 0 +CONFIGACTION_SET = 1 +CONFIGACTION_DELETE = 2 + + + +_EMPTY = _descriptor.Descriptor( + name='Empty', + full_name='context.Empty', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=50, + serialized_end=57, +) + + +_UUID = _descriptor.Descriptor( + name='Uuid', + full_name='context.Uuid', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='uuid', full_name='context.Uuid.uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=59, + serialized_end=79, +) + + +_EVENT = _descriptor.Descriptor( + name='Event', + full_name='context.Event', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='timestamp', full_name='context.Event.timestamp', index=0, + number=1, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='event_type', full_name='context.Event.event_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=81, + serialized_end=151, +) + + +_CONTEXTID = _descriptor.Descriptor( + name='ContextId', + full_name='context.ContextId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_uuid', full_name='context.ContextId.context_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=153, + serialized_end=201, +) + + +_CONTEXT = _descriptor.Descriptor( + name='Context', + full_name='context.Context', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.Context.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_ids', full_name='context.Context.topology_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_ids', full_name='context.Context.service_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='controller', full_name='context.Context.controller', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=204, + serialized_end=386, +) + + +_CONTEXTIDLIST = _descriptor.Descriptor( + name='ContextIdList', + full_name='context.ContextIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_ids', full_name='context.ContextIdList.context_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=388, + serialized_end=444, +) + + +_CONTEXTLIST = _descriptor.Descriptor( + name='ContextList', + full_name='context.ContextList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='contexts', full_name='context.ContextList.contexts', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=446, + serialized_end=495, +) + + +_CONTEXTEVENT = _descriptor.Descriptor( + name='ContextEvent', + full_name='context.ContextEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.ContextEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='context_id', full_name='context.ContextEvent.context_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=497, + serialized_end=582, +) + + +_TOPOLOGYID = _descriptor.Descriptor( + name='TopologyId', + full_name='context.TopologyId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.TopologyId.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_uuid', full_name='context.TopologyId.topology_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=584, + serialized_end=674, +) + + +_TOPOLOGY = _descriptor.Descriptor( + name='Topology', + full_name='context.Topology', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.Topology.topology_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_ids', full_name='context.Topology.device_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_ids', full_name='context.Topology.link_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=676, + serialized_end=802, +) + + +_TOPOLOGYIDLIST = _descriptor.Descriptor( + name='TopologyIdList', + full_name='context.TopologyIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_ids', full_name='context.TopologyIdList.topology_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=804, + serialized_end=863, +) + + +_TOPOLOGYLIST = _descriptor.Descriptor( + name='TopologyList', + full_name='context.TopologyList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topologies', full_name='context.TopologyList.topologies', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=865, + serialized_end=918, +) + + +_TOPOLOGYEVENT = _descriptor.Descriptor( + name='TopologyEvent', + full_name='context.TopologyEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.TopologyEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.TopologyEvent.topology_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=920, + serialized_end=1008, +) + + +_DEVICEID = _descriptor.Descriptor( + name='DeviceId', + full_name='context.DeviceId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_uuid', full_name='context.DeviceId.device_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1010, + serialized_end=1056, +) + + +_DEVICE = _descriptor.Descriptor( + name='Device', + full_name='context.Device', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_id', full_name='context.Device.device_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_type', full_name='context.Device.device_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_config', full_name='context.Device.device_config', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_operational_status', full_name='context.Device.device_operational_status', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_drivers', full_name='context.Device.device_drivers', index=4, + number=5, type=14, cpp_type=8, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_endpoints', full_name='context.Device.device_endpoints', index=5, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1059, + serialized_end=1341, +) + + +_DEVICECONFIG = _descriptor.Descriptor( + name='DeviceConfig', + full_name='context.DeviceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.DeviceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1343, + serialized_end=1400, +) + + +_DEVICEIDLIST = _descriptor.Descriptor( + name='DeviceIdList', + full_name='context.DeviceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='device_ids', full_name='context.DeviceIdList.device_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1402, + serialized_end=1455, +) + + +_DEVICELIST = _descriptor.Descriptor( + name='DeviceList', + full_name='context.DeviceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='devices', full_name='context.DeviceList.devices', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1457, + serialized_end=1503, +) + + +_DEVICEEVENT = _descriptor.Descriptor( + name='DeviceEvent', + full_name='context.DeviceEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.DeviceEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_id', full_name='context.DeviceEvent.device_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1505, + serialized_end=1587, +) + + +_LINKID = _descriptor.Descriptor( + name='LinkId', + full_name='context.LinkId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_uuid', full_name='context.LinkId.link_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1589, + serialized_end=1631, +) + + +_LINK = _descriptor.Descriptor( + name='Link', + full_name='context.Link', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_id', full_name='context.Link.link_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_endpoint_ids', full_name='context.Link.link_endpoint_ids', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1633, + serialized_end=1721, +) + + +_LINKIDLIST = _descriptor.Descriptor( + name='LinkIdList', + full_name='context.LinkIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='link_ids', full_name='context.LinkIdList.link_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1723, + serialized_end=1770, +) + + +_LINKLIST = _descriptor.Descriptor( + name='LinkList', + full_name='context.LinkList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='links', full_name='context.LinkList.links', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1772, + serialized_end=1812, +) + + +_LINKEVENT = _descriptor.Descriptor( + name='LinkEvent', + full_name='context.LinkEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.LinkEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='link_id', full_name='context.LinkEvent.link_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1814, + serialized_end=1890, +) + + +_SERVICEID = _descriptor.Descriptor( + name='ServiceId', + full_name='context.ServiceId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.ServiceId.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_uuid', full_name='context.ServiceId.service_uuid', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1892, + serialized_end=1980, +) + + +_SERVICE = _descriptor.Descriptor( + name='Service', + full_name='context.Service', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_id', full_name='context.Service.service_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_type', full_name='context.Service.service_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_endpoint_ids', full_name='context.Service.service_endpoint_ids', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_constraints', full_name='context.Service.service_constraints', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_status', full_name='context.Service.service_status', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_config', full_name='context.Service.service_config', index=5, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1983, + serialized_end=2277, +) + + +_SERVICESTATUS = _descriptor.Descriptor( + name='ServiceStatus', + full_name='context.ServiceStatus', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_status', full_name='context.ServiceStatus.service_status', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2279, + serialized_end=2346, +) + + +_SERVICECONFIG = _descriptor.Descriptor( + name='ServiceConfig', + full_name='context.ServiceConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='config_rules', full_name='context.ServiceConfig.config_rules', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2348, + serialized_end=2406, +) + + +_SERVICEIDLIST = _descriptor.Descriptor( + name='ServiceIdList', + full_name='context.ServiceIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='service_ids', full_name='context.ServiceIdList.service_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2408, + serialized_end=2464, +) + + +_SERVICELIST = _descriptor.Descriptor( + name='ServiceList', + full_name='context.ServiceList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='services', full_name='context.ServiceList.services', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2466, + serialized_end=2515, +) + + +_SERVICEEVENT = _descriptor.Descriptor( + name='ServiceEvent', + full_name='context.ServiceEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='event', full_name='context.ServiceEvent.event', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_id', full_name='context.ServiceEvent.service_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2517, + serialized_end=2602, +) + + +_ENDPOINTID = _descriptor.Descriptor( + name='EndPointId', + full_name='context.EndPointId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='topology_id', full_name='context.EndPointId.topology_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_id', full_name='context.EndPointId.device_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_uuid', full_name='context.EndPointId.endpoint_uuid', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2605, + serialized_end=2735, +) + + +_ENDPOINT = _descriptor.Descriptor( + name='EndPoint', + full_name='context.EndPoint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='endpoint_id', full_name='context.EndPoint.endpoint_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_type', full_name='context.EndPoint.endpoint_type', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2737, + serialized_end=2812, +) + + +_CONFIGRULE = _descriptor.Descriptor( + name='ConfigRule', + full_name='context.ConfigRule', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='action', full_name='context.ConfigRule.action', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='resource_key', full_name='context.ConfigRule.resource_key', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='resource_value', full_name='context.ConfigRule.resource_value', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='kpi_sample_type', full_name='context.ConfigRule.kpi_sample_type', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2815, + serialized_end=2974, +) + + +_CONSTRAINT = _descriptor.Descriptor( + name='Constraint', + full_name='context.Constraint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='constraint_type', full_name='context.Constraint.constraint_type', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='constraint_value', full_name='context.Constraint.constraint_value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2976, + serialized_end=3039, +) + + +_CONNECTIONID = _descriptor.Descriptor( + name='ConnectionId', + full_name='context.ConnectionId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_uuid', full_name='context.ConnectionId.connection_uuid', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3041, + serialized_end=3095, +) + + +_CONNECTION = _descriptor.Descriptor( + name='Connection', + full_name='context.Connection', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_id', full_name='context.Connection.connection_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='related_service_id', full_name='context.Connection.related_service_id', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='path', full_name='context.Connection.path', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3098, + serialized_end=3239, +) + + +_CONNECTIONIDLIST = _descriptor.Descriptor( + name='ConnectionIdList', + full_name='context.ConnectionIdList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connection_ids', full_name='context.ConnectionIdList.connection_ids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3241, + serialized_end=3306, +) + + +_CONNECTIONLIST = _descriptor.Descriptor( + name='ConnectionList', + full_name='context.ConnectionList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='connections', full_name='context.ConnectionList.connections', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3308, + serialized_end=3366, +) + + +_TERAFLOWCONTROLLER = _descriptor.Descriptor( + name='TeraFlowController', + full_name='context.TeraFlowController', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.TeraFlowController.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='ip_address', full_name='context.TeraFlowController.ip_address', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='port', full_name='context.TeraFlowController.port', index=2, + number=3, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3368, + serialized_end=3462, +) + + +_AUTHENTICATIONRESULT = _descriptor.Descriptor( + name='AuthenticationResult', + full_name='context.AuthenticationResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='context_id', full_name='context.AuthenticationResult.context_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='authenticated', full_name='context.AuthenticationResult.authenticated', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3464, + serialized_end=3549, +) + +_EVENT.fields_by_name['event_type'].enum_type = _EVENTTYPEENUM +_CONTEXTID.fields_by_name['context_uuid'].message_type = _UUID +_CONTEXT.fields_by_name['context_id'].message_type = _CONTEXTID +_CONTEXT.fields_by_name['topology_ids'].message_type = _TOPOLOGYID +_CONTEXT.fields_by_name['service_ids'].message_type = _SERVICEID +_CONTEXT.fields_by_name['controller'].message_type = _TERAFLOWCONTROLLER +_CONTEXTIDLIST.fields_by_name['context_ids'].message_type = _CONTEXTID +_CONTEXTLIST.fields_by_name['contexts'].message_type = _CONTEXT +_CONTEXTEVENT.fields_by_name['event'].message_type = _EVENT +_CONTEXTEVENT.fields_by_name['context_id'].message_type = _CONTEXTID +_TOPOLOGYID.fields_by_name['context_id'].message_type = _CONTEXTID +_TOPOLOGYID.fields_by_name['topology_uuid'].message_type = _UUID +_TOPOLOGY.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_TOPOLOGY.fields_by_name['device_ids'].message_type = _DEVICEID +_TOPOLOGY.fields_by_name['link_ids'].message_type = _LINKID +_TOPOLOGYIDLIST.fields_by_name['topology_ids'].message_type = _TOPOLOGYID +_TOPOLOGYLIST.fields_by_name['topologies'].message_type = _TOPOLOGY +_TOPOLOGYEVENT.fields_by_name['event'].message_type = _EVENT +_TOPOLOGYEVENT.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_DEVICEID.fields_by_name['device_uuid'].message_type = _UUID +_DEVICE.fields_by_name['device_id'].message_type = _DEVICEID +_DEVICE.fields_by_name['device_config'].message_type = _DEVICECONFIG +_DEVICE.fields_by_name['device_operational_status'].enum_type = _DEVICEOPERATIONALSTATUSENUM +_DEVICE.fields_by_name['device_drivers'].enum_type = _DEVICEDRIVERENUM +_DEVICE.fields_by_name['device_endpoints'].message_type = _ENDPOINT +_DEVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_DEVICEIDLIST.fields_by_name['device_ids'].message_type = _DEVICEID +_DEVICELIST.fields_by_name['devices'].message_type = _DEVICE +_DEVICEEVENT.fields_by_name['event'].message_type = _EVENT +_DEVICEEVENT.fields_by_name['device_id'].message_type = _DEVICEID +_LINKID.fields_by_name['link_uuid'].message_type = _UUID +_LINK.fields_by_name['link_id'].message_type = _LINKID +_LINK.fields_by_name['link_endpoint_ids'].message_type = _ENDPOINTID +_LINKIDLIST.fields_by_name['link_ids'].message_type = _LINKID +_LINKLIST.fields_by_name['links'].message_type = _LINK +_LINKEVENT.fields_by_name['event'].message_type = _EVENT +_LINKEVENT.fields_by_name['link_id'].message_type = _LINKID +_SERVICEID.fields_by_name['context_id'].message_type = _CONTEXTID +_SERVICEID.fields_by_name['service_uuid'].message_type = _UUID +_SERVICE.fields_by_name['service_id'].message_type = _SERVICEID +_SERVICE.fields_by_name['service_type'].enum_type = _SERVICETYPEENUM +_SERVICE.fields_by_name['service_endpoint_ids'].message_type = _ENDPOINTID +_SERVICE.fields_by_name['service_constraints'].message_type = _CONSTRAINT +_SERVICE.fields_by_name['service_status'].message_type = _SERVICESTATUS +_SERVICE.fields_by_name['service_config'].message_type = _SERVICECONFIG +_SERVICESTATUS.fields_by_name['service_status'].enum_type = _SERVICESTATUSENUM +_SERVICECONFIG.fields_by_name['config_rules'].message_type = _CONFIGRULE +_SERVICEIDLIST.fields_by_name['service_ids'].message_type = _SERVICEID +_SERVICELIST.fields_by_name['services'].message_type = _SERVICE +_SERVICEEVENT.fields_by_name['event'].message_type = _EVENT +_SERVICEEVENT.fields_by_name['service_id'].message_type = _SERVICEID +_ENDPOINTID.fields_by_name['topology_id'].message_type = _TOPOLOGYID +_ENDPOINTID.fields_by_name['device_id'].message_type = _DEVICEID +_ENDPOINTID.fields_by_name['endpoint_uuid'].message_type = _UUID +_ENDPOINT.fields_by_name['endpoint_id'].message_type = _ENDPOINTID +_CONFIGRULE.fields_by_name['action'].enum_type = _CONFIGACTIONENUM +_CONFIGRULE.fields_by_name['kpi_sample_type'].enum_type = kpi__sample__types__pb2._KPISAMPLETYPE +_CONNECTIONID.fields_by_name['connection_uuid'].message_type = _UUID +_CONNECTION.fields_by_name['connection_id'].message_type = _CONNECTIONID +_CONNECTION.fields_by_name['related_service_id'].message_type = _SERVICEID +_CONNECTION.fields_by_name['path'].message_type = _ENDPOINTID +_CONNECTIONIDLIST.fields_by_name['connection_ids'].message_type = _CONNECTIONID +_CONNECTIONLIST.fields_by_name['connections'].message_type = _CONNECTION +_TERAFLOWCONTROLLER.fields_by_name['context_id'].message_type = _CONTEXTID +_AUTHENTICATIONRESULT.fields_by_name['context_id'].message_type = _CONTEXTID +DESCRIPTOR.message_types_by_name['Empty'] = _EMPTY +DESCRIPTOR.message_types_by_name['Uuid'] = _UUID +DESCRIPTOR.message_types_by_name['Event'] = _EVENT +DESCRIPTOR.message_types_by_name['ContextId'] = _CONTEXTID +DESCRIPTOR.message_types_by_name['Context'] = _CONTEXT +DESCRIPTOR.message_types_by_name['ContextIdList'] = _CONTEXTIDLIST +DESCRIPTOR.message_types_by_name['ContextList'] = _CONTEXTLIST +DESCRIPTOR.message_types_by_name['ContextEvent'] = _CONTEXTEVENT +DESCRIPTOR.message_types_by_name['TopologyId'] = _TOPOLOGYID +DESCRIPTOR.message_types_by_name['Topology'] = _TOPOLOGY +DESCRIPTOR.message_types_by_name['TopologyIdList'] = _TOPOLOGYIDLIST +DESCRIPTOR.message_types_by_name['TopologyList'] = _TOPOLOGYLIST +DESCRIPTOR.message_types_by_name['TopologyEvent'] = _TOPOLOGYEVENT +DESCRIPTOR.message_types_by_name['DeviceId'] = _DEVICEID +DESCRIPTOR.message_types_by_name['Device'] = _DEVICE +DESCRIPTOR.message_types_by_name['DeviceConfig'] = _DEVICECONFIG +DESCRIPTOR.message_types_by_name['DeviceIdList'] = _DEVICEIDLIST +DESCRIPTOR.message_types_by_name['DeviceList'] = _DEVICELIST +DESCRIPTOR.message_types_by_name['DeviceEvent'] = _DEVICEEVENT +DESCRIPTOR.message_types_by_name['LinkId'] = _LINKID +DESCRIPTOR.message_types_by_name['Link'] = _LINK +DESCRIPTOR.message_types_by_name['LinkIdList'] = _LINKIDLIST +DESCRIPTOR.message_types_by_name['LinkList'] = _LINKLIST +DESCRIPTOR.message_types_by_name['LinkEvent'] = _LINKEVENT +DESCRIPTOR.message_types_by_name['ServiceId'] = _SERVICEID +DESCRIPTOR.message_types_by_name['Service'] = _SERVICE +DESCRIPTOR.message_types_by_name['ServiceStatus'] = _SERVICESTATUS +DESCRIPTOR.message_types_by_name['ServiceConfig'] = _SERVICECONFIG +DESCRIPTOR.message_types_by_name['ServiceIdList'] = _SERVICEIDLIST +DESCRIPTOR.message_types_by_name['ServiceList'] = _SERVICELIST +DESCRIPTOR.message_types_by_name['ServiceEvent'] = _SERVICEEVENT +DESCRIPTOR.message_types_by_name['EndPointId'] = _ENDPOINTID +DESCRIPTOR.message_types_by_name['EndPoint'] = _ENDPOINT +DESCRIPTOR.message_types_by_name['ConfigRule'] = _CONFIGRULE +DESCRIPTOR.message_types_by_name['Constraint'] = _CONSTRAINT +DESCRIPTOR.message_types_by_name['ConnectionId'] = _CONNECTIONID +DESCRIPTOR.message_types_by_name['Connection'] = _CONNECTION +DESCRIPTOR.message_types_by_name['ConnectionIdList'] = _CONNECTIONIDLIST +DESCRIPTOR.message_types_by_name['ConnectionList'] = _CONNECTIONLIST +DESCRIPTOR.message_types_by_name['TeraFlowController'] = _TERAFLOWCONTROLLER +DESCRIPTOR.message_types_by_name['AuthenticationResult'] = _AUTHENTICATIONRESULT +DESCRIPTOR.enum_types_by_name['EventTypeEnum'] = _EVENTTYPEENUM +DESCRIPTOR.enum_types_by_name['DeviceDriverEnum'] = _DEVICEDRIVERENUM +DESCRIPTOR.enum_types_by_name['DeviceOperationalStatusEnum'] = _DEVICEOPERATIONALSTATUSENUM +DESCRIPTOR.enum_types_by_name['ServiceTypeEnum'] = _SERVICETYPEENUM +DESCRIPTOR.enum_types_by_name['ServiceStatusEnum'] = _SERVICESTATUSENUM +DESCRIPTOR.enum_types_by_name['ConfigActionEnum'] = _CONFIGACTIONENUM +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Empty = _reflection.GeneratedProtocolMessageType('Empty', (_message.Message,), { + 'DESCRIPTOR' : _EMPTY, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Empty) + }) +_sym_db.RegisterMessage(Empty) + +Uuid = _reflection.GeneratedProtocolMessageType('Uuid', (_message.Message,), { + 'DESCRIPTOR' : _UUID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Uuid) + }) +_sym_db.RegisterMessage(Uuid) + +Event = _reflection.GeneratedProtocolMessageType('Event', (_message.Message,), { + 'DESCRIPTOR' : _EVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Event) + }) +_sym_db.RegisterMessage(Event) + +ContextId = _reflection.GeneratedProtocolMessageType('ContextId', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextId) + }) +_sym_db.RegisterMessage(ContextId) + +Context = _reflection.GeneratedProtocolMessageType('Context', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Context) + }) +_sym_db.RegisterMessage(Context) + +ContextIdList = _reflection.GeneratedProtocolMessageType('ContextIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextIdList) + }) +_sym_db.RegisterMessage(ContextIdList) + +ContextList = _reflection.GeneratedProtocolMessageType('ContextList', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextList) + }) +_sym_db.RegisterMessage(ContextList) + +ContextEvent = _reflection.GeneratedProtocolMessageType('ContextEvent', (_message.Message,), { + 'DESCRIPTOR' : _CONTEXTEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ContextEvent) + }) +_sym_db.RegisterMessage(ContextEvent) + +TopologyId = _reflection.GeneratedProtocolMessageType('TopologyId', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyId) + }) +_sym_db.RegisterMessage(TopologyId) + +Topology = _reflection.GeneratedProtocolMessageType('Topology', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGY, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Topology) + }) +_sym_db.RegisterMessage(Topology) + +TopologyIdList = _reflection.GeneratedProtocolMessageType('TopologyIdList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyIdList) + }) +_sym_db.RegisterMessage(TopologyIdList) + +TopologyList = _reflection.GeneratedProtocolMessageType('TopologyList', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyList) + }) +_sym_db.RegisterMessage(TopologyList) + +TopologyEvent = _reflection.GeneratedProtocolMessageType('TopologyEvent', (_message.Message,), { + 'DESCRIPTOR' : _TOPOLOGYEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TopologyEvent) + }) +_sym_db.RegisterMessage(TopologyEvent) + +DeviceId = _reflection.GeneratedProtocolMessageType('DeviceId', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceId) + }) +_sym_db.RegisterMessage(DeviceId) + +Device = _reflection.GeneratedProtocolMessageType('Device', (_message.Message,), { + 'DESCRIPTOR' : _DEVICE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Device) + }) +_sym_db.RegisterMessage(Device) + +DeviceConfig = _reflection.GeneratedProtocolMessageType('DeviceConfig', (_message.Message,), { + 'DESCRIPTOR' : _DEVICECONFIG, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceConfig) + }) +_sym_db.RegisterMessage(DeviceConfig) + +DeviceIdList = _reflection.GeneratedProtocolMessageType('DeviceIdList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceIdList) + }) +_sym_db.RegisterMessage(DeviceIdList) + +DeviceList = _reflection.GeneratedProtocolMessageType('DeviceList', (_message.Message,), { + 'DESCRIPTOR' : _DEVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceList) + }) +_sym_db.RegisterMessage(DeviceList) + +DeviceEvent = _reflection.GeneratedProtocolMessageType('DeviceEvent', (_message.Message,), { + 'DESCRIPTOR' : _DEVICEEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.DeviceEvent) + }) +_sym_db.RegisterMessage(DeviceEvent) + +LinkId = _reflection.GeneratedProtocolMessageType('LinkId', (_message.Message,), { + 'DESCRIPTOR' : _LINKID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkId) + }) +_sym_db.RegisterMessage(LinkId) + +Link = _reflection.GeneratedProtocolMessageType('Link', (_message.Message,), { + 'DESCRIPTOR' : _LINK, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Link) + }) +_sym_db.RegisterMessage(Link) + +LinkIdList = _reflection.GeneratedProtocolMessageType('LinkIdList', (_message.Message,), { + 'DESCRIPTOR' : _LINKIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkIdList) + }) +_sym_db.RegisterMessage(LinkIdList) + +LinkList = _reflection.GeneratedProtocolMessageType('LinkList', (_message.Message,), { + 'DESCRIPTOR' : _LINKLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkList) + }) +_sym_db.RegisterMessage(LinkList) + +LinkEvent = _reflection.GeneratedProtocolMessageType('LinkEvent', (_message.Message,), { + 'DESCRIPTOR' : _LINKEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.LinkEvent) + }) +_sym_db.RegisterMessage(LinkEvent) + +ServiceId = _reflection.GeneratedProtocolMessageType('ServiceId', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceId) + }) +_sym_db.RegisterMessage(ServiceId) + +Service = _reflection.GeneratedProtocolMessageType('Service', (_message.Message,), { + 'DESCRIPTOR' : _SERVICE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Service) + }) +_sym_db.RegisterMessage(Service) + +ServiceStatus = _reflection.GeneratedProtocolMessageType('ServiceStatus', (_message.Message,), { + 'DESCRIPTOR' : _SERVICESTATUS, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceStatus) + }) +_sym_db.RegisterMessage(ServiceStatus) + +ServiceConfig = _reflection.GeneratedProtocolMessageType('ServiceConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVICECONFIG, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceConfig) + }) +_sym_db.RegisterMessage(ServiceConfig) + +ServiceIdList = _reflection.GeneratedProtocolMessageType('ServiceIdList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceIdList) + }) +_sym_db.RegisterMessage(ServiceIdList) + +ServiceList = _reflection.GeneratedProtocolMessageType('ServiceList', (_message.Message,), { + 'DESCRIPTOR' : _SERVICELIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceList) + }) +_sym_db.RegisterMessage(ServiceList) + +ServiceEvent = _reflection.GeneratedProtocolMessageType('ServiceEvent', (_message.Message,), { + 'DESCRIPTOR' : _SERVICEEVENT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ServiceEvent) + }) +_sym_db.RegisterMessage(ServiceEvent) + +EndPointId = _reflection.GeneratedProtocolMessageType('EndPointId', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINTID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.EndPointId) + }) +_sym_db.RegisterMessage(EndPointId) + +EndPoint = _reflection.GeneratedProtocolMessageType('EndPoint', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.EndPoint) + }) +_sym_db.RegisterMessage(EndPoint) + +ConfigRule = _reflection.GeneratedProtocolMessageType('ConfigRule', (_message.Message,), { + 'DESCRIPTOR' : _CONFIGRULE, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConfigRule) + }) +_sym_db.RegisterMessage(ConfigRule) + +Constraint = _reflection.GeneratedProtocolMessageType('Constraint', (_message.Message,), { + 'DESCRIPTOR' : _CONSTRAINT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Constraint) + }) +_sym_db.RegisterMessage(Constraint) + +ConnectionId = _reflection.GeneratedProtocolMessageType('ConnectionId', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONID, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionId) + }) +_sym_db.RegisterMessage(ConnectionId) + +Connection = _reflection.GeneratedProtocolMessageType('Connection', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTION, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.Connection) + }) +_sym_db.RegisterMessage(Connection) + +ConnectionIdList = _reflection.GeneratedProtocolMessageType('ConnectionIdList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONIDLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionIdList) + }) +_sym_db.RegisterMessage(ConnectionIdList) + +ConnectionList = _reflection.GeneratedProtocolMessageType('ConnectionList', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONLIST, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.ConnectionList) + }) +_sym_db.RegisterMessage(ConnectionList) + +TeraFlowController = _reflection.GeneratedProtocolMessageType('TeraFlowController', (_message.Message,), { + 'DESCRIPTOR' : _TERAFLOWCONTROLLER, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.TeraFlowController) + }) +_sym_db.RegisterMessage(TeraFlowController) + +AuthenticationResult = _reflection.GeneratedProtocolMessageType('AuthenticationResult', (_message.Message,), { + 'DESCRIPTOR' : _AUTHENTICATIONRESULT, + '__module__' : 'context_pb2' + # @@protoc_insertion_point(class_scope:context.AuthenticationResult) + }) +_sym_db.RegisterMessage(AuthenticationResult) + + + +_CONTEXTSERVICE = _descriptor.ServiceDescriptor( + name='ContextService', + full_name='context.ContextService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=4372, + serialized_end=6073, + methods=[ + _descriptor.MethodDescriptor( + name='ListContextIds', + full_name='context.ContextService.ListContextIds', + index=0, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListContexts', + full_name='context.ContextService.ListContexts', + index=1, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetContext', + full_name='context.ContextService.GetContext', + index=2, + containing_service=None, + input_type=_CONTEXTID, + output_type=_CONTEXT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetContext', + full_name='context.ContextService.SetContext', + index=3, + containing_service=None, + input_type=_CONTEXT, + output_type=_CONTEXTID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveContext', + full_name='context.ContextService.RemoveContext', + index=4, + containing_service=None, + input_type=_CONTEXTID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetContextEvents', + full_name='context.ContextService.GetContextEvents', + index=5, + containing_service=None, + input_type=_EMPTY, + output_type=_CONTEXTEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListTopologyIds', + full_name='context.ContextService.ListTopologyIds', + index=6, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListTopologies', + full_name='context.ContextService.ListTopologies', + index=7, + containing_service=None, + input_type=_CONTEXTID, + output_type=_TOPOLOGYLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopology', + full_name='context.ContextService.GetTopology', + index=8, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_TOPOLOGY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetTopology', + full_name='context.ContextService.SetTopology', + index=9, + containing_service=None, + input_type=_TOPOLOGY, + output_type=_TOPOLOGYID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveTopology', + full_name='context.ContextService.RemoveTopology', + index=10, + containing_service=None, + input_type=_TOPOLOGYID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetTopologyEvents', + full_name='context.ContextService.GetTopologyEvents', + index=11, + containing_service=None, + input_type=_EMPTY, + output_type=_TOPOLOGYEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListDeviceIds', + full_name='context.ContextService.ListDeviceIds', + index=12, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListDevices', + full_name='context.ContextService.ListDevices', + index=13, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDevice', + full_name='context.ContextService.GetDevice', + index=14, + containing_service=None, + input_type=_DEVICEID, + output_type=_DEVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetDevice', + full_name='context.ContextService.SetDevice', + index=15, + containing_service=None, + input_type=_DEVICE, + output_type=_DEVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveDevice', + full_name='context.ContextService.RemoveDevice', + index=16, + containing_service=None, + input_type=_DEVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetDeviceEvents', + full_name='context.ContextService.GetDeviceEvents', + index=17, + containing_service=None, + input_type=_EMPTY, + output_type=_DEVICEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListLinkIds', + full_name='context.ContextService.ListLinkIds', + index=18, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListLinks', + full_name='context.ContextService.ListLinks', + index=19, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLink', + full_name='context.ContextService.GetLink', + index=20, + containing_service=None, + input_type=_LINKID, + output_type=_LINK, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetLink', + full_name='context.ContextService.SetLink', + index=21, + containing_service=None, + input_type=_LINK, + output_type=_LINKID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveLink', + full_name='context.ContextService.RemoveLink', + index=22, + containing_service=None, + input_type=_LINKID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetLinkEvents', + full_name='context.ContextService.GetLinkEvents', + index=23, + containing_service=None, + input_type=_EMPTY, + output_type=_LINKEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListServiceIds', + full_name='context.ContextService.ListServiceIds', + index=24, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICEIDLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ListServices', + full_name='context.ContextService.ListServices', + index=25, + containing_service=None, + input_type=_CONTEXTID, + output_type=_SERVICELIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetService', + full_name='context.ContextService.GetService', + index=26, + containing_service=None, + input_type=_SERVICEID, + output_type=_SERVICE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='SetService', + full_name='context.ContextService.SetService', + index=27, + containing_service=None, + input_type=_SERVICE, + output_type=_SERVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='RemoveService', + full_name='context.ContextService.RemoveService', + index=28, + containing_service=None, + input_type=_SERVICEID, + output_type=_EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetServiceEvents', + full_name='context.ContextService.GetServiceEvents', + index=29, + containing_service=None, + input_type=_EMPTY, + output_type=_SERVICEEVENT, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_CONTEXTSERVICE) + +DESCRIPTOR.services_by_name['ContextService'] = _CONTEXTSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py b/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..31fbaa216bca629a4de4272091c490982c1aa166 --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: kpi_sample_types.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='kpi_sample_types.proto', + package='kpi_sample_types', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x16kpi_sample_types.proto\x12\x10kpi_sample_types*x\n\rKpiSampleType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x17\n\x13PACKETS_TRANSMITTED\x10\x65\x12\x14\n\x10PACKETS_RECEIVED\x10\x66\x12\x16\n\x11\x42YTES_TRANSMITTED\x10\xc9\x01\x12\x13\n\x0e\x42YTES_RECEIVED\x10\xca\x01\x62\x06proto3' +) + +_KPISAMPLETYPE = _descriptor.EnumDescriptor( + name='KpiSampleType', + full_name='kpi_sample_types.KpiSampleType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PACKETS_TRANSMITTED', index=1, number=101, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='PACKETS_RECEIVED', index=2, number=102, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='BYTES_TRANSMITTED', index=3, number=201, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='BYTES_RECEIVED', index=4, number=202, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=44, + serialized_end=164, +) +_sym_db.RegisterEnumDescriptor(_KPISAMPLETYPE) + +KpiSampleType = enum_type_wrapper.EnumTypeWrapper(_KPISAMPLETYPE) +UNKNOWN = 0 +PACKETS_TRANSMITTED = 101 +PACKETS_RECEIVED = 102 +BYTES_TRANSMITTED = 201 +BYTES_RECEIVED = 202 + + +DESCRIPTOR.enum_types_by_name['KpiSampleType'] = _KPISAMPLETYPE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/proto/monitoring_pb2.py b/src/opticalcentralizedattackdetector/proto/monitoring_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..b313ebb68f0da37a540898e8c362fd204a799076 --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/monitoring_pb2.py @@ -0,0 +1,452 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: monitoring.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import context_pb2 as context__pb2 +from . import kpi_sample_types_pb2 as kpi__sample__types__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='monitoring.proto', + package='monitoring', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x10monitoring.proto\x12\nmonitoring\x1a\rcontext.proto\x1a\x16kpi_sample_types.proto\"\xda\x01\n\rKpiDescriptor\x12\x17\n\x0fkpi_description\x18\x01 \x01(\t\x12\x38\n\x0fkpi_sample_type\x18\x02 \x01(\x0e\x32\x1f.kpi_sample_types.KpiSampleType\x12$\n\tdevice_id\x18\x03 \x01(\x0b\x32\x11.context.DeviceId\x12(\n\x0b\x65ndpoint_id\x18\x04 \x01(\x0b\x32\x13.context.EndPointId\x12&\n\nservice_id\x18\x05 \x01(\x0b\x32\x12.context.ServiceId\"p\n\x11MonitorKpiRequest\x12!\n\x06kpi_id\x18\x01 \x01(\x0b\x32\x11.monitoring.KpiId\x12\x1b\n\x13sampling_duration_s\x18\x02 \x01(\x02\x12\x1b\n\x13sampling_interval_s\x18\x03 \x01(\x02\"&\n\x05KpiId\x12\x1d\n\x06kpi_id\x18\x01 \x01(\x0b\x32\r.context.Uuid\"d\n\x03Kpi\x12!\n\x06kpi_id\x18\x01 \x01(\x0b\x32\x11.monitoring.KpiId\x12\x11\n\ttimestamp\x18\x02 \x01(\t\x12\'\n\tkpi_value\x18\x04 \x01(\x0b\x32\x14.monitoring.KpiValue\"a\n\x08KpiValue\x12\x10\n\x06intVal\x18\x01 \x01(\rH\x00\x12\x12\n\x08\x66loatVal\x18\x02 \x01(\x02H\x00\x12\x13\n\tstringVal\x18\x03 \x01(\tH\x00\x12\x11\n\x07\x62oolVal\x18\x04 \x01(\x08H\x00\x42\x07\n\x05value\",\n\x07KpiList\x12!\n\x08kpi_list\x18\x01 \x03(\x0b\x32\x0f.monitoring.Kpi2\xf3\x02\n\x11MonitoringService\x12;\n\tCreateKpi\x12\x19.monitoring.KpiDescriptor\x1a\x11.monitoring.KpiId\"\x00\x12\x42\n\x10GetKpiDescriptor\x12\x11.monitoring.KpiId\x1a\x19.monitoring.KpiDescriptor\"\x00\x12/\n\nIncludeKpi\x12\x0f.monitoring.Kpi\x1a\x0e.context.Empty\"\x00\x12=\n\nMonitorKpi\x12\x1d.monitoring.MonitorKpiRequest\x1a\x0e.context.Empty\"\x00\x12\x36\n\x0cGetStreamKpi\x12\x11.monitoring.KpiId\x1a\x0f.monitoring.Kpi\"\x00\x30\x01\x12\x35\n\rGetInstantKpi\x12\x11.monitoring.KpiId\x1a\x0f.monitoring.Kpi\"\x00\x62\x06proto3' + , + dependencies=[context__pb2.DESCRIPTOR,kpi__sample__types__pb2.DESCRIPTOR,]) + + + + +_KPIDESCRIPTOR = _descriptor.Descriptor( + name='KpiDescriptor', + full_name='monitoring.KpiDescriptor', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='kpi_description', full_name='monitoring.KpiDescriptor.kpi_description', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='kpi_sample_type', full_name='monitoring.KpiDescriptor.kpi_sample_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='device_id', full_name='monitoring.KpiDescriptor.device_id', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='endpoint_id', full_name='monitoring.KpiDescriptor.endpoint_id', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='service_id', full_name='monitoring.KpiDescriptor.service_id', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=72, + serialized_end=290, +) + + +_MONITORKPIREQUEST = _descriptor.Descriptor( + name='MonitorKpiRequest', + full_name='monitoring.MonitorKpiRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='kpi_id', full_name='monitoring.MonitorKpiRequest.kpi_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sampling_duration_s', full_name='monitoring.MonitorKpiRequest.sampling_duration_s', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sampling_interval_s', full_name='monitoring.MonitorKpiRequest.sampling_interval_s', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=292, + serialized_end=404, +) + + +_KPIID = _descriptor.Descriptor( + name='KpiId', + full_name='monitoring.KpiId', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='kpi_id', full_name='monitoring.KpiId.kpi_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=406, + serialized_end=444, +) + + +_KPI = _descriptor.Descriptor( + name='Kpi', + full_name='monitoring.Kpi', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='kpi_id', full_name='monitoring.Kpi.kpi_id', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='timestamp', full_name='monitoring.Kpi.timestamp', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='kpi_value', full_name='monitoring.Kpi.kpi_value', index=2, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=446, + serialized_end=546, +) + + +_KPIVALUE = _descriptor.Descriptor( + name='KpiValue', + full_name='monitoring.KpiValue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='intVal', full_name='monitoring.KpiValue.intVal', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='floatVal', full_name='monitoring.KpiValue.floatVal', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='stringVal', full_name='monitoring.KpiValue.stringVal', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='boolVal', full_name='monitoring.KpiValue.boolVal', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='value', full_name='monitoring.KpiValue.value', + index=0, containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[]), + ], + serialized_start=548, + serialized_end=645, +) + + +_KPILIST = _descriptor.Descriptor( + name='KpiList', + full_name='monitoring.KpiList', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='kpi_list', full_name='monitoring.KpiList.kpi_list', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=647, + serialized_end=691, +) + +_KPIDESCRIPTOR.fields_by_name['kpi_sample_type'].enum_type = kpi__sample__types__pb2._KPISAMPLETYPE +_KPIDESCRIPTOR.fields_by_name['device_id'].message_type = context__pb2._DEVICEID +_KPIDESCRIPTOR.fields_by_name['endpoint_id'].message_type = context__pb2._ENDPOINTID +_KPIDESCRIPTOR.fields_by_name['service_id'].message_type = context__pb2._SERVICEID +_MONITORKPIREQUEST.fields_by_name['kpi_id'].message_type = _KPIID +_KPIID.fields_by_name['kpi_id'].message_type = context__pb2._UUID +_KPI.fields_by_name['kpi_id'].message_type = _KPIID +_KPI.fields_by_name['kpi_value'].message_type = _KPIVALUE +_KPIVALUE.oneofs_by_name['value'].fields.append( + _KPIVALUE.fields_by_name['intVal']) +_KPIVALUE.fields_by_name['intVal'].containing_oneof = _KPIVALUE.oneofs_by_name['value'] +_KPIVALUE.oneofs_by_name['value'].fields.append( + _KPIVALUE.fields_by_name['floatVal']) +_KPIVALUE.fields_by_name['floatVal'].containing_oneof = _KPIVALUE.oneofs_by_name['value'] +_KPIVALUE.oneofs_by_name['value'].fields.append( + _KPIVALUE.fields_by_name['stringVal']) +_KPIVALUE.fields_by_name['stringVal'].containing_oneof = _KPIVALUE.oneofs_by_name['value'] +_KPIVALUE.oneofs_by_name['value'].fields.append( + _KPIVALUE.fields_by_name['boolVal']) +_KPIVALUE.fields_by_name['boolVal'].containing_oneof = _KPIVALUE.oneofs_by_name['value'] +_KPILIST.fields_by_name['kpi_list'].message_type = _KPI +DESCRIPTOR.message_types_by_name['KpiDescriptor'] = _KPIDESCRIPTOR +DESCRIPTOR.message_types_by_name['MonitorKpiRequest'] = _MONITORKPIREQUEST +DESCRIPTOR.message_types_by_name['KpiId'] = _KPIID +DESCRIPTOR.message_types_by_name['Kpi'] = _KPI +DESCRIPTOR.message_types_by_name['KpiValue'] = _KPIVALUE +DESCRIPTOR.message_types_by_name['KpiList'] = _KPILIST +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +KpiDescriptor = _reflection.GeneratedProtocolMessageType('KpiDescriptor', (_message.Message,), { + 'DESCRIPTOR' : _KPIDESCRIPTOR, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.KpiDescriptor) + }) +_sym_db.RegisterMessage(KpiDescriptor) + +MonitorKpiRequest = _reflection.GeneratedProtocolMessageType('MonitorKpiRequest', (_message.Message,), { + 'DESCRIPTOR' : _MONITORKPIREQUEST, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.MonitorKpiRequest) + }) +_sym_db.RegisterMessage(MonitorKpiRequest) + +KpiId = _reflection.GeneratedProtocolMessageType('KpiId', (_message.Message,), { + 'DESCRIPTOR' : _KPIID, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.KpiId) + }) +_sym_db.RegisterMessage(KpiId) + +Kpi = _reflection.GeneratedProtocolMessageType('Kpi', (_message.Message,), { + 'DESCRIPTOR' : _KPI, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.Kpi) + }) +_sym_db.RegisterMessage(Kpi) + +KpiValue = _reflection.GeneratedProtocolMessageType('KpiValue', (_message.Message,), { + 'DESCRIPTOR' : _KPIVALUE, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.KpiValue) + }) +_sym_db.RegisterMessage(KpiValue) + +KpiList = _reflection.GeneratedProtocolMessageType('KpiList', (_message.Message,), { + 'DESCRIPTOR' : _KPILIST, + '__module__' : 'monitoring_pb2' + # @@protoc_insertion_point(class_scope:monitoring.KpiList) + }) +_sym_db.RegisterMessage(KpiList) + + + +_MONITORINGSERVICE = _descriptor.ServiceDescriptor( + name='MonitoringService', + full_name='monitoring.MonitoringService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=694, + serialized_end=1065, + methods=[ + _descriptor.MethodDescriptor( + name='CreateKpi', + full_name='monitoring.MonitoringService.CreateKpi', + index=0, + containing_service=None, + input_type=_KPIDESCRIPTOR, + output_type=_KPIID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetKpiDescriptor', + full_name='monitoring.MonitoringService.GetKpiDescriptor', + index=1, + containing_service=None, + input_type=_KPIID, + output_type=_KPIDESCRIPTOR, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='IncludeKpi', + full_name='monitoring.MonitoringService.IncludeKpi', + index=2, + containing_service=None, + input_type=_KPI, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='MonitorKpi', + full_name='monitoring.MonitoringService.MonitorKpi', + index=3, + containing_service=None, + input_type=_MONITORKPIREQUEST, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetStreamKpi', + full_name='monitoring.MonitoringService.GetStreamKpi', + index=4, + containing_service=None, + input_type=_KPIID, + output_type=_KPI, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetInstantKpi', + full_name='monitoring.MonitoringService.GetInstantKpi', + index=5, + containing_service=None, + input_type=_KPIID, + output_type=_KPI, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_MONITORINGSERVICE) + +DESCRIPTOR.services_by_name['MonitoringService'] = _MONITORINGSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2.py b/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..b97a93fef290a5d27c2369d3b69d1405ea8a6442 --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: optical_centralized_attack_detector.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import context_pb2 as context__pb2 +from . import monitoring_pb2 as monitoring__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='optical_centralized_attack_detector.proto', + package='centralized_attack_detector', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n)optical_centralized_attack_detector.proto\x12\x1b\x63\x65ntralized_attack_detector\x1a\rcontext.proto\x1a\x10monitoring.proto2\x88\x02\n\'OpticalCentralizedAttackDetectorService\x12\x39\n\x13NotifyServiceUpdate\x12\x10.context.Service\x1a\x0e.context.Empty\"\x00\x12\x30\n\x0c\x44\x65tectAttack\x12\x0e.context.Empty\x1a\x0e.context.Empty\"\x00\x12<\n\x13ReportSummarizedKpi\x12\x13.monitoring.KpiList\x1a\x0e.context.Empty\"\x00\x12\x32\n\tReportKpi\x12\x13.monitoring.KpiList\x1a\x0e.context.Empty\"\x00\x62\x06proto3' + , + dependencies=[context__pb2.DESCRIPTOR,monitoring__pb2.DESCRIPTOR,]) + + + +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + +_OPTICALCENTRALIZEDATTACKDETECTORSERVICE = _descriptor.ServiceDescriptor( + name='OpticalCentralizedAttackDetectorService', + full_name='centralized_attack_detector.OpticalCentralizedAttackDetectorService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=108, + serialized_end=372, + methods=[ + _descriptor.MethodDescriptor( + name='NotifyServiceUpdate', + full_name='centralized_attack_detector.OpticalCentralizedAttackDetectorService.NotifyServiceUpdate', + index=0, + containing_service=None, + input_type=context__pb2._SERVICE, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DetectAttack', + full_name='centralized_attack_detector.OpticalCentralizedAttackDetectorService.DetectAttack', + index=1, + containing_service=None, + input_type=context__pb2._EMPTY, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ReportSummarizedKpi', + full_name='centralized_attack_detector.OpticalCentralizedAttackDetectorService.ReportSummarizedKpi', + index=2, + containing_service=None, + input_type=monitoring__pb2._KPILIST, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='ReportKpi', + full_name='centralized_attack_detector.OpticalCentralizedAttackDetectorService.ReportKpi', + index=3, + containing_service=None, + input_type=monitoring__pb2._KPILIST, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_OPTICALCENTRALIZEDATTACKDETECTORSERVICE) + +DESCRIPTOR.services_by_name['OpticalCentralizedAttackDetectorService'] = _OPTICALCENTRALIZEDATTACKDETECTORSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2_grpc.py b/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2_grpc.py new file mode 100644 index 0000000000000000000000000000000000000000..17b839fa3bbaafb8ecfa795db21ba6baba8cd28b --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2_grpc.py @@ -0,0 +1,168 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import context_pb2 as context__pb2 +from . import monitoring_pb2 as monitoring__pb2 + + +class OpticalCentralizedAttackDetectorServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.NotifyServiceUpdate = channel.unary_unary( + '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/NotifyServiceUpdate', + request_serializer=context__pb2.Service.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.DetectAttack = channel.unary_unary( + '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/DetectAttack', + request_serializer=context__pb2.Empty.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.ReportSummarizedKpi = channel.unary_unary( + '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/ReportSummarizedKpi', + request_serializer=monitoring__pb2.KpiList.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + self.ReportKpi = channel.unary_unary( + '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/ReportKpi', + request_serializer=monitoring__pb2.KpiList.SerializeToString, + response_deserializer=context__pb2.Empty.FromString, + ) + + +class OpticalCentralizedAttackDetectorServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def NotifyServiceUpdate(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def DetectAttack(self, request, context): + """rpc that triggers the attack detection loop + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ReportSummarizedKpi(self, request, context): + """rpc called by the distributed component to report KPIs + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ReportKpi(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_OpticalCentralizedAttackDetectorServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'NotifyServiceUpdate': grpc.unary_unary_rpc_method_handler( + servicer.NotifyServiceUpdate, + request_deserializer=context__pb2.Service.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'DetectAttack': grpc.unary_unary_rpc_method_handler( + servicer.DetectAttack, + request_deserializer=context__pb2.Empty.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'ReportSummarizedKpi': grpc.unary_unary_rpc_method_handler( + servicer.ReportSummarizedKpi, + request_deserializer=monitoring__pb2.KpiList.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + 'ReportKpi': grpc.unary_unary_rpc_method_handler( + servicer.ReportKpi, + request_deserializer=monitoring__pb2.KpiList.FromString, + response_serializer=context__pb2.Empty.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'centralized_attack_detector.OpticalCentralizedAttackDetectorService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class OpticalCentralizedAttackDetectorService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def NotifyServiceUpdate(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/NotifyServiceUpdate', + context__pb2.Service.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def DetectAttack(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/DetectAttack', + context__pb2.Empty.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ReportSummarizedKpi(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/ReportSummarizedKpi', + monitoring__pb2.KpiList.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def ReportKpi(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/centralized_attack_detector.OpticalCentralizedAttackDetectorService/ReportKpi', + monitoring__pb2.KpiList.SerializeToString, + context__pb2.Empty.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/src/opticalcentralizedattackdetector/proto/service_pb2.py b/src/opticalcentralizedattackdetector/proto/service_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..7a006915b8be39710a17faab075e382e322d918f --- /dev/null +++ b/src/opticalcentralizedattackdetector/proto/service_pb2.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: service.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import context_pb2 as context__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='service.proto', + package='service', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\rservice.proto\x12\x07service\x1a\rcontext.proto2\xfd\x01\n\x0eServiceService\x12\x37\n\rCreateService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x37\n\rUpdateService\x12\x10.context.Service\x1a\x12.context.ServiceId\"\x00\x12\x35\n\rDeleteService\x12\x12.context.ServiceId\x1a\x0e.context.Empty\"\x00\x12\x42\n\x11GetConnectionList\x12\x12.context.ServiceId\x1a\x17.context.ConnectionList\"\x00\x62\x06proto3' + , + dependencies=[context__pb2.DESCRIPTOR,]) + + + +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + +_SERVICESERVICE = _descriptor.ServiceDescriptor( + name='ServiceService', + full_name='service.ServiceService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=42, + serialized_end=295, + methods=[ + _descriptor.MethodDescriptor( + name='CreateService', + full_name='service.ServiceService.CreateService', + index=0, + containing_service=None, + input_type=context__pb2._SERVICE, + output_type=context__pb2._SERVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='UpdateService', + full_name='service.ServiceService.UpdateService', + index=1, + containing_service=None, + input_type=context__pb2._SERVICE, + output_type=context__pb2._SERVICEID, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DeleteService', + full_name='service.ServiceService.DeleteService', + index=2, + containing_service=None, + input_type=context__pb2._SERVICEID, + output_type=context__pb2._EMPTY, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetConnectionList', + full_name='service.ServiceService.GetConnectionList', + index=3, + containing_service=None, + input_type=context__pb2._SERVICEID, + output_type=context__pb2._CONNECTIONLIST, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_SERVICESERVICE) + +DESCRIPTOR.services_by_name['ServiceService'] = _SERVICESERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/requirements.in b/src/opticalcentralizedattackdetector/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..00acd77fe30ca10ffe3af04f7cf7ced2cb9256f8 --- /dev/null +++ b/src/opticalcentralizedattackdetector/requirements.in @@ -0,0 +1,9 @@ +grpcio-health-checking +grpcio +prometheus-client +pytest +pytest-benchmark +redis +# from the monitoring component +influxdb +python-json-logger diff --git a/src/opticalcentralizedattackdetector/requirements.txt b/src/opticalcentralizedattackdetector/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fca44cbb133ae3c6d5ba2a6d12882ecad9a2c467 --- /dev/null +++ b/src/opticalcentralizedattackdetector/requirements.txt @@ -0,0 +1,60 @@ +# +# This file is autogenerated by pip-compile with python 3.9 +# To update, run: +# +# pip-compile --output-file=opticalcentralizedattackdetector/requirements.txt opticalcentralizedattackdetector/requirements.in +# +attrs==21.2.0 + # via pytest +certifi==2021.10.8 + # via influxdb-client +grpcio==1.41.0 + # via + # -r opticalcentralizedattackdetector/requirements.in + # grpcio-health-checking +grpcio-health-checking==1.41.0 + # via -r opticalcentralizedattackdetector/requirements.in +influxdb-client==1.23.0 + # via -r opticalcentralizedattackdetector/requirements.in +iniconfig==1.1.1 + # via pytest +packaging==21.0 + # via pytest +pluggy==1.0.0 + # via pytest +prometheus-client==0.11.0 + # via -r opticalcentralizedattackdetector/requirements.in +protobuf==3.18.0 + # via grpcio-health-checking +py==1.10.0 + # via pytest +py-cpuinfo==8.0.0 + # via pytest-benchmark +pyparsing==2.4.7 + # via packaging +pytest==6.2.5 + # via + # -r opticalcentralizedattackdetector/requirements.in + # pytest-benchmark +pytest-benchmark==3.4.1 + # via -r opticalcentralizedattackdetector/requirements.in +python-dateutil==2.8.2 + # via influxdb-client +pytz==2021.3 + # via influxdb-client +redis==3.5.3 + # via -r opticalcentralizedattackdetector/requirements.in +rx==3.2.0 + # via influxdb-client +six==1.16.0 + # via + # grpcio + # influxdb-client + # python-dateutil +toml==0.10.2 + # via pytest +urllib3==1.26.7 + # via influxdb-client + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorService.py b/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorService.py new file mode 100644 index 0000000000000000000000000000000000000000..a017292da6228bdf1ba67b48c1b1dcba5dff6ee8 --- /dev/null +++ b/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorService.py @@ -0,0 +1,58 @@ +import grpc +import logging +from concurrent import futures +from grpc_health.v1.health import HealthServicer, OVERALL_HEALTH +from grpc_health.v1.health_pb2 import HealthCheckResponse +from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server +from opticalcentralizedattackdetector.proto.optical_centralized_attack_detector_pb2_grpc import ( + add_OpticalCentralizedAttackDetectorServiceServicer_to_server) +from opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl import ( + OpticalCentralizedAttackDetectorServiceServicerImpl) +from opticalcentralizedattackdetector.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD + +BIND_ADDRESS = '0.0.0.0' +LOGGER = logging.getLogger(__name__) + +class OpticalCentralizedAttackDetectorService: + def __init__( + self, address=BIND_ADDRESS, port=GRPC_SERVICE_PORT, max_workers=GRPC_MAX_WORKERS, + grace_period=GRPC_GRACE_PERIOD): + + self.address = address + self.port = port + self.endpoint = None + self.max_workers = max_workers + self.grace_period = grace_period + self.centralized_attack_detector_servicer = None + self.health_servicer = None + self.pool = None + self.server = None + + def start(self): + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(self.port)) + LOGGER.debug('Starting Service (tentative endpoint: {:s}, max_workers: {:s})...'.format( + str(self.endpoint), str(self.max_workers))) + + self.pool = futures.ThreadPoolExecutor(max_workers=self.max_workers) + self.server = grpc.server(self.pool) # , interceptors=(tracer_interceptor,)) + + self.centralized_attack_detector_servicer = OpticalCentralizedAttackDetectorServiceServicerImpl() + add_OpticalCentralizedAttackDetectorServiceServicer_to_server(self.centralized_attack_detector_servicer, self.server) + + self.health_servicer = HealthServicer( + experimental_non_blocking=True, experimental_thread_pool=futures.ThreadPoolExecutor(max_workers=1)) + add_HealthServicer_to_server(self.health_servicer, self.server) + + port = self.server.add_insecure_port(self.endpoint) + self.endpoint = '{:s}:{:s}'.format(str(self.address), str(port)) + LOGGER.info('Listening on {:s}...'.format(self.endpoint)) + self.server.start() + self.health_servicer.set(OVERALL_HEALTH, HealthCheckResponse.SERVING) # pylint: disable=maybe-no-member + + LOGGER.debug('Service started') + + def stop(self): + LOGGER.debug('Stopping service (grace period {:s} seconds)...'.format(str(self.grace_period))) + self.health_servicer.enter_graceful_shutdown() + self.server.stop(self.grace_period) + LOGGER.debug('Service stopped') diff --git a/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py b/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py new file mode 100644 index 0000000000000000000000000000000000000000..48e72a72d2d68e4107957228fca04c9deb55ae4b --- /dev/null +++ b/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py @@ -0,0 +1,126 @@ +import os, grpc, logging, random +from influxdb import InfluxDBClient +from common.rpc_method_wrapper.Decorator import create_metrics, safe_and_metered_rpc_method +from context.client.ContextClient import ContextClient +from context.Config import GRPC_SERVICE_PORT as CONTEXT_GRPC_SERVICE_PORT +from monitoring.client.monitoring_client import MonitoringClient +from monitoring.Config import GRPC_SERVICE_PORT as MONITORING_GRPC_SERVICE_PORT +from service.client.ServiceClient import ServiceClient +from service.Config import GRPC_SERVICE_PORT as SERVICE_GRPC_SERVICE_PORT +from dbscanserving.proto.dbscanserving_pb2 import DetectionRequest, DetectionResponse, Sample +from dbscanserving.client.DbscanServingClient import DbscanServingClient +from dbscanserving.Config import GRPC_SERVICE_PORT as DBSCANSERVING_GRPC_SERVICE_PORT +from opticalattackmitigator.client.OpticalAttackMitigatorClient import OpticalAttackMitigatorClient +from opticalattackmitigator.proto.optical_attack_mitigator_pb2 import AttackDescription, AttackResponse +from opticalattackmitigator.Config import GRPC_SERVICE_PORT as ATTACK_MITIGATOR_GRPC_SERVICE_PORT +from opticalcentralizedattackdetector.proto.context_pb2 import (Empty, + Context, ContextId, ContextIdList, ContextList, + Service, ServiceId, ServiceIdList, ServiceList +) +from opticalcentralizedattackdetector.proto.monitoring_pb2 import KpiList +from opticalcentralizedattackdetector.proto.optical_centralized_attack_detector_pb2_grpc import ( + OpticalCentralizedAttackDetectorServiceServicer) +from opticalcentralizedattackdetector.Config import ( + CONTEXT_SERVICE_ADDRESS, SERVICE_SERVICE_ADDRESS, INFERENCE_SERVICE_ADDRESS, MONITORING_SERVICE_ADDRESS, + ATTACK_MITIGATOR_SERVICE_ADDRESS) + + +LOGGER = logging.getLogger(__name__) + +SERVICE_NAME = 'OpticalCentralizedAttackDetector' +METHOD_NAMES = ['NotifyServiceUpdate', 'DetectAttack', 'ReportSummarizedKpi', 'ReportKpi'] +METRICS = create_metrics(SERVICE_NAME, METHOD_NAMES) + +INFLUXDB_HOSTNAME = os.environ.get("INFLUXDB_HOSTNAME") +INFLUXDB_USER = os.environ.get("INFLUXDB_USER") +INFLUXDB_PASSWORD = os.environ.get("INFLUXDB_PASSWORD") +INFLUXDB_DATABASE = os.environ.get("INFLUXDB_DATABASE") +context_client: ContextClient = ContextClient(address=CONTEXT_SERVICE_ADDRESS, port=CONTEXT_GRPC_SERVICE_PORT) +influxdb_client: InfluxDBClient = InfluxDBClient(host=MONITORING_SERVICE_ADDRESS, port=8086, username=INFLUXDB_USER, password=INFLUXDB_PASSWORD, database=INFLUXDB_DATABASE) +monitoring_client: MonitoringClient = MonitoringClient(server=MONITORING_SERVICE_ADDRESS, port=MONITORING_GRPC_SERVICE_PORT) +dbscanserving_client: DbscanServingClient = DbscanServingClient(address=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) +service_client: ServiceClient = ServiceClient(SERVICE_SERVICE_ADDRESS, SERVICE_GRPC_SERVICE_PORT) +attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient(address=ATTACK_MITIGATOR_SERVICE_ADDRESS, port=ATTACK_MITIGATOR_GRPC_SERVICE_PORT) + + +class OpticalCentralizedAttackDetectorServiceServicerImpl(OpticalCentralizedAttackDetectorServiceServicer): + + def __init__(self): + LOGGER.debug('Creating Servicer...') + LOGGER.debug('Servicer Created') + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def NotifyServiceUpdate(self, request : Service, context : grpc.ServicerContext) -> Empty: + return Empty() + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def DetectAttack(self, request : Empty, context : grpc.ServicerContext) -> Empty: + + # retrieve list with current contexts + # import pdb; pdb.set_trace() + context_ids: ContextIdList = context_client.ListContextIds(Empty()) + + # for each context, retrieve list of current services + services = [] + for context_id in context_ids.context_ids: + + context_services: ServiceIdList = context_client.ListServices(context_id) + for service in context_services.services: + services.append(service) + + # get monitoring data for each of the current services + results = influxdb_client.query('select * from samples;') + + for service in services: + for endpoint in service.service_endpoint_ids: + # get instant KPI for this endpoint + LOGGER.warning(f'service: {service.service_id.service_uuid.uuid}\t endpoint: {endpoint.endpoint_uuid.uuid}\tdevice: {endpoint.device_id.device_uuid.uuid}') + # how to get all KPIs for a particular device? + points = results.get_points(tags={'device_id': endpoint.device_id.device_uuid.uuid}) + print('points:', points) + for point in points: + print('\t', point) + + # run attack detection for every service + request: DetectionRequest = DetectionRequest() + + request.num_samples = 310 + request.num_features = 100 + request.eps = 100.5 + request.min_samples = 50 + + for _ in range(200): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(0., 10.)) + request.samples.append(grpc_sample) + + for _ in range(100): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(50., 60.)) + request.samples.append(grpc_sample) + + for _ in range(10): + grpc_sample = Sample() + for __ in range(100): + grpc_sample.features.append(random.uniform(5000., 6000.)) + request.samples.append(grpc_sample) + + response: DetectionResponse = dbscanserving_client.Detect(request) + + if -1 in response.cluster_indices: # attack detected + attack = AttackDescription() + attack.cs_id.uuid = service.service_id.service_uuid.uuid + response: AttackResponse = attack_mitigator_client.NotifyAttack(attack) + + # if attack is detected, run the attack mitigator + return Empty() + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def ReportSummarizedKpi(self, request : KpiList, context : grpc.ServicerContext) -> Empty: + return Empty() + + @safe_and_metered_rpc_method(METRICS, LOGGER) + def ReportKpi(self, request : KpiList, context : grpc.ServicerContext) -> Empty: + return Empty() diff --git a/src/opticalcentralizedattackdetector/service/__init__.py b/src/opticalcentralizedattackdetector/service/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalcentralizedattackdetector/service/__main__.py b/src/opticalcentralizedattackdetector/service/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..37cff6b7dec1554b69d93148307e074240f2dca2 --- /dev/null +++ b/src/opticalcentralizedattackdetector/service/__main__.py @@ -0,0 +1,80 @@ +import os, logging, signal, sys, time, threading, multiprocessing +from prometheus_client import start_http_server + +from common.Settings import get_setting +from opticalcentralizedattackdetector.Config import ( + GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, METRICS_PORT, + MONITORING_INTERVAL) +from opticalcentralizedattackdetector.proto.context_pb2 import (Empty, + Context, ContextId, ContextIdList, ContextList, + Service, ServiceId, ServiceIdList, ServiceList +) +from opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorService import OpticalCentralizedAttackDetectorService +from opticalcentralizedattackdetector.client.OpticalCentralizedAttackDetectorClient import OpticalCentralizedAttackDetectorClient + +terminate = threading.Event() +LOGGER = None + +client: OpticalCentralizedAttackDetectorClient = None + +def signal_handler(signal, frame): # pylint: disable=redefined-outer-name + LOGGER.warning('Terminate signal received') + terminate.set() + +def detect_attack(monitoring_interval): + time.sleep(10) # wait for the service to start + LOGGER.info("Starting the attack detection loop") + client = OpticalCentralizedAttackDetectorClient(address='localhost', port=GRPC_SERVICE_PORT) + client.connect() + while True: # infinite loop that runs until the terminate is set + if terminate.is_set(): # if terminate is set + LOGGER.warning("Stopping execution...") + client.close() + break # break the while and stop execution + client.DetectAttack(Empty()) + # sleep + LOGGER.debug("Sleeping for {} seconds...".format(monitoring_interval)) + time.sleep(monitoring_interval) + +def main(): + global LOGGER # pylint: disable=global-statement + + service_port = get_setting('OPTICALCENTRALIZEDATTACKDETECTORSERVICE_SERVICE_PORT_GRPC', default=GRPC_SERVICE_PORT) + max_workers = get_setting('MAX_WORKERS', default=GRPC_MAX_WORKERS ) + grace_period = get_setting('GRACE_PERIOD', default=GRPC_GRACE_PERIOD) + log_level = get_setting('LOG_LEVEL', default=LOG_LEVEL ) + metrics_port = get_setting('METRICS_PORT', default=METRICS_PORT ) + monitoring_interval = get_setting('MONITORING_INTERVAL', default=MONITORING_INTERVAL ) + + logging.basicConfig(level=log_level) + LOGGER = logging.getLogger(__name__) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + LOGGER.info('Starting...') + + # Start metrics server + start_http_server(metrics_port) + + # Starting CentralizedCybersecurity service + grpc_service = OpticalCentralizedAttackDetectorService( + port=service_port, max_workers=max_workers, grace_period=grace_period) + grpc_service.start() + + # p = multiprocessing.Process(target=detect_attack, args=(monitoring_interval, )) + # p.start() + detect_attack(monitoring_interval) + + # Wait for Ctrl+C or termination signal + while not terminate.wait(timeout=0.1): pass + + LOGGER.info('Terminating...') + grpc_service.stop() + # p.kill() + + LOGGER.info('Bye') + return 0 + +if __name__ == '__main__': + sys.exit(main()) diff --git a/src/opticalcentralizedattackdetector/tests/__init__.py b/src/opticalcentralizedattackdetector/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/opticalcentralizedattackdetector/tests/example_objects.py b/src/opticalcentralizedattackdetector/tests/example_objects.py new file mode 100644 index 0000000000000000000000000000000000000000..206d17cb70869a66cf1739f54a83598b1e031edb --- /dev/null +++ b/src/opticalcentralizedattackdetector/tests/example_objects.py @@ -0,0 +1,201 @@ +from copy import deepcopy +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID +from context.proto.context_pb2 import ( + ConfigActionEnum, DeviceDriverEnum, DeviceOperationalStatusEnum, ServiceStatusEnum, ServiceTypeEnum) + +# Some example objects to be used by the tests + +# Helper methods +def config_rule(action, resource_key, resource_value): + return {'action': action, 'resource_key': resource_key, 'resource_value': resource_value} + +def endpoint_id(topology_id, device_id, endpoint_uuid): + return {'topology_id': deepcopy(topology_id), 'device_id': deepcopy(device_id), + 'endpoint_uuid': {'uuid': endpoint_uuid}} + +def endpoint(topology_id, device_id, endpoint_uuid, endpoint_type): + return {'endpoint_id': endpoint_id(topology_id, device_id, endpoint_uuid), 'endpoint_type': endpoint_type} + +## use "deepcopy" to prevent propagating forced changes during tests +CONTEXT_ID = {'context_uuid': {'uuid': DEFAULT_CONTEXT_UUID}} +CONTEXT = { + 'context_id': deepcopy(CONTEXT_ID), + 'topology_ids': [], + 'service_ids': [], +} + +CONTEXT_ID_2 = {'context_uuid': {'uuid': 'test'}} +CONTEXT_2 = { + 'context_id': deepcopy(CONTEXT_ID_2), + 'topology_ids': [], + 'service_ids': [], +} + +TOPOLOGY_ID = { + 'context_id': deepcopy(CONTEXT_ID), + 'topology_uuid': {'uuid': DEFAULT_TOPOLOGY_UUID}, +} +TOPOLOGY = { + 'topology_id': deepcopy(TOPOLOGY_ID), + 'device_ids': [], + 'link_ids': [], +} + +DEVICE1_UUID = 'DEV1' +DEVICE1_ID = {'device_uuid': {'uuid': DEVICE1_UUID}} +DEVICE1 = { + 'device_id': deepcopy(DEVICE1_ID), + 'device_type': 'packet-router', + 'device_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value1'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value2'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value3'), + ]}, + 'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED, + 'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4], + 'device_endpoints': [ + endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP2', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP3', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE1_ID, 'EP100', 'port-packet-10G'), + ], +} + +DEVICE2_UUID = 'DEV2' +DEVICE2_ID = {'device_uuid': {'uuid': DEVICE2_UUID}} +DEVICE2 = { + 'device_id': deepcopy(DEVICE2_ID), + 'device_type': 'packet-router', + 'device_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value4'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value5'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value6'), + ]}, + 'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED, + 'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4], + 'device_endpoints': [ + endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP1', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP3', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE2_ID, 'EP100', 'port-packet-10G'), + ], +} + +DEVICE3_UUID = 'DEV3' +DEVICE3_ID = {'device_uuid': {'uuid': DEVICE3_UUID}} +DEVICE3 = { + 'device_id': deepcopy(DEVICE3_ID), + 'device_type': 'packet-router', + 'device_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc1/value', 'value4'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc2/value', 'value5'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'dev/rsrc3/value', 'value6'), + ]}, + 'device_operational_status': DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_ENABLED, + 'device_drivers': [DeviceDriverEnum.DEVICEDRIVER_OPENCONFIG, DeviceDriverEnum.DEVICEDRIVER_P4], + 'device_endpoints': [ + endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP1', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP2', 'port-packet-100G'), + endpoint(TOPOLOGY_ID, DEVICE3_ID, 'EP100', 'port-packet-10G'), + ], +} + +LINK_DEV1_DEV2_UUID = 'DEV1/EP2 ==> DEV2/EP1' +LINK_DEV1_DEV2_ID = {'link_uuid': {'uuid': LINK_DEV1_DEV2_UUID}} +LINK_DEV1_DEV2 = { + 'link_id': deepcopy(LINK_DEV1_DEV2_ID), + 'link_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP2'), + endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP1'), + ] +} + +LINK_DEV2_DEV3_UUID = 'DEV2/EP3 ==> DEV3/EP2' +LINK_DEV2_DEV3_ID = {'link_uuid': {'uuid': LINK_DEV2_DEV3_UUID}} +LINK_DEV2_DEV3 = { + 'link_id': deepcopy(LINK_DEV2_DEV3_ID), + 'link_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP3'), + endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP2'), + ] +} + +LINK_DEV1_DEV3_UUID = 'DEV1/EP3 ==> DEV3/EP1' +LINK_DEV1_DEV3_ID = {'link_uuid': {'uuid': LINK_DEV1_DEV3_UUID}} +LINK_DEV1_DEV3 = { + 'link_id': deepcopy(LINK_DEV1_DEV3_ID), + 'link_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP3'), + endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP1'), + ] +} + +SERVICE_DEV1_DEV2_UUID = 'SVC:DEV1/EP100-DEV2/EP100' +SERVICE_DEV1_DEV2_ID = { + 'context_id': deepcopy(CONTEXT_ID), + 'service_uuid': {'uuid': SERVICE_DEV1_DEV2_UUID}, +} +SERVICE_DEV1_DEV2 = { + 'service_id': deepcopy(SERVICE_DEV1_DEV2_ID), + 'service_type': ServiceTypeEnum.SERVICETYPE_L3NM, + 'service_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP100'), + endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP100'), + ], + 'service_constraints': [ + {'constraint_type': 'latency_ms', 'constraint_value': '15.2'}, + {'constraint_type': 'jitter_us', 'constraint_value': '1.2'}, + ], + 'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE}, + 'service_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'), + ]}, +} + +SERVICE_DEV1_DEV3_UUID = 'SVC:DEV1/EP100-DEV3/EP100' +SERVICE_DEV1_DEV3_ID = { + 'context_id': deepcopy(CONTEXT_ID), + 'service_uuid': {'uuid': SERVICE_DEV1_DEV3_UUID}, +} +SERVICE_DEV1_DEV3 = { + 'service_id': deepcopy(SERVICE_DEV1_DEV3_ID), + 'service_type': ServiceTypeEnum.SERVICETYPE_L3NM, + 'service_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE1_ID, 'EP100'), + endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP100'), + ], + 'service_constraints': [ + {'constraint_type': 'latency_ms', 'constraint_value': '5.8'}, + {'constraint_type': 'jitter_us', 'constraint_value': '0.1'}, + ], + 'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE}, + 'service_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'), + ]}, +} + +SERVICE_DEV2_DEV3_UUID = 'SVC:DEV2/EP100-DEV3/EP100' +SERVICE_DEV2_DEV3_ID = { + 'context_id': deepcopy(CONTEXT_ID), + 'service_uuid': {'uuid': SERVICE_DEV2_DEV3_UUID}, +} +SERVICE_DEV2_DEV3 = { + 'service_id': deepcopy(SERVICE_DEV2_DEV3_ID), + 'service_type': ServiceTypeEnum.SERVICETYPE_L3NM, + 'service_endpoint_ids' : [ + endpoint_id(TOPOLOGY_ID, DEVICE2_ID, 'EP100'), + endpoint_id(TOPOLOGY_ID, DEVICE3_ID, 'EP100'), + ], + 'service_constraints': [ + {'constraint_type': 'latency_ms', 'constraint_value': '23.1'}, + {'constraint_type': 'jitter_us', 'constraint_value': '3.4'}, + ], + 'service_status': {'service_status': ServiceStatusEnum.SERVICESTATUS_ACTIVE}, + 'service_config': {'config_rules': [ + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc1/value', 'value7'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc2/value', 'value8'), + config_rule(ConfigActionEnum.CONFIGACTION_SET, 'svc/rsrc3/value', 'value9'), + ]}, +} diff --git a/src/opticalcentralizedattackdetector/tests/test_unitary.py b/src/opticalcentralizedattackdetector/tests/test_unitary.py new file mode 100644 index 0000000000000000000000000000000000000000..a04afdf2379569ec4d723fa9c5c0895a0d9c47f8 --- /dev/null +++ b/src/opticalcentralizedattackdetector/tests/test_unitary.py @@ -0,0 +1,176 @@ +import logging, pytest +from unittest.mock import patch +from opticalcentralizedattackdetector.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD +from opticalcentralizedattackdetector.client.OpticalCentralizedAttackDetectorClient import OpticalCentralizedAttackDetectorClient +from opticalcentralizedattackdetector.proto.context_pb2 import ContextIdList, ContextId, Empty, Service, ContextId, ServiceList +from opticalcentralizedattackdetector.proto.monitoring_pb2 import Kpi, KpiList +from opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorService import OpticalCentralizedAttackDetectorService +from .example_objects import CONTEXT_ID, CONTEXT_ID_2, SERVICE_DEV1_DEV2 + +port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports + +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +@pytest.fixture(scope='session') +def optical_centralized_attack_detector_service(): + _service = OpticalCentralizedAttackDetectorService( + port=port, max_workers=GRPC_MAX_WORKERS, grace_period=GRPC_GRACE_PERIOD) + # mocker_context_client = mock.patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') + # mocker_context_client.start() + + # mocker_influx_db = mock.patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') + # mocker_influx_db.start() + + _service.start() + yield _service + _service.stop() + # mocker_context_client.stop() + # mocker_influx_db.stop() + +@pytest.fixture(scope='session') +def optical_centralized_attack_detector_client(optical_centralized_attack_detector_service): + _client = OpticalCentralizedAttackDetectorClient(address='127.0.0.1', port=port) + yield _client + _client.close() + +def test_notify_service_update(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient): + service = Service() + optical_centralized_attack_detector_client.NotifyServiceUpdate(service) + +def test_detect_attack_no_contexts(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb: + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + context.ListContextIds.assert_called_once() + influxdb.query.assert_called_once() + context.ListServices.assert_not_called() + +def test_detect_attack_with_context(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient,): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb: + # setting up the mock + cid_list = ContextIdList() + cid_list.context_ids.append(ContextId(**CONTEXT_ID)) + context.ListContextIds.return_value = cid_list + + # making the test + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + + # checking behavior + context.ListContextIds.assert_called_once() + context.ListServices.assert_called_with(cid_list.context_ids[0]) + influxdb.query.assert_called_once() + +def test_detect_attack_with_contexts(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient,): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb: + # setting up the mock + cid_list = ContextIdList() + cid_list.context_ids.append(ContextId(**CONTEXT_ID)) + cid_list.context_ids.append(ContextId(**CONTEXT_ID_2)) + context.ListContextIds.return_value = cid_list + + # making the test + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + + # checking behavior + context.ListContextIds.assert_called_once() + context.ListServices.assert_any_call(cid_list.context_ids[0]) + context.ListServices.assert_any_call(cid_list.context_ids[1]) + influxdb.query.assert_called_once() + +def test_detect_attack_with_service(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient,): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.dbscanserving_client') as dbscan: + + # setting up the mock + cid_list = ContextIdList() + cid_list.context_ids.append(ContextId(**CONTEXT_ID)) + context.ListContextIds.return_value = cid_list + + service_list = ServiceList() + service_list.services.append(Service(**SERVICE_DEV1_DEV2)) + context.ListServices.return_value = service_list + + influxdb.query.return_value.get_points.return_value = [(1, 2), (3, 4)] + + # making the test + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + + # checking behavior + context.ListContextIds.assert_called_once() + context.ListServices.assert_called_with(cid_list.context_ids[0]) + influxdb.query.assert_called_once() + dbscan.Detect.assert_called() + +def test_detect_attack_no_attack(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient,): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.dbscanserving_client') as dbscan, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.attack_mitigator_client') as mitigator: + + # setting up the mock + cid_list = ContextIdList() + cid_list.context_ids.append(ContextId(**CONTEXT_ID)) + context.ListContextIds.return_value = cid_list + + service_list = ServiceList() + service_list.services.append(Service(**SERVICE_DEV1_DEV2)) + context.ListServices.return_value = service_list + + # dbscan.Detect.return_value = object() + dbscan.Detect.return_value.cluster_indices = [0, 1, 2, 3, 4, 5] + + # making the test + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + + # checking behavior + context.ListContextIds.assert_called_once() + context.ListServices.assert_called_with(cid_list.context_ids[0]) + influxdb.query.assert_called_once() + dbscan.Detect.assert_called() + mitigator.NotifyAttack.assert_not_called() + +def test_detect_attack_with_attack(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient,): + with patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.context_client') as context, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.influxdb_client') as influxdb, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.dbscanserving_client') as dbscan, \ + patch('opticalcentralizedattackdetector.service.OpticalCentralizedAttackDetectorServiceServicerImpl.attack_mitigator_client') as mitigator: + + # setting up the mock + cid_list = ContextIdList() + cid_list.context_ids.append(ContextId(**CONTEXT_ID)) + context.ListContextIds.return_value = cid_list + + service_list = ServiceList() + service_list.services.append(Service(**SERVICE_DEV1_DEV2)) + context.ListServices.return_value = service_list + + # dbscan.Detect.return_value = object() + dbscan.Detect.return_value.cluster_indices = [0, 1, 2, 3, 4, -1] + + # making the test + request = Empty() + optical_centralized_attack_detector_client.DetectAttack(request) + + # checking behavior + context.ListContextIds.assert_called_once() + context.ListServices.assert_called_with(cid_list.context_ids[0]) + influxdb.query.assert_called_once() + dbscan.Detect.assert_called() + mitigator.NotifyAttack.assert_called() + +def test_report_summarized_kpi(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient): + kpi_list = KpiList() + optical_centralized_attack_detector_client.ReportSummarizedKpi(kpi_list) + +def test_report_kpi(optical_centralized_attack_detector_client: OpticalCentralizedAttackDetectorClient): + kpi_list = KpiList() + optical_centralized_attack_detector_client.ReportKpi(kpi_list)