Skip to content
Snippets Groups Projects
Commit e88cecd0 authored by delacal's avatar delacal
Browse files

Added buffer to centralized attack detector component for it to wait until it...

Added buffer to centralized attack detector component for it to wait until it receives BATCH_SIZE requests until it makes an inference
parent 9758c5b2
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!93Updated L3 components + scalability
...@@ -68,8 +68,6 @@ spec: ...@@ -68,8 +68,6 @@ spec:
- name: grpc - name: grpc
port: 10002 port: 10002
targetPort: 10002 targetPort: 10002
strategy:
type: Recreate
--- ---
apiVersion: autoscaling/v2 apiVersion: autoscaling/v2
......
...@@ -68,8 +68,6 @@ spec: ...@@ -68,8 +68,6 @@ spec:
- name: grpc - name: grpc
port: 10001 port: 10001
targetPort: 10001 targetPort: 10001
strategy:
type: Recreate
--- ---
apiVersion: autoscaling/v2 apiVersion: autoscaling/v2
......
#!/bin/bash
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----- TeraFlowSDN ------------------------------------------------------------ # ----- TeraFlowSDN ------------------------------------------------------------
# Set the URL of the internal MicroK8s Docker registry where the images will be uploaded to.
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy.
export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator l3_attackmitigator l3_centralizedattackdetector" export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator l3_attackmitigator l3_centralizedattackdetector"
# Set the tag you want to use for your images.
export TFS_IMAGE_TAG="dev" export TFS_IMAGE_TAG="dev"
# Set the name of the Kubernetes namespace to deploy TFS to.
export TFS_K8S_NAMESPACE="tfs" export TFS_K8S_NAMESPACE="tfs"
# Set additional manifest files to be applied after the deployment
export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml"
# Set the new Grafana admin password
export TFS_GRAFANA_PASSWORD="admin123+" export TFS_GRAFANA_PASSWORD="admin123+"
# Disable skip-build flag to rebuild the Docker images.
export TFS_SKIP_BUILD="" export TFS_SKIP_BUILD=""
# ----- CockroachDB ------------------------------------------------------------ # ----- CockroachDB ------------------------------------------------------------
# Set the namespace where CockroackDB will be deployed.
export CRDB_NAMESPACE="crdb" export CRDB_NAMESPACE="crdb"
# Set the external port CockroackDB Postgre SQL interface will be exposed to. # Set the external port CockroackDB Postgre SQL interface will be exposed to.
...@@ -18,15 +51,27 @@ export CRDB_EXT_PORT_HTTP="8081" ...@@ -18,15 +51,27 @@ export CRDB_EXT_PORT_HTTP="8081"
# Set the database username to be used by Context. # Set the database username to be used by Context.
export CRDB_USERNAME="tfs" export CRDB_USERNAME="tfs"
# Set the database user's password to be used by Context.
export CRDB_PASSWORD="tfs123" export CRDB_PASSWORD="tfs123"
# Set the database name to be used by Context.
export CRDB_DATABASE="tfs" export CRDB_DATABASE="tfs"
# Set CockroachDB installation mode to 'single'. This option is convenient for development and testing.
# See ./deploy/all.sh or ./deploy/crdb.sh for additional details
export CRDB_DEPLOY_MODE="single" export CRDB_DEPLOY_MODE="single"
# Disable flag for dropping database, if it exists. # Disable flag for dropping database, if it exists.
export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS=""
# Disable flag for re-deploying CockroachDB from scratch.
export CRDB_REDEPLOY="" export CRDB_REDEPLOY=""
# ----- NATS ------------------------------------------------------------------- # ----- NATS -------------------------------------------------------------------
# Set the namespace where NATS will be deployed.
export NATS_NAMESPACE="nats" export NATS_NAMESPACE="nats"
# Set the external port NATS Client interface will be exposed to. # Set the external port NATS Client interface will be exposed to.
...@@ -38,6 +83,7 @@ export NATS_EXT_PORT_HTTP="8222" ...@@ -38,6 +83,7 @@ export NATS_EXT_PORT_HTTP="8222"
# Disable flag for re-deploying NATS from scratch. # Disable flag for re-deploying NATS from scratch.
export NATS_REDEPLOY="" export NATS_REDEPLOY=""
# ----- QuestDB ---------------------------------------------------------------- # ----- QuestDB ----------------------------------------------------------------
# Set the namespace where QuestDB will be deployed. # Set the namespace where QuestDB will be deployed.
...@@ -69,8 +115,3 @@ export QDB_DROP_TABLES_IF_EXIST="" ...@@ -69,8 +115,3 @@ export QDB_DROP_TABLES_IF_EXIST=""
# Disable flag for re-deploying QuestDB from scratch. # Disable flag for re-deploying QuestDB from scratch.
export QDB_REDEPLOY="" export QDB_REDEPLOY=""
export CRDB_DROP_DATABASE_IF_EXISTS="YES"
export CRDB_REDEPLOY="YES"
export NATS_REDEPLOY="YES"
export QDB_REDEPLOY="TRUE"
\ No newline at end of file
...@@ -30,8 +30,12 @@ from common.tools.grpc.Tools import grpc_message_to_json_string ...@@ -30,8 +30,12 @@ from common.tools.grpc.Tools import grpc_message_to_json_string
from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient
from service.client.ServiceClient import ServiceClient from service.client.ServiceClient import ServiceClient
from common.method_wrappers.Decorator import MetricsPool, safe_and_metered_rpc_method
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
METRICS_POOL = MetricsPool('l3_attackmitigator', 'RPC')
class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer):
def __init__(self): def __init__(self):
...@@ -123,6 +127,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): ...@@ -123,6 +127,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer):
if service_reply != service_request.service_id: # pylint: disable=no-member if service_reply != service_request.service_id: # pylint: disable=no-member
raise Exception("Service update failed. Wrong ServiceId was returned") raise Exception("Service update failed. Wrong ServiceId was returned")
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def PerformMitigation(self, request, context): def PerformMitigation(self, request, context):
last_value = request.confidence last_value = request.confidence
last_tag = request.tag last_tag = request.tag
...@@ -180,6 +186,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): ...@@ -180,6 +186,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer):
return Empty(message=f"OK, received values: {last_tag} with confidence {last_value}.") return Empty(message=f"OK, received values: {last_tag} with confidence {last_value}.")
@safe_and_metered_rpc_method(METRICS_POOL, LOGGER)
def GetConfiguredACLRules(self, request, context): def GetConfiguredACLRules(self, request, context):
acl_rules = ACLRules() acl_rules = ACLRules()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment