Commit 436e649e authored by Carlos Natalino's avatar Carlos Natalino
Browse files

Continuing with the implementation of the workflow

parent 527ca678
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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"
+3 −3
Original line number Diff line number Diff line
@@ -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

+11 −5
Original line number Diff line number Diff line
@@ -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