diff --git a/deploy_in_kubernetes.sh b/deploy_in_kubernetes.sh index b5959c5d80b59f3220d86706e637d496231b45a2..3f75c86dbdea6a5792924e62185977b8d90f04bf 100755 --- a/deploy_in_kubernetes.sh +++ b/deploy_in_kubernetes.sh @@ -10,7 +10,7 @@ REGISTRY_IMAGE="" #REGISTRY_IMAGE="http://my-container-registry.local/" # Set the list of components you want to build images for, and deploy. -COMPONENTS="context device automation policy service compute monitoring centralizedattackdetector" +COMPONENTS="context device automation policy service compute monitoring centralizedattackdetector opticalcentralizedattackdetector" # Set the tag you want to use for your images. IMAGE_TAG="tf-dev" @@ -38,6 +38,10 @@ kubectl delete namespace $K8S_NAMESPACE kubectl create namespace $K8S_NAMESPACE printf "\n" +# creating secrets +kubectl create secret generic influxdb-secrets --namespace=tf-dev --from-literal=INFLUXDB_USER='test_user' --from-literal=INFLUXDB_DATABASE='test' --from-literal=INFLUXDB_HOSTNAME='influxdb' --from-literal=INFLUXDB_PASSWORD='test_password' +kubectl create secret generic monitoring-secrets --namespace=tf-dev --from-literal=INFLUXDB_USER='test_user' --from-literal=INFLUXDB_DATABASE='test' --from-literal=INFLUXDB_HOSTNAME='influxdb' --from-literal=INFLUXDB_PASSWORD='test_password' + for COMPONENT in $COMPONENTS; do echo "Processing '$COMPONENT' component..." IMAGE_NAME="$COMPONENT:$IMAGE_TAG" diff --git a/src/opticalcentralizedattackdetector/Config.py b/src/opticalcentralizedattackdetector/Config.py index e5a33adf3c449fcd835cf6013e053258c7ec2faf..94a941ed48cb2a15fa0b9568978b9bde46ef0c55 100644 --- a/src/opticalcentralizedattackdetector/Config.py +++ b/src/opticalcentralizedattackdetector/Config.py @@ -12,11 +12,11 @@ GRPC_GRACE_PERIOD = 60 MONITORING_INTERVAL = 2 # monitoring interval in seconds #TODO: adjust the addresses below for the specific case # MONITORING_SERVICE_ADDRESS = 'monitoring' # address/name of the monitoring service -MONITORING_SERVICE_ADDRESS = 'localhost' # address/name of the monitoring service +MONITORING_SERVICE_ADDRESS = '10.109.226.172' # address/name of the monitoring service # CONTEXT_SERVICE_ADDRESS = 'context' # address/name of the monitoring service -CONTEXT_SERVICE_ADDRESS = '10.103.238.143' # address/name of the monitoring service +CONTEXT_SERVICE_ADDRESS = '10.98.160.79' # address/name of the monitoring service # SERVICE_SERVICE_ADDRESS = 'service' # address/name of the service service -SERVICE_SERVICE_ADDRESS = '10.98.1.146' # address/name of the service service +SERVICE_SERVICE_ADDRESS = '10.97.59.81' # address/name of the service service # INFERENCE_SERVICE_ADDRESS = 'dbscanserving' # address/name of the inference service INFERENCE_SERVICE_ADDRESS = 'localhost' # address/name of the inference service diff --git a/src/opticalcentralizedattackdetector/service/__main__.py b/src/opticalcentralizedattackdetector/service/__main__.py index 7dba022cbc6443161e27e1583d1baa62d96c9c78..e18cbff2adad42363ce0d2794f61243f8d84a4f8 100644 --- a/src/opticalcentralizedattackdetector/service/__main__.py +++ b/src/opticalcentralizedattackdetector/service/__main__.py @@ -40,14 +40,20 @@ def detect_attack(monitoring_interval): context_ids: ContextIdList = context_client.ListContextIds(Empty()) # for each context, retrieve list of current services - service_uuids = [] + services = [] for context_id in context_ids.context_ids: - LOGGER.warning(context_id.context_uuid.uuid) - service_ids: ServiceIdList = context_client.ListServiceIds(context_id) - for service_id in service_ids.service_ids: - service_uuids.append((service_id.context_id.context_uuid.uuid, service_id.service_uuid.uuid)) + + 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 + 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? + pass # run attack detection for every service