From f96ed153a58e51ee625e4446c980e44fafd29c0e Mon Sep 17 00:00:00 2001 From: ldemarcosm <l.demarcosm@alumnos.upm.es> Date: Thu, 4 Nov 2021 12:51:55 +0100 Subject: [PATCH] Updated AM and CAD services for codefreeze --- manifests/l3_attackmitigatorservice.yaml | 21 ----- .../l3_centralizedattackdetectorservice.yaml | 21 ----- .../l3_distributedattackdetectorservice.yaml | 21 ----- report_coverage_l3_attackmitigator.sh | 2 +- ...t_coverage_l3_centralizedattackdetector.sh | 2 +- ...t_coverage_l3_distributedattackdetector.sh | 2 +- .../client/l3_attackmitigatorClient.py | 18 ++++ src/l3_attackmitigator/requirements.in | 1 - src/l3_attackmitigator/service/__main__.py | 4 - .../l3_attackmitigatorServiceServicerImpl.py | 41 ++------- src/l3_attackmitigator/tests/test_unitary.py | 53 ++++------- .../l3_centralizedattackdetectorClient.py | 21 ++++- .../requirements.in | 3 +- .../service/__main__.py | 1 - ...alizedattackdetectorServiceServicerImpl.py | 91 +++++++------------ .../tests/test_unitary.py | 55 +++++------ .../l3_distributedattackdetectorClient.py | 3 - .../requirements.in | 1 - 18 files changed, 115 insertions(+), 246 deletions(-) diff --git a/manifests/l3_attackmitigatorservice.yaml b/manifests/l3_attackmitigatorservice.yaml index be335171f..7ac91b02f 100644 --- a/manifests/l3_attackmitigatorservice.yaml +++ b/manifests/l3_attackmitigatorservice.yaml @@ -19,10 +19,6 @@ spec: ports: - containerPort: 10002 env: - - name: DB_ENGINE - value: "redis" - - name: REDIS_DATABASE_ID - value: "0" - name: LOG_LEVEL value: "DEBUG" readinessProbe: @@ -51,20 +47,3 @@ spec: - name: grpc port: 10002 targetPort: 10002 ---- -apiVersion: v1 -kind: Service -metadata: - name: attackmitigatorservice-public - labels: - app: attackmitigatorservice -spec: - type: NodePort - selector: - app: attackmitigatorservice - ports: - - name: grpc - protocol: TCP - port: 10002 - targetPort: 10002 ---- diff --git a/manifests/l3_centralizedattackdetectorservice.yaml b/manifests/l3_centralizedattackdetectorservice.yaml index 9381bf10d..4b4b62929 100644 --- a/manifests/l3_centralizedattackdetectorservice.yaml +++ b/manifests/l3_centralizedattackdetectorservice.yaml @@ -19,10 +19,6 @@ spec: ports: - containerPort: 10001 env: - - name: DB_ENGINE - value: "redis" - - name: REDIS_DATABASE_ID - value: "0" - name: LOG_LEVEL value: "DEBUG" readinessProbe: @@ -51,20 +47,3 @@ spec: - name: grpc port: 10001 targetPort: 10001 ---- -apiVersion: v1 -kind: Service -metadata: - name: centralizedattackdetectorservice-public - labels: - app: centralizedattackdetectorservice -spec: - type: NodePort - selector: - app: centralizedattackdetectorservice - ports: - - name: grpc - protocol: TCP - port: 10001 - targetPort: 10001 ---- diff --git a/manifests/l3_distributedattackdetectorservice.yaml b/manifests/l3_distributedattackdetectorservice.yaml index 1163ed87d..22157d9a4 100644 --- a/manifests/l3_distributedattackdetectorservice.yaml +++ b/manifests/l3_distributedattackdetectorservice.yaml @@ -19,10 +19,6 @@ spec: ports: - containerPort: 10000 env: - - name: DB_ENGINE - value: "redis" - - name: REDIS_DATABASE_ID - value: "0" - name: LOG_LEVEL value: "DEBUG" readinessProbe: @@ -51,20 +47,3 @@ spec: - name: grpc port: 10000 targetPort: 10000 ---- -apiVersion: v1 -kind: Service -metadata: - name: distributedattackdetectorservice-public - labels: - app: distributedattackdetectorservice -spec: - type: NodePort - selector: - app: distributedattackdetectorservice - ports: - - name: grpc - protocol: TCP - port: 10000 - targetPort: 10000 ---- diff --git a/report_coverage_l3_attackmitigator.sh b/report_coverage_l3_attackmitigator.sh index 9ae29d813..74df2c280 100644 --- a/report_coverage_l3_attackmitigator.sh +++ b/report_coverage_l3_attackmitigator.sh @@ -1,3 +1,3 @@ #!/bin/bash -./report_coverage_all.sh | grep --color -E -i "^attackmitigator/.*$|$" +./report_coverage_all.sh | grep --color -E -i "^l3_attackmitigator/.*$|$" diff --git a/report_coverage_l3_centralizedattackdetector.sh b/report_coverage_l3_centralizedattackdetector.sh index ea34a1131..46faba45d 100644 --- a/report_coverage_l3_centralizedattackdetector.sh +++ b/report_coverage_l3_centralizedattackdetector.sh @@ -1,3 +1,3 @@ #!/bin/bash -./report_coverage_all.sh | grep --color -E -i "^centralizedattackdetector/.*$|$" +./report_coverage_all.sh | grep --color -E -i "^l3_centralizedattackdetector/.*$|$" diff --git a/report_coverage_l3_distributedattackdetector.sh b/report_coverage_l3_distributedattackdetector.sh index 842a55de4..eff6b1ce5 100644 --- a/report_coverage_l3_distributedattackdetector.sh +++ b/report_coverage_l3_distributedattackdetector.sh @@ -1,3 +1,3 @@ #!/bin/bash -./report_coverage_all.sh | grep --color -E -i "^distributedattackdetector/.*$|$" +./report_coverage_all.sh | grep --color -E -i "^l3_distributedattackdetector/.*$|$" diff --git a/src/l3_attackmitigator/client/l3_attackmitigatorClient.py b/src/l3_attackmitigator/client/l3_attackmitigatorClient.py index dca6c60ec..190d63884 100644 --- a/src/l3_attackmitigator/client/l3_attackmitigatorClient.py +++ b/src/l3_attackmitigator/client/l3_attackmitigatorClient.py @@ -3,6 +3,10 @@ from common.tools.client.RetryDecorator import retry, delay_exponential from l3_attackmitigator.proto.l3_attackmitigator_pb2_grpc import ( L3AttackmitigatorStub, ) +from l3_attackmitigator.proto.l3_attackmitigator_pb2 import ( + Output, + EmptyMitigator +) LOGGER = logging.getLogger(__name__) MAX_RETRIES = 15 @@ -28,3 +32,17 @@ class l3_attackmitigatorClient: self.channel = None self.stub = None + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def SendOutput(self, request: Output) -> EmptyMitigator: + LOGGER.debug('SendOutput request: {}'.format(request)) + response = self.stub.SendOutput(request) + LOGGER.debug('SendOutput result: {}'.format(response)) + return response + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def GetMitigation(self, request: EmptyMitigator) -> EmptyMitigator: + LOGGER.debug('GetMitigation request: {}'.format(request)) + response = self.stub.GetMitigation(request) + LOGGER.debug('GetMitigation result: {}'.format(response)) + return response + diff --git a/src/l3_attackmitigator/requirements.in b/src/l3_attackmitigator/requirements.in index 7a7646730..e11480b45 100644 --- a/src/l3_attackmitigator/requirements.in +++ b/src/l3_attackmitigator/requirements.in @@ -6,4 +6,3 @@ pytest pytest-benchmark numpy scikit-learn -redis diff --git a/src/l3_attackmitigator/service/__main__.py b/src/l3_attackmitigator/service/__main__.py index 3843c6c18..baa85988b 100644 --- a/src/l3_attackmitigator/service/__main__.py +++ b/src/l3_attackmitigator/service/__main__.py @@ -1,7 +1,6 @@ import logging, signal, sys, threading, os from prometheus_client import start_http_server from common.Settings import get_setting -from common.orm.Factory import get_database_backend as get_database from l3_attackmitigator.service.l3_attackmitigatorService import l3_attackmitigatorService from l3_attackmitigator.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, METRICS_PORT @@ -33,9 +32,6 @@ def main(): # Start metrics server start_http_server(metrics_port) - # Get database instance - #database = get_database() - # Starting l3_attackmitigator service grpc_service = l3_attackmitigatorService( port=service_port, max_workers=max_workers, grace_period=grace_period) diff --git a/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py b/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py index ce365548b..725dc36b4 100644 --- a/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py +++ b/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py @@ -1,69 +1,40 @@ from __future__ import print_function -from concurrent import futures -from subprocess import Popen, DEVNULL -import argparse -import sys -import time -import os -import grpc import logging -from typing import Dict -import grpc, logging -from prometheus_client import Counter, Histogram -from common.orm.Database import Database -from l3_attackmitigator.proto.context_pb2 import Empty from l3_attackmitigator.proto.l3_attackmitigator_pb2 import ( EmptyMitigator ) from l3_attackmitigator.proto.l3_attackmitigator_pb2_grpc import ( L3AttackmitigatorServicer, - add_L3AttackmitigatorServicer_to_server ) LOGGER = logging.getLogger(__name__) -LAST_VALUE = -1 - - class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): def __init__(self): LOGGER.debug("Creating Servicer...") + self.last_value = -1 + self.last_tag = 0 def SendOutput(self, request, context): # SEND CONFIDENCE TO MITIGATION SERVER logging.debug("") print("Server received mitigation values...", request.confidence) - LAST_VALUE = request.confidence - LAST_TAG = request.tag + last_value = request.confidence + last_tag = request.tag # RETURN OK TO THE CALLER return EmptyMitigator( - message=f"OK, received values: {LAST_TAG} with confidence {LAST_VALUE}." + message=f"OK, received values: {last_tag} with confidence {last_value}." ) def GetMitigation(self, request, context): # GET OR PERFORM MITIGATION STRATEGY logging.debug("") print("Returing mitigation strategy...") - k = LAST_VALUE * 2 + k = self.last_value * 2 return EmptyMitigator( message=f"Mitigation with double confidence = {k}" ) - ''' - def serve(self): - server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) - add_L3AttackmitigatorServicer_to_server(self.Mitigator(), server) - server.add_insecure_port('[::]:10002') - server.start() - print('Server Started') - server.wait_for_termination() - print('Server Terminated') - - def setupl3_attackmitigator(self): - logging.basicConfig() - self.serve() - ''' - diff --git a/src/l3_attackmitigator/tests/test_unitary.py b/src/l3_attackmitigator/tests/test_unitary.py index 7ef202f24..1aa6fc4a8 100644 --- a/src/l3_attackmitigator/tests/test_unitary.py +++ b/src/l3_attackmitigator/tests/test_unitary.py @@ -1,21 +1,11 @@ -import copy -import grpc import logging import pytest -import multiprocessing -import subprocess -import time -from l3_attackmitigator.proto.monitoring_pb2 import Kpi, KpiList -from common.orm.Factory import get_database_backend as get_database, BackendEnum as DatabaseEngineEnum from l3_attackmitigator.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD from l3_attackmitigator.client.l3_attackmitigatorClient import l3_attackmitigatorClient from l3_attackmitigator.service.l3_attackmitigatorService import l3_attackmitigatorService from l3_attackmitigator.proto.l3_attackmitigator_pb2 import ( Output, ) -from l3_attackmitigator.proto.l3_attackmitigator_pb2_grpc import ( - L3AttackmitigatorStub, -) port = 10000 + GRPC_SERVICE_PORT # avoid privileged ports @@ -43,30 +33,21 @@ def test_demo(): LOGGER.info('Demo Test') pass -def test_grpc_server(l3_attackmitigator_service): +def test_grpc_server(l3_attackmitigator_client): output_message = { - "confidence": 0.8, - "timestamp": "date", - "ip_o": "randomIP", - "tag_name": "HTTP", - "tag": 0, - "flow_id": "FlowID", - "protocol": "RandomProtocol", - "port_d": "3456", - "ml_id": "RandomForest", - "time_start": 0.0, - "time_end": 10.0, - } - - def open_channel(input_information): - LOGGER.info(str(f"localhost:{port}")) - with grpc.insecure_channel(f"localhost:{port}") as channel: - stub = L3AttackmitigatorStub(channel) - response = stub.SendOutput(input_information) - LOGGER.info("Inferencer send_input sent and received: "+str(response.message)) - try: - open_channel(Output(**output_message)) - LOGGER.info('Success!') - except: - assert 0=="GRPC server failed" - + "confidence": 0.8, + "timestamp": "date", + "ip_o": "randomIP", + "tag_name": "HTTP", + "tag": 0, + "flow_id": "FlowID", + "protocol": "RandomProtocol", + "port_d": "3456", + "ml_id": "RandomForest", + "time_start": 0.0, + "time_end": 10.0, + } + response = l3_attackmitigator_client.SendOutput(Output(**output_message)) + LOGGER.info("Inferencer send_input sent and received: " + + str(response.message)) + LOGGER.info('Success!') diff --git a/src/l3_centralizedattackdetector/client/l3_centralizedattackdetectorClient.py b/src/l3_centralizedattackdetector/client/l3_centralizedattackdetectorClient.py index cc08a7559..cd1178348 100644 --- a/src/l3_centralizedattackdetector/client/l3_centralizedattackdetectorClient.py +++ b/src/l3_centralizedattackdetector/client/l3_centralizedattackdetectorClient.py @@ -4,12 +4,16 @@ from l3_centralizedattackdetector.proto.context_pb2 import Empty from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2_grpc import ( L3CentralizedattackdetectorStub, ) +from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2 import ( + Empty, + ModelInput, + ModelOutput +) LOGGER = logging.getLogger(__name__) MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) - class l3_centralizedattackdetectorClient: def __init__(self, address, port): self.endpoint = "{}:{}".format(address, port) @@ -30,10 +34,17 @@ class l3_centralizedattackdetectorClient: self.stub = None @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') - def DetectAttack(self, request : Empty) -> Empty: - LOGGER.debug('DetectAttack request: {}'.format(request)) - response = self.stub.DetectAttack(request) - LOGGER.debug('DetectAttack result: {}'.format(response)) + def SendInput(self, request: ModelInput) -> Empty: + LOGGER.debug('SendInput request: {}'.format(request)) + response = self.stub.SendInput(request) + LOGGER.debug('SendInput result: {}'.format(response)) + return response + + @retry(exceptions=set(), max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION, prepare_method_name='connect') + def GetOutput(self, request: Empty) -> ModelOutput: + LOGGER.debug('GetOutput request: {}'.format(request)) + response = self.stub.GetOutput(request) + LOGGER.debug('GetOutput result: {}'.format(response)) return response diff --git a/src/l3_centralizedattackdetector/requirements.in b/src/l3_centralizedattackdetector/requirements.in index 7a7646730..e3d53682f 100644 --- a/src/l3_centralizedattackdetector/requirements.in +++ b/src/l3_centralizedattackdetector/requirements.in @@ -5,5 +5,4 @@ prometheus-client pytest pytest-benchmark numpy -scikit-learn -redis +scikit-learn \ No newline at end of file diff --git a/src/l3_centralizedattackdetector/service/__main__.py b/src/l3_centralizedattackdetector/service/__main__.py index 1e593111b..b05d5b147 100644 --- a/src/l3_centralizedattackdetector/service/__main__.py +++ b/src/l3_centralizedattackdetector/service/__main__.py @@ -1,7 +1,6 @@ import logging, signal, sys, threading, os from prometheus_client import start_http_server from common.Settings import get_setting -from common.orm.Factory import get_database_backend as get_database from l3_centralizedattackdetector.service.l3_centralizedattackdetectorService import l3_centralizedattackdetectorService from l3_centralizedattackdetector.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD, LOG_LEVEL, METRICS_PORT diff --git a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py index 993198c5e..47ba5fe37 100644 --- a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py +++ b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py @@ -1,24 +1,16 @@ from __future__ import print_function -from concurrent import futures -from subprocess import Popen, DEVNULL -import argparse -import sys -import time from datetime import datetime import os import grpc import numpy as np import pickle as pkl import logging -import grpc, logging -from common.orm.Database import Database from l3_centralizedattackdetector.proto.context_pb2 import Empty from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2 import ( Empty, ) from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2_grpc import ( L3CentralizedattackdetectorServicer, - add_L3CentralizedattackdetectorServicer_to_server ) from l3_centralizedattackdetector.proto.l3_attackmitigator_pb2 import ( @@ -31,48 +23,17 @@ from l3_centralizedattackdetector.proto.l3_attackmitigator_pb2_grpc import ( LOGGER = logging.getLogger(__name__) here = os.path.dirname(os.path.abspath(__file__)) MODEL_FILE = os.path.join(here, "ml_model/RF_Netflow_TF") -INFERENCE_VALUES = [] - class l3_centralizedattackdetectorServiceServicerImpl(L3CentralizedattackdetectorServicer): def __init__(self): LOGGER.debug("Creating Servicer...") + self.inference_values = [] with open(MODEL_FILE, "rb") as f: self.ml_model = pkl.load(f) - def SendInput(self, request, context): - # PERFORM INFERENCE WITH SENT INPUTS - logging.debug("") - print("Inferencing ...") - - # STORE VALUES - INFERENCE_VALUES.append(request) - - # MAKE INFERENCE - output = self.make_inference(request) - - # SEND INFO TO MITIGATION SERVER - try: - with grpc.insecure_channel("localhost:10002") as channel: - stub = L3AttackmitigatorStub(channel) - print("Sending to mitigator...") - response = stub.SendOutput(output) - print("Sent output to mitigator and received: ", response.message) - - # RETURN "OK" TO THE CALLER - return Empty( - message="OK, information received and mitigator notified" - ) - except: - print('Couldnt find l3_attackmitigator') - return Empty( - message="Mitigator Not found" - ) - def make_inference(self, request): # ML MODEL - # new_predictions = model.predict_proba(list(new_connections.values())) predictions = self.ml_model.predict_proba( [ [ @@ -112,32 +73,42 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto return Output(**output_message) + def SendInput(self, request, context): + # PERFORM INFERENCE WITH SENT INPUTS + logging.debug("") + print("Inferencing ...") + + # STORE VALUES + self.inference_values.append(request) + + # MAKE INFERENCE + output = self.make_inference(request) + + # SEND INFO TO MITIGATION SERVER + try: + with grpc.insecure_channel("localhost:10002") as channel: + stub = L3AttackmitigatorStub(channel) + print("Sending to mitigator...") + response = stub.SendOutput(output) + print("Sent output to mitigator and received: ", response.message) + + # RETURN "OK" TO THE CALLER + return Empty( + message="OK, information received and mitigator notified" + ) + except: + print('Couldnt find l3_attackmitigator') + return Empty( + message="Mitigator Not found" + ) + def GetOutput(self, request, context): logging.debug("") print("Returing inference output...") - k = np.multiply(INFERENCE_VALUES, [2]) + k = np.multiply(self.inference_values, [2]) k = np.sum(k) return self.make_inference(k) - ''' - def setup_l3_centralizedattackdetector(self): - print('Starting CAD') - with open(MODEL_FILE, "rb") as f: - ml_model = pkl.load(f) - server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) - add_L3CentralizedattackdetectorServicer_to_server( - self.CAD(ml_model), server) - server.add_insecure_port("[::]:10001") - server.start() - server.wait_for_termination() - - def DetectAttack(self, request: Empty, grpc_context: grpc.ServicerContext) -> Empty: - LOGGER.debug('DetectAttack request: {}'.format(str(request))) - reply = Empty() - LOGGER.debug('DetectAttack reply: {}'.format(str(reply))) - return reply - ''' - diff --git a/src/l3_centralizedattackdetector/tests/test_unitary.py b/src/l3_centralizedattackdetector/tests/test_unitary.py index e7cabcba5..2f991feda 100644 --- a/src/l3_centralizedattackdetector/tests/test_unitary.py +++ b/src/l3_centralizedattackdetector/tests/test_unitary.py @@ -1,13 +1,8 @@ -import copy -import grpc import logging import pytest from l3_centralizedattackdetector.Config import GRPC_SERVICE_PORT, GRPC_MAX_WORKERS, GRPC_GRACE_PERIOD from l3_centralizedattackdetector.client.l3_centralizedattackdetectorClient import l3_centralizedattackdetectorClient from l3_centralizedattackdetector.service.l3_centralizedattackdetectorService import l3_centralizedattackdetectorService -from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2_grpc import ( - L3CentralizedattackdetectorStub, -) from l3_centralizedattackdetector.proto.l3_centralizedattackdetector_pb2 import ( ModelInput, ) @@ -36,33 +31,29 @@ def test_demo(): LOGGER.info('Demo Test') pass -def test_system(l3_centralizedattackdetector_service): + +def test_system(l3_centralizedattackdetector_client): inference_information = { - "n_packets_server_seconds": 5.0, - "n_packets_client_seconds": 5.0, - "n_bits_server_seconds": 5.0, - "n_bits_client_seconds": 5.0, - "n_bits_server_n_packets_server": 5.0, - "n_bits_client_n_packets_client": 5.0, - "n_packets_server_n_packets_client": 5.0, - "n_bits_server_n_bits_client": 5.0, - "ip_o": "ipo", - "port_o": "porto", - "ip_d": "ipd", - "port_d": "portd", - "flow_id": "flowid", - "protocol": "protocol", - "time_start": 0.0, - "time_end": 10.0, + "n_packets_server_seconds": 5.0, + "n_packets_client_seconds": 5.0, + "n_bits_server_seconds": 5.0, + "n_bits_client_seconds": 5.0, + "n_bits_server_n_packets_server": 5.0, + "n_bits_client_n_packets_client": 5.0, + "n_packets_server_n_packets_client": 5.0, + "n_bits_server_n_bits_client": 5.0, + "ip_o": "ipo", + "port_o": "porto", + "ip_d": "ipd", + "port_d": "portd", + "flow_id": "flowid", + "protocol": "protocol", + "time_start": 0.0, + "time_end": 10.0, } - def open_channel(input_information): - LOGGER.info(str(f"localhost:{port}")) - with grpc.insecure_channel(f"localhost:{port}") as channel: - stub = L3CentralizedattackdetectorStub(channel) - response = stub.SendInput(input_information) - LOGGER.info("Cad send_input sent and received: "+str(response.message)) - try: - open_channel(ModelInput(**inference_information)) - except: - assert 0=="GRPC server failed" + response = l3_centralizedattackdetector_client.SendInput( + ModelInput(**inference_information)) + LOGGER.info("Cad send_input sent and received: "+str(response.message)) + LOGGER.info('Success!') + diff --git a/src/l3_distributedattackdetector/client/l3_distributedattackdetectorClient.py b/src/l3_distributedattackdetector/client/l3_distributedattackdetectorClient.py index 03ae029ee..4f061ac79 100644 --- a/src/l3_distributedattackdetector/client/l3_distributedattackdetectorClient.py +++ b/src/l3_distributedattackdetector/client/l3_distributedattackdetectorClient.py @@ -1,7 +1,5 @@ import grpc, logging from common.tools.client.RetryDecorator import retry, delay_exponential -from l3_distributedattackdetector.proto.context_pb2 import Empty -from l3_distributedattackdetector.proto.monitoring_pb2 import KpiList from l3_distributedattackdetector.proto.l3_centralizedattackdetector_pb2_grpc import ( L3CentralizedattackdetectorStub, ) @@ -10,7 +8,6 @@ LOGGER = logging.getLogger(__name__) MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) - class l3_distributedattackdetectorClient: def __init__(self, address, port): self.endpoint = "{}:{}".format(address, port) diff --git a/src/l3_distributedattackdetector/requirements.in b/src/l3_distributedattackdetector/requirements.in index 7a7646730..e11480b45 100644 --- a/src/l3_distributedattackdetector/requirements.in +++ b/src/l3_distributedattackdetector/requirements.in @@ -6,4 +6,3 @@ pytest pytest-benchmark numpy scikit-learn -redis -- GitLab