diff --git a/my_deploy.sh b/my_deploy.sh index 67a2e0558c25d767e14b635e6dd9174433827156..b523f6652996e0bbf040f1239cf06c36ca635ef3 100644 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -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" diff --git a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py index f66401a95f7766ade02642f5e7fa5354e22da6fa..4386e6726faacef38a4361255c4db24aecd7c092 100644 --- a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py +++ b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py @@ -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: