diff --git a/manifests/opticalattackdetectorservice.yaml b/manifests/opticalattackdetectorservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bf7381a4e27f459c27e6cec9cad9b5e55df56578 --- /dev/null +++ b/manifests/opticalattackdetectorservice.yaml @@ -0,0 +1,96 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: opticalattackdetectorservice +spec: + selector: + matchLabels: + app: opticalattackdetectorservice + template: + metadata: + labels: + app: opticalattackdetectorservice + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: server + image: labs.etsi.org:5050/tfs/controller/opticalattackdetector:latest + imagePullPolicy: Always + ports: + - containerPort: 10006 + - containerPort: 9192 + env: + - name: LOG_LEVEL + value: "DEBUG" + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secrets + key: REDIS_PASSWORD + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10006"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10006"] + resources: + requests: + cpu: 250m + memory: 128Mi + limits: + cpu: 1000m + memory: 1024Mi +--- +apiVersion: v1 +kind: Service +metadata: + name: opticalattackdetectorservice + labels: + app: opticalattackdetectorservice +spec: + type: ClusterIP + selector: + app: opticalattackdetectorservice + ports: + - name: grpc + port: 10006 + targetPort: 10006 + - name: metrics + port: 9192 + targetPort: 9192 +--- +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: opticalattackdetectorservice-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: opticalattackdetectorservice + minReplicas: 1 + maxReplicas: 20 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 + #behavior: + # scaleDown: + # stabilizationWindowSeconds: 30 diff --git a/manifests/opticalcentralizedattackdetectorservice.yaml b/manifests/opticalcentralizedattackdetectorservice.yaml deleted file mode 100644 index 13d4d97c222699544dc051564ec1609cad7ed7e1..0000000000000000000000000000000000000000 --- a/manifests/opticalcentralizedattackdetectorservice.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -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: labs.etsi.org:5050/tfs/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 diff --git a/manifests/servicemonitors.yaml b/manifests/servicemonitors.yaml index 13af0c2a1b11e93e09bad257f3502002500630c6..e77216af2a723cef8a4c5f468ef564625ea810f1 100644 --- a/manifests/servicemonitors.yaml +++ b/manifests/servicemonitors.yaml @@ -409,6 +409,64 @@ spec: app: opticalattackmitigatorservice # same as above #release: prometheus # same as above endpoints: + - port: metrics # named port in target app + scheme: http + path: /metrics # path to scrape + interval: 5s # scrape interval + namespaceSelector: + any: false + matchNames: + - tfs # namespace where the app is running +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + namespace: monitoring # namespace where prometheus is running + name: tfs-opticalattackdetectorservice-metric + labels: + app: opticalattackdetectorservice + #release: prometheus + #release: prom # name of the release + # ( VERY IMPORTANT: You need to know the correct release name by viewing + # the servicemonitor of Prometheus itself: Without the correct name, + # Prometheus cannot identify the metrics of the Flask app as the target.) +spec: + selector: + matchLabels: + # Target app service + #namespace: tfs + app: opticalattackdetectorservice # same as above + #release: prometheus # same as above + endpoints: + - port: metrics # named port in target app + scheme: http + path: /metrics # path to scrape + interval: 5s # scrape interval + namespaceSelector: + any: false + matchNames: + - tfs # namespace where the app is running +--- +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + namespace: monitoring # namespace where prometheus is running + name: tfs-opticalattackmanagerservice-metric + labels: + app: opticalattackmanagerservice + #release: prometheus + #release: prom # name of the release + # ( VERY IMPORTANT: You need to know the correct release name by viewing + # the servicemonitor of Prometheus itself: Without the correct name, + # Prometheus cannot identify the metrics of the Flask app as the target.) +spec: + selector: + matchLabels: + # Target app service + #namespace: tfs + app: opticalattackmanagerservice # same as above + #release: prometheus # same as above + endpoints: - port: metrics # named port in target app scheme: http path: /metrics # path to scrape diff --git a/proto/centralized_attack_detector.proto b/proto/optical_attack_detector.proto similarity index 62% rename from proto/centralized_attack_detector.proto rename to proto/optical_attack_detector.proto index 7b4fc35f07b079955d4c347ecf3f728abd0292f5..ebe3b5e06163c6e5a3bf7889065d5bb31923dd89 100644 --- a/proto/centralized_attack_detector.proto +++ b/proto/optical_attack_detector.proto @@ -14,19 +14,19 @@ // protocol buffers documentation: https://developers.google.com/protocol-buffers/docs/proto3 syntax = "proto3"; -package centralized_attack_detector; +package optical_attack_detector; import "context.proto"; import "monitoring.proto"; -service CentralizedAttackDetectorService { - rpc NotifyServiceUpdate (context.Service ) returns (context.Empty) {} +service OpticalAttackDetectorService { - // rpc that triggers the attack detection loop - rpc DetectAttack (context.Empty ) returns (context.Empty) {} + // rpc that executes the detection loop for a particular service + rpc DetectAttack (DetectionRequest) 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) {} +message DetectionRequest { + context.ServiceId service_id = 1; + monitoring.KpiId kpi_id = 2; } diff --git a/proto/optical_centralized_attack_detector.proto b/proto/optical_centralized_attack_detector.proto deleted file mode 100644 index 98ffeddc81c7533fccfd118075732a3f7799264f..0000000000000000000000000000000000000000 --- a/proto/optical_centralized_attack_detector.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// 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/src/common/Constants.py b/src/common/Constants.py index a7bf198a7204677ed3669fc28a2c3528a5936425..480e2a2313c22074a0a9c1297b2d794f36cdbc9d 100644 --- a/src/common/Constants.py +++ b/src/common/Constants.py @@ -36,19 +36,24 @@ INTERDOMAIN_TOPOLOGY_NAME = 'inter' # contains the abstract inter-domain top # Default service names class ServiceNameEnum(Enum): - CONTEXT = 'context' - DEVICE = 'device' - SERVICE = 'service' - SLICE = 'slice' - AUTOMATION = 'automation' - POLICY = 'policy' - MONITORING = 'monitoring' - DLT = 'dlt' - COMPUTE = 'compute' - CYBERSECURITY = 'cybersecurity' - INTERDOMAIN = 'interdomain' - PATHCOMP = 'pathcomp' - WEBUI = 'webui' + CONTEXT = 'context' + DEVICE = 'device' + SERVICE = 'service' + SLICE = 'slice' + AUTOMATION = 'automation' + POLICY = 'policy' + MONITORING = 'monitoring' + DLT = 'dlt' + COMPUTE = 'compute' + CYBERSECURITY = 'cybersecurity' + INTERDOMAIN = 'interdomain' + PATHCOMP = 'pathcomp' + WEBUI = 'webui' + DBSCANSERVING = 'dbscanserving' + OPTICALATTACKMANAGER = 'opticalattackmanager' + OPTICALATTACKDETECTOR = 'opticalattackdetector' + OPTICALATTACKMITIGATOR = 'opticalattackmitigator' + CACHING = 'caching' # Used for test and debugging only DLT_GATEWAY = 'dltgateway' diff --git a/src/opticalcentralizedattackdetector/.gitlab-ci.yml b/src/opticalattackdetector/.gitlab-ci.yml similarity index 77% rename from src/opticalcentralizedattackdetector/.gitlab-ci.yml rename to src/opticalattackdetector/.gitlab-ci.yml index 3db4de3f177cfb1478bc306067564e9a293e0737..4d3fd8f29f94986cc809b874fd705ea9e3763668 100644 --- a/src/opticalcentralizedattackdetector/.gitlab-ci.yml +++ b/src/opticalattackdetector/.gitlab-ci.yml @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,15 +13,15 @@ # limitations under the License. # build, tag and push the Docker image to the gitlab registry -build opticalcentralizedattackdetector: +build opticalattackdetector: variables: - IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_NAME: 'opticalattackdetector' # 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 build -t "$IMAGE_NAME:$IMAGE_TAG" -f ./src/$IMAGE_NAME/Dockerfile . - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG" after_script: @@ -37,25 +37,25 @@ build opticalcentralizedattackdetector: - manifests/${IMAGE_NAME}service.yaml - .gitlab-ci.yml -# apply unit test to the opticalcentralizedattackdetector component -unit test opticalcentralizedattackdetector: +# apply unit test to the opticalattackdetector component +unit test opticalattackdetector: variables: - IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_NAME: 'opticalattackdetector' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: unit_test needs: - - build opticalcentralizedattackdetector + - build opticalattackdetector 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 -v "$PWD/src/$IMAGE_NAME/tests:/opt/results" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG + - docker run --name $IMAGE_NAME -d -p 10006:10006 --env-file "$PWD/src/$IMAGE_NAME/.env" -v "$PWD/src/$IMAGE_NAME/tests:/home/${IMAGE_NAME}/results" --network=teraflowbridge --rm $CI_REGISTRY_IMAGE/$IMAGE_NAME:$IMAGE_TAG - sleep 5 - docker ps -a - - docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=INFO --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/opt/results/${IMAGE_NAME}_report.xml" - - docker exec -i $IMAGE_NAME bash -c "coverage report --include='${IMAGE_NAME}/*' --show-missing" + - docker logs $IMAGE_NAME + - docker exec -i $IMAGE_NAME bash -c "coverage run -m pytest --log-level=DEBUG --verbose $IMAGE_NAME/tests/test_unitary.py --junitxml=/home/${IMAGE_NAME}/results/${IMAGE_NAME}_report.xml; coverage xml -o /home/${IMAGE_NAME}/results/${IMAGE_NAME}_coverage.xml; coverage report --include='${IMAGE_NAME}/*' --show-missing" coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/' after_script: - docker rm -f $IMAGE_NAME @@ -76,14 +76,14 @@ unit test opticalcentralizedattackdetector: junit: src/$IMAGE_NAME/tests/${IMAGE_NAME}_report.xml -# Deployment of the opticalcentralizedattackdetector service in Kubernetes Cluster -deploy opticalcentralizedattackdetector: +# Deployment of the opticalattackdetector service in Kubernetes Cluster +deploy opticalattackdetector: variables: - IMAGE_NAME: 'opticalcentralizedattackdetector' # name of the microservice + IMAGE_NAME: 'opticalattackdetector' # name of the microservice IMAGE_TAG: 'latest' # tag of the container image (production, development, etc) stage: deploy needs: - - unit test opticalcentralizedattackdetector + - unit test opticalattackdetector # - integ_test execute script: - 'sed -i "s/$IMAGE_NAME:.*/$IMAGE_NAME:$IMAGE_TAG/" manifests/${IMAGE_NAME}service.yaml' diff --git a/src/opticalcentralizedattackdetector/requirements.in b/src/opticalattackdetector/Config.py similarity index 64% rename from src/opticalcentralizedattackdetector/requirements.in rename to src/opticalattackdetector/Config.py index 378e9a10a70f6a41a264c6a76f47239d7515989a..1c356766d30f30b47ca99573a7171b824850ae03 100644 --- a/src/opticalcentralizedattackdetector/requirements.in +++ b/src/opticalattackdetector/Config.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,13 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -grpcio-health-checking -grpcio -prometheus-client -pytest -pytest-benchmark -redis -# from the monitoring component -influxdb -python-json-logger -coverage +import logging + +# General settings +LOG_LEVEL = logging.DEBUG + +# gRPC settings +GRPC_SERVICE_PORT = 10006 + +# service settings +MONITORING_INTERVAL = 10 # monitoring interval in seconds + +# Prometheus settings +METRICS_PORT = 9192 diff --git a/src/opticalattackdetector/Dockerfile b/src/opticalattackdetector/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..31bd3314c31d13d7175e45d18846be67ef69afbf --- /dev/null +++ b/src/opticalattackdetector/Dockerfile @@ -0,0 +1,86 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM python:3.9-slim + +# Install dependencies +RUN apt-get --yes --quiet --quiet update && \ + apt-get --yes --quiet --quiet install wget g++ && \ + rm -rf /var/lib/apt/lists/* + +# Set Python to show logs as they occur +ENV PYTHONUNBUFFERED=0 +ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python + +# 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 + +# Creating a user for security reasons +RUN groupadd -r teraflow && useradd -u 1001 --no-log-init -r -m -g teraflow teraflow +USER teraflow + +# set working directory +RUN mkdir -p /home/teraflow/controller/common/ +WORKDIR /home/teraflow/controller + +# Get Python packages per module +ENV VIRTUAL_ENV=/home/teraflow/venv +RUN python3 -m venv ${VIRTUAL_ENV} +ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" + +# Get generic Python packages +RUN python3 -m pip install --upgrade pip +RUN python3 -m pip install --upgrade setuptools wheel +RUN python3 -m pip install --upgrade pip-tools + +# Get common Python packages +# Note: this step enables sharing the previous Docker build steps among all the Python components +COPY --chown=teraflow:teraflow common_requirements.in common_requirements.in +RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in +RUN python3 -m pip install -r common_requirements.txt + +# Add common files into working directory +WORKDIR /home/teraflow/controller/common +COPY --chown=teraflow:teraflow src/common/. ./ + +# Create proto sub-folder, copy .proto files, and generate Python code +WORKDIR /home/teraflow/controller/common/proto +RUN touch __init__.py +COPY --chown=teraflow:teraflow proto/*.proto ./ +RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto +RUN rm *.proto +RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \; + +# Create module sub-folders +RUN mkdir -p /home/teraflow/controller/opticalattackdetector +WORKDIR /home/teraflow/controller + +# Get Python packages per module +COPY --chown=teraflow:teraflow src/opticalattackdetector/requirements.in opticalattackdetector/requirements.in +# consider common and specific requirements to avoid inconsistencies with dependencies +RUN pip-compile --quiet --output-file=opticalattackdetector/requirements.txt opticalattackdetector/requirements.in common_requirements.in +RUN python3 -m pip install -r opticalattackdetector/requirements.txt + +# Add files into working directory +COPY --chown=teraflow:teraflow src/context/. context +COPY --chown=teraflow:teraflow src/service/. service +COPY --chown=teraflow:teraflow src/monitoring/. monitoring +COPY --chown=teraflow:teraflow src/dbscanserving/. dbscanserving +COPY --chown=teraflow:teraflow src/opticalattackmitigator/. opticalattackmitigator +COPY --chown=teraflow:teraflow src/opticalattackdetector/. opticalattackdetector + +# Start opticalattackdetector service +ENTRYPOINT ["python", "-m", "opticalattackdetector.service"] diff --git a/src/opticalcentralizedattackdetector/__init__.py b/src/opticalattackdetector/__init__.py similarity index 88% rename from src/opticalcentralizedattackdetector/__init__.py rename to src/opticalattackdetector/__init__.py index 1549d9811aa5d1c193a44ad45d0d7773236c0612..9953c820575d42fa88351cc8de022d880ba96e6a 100644 --- a/src/opticalcentralizedattackdetector/__init__.py +++ b/src/opticalattackdetector/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/src/opticalattackdetector/client/OpticalAttackDetectorClient.py b/src/opticalattackdetector/client/OpticalAttackDetectorClient.py new file mode 100644 index 0000000000000000000000000000000000000000..47308f1a8ba0469a498d5d747ccbaa90f25e32a0 --- /dev/null +++ b/src/opticalattackdetector/client/OpticalAttackDetectorClient.py @@ -0,0 +1,72 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging + +import grpc + +from common.proto.context_pb2 import Empty +from common.proto.optical_attack_detector_pb2_grpc import \ + OpticalAttackDetectorServiceStub +from common.Settings import get_setting +from common.tools.client.RetryDecorator import delay_exponential, retry +from common.tools.grpc.Tools import grpc_message_to_json + +LOGGER = logging.getLogger(__name__) +MAX_RETRIES = 15 +DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) +RETRY_DECORATOR = retry( + max_retries=MAX_RETRIES, + delay_function=DELAY_FUNCTION, + prepare_method_name="connect", +) + + +class OpticalAttackDetectorClient: + def __init__(self, host=None, port=None): + if not host: + host = get_setting( + "OPTICALATTACKDETECTORSERVICE_SERVICE_HOST", default="DBSCANSERVING" + ) + if not port: + port = get_setting( + "OPTICALATTACKDETECTORSERVICE_SERVICE_PORT_GRPC", default=10007 + ) + self.endpoint = "{:s}:{:s}".format(str(host), 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 = OpticalAttackDetectorServiceStub(self.channel) + + def close(self): + if self.channel is not None: + self.channel.close() + self.channel = None + self.stub = None + + @RETRY_DECORATOR + def DetectAttack(self, request: Empty) -> Empty: + LOGGER.debug( + "DetectAttack request: {:s}".format(str(grpc_message_to_json(request))) + ) + response = self.stub.DetectAttack(request) + LOGGER.debug( + "DetectAttack result: {:s}".format(str(grpc_message_to_json(response))) + ) + return response diff --git a/src/opticalcentralizedattackdetector/client/__init__.py b/src/opticalattackdetector/client/__init__.py similarity index 88% rename from src/opticalcentralizedattackdetector/client/__init__.py rename to src/opticalattackdetector/client/__init__.py index 1549d9811aa5d1c193a44ad45d0d7773236c0612..9953c820575d42fa88351cc8de022d880ba96e6a 100644 --- a/src/opticalcentralizedattackdetector/client/__init__.py +++ b/src/opticalattackdetector/client/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/src/opticalattackdetector/requirements.in b/src/opticalattackdetector/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..7c2cf4fa6866387dd05592ff19391583bed69572 --- /dev/null +++ b/src/opticalattackdetector/requirements.in @@ -0,0 +1,2 @@ +numpy +redis \ No newline at end of file diff --git a/src/opticalattackdetector/service/OpticalAttackDetectorService.py b/src/opticalattackdetector/service/OpticalAttackDetectorService.py new file mode 100644 index 0000000000000000000000000000000000000000..c6a141371b6ea2790adfa0ef8488b2cf4fda8249 --- /dev/null +++ b/src/opticalattackdetector/service/OpticalAttackDetectorService.py @@ -0,0 +1,94 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +from concurrent import futures + +import grpc +from grpc_health.v1.health import OVERALL_HEALTH, HealthServicer +from grpc_health.v1.health_pb2 import HealthCheckResponse +from grpc_health.v1.health_pb2_grpc import add_HealthServicer_to_server + +from common.Constants import (DEFAULT_GRPC_BIND_ADDRESS, + DEFAULT_GRPC_GRACE_PERIOD, + DEFAULT_GRPC_MAX_WORKERS) +from common.proto.optical_attack_detector_pb2_grpc import \ + add_OpticalAttackDetectorServiceServicer_to_server +from opticalattackdetector.Config import GRPC_SERVICE_PORT +from opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl import \ + OpticalAttackDetectorServiceServicerImpl + +LOGGER = logging.getLogger(__name__) + + +class OpticalAttackDetectorService: + def __init__( + self, + address=DEFAULT_GRPC_BIND_ADDRESS, + port=GRPC_SERVICE_PORT, + max_workers=DEFAULT_GRPC_MAX_WORKERS, + grace_period=DEFAULT_GRPC_GRACE_PERIOD, + ): + + self.address = address + self.port = port + self.endpoint = None + self.max_workers = max_workers + self.grace_period = grace_period + self.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.attack_detector_servicer = OpticalAttackDetectorServiceServicerImpl() + add_OpticalAttackDetectorServiceServicer_to_server( + self.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/opticalattackdetector/service/OpticalAttackDetectorServiceServicerImpl.py b/src/opticalattackdetector/service/OpticalAttackDetectorServiceServicerImpl.py new file mode 100644 index 0000000000000000000000000000000000000000..d7720e0e48e5b0ed5b669d0b31c09acb0b95e60d --- /dev/null +++ b/src/opticalattackdetector/service/OpticalAttackDetectorServiceServicerImpl.py @@ -0,0 +1,232 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import pickle +import random + +import grpc +import numpy as np +import redis +from prometheus_client import Histogram + +from common.Constants import ServiceNameEnum +from common.proto import dbscanserving_pb2 as dbscan +from common.proto import optical_attack_detector_pb2 as oad +from common.proto.context_pb2 import Empty +from common.proto.monitoring_pb2 import Kpi +from common.proto.optical_attack_detector_pb2_grpc import \ + OpticalAttackDetectorServiceServicer +from common.proto.optical_attack_mitigator_pb2 import (AttackDescription, + AttackResponse) +from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method +from common.Settings import get_service_host, get_setting +from common.tools.timestamp.Converters import timestamp_utcnow_to_float +from dbscanserving.client.DbscanServingClient import DbscanServingClient +from monitoring.client.MonitoringClient import MonitoringClient +from opticalattackmitigator.client.OpticalAttackMitigatorClient import \ + OpticalAttackMitigatorClient + +LOGGER = logging.getLogger(__name__) + +METRICS_POOL = MetricsPool('OpticalAttackDetector', 'RPC') + +DETECTION_RESPONSE_TIME = Histogram( + "OPTICAL_ATTACK_DETECTOR_INFERENCE_RESPONSE_TIME", + "Time taken by the inference component to reply" +) +MONITORING_RESPONSE_TIME = Histogram( + "OPTICAL_ATTACK_DETECTOR_MONITORING_RESPONSE_TIME", + "Time taken by the monitoring component to reply" +) +MITIGATION_RESPONSE_TIME = Histogram( + "OPTICAL_ATTACK_DETECTOR_MITIGATION_RESPONSE_TIME", + "Time taken by the attack mitigator to reply" +) +CACHE_RESPONSE_TIME = Histogram( + "OPTICAL_ATTACK_DETECTOR_CACHE_RESPONSE_TIME", + "Time taken by the cache to reply" +) + +monitoring_client: MonitoringClient = MonitoringClient() +dbscanserving_client: DbscanServingClient = DbscanServingClient() +attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient() + +redis_host = get_service_host(ServiceNameEnum.CACHING) +r = None +if redis_host is not None: + redis_port = int(get_setting("CACHINGSERVICE_SERVICE_PORT_REDIS")) + redis_password = get_setting("REDIS_PASSWORD") + + r = redis.Redis(host=redis_host, port=redis_port, password=redis_password) + +# detecting preloading of the stats +path = get_setting("PATH_OPM_INFORMATION_SUMMARY", default=None) +if path is not None and len(path) > 0: + with open(path, "rb") as file: + opm_information_stats = pickle.load(file) + LOGGER.info("Using provided dataset: {}".format(path)) +else: + opm_information_stats = None + +WAD_WINDOW = 20 +WAD_SAMPLES = 9 + + +class OpticalAttackDetectorServiceServicerImpl(OpticalAttackDetectorServiceServicer): + def __init__(self): + LOGGER.debug("Creating Servicer...") + LOGGER.debug("Servicer Created") + + @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) + def DetectAttack( + self, request: oad.DetectionRequest, context: grpc.ServicerContext + ) -> Empty: + + s_uuid = request.service_id.service_uuid.uuid + + # detect if specific configuration is required + # to set the variable on the fly, try: + # https://stackoverflow.com/questions/45050050/can-i-modify-containers-environment-variables-without-restarting-pod-using-kube + _temp = r.get("CLASS_SERVICE_{}".format(s_uuid.replace("-", "_"))) + if _temp is not None and len(_temp) > 0: + _class = int(_temp) + else: # if not, assume no attack is present + _class = 0 + LOGGER.debug("Using class {} for service {}".format(_class, s_uuid)) + + _temp = r.get("PREVIOUS_CLASS_SERVICE_{}".format(s_uuid.replace("-", "_"))) + if _temp is not None and int(_temp) != 0 and _class == 0: + # if value changed to no-attack + # reset the experiment + r.delete("opm_{}".format(s_uuid.replace("-", "_"))) + r.set("PREVIOUS_CLASS_SERVICE_{}".format(s_uuid.replace("-", "_")), _class) + + # code used to validate resiliency against failures and timeouts + # if random.random() > 0.5: + # time.sleep(10) + + # run attack detection for every service + detection_request: dbscan.DetectionRequest = dbscan.DetectionRequest() + detection_request.num_samples = 310 + detection_request.num_features = 11 + + # checking if we have enough samples already for this service + length = r.llen("opm_{}".format(s_uuid.replace("-", "_"))) + if length < detection_request.num_samples: + # if the number of samples is not sufficient, + # we insert new samples + for _ in range(detection_request.num_samples - length): + detection_sample = [] + if opm_information_stats is not None: + for col in range(1, len(opm_information_stats.columns), 2): + name = opm_information_stats.columns[col][0] + # [result.columns[x][0] for x in range(1, len(result.columns), 2)] + detection_sample.append( + np.random.normal( + loc=opm_information_stats[name]["mean"][_class], + scale=opm_information_stats[name]["std"][_class], + ) + ) + else: + for __ in range(detection_request.num_features): + detection_sample.append(random.uniform(0.0, 10.0)) + # push the sample into the list + r.rpush( + "opm_{}".format(s_uuid.replace("-", "_")), + pickle.dumps(tuple(detection_sample)), + ) + + # remove the oldest sample from the list + r.lpop("opm_{}".format(s_uuid.replace("-", "_"))) + + # generate the latest sample + detection_sample = [] + if opm_information_stats is not None: + + for col in range(1, len(opm_information_stats.columns), 2): + name = opm_information_stats.columns[col][0] + # [result.columns[x][0] for x in range(1, len(result.columns), 2)] + detection_sample.append( + np.random.normal( + loc=opm_information_stats[name]["mean"][_class], + scale=opm_information_stats[name]["std"][_class], + ) + ) + + # generate data based on the stats based on the configuration of + # https://dx.doi.org/10.1109/JLT.2020.2987032 + detection_request.eps = 1.0 + detection_request.min_samples = 5 + else: + detection_request.eps = 100.5 + detection_request.min_samples = 5 + + if _class == 0: + for __ in range(detection_request.num_features): + detection_sample.append(random.uniform(0.0, 10.0)) + else: # if not, assume no attack is present + for __ in range(detection_request.num_features): + detection_sample.append(random.uniform(5000.0, 6000.0)) + + # adding the sample to the cache and recovering the cache + with CACHE_RESPONSE_TIME.time(): + r.rpush( + "opm_{}".format(s_uuid.replace("-", "_")), + pickle.dumps(tuple(detection_sample)), + ) + cached_samples = r.lrange("opm_{}".format(s_uuid.replace("-", "_")), 0, -1) + LOGGER.info( + "Recovered {} samples from the cache".format(len(cached_samples)) + ) + + for raw_sample in cached_samples: + sample = pickle.loads(raw_sample) + detection_sample = dbscan.Sample() + for feature in sample: + detection_sample.features.append(feature) + detection_request.samples.append(detection_sample) + + with DETECTION_RESPONSE_TIME.time(): + response: dbscan.DetectionResponse = dbscanserving_client.Detect( + detection_request + ) + + # including KPI + kpi = Kpi() + kpi.kpi_id.kpi_id.uuid = request.kpi_id.kpi_id.uuid + kpi.timestamp.timestamp = timestamp_utcnow_to_float() + # implementing WAD from https://ieeexplore.ieee.org/abstract/document/9064530 + if response.cluster_indices[-WAD_WINDOW:].count(-1) >= WAD_SAMPLES: + kpi.kpi_value.int32Val = 1 + LOGGER.info( + "Attack detected for service {}".format( + request.service_id.service_uuid.uuid + ) + ) + else: + kpi.kpi_value.int32Val = 0 + + with MONITORING_RESPONSE_TIME.time(): + monitoring_client.IncludeKpi(kpi) + + # if -1 in response.cluster_indices: # attack detected + if kpi.kpi_value.int32Val == -1: + attack = AttackDescription() + attack.cs_id.uuid = request.service_id.service_uuid.uuid + with MITIGATION_RESPONSE_TIME.time(): + response: AttackResponse = attack_mitigator_client.NotifyAttack(attack) + + # if attack is detected, run the attack mitigator + return Empty() diff --git a/src/opticalcentralizedattackdetector/proto/__init__.py b/src/opticalattackdetector/service/__init__.py similarity index 88% rename from src/opticalcentralizedattackdetector/proto/__init__.py rename to src/opticalattackdetector/service/__init__.py index 1549d9811aa5d1c193a44ad45d0d7773236c0612..9953c820575d42fa88351cc8de022d880ba96e6a 100644 --- a/src/opticalcentralizedattackdetector/proto/__init__.py +++ b/src/opticalattackdetector/service/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/src/opticalattackdetector/service/__main__.py b/src/opticalattackdetector/service/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..028f576e2ffae2dd4a83f12fba260cb418f3ed54 --- /dev/null +++ b/src/opticalattackdetector/service/__main__.py @@ -0,0 +1,105 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import signal +import sys +import threading + +from prometheus_client import start_http_server + +from common.Constants import (DEFAULT_GRPC_GRACE_PERIOD, + DEFAULT_GRPC_MAX_WORKERS, ServiceNameEnum) +from common.Settings import (ENVVAR_SUFIX_SERVICE_HOST, + ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, + get_log_level, get_metrics_port, get_setting, + wait_for_environment_variables) +from opticalattackdetector.client.OpticalAttackDetectorClient import \ + OpticalAttackDetectorClient +from opticalattackdetector.Config import GRPC_SERVICE_PORT +from opticalattackdetector.service.OpticalAttackDetectorService import \ + OpticalAttackDetectorService + +terminate = threading.Event() +LOGGER = None + +client: OpticalAttackDetectorClient = 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 + + log_level = get_log_level() + logging.basicConfig(level=log_level) + LOGGER = logging.getLogger(__name__) + + wait_for_environment_variables( + [ + get_env_var_name(ServiceNameEnum.DBSCANSERVING, ENVVAR_SUFIX_SERVICE_HOST), + get_env_var_name( + ServiceNameEnum.DBSCANSERVING, ENVVAR_SUFIX_SERVICE_PORT_GRPC + ), + ] + ) + + wait_for_environment_variables( + [ + get_env_var_name( + ServiceNameEnum.OPTICALATTACKMITIGATOR, ENVVAR_SUFIX_SERVICE_HOST + ), + get_env_var_name( + ServiceNameEnum.OPTICALATTACKMITIGATOR, ENVVAR_SUFIX_SERVICE_PORT_GRPC + ), + ] + ) + + service_port = get_setting( + "OPTICALATTACKDETECTORSERVICE_SERVICE_PORT_GRPC", default=GRPC_SERVICE_PORT + ) + max_workers = get_setting("MAX_WORKERS", default=DEFAULT_GRPC_MAX_WORKERS) + grace_period = get_setting("GRACE_PERIOD", default=DEFAULT_GRPC_GRACE_PERIOD) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + LOGGER.info("Starting...") + + # Start metrics server + metrics_port = get_metrics_port() + start_http_server(metrics_port) # TODO: make sure this is uncommented + + # Starting CentralizedCybersecurity service + grpc_service = OpticalAttackDetectorService( + 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/opticalcentralizedattackdetector/service/__init__.py b/src/opticalattackdetector/tests/__init__.py similarity index 88% rename from src/opticalcentralizedattackdetector/service/__init__.py rename to src/opticalattackdetector/tests/__init__.py index 1549d9811aa5d1c193a44ad45d0d7773236c0612..9953c820575d42fa88351cc8de022d880ba96e6a 100644 --- a/src/opticalcentralizedattackdetector/service/__init__.py +++ b/src/opticalattackdetector/tests/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,4 +11,3 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - diff --git a/src/opticalattackdetector/tests/example_objects.py b/src/opticalattackdetector/tests/example_objects.py new file mode 100644 index 0000000000000000000000000000000000000000..6ce094db8f830f5052b2d64bf42af0567781f5a6 --- /dev/null +++ b/src/opticalattackdetector/tests/example_objects.py @@ -0,0 +1,247 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from copy import deepcopy + +from common.Constants import DEFAULT_CONTEXT_UUID, DEFAULT_TOPOLOGY_UUID +from common.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_value): + return {"action": action, "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, "value1"), + config_rule(ConfigActionEnum.CONFIGACTION_SET, "value2"), + config_rule(ConfigActionEnum.CONFIGACTION_SET, "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/opticalattackdetector/tests/test_unitary.py b/src/opticalattackdetector/tests/test_unitary.py new file mode 100644 index 0000000000000000000000000000000000000000..55b6ebaf02d82f312a5d73666ed332fa795bae96 --- /dev/null +++ b/src/opticalattackdetector/tests/test_unitary.py @@ -0,0 +1,275 @@ +# Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import os +from unittest.mock import patch + +import pytest + +from common.Constants import (DEFAULT_GRPC_GRACE_PERIOD, + DEFAULT_GRPC_MAX_WORKERS) +from common.proto import dbscanserving_pb2 as dbscan +from common.proto.optical_attack_detector_pb2 import DetectionRequest +from opticalattackdetector.client.OpticalAttackDetectorClient import \ + OpticalAttackDetectorClient +from opticalattackdetector.Config import GRPC_SERVICE_PORT +from opticalattackdetector.service.OpticalAttackDetectorService import \ + OpticalAttackDetectorService + +# 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_attack_detector_service(): + with patch.dict( + os.environ, + { + "OPTICALATTACKDETECTORSERVICE_SERVICE_HOST": "127.0.0.1", + "OPTICALATTACKDETECTORSERVICE_SERVICE_PORT_GRPC": str(port), + "DBSCANSERVINGSERVICE_SERVICE_HOST": "127.0.0.1", + "DBSCANSERVINGSERVICE_SERVICE_PORT_GRPC": str(port), + }, + clear=True, + ): + _service = OpticalAttackDetectorService( + port=port, + max_workers=DEFAULT_GRPC_MAX_WORKERS, + grace_period=DEFAULT_GRPC_GRACE_PERIOD, + ) + # mocker_context_client = mock.patch('opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client') + # mocker_context_client.start() + + # mocker_influx_db = mock.patch('opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_attack_detector_client(optical_attack_detector_service): + with patch.dict( + os.environ, + { + "OPTICALATTACKDETECTORSERVICE_SERVICE_HOST": "127.0.0.1", + "OPTICALATTACKDETECTORSERVICE_SERVICE_PORT_GRPC": str(port), + "DBSCANSERVINGSERVICE_SERVICE_HOST": "127.0.0.1", + "DBSCANSERVINGSERVICE_SERVICE_PORT_GRPC": str(port), + }, + clear=True, + ): + _client = OpticalAttackDetectorClient() + yield _client + _client.close() + + +def test_detect_attack( + optical_attack_detector_client: OpticalAttackDetectorClient, +): + message = dbscan.DetectionResponse() + message.cluster_indices.extend([0, 1, -1, -1, -1]) + with patch( + "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.attack_mitigator_client" + ) as mitigator, patch( + "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.monitoring_client" + ) as monitoring, patch( + "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client.Detect", + # TODO: return dumb object with "cluster_indices" attribute + # idea: create new response object + return_value=message, + ) as dbscanserving: + request: DetectionRequest = DetectionRequest() + request.service_id.context_id.context_uuid.uuid = "" + request.service_id.service_uuid.uuid = str("") + request.kpi_id.kpi_id.uuid = "" + optical_attack_detector_client.DetectAttack(request) + mitigator.NotifyAttack.assert_called_once() + monitoring.IncludeKpi.assert_called_once() + dbscanserving.assert_called_once() + + +# def test_detect_attack_with_context( +# optical_attack_detector_client: OpticalAttackDetectorClient, +# ): +# with patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client" +# ) as context, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_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_attack_detector_client: OpticalAttackDetectorClient, +# ): +# with patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client" +# ) as context, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_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_attack_detector_client: OpticalAttackDetectorClient, +# ): +# with patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client" +# ) as context, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.influxdb_client" +# ) as influxdb, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_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_attack_detector_client: OpticalAttackDetectorClient, +# ): +# with patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client" +# ) as context, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.influxdb_client" +# ) as influxdb, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client" +# ) as dbscan, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_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_attack_detector_client: OpticalAttackDetectorClient, +# ): +# with patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.context_client" +# ) as context, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.influxdb_client" +# ) as influxdb, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client" +# ) as dbscan, patch( +# "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.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_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_attack_detector_client: OpticalAttackDetectorClient, +# ): +# kpi_list = KpiList() +# optical_attack_detector_client.ReportSummarizedKpi(kpi_list) + + +# def test_report_kpi(optical_attack_detector_client: OpticalAttackDetectorClient): +# kpi_list = KpiList() +# optical_attack_detector_client.ReportKpi(kpi_list) diff --git a/src/opticalcentralizedattackdetector/Config.py b/src/opticalcentralizedattackdetector/Config.py deleted file mode 100644 index c9bfe106b8d69ca52016ccc9512ec4598d3914bf..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/Config.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import logging - -# 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 = 'monitoringservice' # 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 deleted file mode 100644 index a7b32ccc6ee94f0fe741885452a44ca9fb7a0f3f..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM python:3-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/client/OpticalCentralizedAttackDetectorClient.py b/src/opticalcentralizedattackdetector/client/OpticalCentralizedAttackDetectorClient.py deleted file mode 100644 index 3dc2f3ae8f3837fe1c12d530d61fe70acf2563b6..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/client/OpticalCentralizedAttackDetectorClient.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import 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) -RETRY_DECORATOR = retry(max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') - -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_DECORATOR - 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_DECORATOR - 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_DECORATOR - 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_DECORATOR - 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/genproto.sh b/src/opticalcentralizedattackdetector/genproto.sh deleted file mode 100755 index 85941a266c1def6f352d5ade7bfe5b9e99309fd9..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/genproto.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -eu -# -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Make folder containing the script the root folder for its execution -cd $(dirname $0) - -rm -rf proto/*.py -rm -rf proto/__pycache__ -tee proto/__init__.py << EOF > /dev/null -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -EOF - -# 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/context_pb2.py b/src/opticalcentralizedattackdetector/proto/context_pb2.py deleted file mode 100644 index 50d501d3ac053ad644554331af26e3c40cd426a1..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/context_pb2.py +++ /dev/null @@ -1,3071 +0,0 @@ -# -*- 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\"T\n\x07SliceId\x12&\n\ncontext_id\x18\x01 \x01(\x0b\x32\x12.context.ContextId\x12!\n\nslice_uuid\x18\x02 \x01(\x0b\x32\r.context.Uuid\"\x95\x02\n\x05Slice\x12\"\n\x08slice_id\x18\x01 \x01(\x0b\x32\x10.context.SliceId\x12/\n\x12slice_endpoint_ids\x18\x02 \x03(\x0b\x32\x13.context.EndPointId\x12.\n\x11slice_constraints\x18\x03 \x03(\x0b\x32\x13.context.Constraint\x12-\n\x11slice_service_ids\x18\x04 \x03(\x0b\x32\x12.context.ServiceId\x12,\n\x12slice_subslice_ids\x18\x05 \x03(\x0b\x32\x10.context.SliceId\x12*\n\x0cslice_status\x18\x06 \x01(\x0b\x32\x14.context.SliceStatus\"=\n\x0bSliceStatus\x12.\n\x0cslice_status\x18\x01 \x01(\x0e\x32\x18.context.SliceStatusEnum\"2\n\x0bSliceIdList\x12#\n\tslice_ids\x18\x01 \x03(\x0b\x32\x10.context.SliceId\"+\n\tSliceList\x12\x1e\n\x06slices\x18\x01 \x03(\x0b\x32\x0e.context.Slice\"O\n\nSliceEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12\"\n\x08slice_id\x18\x02 \x01(\x0b\x32\x10.context.SliceId\"6\n\x0c\x43onnectionId\x12&\n\x0f\x63onnection_uuid\x18\x01 \x01(\x0b\x32\r.context.Uuid\"\xc4\x01\n\nConnection\x12,\n\rconnection_id\x18\x01 \x01(\x0b\x32\x15.context.ConnectionId\x12&\n\nservice_id\x18\x02 \x01(\x0b\x32\x12.context.ServiceId\x12\x33\n\x16path_hops_endpoint_ids\x18\x03 \x03(\x0b\x32\x13.context.EndPointId\x12+\n\x0fsub_service_ids\x18\x04 \x03(\x0b\x32\x12.context.ServiceId\"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\x0f\x43onnectionEvent\x12\x1d\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x0e.context.Event\x12,\n\rconnection_id\x18\x02 \x01(\x0b\x32\x15.context.ConnectionId\"\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\"^\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*\x8b\x01\n\x0fSliceStatusEnum\x12\x19\n\x15SLICESTATUS_UNDEFINED\x10\x00\x12\x17\n\x13SLICESTATUS_PLANNED\x10\x01\x12\x14\n\x10SLICESTATUS_INIT\x10\x02\x12\x16\n\x12SLICESTATUS_ACTIVE\x10\x03\x12\x16\n\x12SLICESTATUS_DEINIT\x10\x04*]\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\xef\x12\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\x12:\n\x0cListSliceIds\x12\x12.context.ContextId\x1a\x14.context.SliceIdList\"\x00\x12\x36\n\nListSlices\x12\x12.context.ContextId\x1a\x12.context.SliceList\"\x00\x12.\n\x08GetSlice\x12\x10.context.SliceId\x1a\x0e.context.Slice\"\x00\x12.\n\x08SetSlice\x12\x0e.context.Slice\x1a\x10.context.SliceId\"\x00\x12\x31\n\x0bRemoveSlice\x12\x10.context.SliceId\x1a\x0e.context.Empty\"\x00\x12\x39\n\x0eGetSliceEvents\x12\x0e.context.Empty\x1a\x13.context.SliceEvent\"\x00\x30\x01\x12\x44\n\x11ListConnectionIds\x12\x12.context.ServiceId\x1a\x19.context.ConnectionIdList\"\x00\x12@\n\x0fListConnections\x12\x12.context.ServiceId\x1a\x17.context.ConnectionList\"\x00\x12=\n\rGetConnection\x12\x15.context.ConnectionId\x1a\x13.context.Connection\"\x00\x12=\n\rSetConnection\x12\x13.context.Connection\x1a\x15.context.ConnectionId\"\x00\x12;\n\x10RemoveConnection\x12\x15.context.ConnectionId\x1a\x0e.context.Empty\"\x00\x12\x43\n\x13GetConnectionEvents\x12\x0e.context.Empty\x1a\x18.context.ConnectionEvent\"\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=4310, - serialized_end=4416, -) -_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=4419, - serialized_end=4616, -) -_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=4619, - serialized_end=4762, -) -_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=4765, - serialized_end=4894, -) -_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=4897, - serialized_end=5033, -) -_sym_db.RegisterEnumDescriptor(_SERVICESTATUSENUM) - -ServiceStatusEnum = enum_type_wrapper.EnumTypeWrapper(_SERVICESTATUSENUM) -_SLICESTATUSENUM = _descriptor.EnumDescriptor( - name='SliceStatusEnum', - full_name='context.SliceStatusEnum', - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name='SLICESTATUS_UNDEFINED', index=0, number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SLICESTATUS_PLANNED', index=1, number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SLICESTATUS_INIT', index=2, number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SLICESTATUS_ACTIVE', index=3, number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - _descriptor.EnumValueDescriptor( - name='SLICESTATUS_DEINIT', index=4, number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key), - ], - containing_type=None, - serialized_options=None, - serialized_start=5036, - serialized_end=5175, -) -_sym_db.RegisterEnumDescriptor(_SLICESTATUSENUM) - -SliceStatusEnum = enum_type_wrapper.EnumTypeWrapper(_SLICESTATUSENUM) -_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=5177, - serialized_end=5270, -) -_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 -SLICESTATUS_UNDEFINED = 0 -SLICESTATUS_PLANNED = 1 -SLICESTATUS_INIT = 2 -SLICESTATUS_ACTIVE = 3 -SLICESTATUS_DEINIT = 4 -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, -) - - -_SLICEID = _descriptor.Descriptor( - name='SliceId', - full_name='context.SliceId', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='context_id', full_name='context.SliceId.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='slice_uuid', full_name='context.SliceId.slice_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=2604, - serialized_end=2688, -) - - -_SLICE = _descriptor.Descriptor( - name='Slice', - full_name='context.Slice', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='slice_id', full_name='context.Slice.slice_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='slice_endpoint_ids', full_name='context.Slice.slice_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), - _descriptor.FieldDescriptor( - name='slice_constraints', full_name='context.Slice.slice_constraints', 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='slice_service_ids', full_name='context.Slice.slice_service_ids', 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='slice_subslice_ids', full_name='context.Slice.slice_subslice_ids', index=4, - number=5, 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='slice_status', full_name='context.Slice.slice_status', 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=2691, - serialized_end=2968, -) - - -_SLICESTATUS = _descriptor.Descriptor( - name='SliceStatus', - full_name='context.SliceStatus', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='slice_status', full_name='context.SliceStatus.slice_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=2970, - serialized_end=3031, -) - - -_SLICEIDLIST = _descriptor.Descriptor( - name='SliceIdList', - full_name='context.SliceIdList', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='slice_ids', full_name='context.SliceIdList.slice_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=3033, - serialized_end=3083, -) - - -_SLICELIST = _descriptor.Descriptor( - name='SliceList', - full_name='context.SliceList', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='slices', full_name='context.SliceList.slices', 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=3085, - serialized_end=3128, -) - - -_SLICEEVENT = _descriptor.Descriptor( - name='SliceEvent', - full_name='context.SliceEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='event', full_name='context.SliceEvent.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='slice_id', full_name='context.SliceEvent.slice_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=3130, - serialized_end=3209, -) - - -_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=3211, - serialized_end=3265, -) - - -_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='service_id', full_name='context.Connection.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_hops_endpoint_ids', full_name='context.Connection.path_hops_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='sub_service_ids', full_name='context.Connection.sub_service_ids', 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), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - serialized_options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=3268, - serialized_end=3464, -) - - -_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=3466, - serialized_end=3531, -) - - -_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=3533, - serialized_end=3591, -) - - -_CONNECTIONEVENT = _descriptor.Descriptor( - name='ConnectionEvent', - full_name='context.ConnectionEvent', - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name='event', full_name='context.ConnectionEvent.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='connection_id', full_name='context.ConnectionEvent.connection_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=3593, - serialized_end=3687, -) - - -_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=3690, - serialized_end=3820, -) - - -_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=3823, - serialized_end=3957, -) - - -_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=3959, - serialized_end=4060, -) - - -_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=4062, - serialized_end=4125, -) - - -_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=4127, - serialized_end=4221, -) - - -_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=4223, - serialized_end=4308, -) - -_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 -_SLICEID.fields_by_name['context_id'].message_type = _CONTEXTID -_SLICEID.fields_by_name['slice_uuid'].message_type = _UUID -_SLICE.fields_by_name['slice_id'].message_type = _SLICEID -_SLICE.fields_by_name['slice_endpoint_ids'].message_type = _ENDPOINTID -_SLICE.fields_by_name['slice_constraints'].message_type = _CONSTRAINT -_SLICE.fields_by_name['slice_service_ids'].message_type = _SERVICEID -_SLICE.fields_by_name['slice_subslice_ids'].message_type = _SLICEID -_SLICE.fields_by_name['slice_status'].message_type = _SLICESTATUS -_SLICESTATUS.fields_by_name['slice_status'].enum_type = _SLICESTATUSENUM -_SLICEIDLIST.fields_by_name['slice_ids'].message_type = _SLICEID -_SLICELIST.fields_by_name['slices'].message_type = _SLICE -_SLICEEVENT.fields_by_name['event'].message_type = _EVENT -_SLICEEVENT.fields_by_name['slice_id'].message_type = _SLICEID -_CONNECTIONID.fields_by_name['connection_uuid'].message_type = _UUID -_CONNECTION.fields_by_name['connection_id'].message_type = _CONNECTIONID -_CONNECTION.fields_by_name['service_id'].message_type = _SERVICEID -_CONNECTION.fields_by_name['path_hops_endpoint_ids'].message_type = _ENDPOINTID -_CONNECTION.fields_by_name['sub_service_ids'].message_type = _SERVICEID -_CONNECTIONIDLIST.fields_by_name['connection_ids'].message_type = _CONNECTIONID -_CONNECTIONLIST.fields_by_name['connections'].message_type = _CONNECTION -_CONNECTIONEVENT.fields_by_name['event'].message_type = _EVENT -_CONNECTIONEVENT.fields_by_name['connection_id'].message_type = _CONNECTIONID -_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 -_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['SliceId'] = _SLICEID -DESCRIPTOR.message_types_by_name['Slice'] = _SLICE -DESCRIPTOR.message_types_by_name['SliceStatus'] = _SLICESTATUS -DESCRIPTOR.message_types_by_name['SliceIdList'] = _SLICEIDLIST -DESCRIPTOR.message_types_by_name['SliceList'] = _SLICELIST -DESCRIPTOR.message_types_by_name['SliceEvent'] = _SLICEEVENT -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['ConnectionEvent'] = _CONNECTIONEVENT -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['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['SliceStatusEnum'] = _SLICESTATUSENUM -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) - -SliceId = _reflection.GeneratedProtocolMessageType('SliceId', (_message.Message,), { - 'DESCRIPTOR' : _SLICEID, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.SliceId) - }) -_sym_db.RegisterMessage(SliceId) - -Slice = _reflection.GeneratedProtocolMessageType('Slice', (_message.Message,), { - 'DESCRIPTOR' : _SLICE, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.Slice) - }) -_sym_db.RegisterMessage(Slice) - -SliceStatus = _reflection.GeneratedProtocolMessageType('SliceStatus', (_message.Message,), { - 'DESCRIPTOR' : _SLICESTATUS, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.SliceStatus) - }) -_sym_db.RegisterMessage(SliceStatus) - -SliceIdList = _reflection.GeneratedProtocolMessageType('SliceIdList', (_message.Message,), { - 'DESCRIPTOR' : _SLICEIDLIST, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.SliceIdList) - }) -_sym_db.RegisterMessage(SliceIdList) - -SliceList = _reflection.GeneratedProtocolMessageType('SliceList', (_message.Message,), { - 'DESCRIPTOR' : _SLICELIST, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.SliceList) - }) -_sym_db.RegisterMessage(SliceList) - -SliceEvent = _reflection.GeneratedProtocolMessageType('SliceEvent', (_message.Message,), { - 'DESCRIPTOR' : _SLICEEVENT, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.SliceEvent) - }) -_sym_db.RegisterMessage(SliceEvent) - -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) - -ConnectionEvent = _reflection.GeneratedProtocolMessageType('ConnectionEvent', (_message.Message,), { - 'DESCRIPTOR' : _CONNECTIONEVENT, - '__module__' : 'context_pb2' - # @@protoc_insertion_point(class_scope:context.ConnectionEvent) - }) -_sym_db.RegisterMessage(ConnectionEvent) - -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) - -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=5273, - serialized_end=7688, - 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, - ), - _descriptor.MethodDescriptor( - name='ListSliceIds', - full_name='context.ContextService.ListSliceIds', - index=30, - containing_service=None, - input_type=_CONTEXTID, - output_type=_SLICEIDLIST, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='ListSlices', - full_name='context.ContextService.ListSlices', - index=31, - containing_service=None, - input_type=_CONTEXTID, - output_type=_SLICELIST, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetSlice', - full_name='context.ContextService.GetSlice', - index=32, - containing_service=None, - input_type=_SLICEID, - output_type=_SLICE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetSlice', - full_name='context.ContextService.SetSlice', - index=33, - containing_service=None, - input_type=_SLICE, - output_type=_SLICEID, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='RemoveSlice', - full_name='context.ContextService.RemoveSlice', - index=34, - containing_service=None, - input_type=_SLICEID, - output_type=_EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetSliceEvents', - full_name='context.ContextService.GetSliceEvents', - index=35, - containing_service=None, - input_type=_EMPTY, - output_type=_SLICEEVENT, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='ListConnectionIds', - full_name='context.ContextService.ListConnectionIds', - index=36, - containing_service=None, - input_type=_SERVICEID, - output_type=_CONNECTIONIDLIST, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='ListConnections', - full_name='context.ContextService.ListConnections', - index=37, - containing_service=None, - input_type=_SERVICEID, - output_type=_CONNECTIONLIST, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetConnection', - full_name='context.ContextService.GetConnection', - index=38, - containing_service=None, - input_type=_CONNECTIONID, - output_type=_CONNECTION, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='SetConnection', - full_name='context.ContextService.SetConnection', - index=39, - containing_service=None, - input_type=_CONNECTION, - output_type=_CONNECTIONID, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='RemoveConnection', - full_name='context.ContextService.RemoveConnection', - index=40, - containing_service=None, - input_type=_CONNECTIONID, - output_type=_EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name='GetConnectionEvents', - full_name='context.ContextService.GetConnectionEvents', - index=41, - containing_service=None, - input_type=_EMPTY, - output_type=_CONNECTIONEVENT, - 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 deleted file mode 100644 index ea7fd2f82757d4c3db02d7e2c7817e2787b0b490..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/kpi_sample_types_pb2.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- 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/opticalcentralizedattackdetector/proto/monitoring_pb2.py b/src/opticalcentralizedattackdetector/proto/monitoring_pb2.py deleted file mode 100644 index b313ebb68f0da37a540898e8c362fd204a799076..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/monitoring_pb2.py +++ /dev/null @@ -1,452 +0,0 @@ -# -*- 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 deleted file mode 100644 index b97a93fef290a5d27c2369d3b69d1405ea8a6442..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- 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 deleted file mode 100644 index 17b839fa3bbaafb8ecfa795db21ba6baba8cd28b..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/optical_centralized_attack_detector_pb2_grpc.py +++ /dev/null @@ -1,168 +0,0 @@ -# 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 deleted file mode 100644 index 8e2806c7685e24ab90a3d59a19f1e4f99ebc9712..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/proto/service_pb2.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- 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\xb9\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\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=227, - 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, - ), -]) -_sym_db.RegisterServiceDescriptor(_SERVICESERVICE) - -DESCRIPTOR.services_by_name['ServiceService'] = _SERVICESERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/src/opticalcentralizedattackdetector/requirements.txt b/src/opticalcentralizedattackdetector/requirements.txt deleted file mode 100644 index 5d13e7bc5d318c65e5cc0fe8a4501631aa5428ff..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/requirements.txt +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# 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 deleted file mode 100644 index f281063f47cd7ef79b06640a5588286699d55848..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorService.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import 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 deleted file mode 100644 index c3ca1c1cfc21dd22c3f2f801a8d1c1321274ad29..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os, grpc, logging, random -from influxdb import InfluxDBClient -from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method -from context.client.ContextClient import ContextClient -from monitoring.client.MonitoringClient import MonitoringClient -from service.client.ServiceClient import ServiceClient -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 ( - INFERENCE_SERVICE_ADDRESS, MONITORING_SERVICE_ADDRESS, ATTACK_MITIGATOR_SERVICE_ADDRESS) - - -LOGGER = logging.getLogger(__name__) - -METRICS_POOL = MetricsPool('OpticalCentralizedAttackDetector', 'RPC') - -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() -influxdb_client: InfluxDBClient = InfluxDBClient( - host=MONITORING_SERVICE_ADDRESS, port=8086, username=INFLUXDB_USER, password=INFLUXDB_PASSWORD, - database=INFLUXDB_DATABASE) -monitoring_client: MonitoringClient = MonitoringClient() -dbscanserving_client: DbscanServingClient = DbscanServingClient( - address=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) -service_client: ServiceClient = ServiceClient() -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_POOL, LOGGER) - def NotifyServiceUpdate(self, request : Service, context : grpc.ServicerContext) -> Empty: - return Empty() - - @safe_and_metered_rpc_method(METRICS_POOL, 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_POOL, LOGGER) - def ReportSummarizedKpi(self, request : KpiList, context : grpc.ServicerContext) -> Empty: - return Empty() - - @safe_and_metered_rpc_method(METRICS_POOL, LOGGER) - def ReportKpi(self, request : KpiList, context : grpc.ServicerContext) -> Empty: - return Empty() diff --git a/src/opticalcentralizedattackdetector/service/__main__.py b/src/opticalcentralizedattackdetector/service/__main__.py deleted file mode 100644 index 89dfe277d1b642727cca1199e250153264aeb5c2..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/service/__main__.py +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import 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 deleted file mode 100644 index 1549d9811aa5d1c193a44ad45d0d7773236c0612..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/tests/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - diff --git a/src/opticalcentralizedattackdetector/tests/example_objects.py b/src/opticalcentralizedattackdetector/tests/example_objects.py deleted file mode 100644 index a6859bfb4defd4ccb9df318222237efb8e9cb036..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/tests/example_objects.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from copy import deepcopy -from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME -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_NAME}} -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_NAME}, -} -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 deleted file mode 100644 index d89ef2fe27a7d284b655698e7ee89e79b230b04b..0000000000000000000000000000000000000000 --- a/src/opticalcentralizedattackdetector/tests/test_unitary.py +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import logging, 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)