Commit e4c17515 authored by Luis de la Cal's avatar Luis de la Cal
Browse files

Fixed L3 security status KPIs monitoring in CentralizedAttackDetector...

Fixed L3 security status KPIs monitoring in CentralizedAttackDetector component and added scenario 3 components to my_deploy.sh
parent 5f025ff1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/"
#   interdomain slice pathcomp dlt
#   dbscanserving opticalattackmitigator opticalcentralizedattackdetector
#   l3_attackmitigator l3_centralizedattackdetector l3_distributedattackdetector
export TFS_COMPONENTS="context device automation service compute monitoring webui"
export TFS_COMPONENTS="context device automation service compute monitoring webui l3_attackmitigator l3_centralizedattackdetector"

# Set the tag you want to use for your images.
export TFS_IMAGE_TAG="dev"
+27 −0
Original line number Diff line number Diff line
@@ -137,6 +137,33 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto
        # MAKE INFERENCE
        output = self.make_inference(request)

        # Monitoring
        service_id = request.service_id

        if self.predicted_class_kpi_id is None:
            self.predicted_class_kpi_id = self.create_predicted_class_kpi(self.monitoring_client, service_id)

        if self.class_probability_kpi_id is None:
            self.class_probability_kpi_id = self.create_class_prob_kpi(self.monitoring_client, service_id)

        # Packet -> DAD -> CAD -> ML -> (2 Instantaneous Value: higher class probability, predicted class) -> Monitoring
        # In addition, two counters:
        # Counter 1: Total number of crypto attack connections
        # Counter 2: Rate of crypto attack connections with respect to the total number of connections

        kpi_class = Kpi()
        kpi_class.kpi_id.kpi_id.uuid = self.predicted_class_kpi_id.uuid
        kpi_class.kpi_value.int32Val = 1 if request.tag_name == "Crypto" else 0

        kpi_prob = Kpi()
        kpi_prob.kpi_id.kpi_id.uuid = self.class_probability_kpi_id.uuid
        kpi_prob.kpi_value.floatVal = request.confidence

        kpi_class.timestamp = kpi_prob.timestamp = Timestamp()

        self.monitoring_client.IncludeKpi(kpi_class)
        self.monitoring_client.IncludeKpi(kpi_prob)

        if output.tag_name == "Crypto":
            # SEND INFO TO MITIGATION SERVER
            try: