diff --git a/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py b/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py index 07b5c6db19bfd726ffd4fedf71788507414972c9..da950df7533fb80c587a8c918628832625470b0e 100644 --- a/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py +++ b/src/l3_attackmitigator/service/l3_attackmitigatorServiceServicerImpl.py @@ -146,8 +146,8 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): ) acl_entry.match.src_address = "{}/32".format(src_ip) acl_entry.match.dst_address = "{}/32".format(dst_ip) - acl_entry.match.src_port = src_port - acl_entry.match.dst_port = dst_port + acl_entry.match.src_port = int(src_port) + acl_entry.match.dst_port = int(dst_port) # TODO: update the following parameters; for instance, add them as parameters of the method configure_acl_rule acl_entry.action.forward_action = AclForwardActionEnum.ACLFORWARDINGACTION_DROP acl_entry.action.log_action = AclLogActionEnum.ACLLOGACTION_NOLOG @@ -194,23 +194,23 @@ class l3_attackmitigatorServiceServicerImpl(L3AttackmitigatorServicer): LOGGER.info("Service obtained from ServiceId:\n{}".format(service)) # Old version - config_rule = self.GetConfigRule(ip_o, ip_d, port_o, port_d) + # config_rule = self.GetConfigRule(ip_o, ip_d, port_o, port_d) - service_config = ServiceConfig() - service_config.config_rules.extend([config_rule]) - service.service_config.CopyFrom(service_config) + # service_config = ServiceConfig() + # service_config.config_rules.extend([config_rule]) + # service.service_config.CopyFrom(service_config) # New version - # self.configure_acl_rule( - # context_uuid=service_id.context_id.context_uuid.uuid, - # service_uuid=service_id.service_uuid.uuid, - # device_uuid=request.device_id.device_uuid.uuid, - # endpoint_uuid=request.endpoint_id.endpoint_uuid.uuid, - # src_ip=ip_o, - # dst_ip=ip_d, - # src_port=port_o, - # dst_port=port_d, - # ) + self.configure_acl_rule( + context_uuid=service_id.context_id.context_uuid.uuid, + service_uuid=service_id.service_uuid.uuid, + device_uuid=request.endpoint_id.device_id.device_uuid.uuid, + endpoint_uuid=request.endpoint_id.endpoint_uuid.uuid, + src_ip=ip_o, + dst_ip=ip_d, + src_port=port_o, + dst_port=port_d, + ) LOGGER.info("Service with new rule:\n{}".format(service)) self.UpdateService(service) diff --git a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py index 50151efb5f0909df5c90da2c01799dd1f0688b4d..7ee533806dab9bf5810a0df731221e87310b1b70 100644 --- a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py +++ b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py @@ -112,6 +112,7 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto "port_d": request.port_d, "ml_id": "RandomForest", "service_id": request.service_id, + "endpoint_id": request.endpoint_id, "time_start": request.time_start, "time_end": request.time_end, } @@ -203,4 +204,3 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto k = np.sum(k) return self.make_inference(k) -