Loading manifests/opticalcentralizedattackdetectorservice.yaml→manifests/opticalattackdetectorservice.yaml +49 −16 Original line number Diff line number Diff line Loading @@ -15,49 +15,82 @@ apiVersion: apps/v1 kind: Deployment metadata: name: opticalcentralizedattackdetectorservice name: opticalattackdetectorservice spec: selector: matchLabels: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice template: metadata: labels: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice spec: terminationGracePeriodSeconds: 5 containers: - name: server image: labs.etsi.org:5050/tfs/controller/opticalcentralizedattackdetector:latest image: labs.etsi.org:5050/tfs/controller/opticalattackdetector:latest imagePullPolicy: Always ports: - containerPort: 10005 envFrom: - secretRef: name: monitoring-secrets - 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=:10005"] command: ["/bin/grpc_health_probe", "-addr=:10006"] livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10005"] command: ["/bin/grpc_health_probe", "-addr=:10006"] resources: requests: cpu: 250m memory: 512Mi memory: 128Mi limits: cpu: 700m cpu: 1000m memory: 1024Mi --- apiVersion: v1 kind: Service metadata: name: opticalcentralizedattackdetectorservice name: opticalattackdetectorservice labels: app: opticalattackdetectorservice spec: type: ClusterIP selector: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice ports: - name: grpc port: 10005 targetPort: 10005 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 manifests/servicemonitors.yaml +58 −0 Original line number Diff line number Diff line Loading @@ -417,3 +417,61 @@ spec: 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 interval: 5s # scrape interval namespaceSelector: any: false matchNames: - tfs # namespace where the app is running No newline at end of file proto/centralized_attack_detector.proto→proto/optical_attack_detector.proto +8 −8 Original line number Diff line number Diff line Loading @@ -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; } proto/optical_centralized_attack_detector.protodeleted 100644 → 0 +0 −32 Original line number Diff line number Diff line // 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) {} } src/common/Constants.py +18 −13 Original line number Diff line number Diff line Loading @@ -49,6 +49,11 @@ class ServiceNameEnum(Enum): 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' Loading Loading
manifests/opticalcentralizedattackdetectorservice.yaml→manifests/opticalattackdetectorservice.yaml +49 −16 Original line number Diff line number Diff line Loading @@ -15,49 +15,82 @@ apiVersion: apps/v1 kind: Deployment metadata: name: opticalcentralizedattackdetectorservice name: opticalattackdetectorservice spec: selector: matchLabels: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice template: metadata: labels: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice spec: terminationGracePeriodSeconds: 5 containers: - name: server image: labs.etsi.org:5050/tfs/controller/opticalcentralizedattackdetector:latest image: labs.etsi.org:5050/tfs/controller/opticalattackdetector:latest imagePullPolicy: Always ports: - containerPort: 10005 envFrom: - secretRef: name: monitoring-secrets - 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=:10005"] command: ["/bin/grpc_health_probe", "-addr=:10006"] livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:10005"] command: ["/bin/grpc_health_probe", "-addr=:10006"] resources: requests: cpu: 250m memory: 512Mi memory: 128Mi limits: cpu: 700m cpu: 1000m memory: 1024Mi --- apiVersion: v1 kind: Service metadata: name: opticalcentralizedattackdetectorservice name: opticalattackdetectorservice labels: app: opticalattackdetectorservice spec: type: ClusterIP selector: app: opticalcentralizedattackdetectorservice app: opticalattackdetectorservice ports: - name: grpc port: 10005 targetPort: 10005 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
manifests/servicemonitors.yaml +58 −0 Original line number Diff line number Diff line Loading @@ -417,3 +417,61 @@ spec: 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 interval: 5s # scrape interval namespaceSelector: any: false matchNames: - tfs # namespace where the app is running No newline at end of file
proto/centralized_attack_detector.proto→proto/optical_attack_detector.proto +8 −8 Original line number Diff line number Diff line Loading @@ -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; }
proto/optical_centralized_attack_detector.protodeleted 100644 → 0 +0 −32 Original line number Diff line number Diff line // 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) {} }
src/common/Constants.py +18 −13 Original line number Diff line number Diff line Loading @@ -49,6 +49,11 @@ class ServiceNameEnum(Enum): 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' Loading