Loading src/dbscanserving/client/DbscanServingClient.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) class DbscanServingClient: def __init__(self, host, port): self.endpoint = '{:s}:{:s}'.format(str(host), str(port)) 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 Loading src/opticalattackmitigator/client/OpticalAttackMitigatorClient.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) class OpticalAttackMitigatorClient: def __init__(self, host, port): self.endpoint = '{:s}:{:s}'.format(str(host), str(port)) 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 Loading src/opticalattackmitigator/service/OpticalAttackMitigatorServiceServicerImpl.py +1 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,6 @@ class OpticalAttackMitigatorServiceServicerImpl(AttackMitigatorServicer): @safe_and_metered_rpc_method(METRICS, LOGGER) def NotifyAttack(self, request : AttackDescription, context : grpc.ServicerContext) -> AttackResponse: LOGGER.debug(f"NotifyAttack: {request}") response: AttackResponse = AttackDescription() response: AttackResponse = AttackResponse() response.response_strategy_description = 'The AttackMitigator has received the attack description.' return response src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py +2 −3 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class OpticalCentralizedAttackDetectorServiceServicerImpl(OpticalCentralizedAtta self.monitoring_client: MonitoringClient = MonitoringClient(server=MONITORING_SERVICE_ADDRESS, port=MONITORING_GRPC_SERVICE_PORT) self.service_client: ServiceClient = ServiceClient(SERVICE_SERVICE_ADDRESS, SERVICE_GRPC_SERVICE_PORT) self.influxdb_client: InfluxDBClient = InfluxDBClient(host=MONITORING_SERVICE_ADDRESS, port=8086, username=INFLUXDB_USER, password=INFLUXDB_PASSWORD, database=INFLUXDB_DATABASE) self.dbscanserving_client: DbscanServingClient = DbscanServingClient(host=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) self.attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient(host=ATTACK_MITIGATOR_SERVICE_ADDRESS, port=ATTACK_MITIGATOR_GRPC_SERVICE_PORT) self.dbscanserving_client: DbscanServingClient = DbscanServingClient(address=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) self.attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient(address=ATTACK_MITIGATOR_SERVICE_ADDRESS, port=ATTACK_MITIGATOR_GRPC_SERVICE_PORT) LOGGER.debug('Servicer Created') @safe_and_metered_rpc_method(METRICS, LOGGER) Loading @@ -70,7 +70,6 @@ class OpticalCentralizedAttackDetectorServiceServicerImpl(OpticalCentralizedAtta # get monitoring data for each of the current services results = self.influxdb_client.query('select * from samples;') print(results.raw) for service in services: for endpoint in service.service_endpoint_ids: Loading src/opticalcentralizedattackdetector/service/__main__.py +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ def signal_handler(signal, frame): # pylint: disable=redefined-outer-name 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() Loading Loading
src/dbscanserving/client/DbscanServingClient.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) class DbscanServingClient: def __init__(self, host, port): self.endpoint = '{:s}:{:s}'.format(str(host), str(port)) 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 Loading
src/opticalattackmitigator/client/OpticalAttackMitigatorClient.py +2 −2 Original line number Diff line number Diff line Loading @@ -8,8 +8,8 @@ MAX_RETRIES = 15 DELAY_FUNCTION = delay_exponential(initial=0.01, increment=2.0, maximum=5.0) class OpticalAttackMitigatorClient: def __init__(self, host, port): self.endpoint = '{:s}:{:s}'.format(str(host), str(port)) 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 Loading
src/opticalattackmitigator/service/OpticalAttackMitigatorServiceServicerImpl.py +1 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,6 @@ class OpticalAttackMitigatorServiceServicerImpl(AttackMitigatorServicer): @safe_and_metered_rpc_method(METRICS, LOGGER) def NotifyAttack(self, request : AttackDescription, context : grpc.ServicerContext) -> AttackResponse: LOGGER.debug(f"NotifyAttack: {request}") response: AttackResponse = AttackDescription() response: AttackResponse = AttackResponse() response.response_strategy_description = 'The AttackMitigator has received the attack description.' return response
src/opticalcentralizedattackdetector/service/OpticalCentralizedAttackDetectorServiceServicerImpl.py +2 −3 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class OpticalCentralizedAttackDetectorServiceServicerImpl(OpticalCentralizedAtta self.monitoring_client: MonitoringClient = MonitoringClient(server=MONITORING_SERVICE_ADDRESS, port=MONITORING_GRPC_SERVICE_PORT) self.service_client: ServiceClient = ServiceClient(SERVICE_SERVICE_ADDRESS, SERVICE_GRPC_SERVICE_PORT) self.influxdb_client: InfluxDBClient = InfluxDBClient(host=MONITORING_SERVICE_ADDRESS, port=8086, username=INFLUXDB_USER, password=INFLUXDB_PASSWORD, database=INFLUXDB_DATABASE) self.dbscanserving_client: DbscanServingClient = DbscanServingClient(host=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) self.attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient(host=ATTACK_MITIGATOR_SERVICE_ADDRESS, port=ATTACK_MITIGATOR_GRPC_SERVICE_PORT) self.dbscanserving_client: DbscanServingClient = DbscanServingClient(address=INFERENCE_SERVICE_ADDRESS, port=DBSCANSERVING_GRPC_SERVICE_PORT) self.attack_mitigator_client: OpticalAttackMitigatorClient = OpticalAttackMitigatorClient(address=ATTACK_MITIGATOR_SERVICE_ADDRESS, port=ATTACK_MITIGATOR_GRPC_SERVICE_PORT) LOGGER.debug('Servicer Created') @safe_and_metered_rpc_method(METRICS, LOGGER) Loading @@ -70,7 +70,6 @@ class OpticalCentralizedAttackDetectorServiceServicerImpl(OpticalCentralizedAtta # get monitoring data for each of the current services results = self.influxdb_client.query('select * from samples;') print(results.raw) for service in services: for endpoint in service.service_endpoint_ids: Loading
src/opticalcentralizedattackdetector/service/__main__.py +1 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ def signal_handler(signal, frame): # pylint: disable=redefined-outer-name 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() Loading