bdi-network-resilience
Changes
network-resilience/.classpath 1(+1 -0)
network-resilience/.project 3(+3 -0)
network-resilience/APDescription.txt 2(+1 -1)
Details
network-resilience/.classpath 1(+1 -0)
diff --git a/network-resilience/.classpath b/network-resilience/.classpath
index 0f45fde..a840a13 100644
--- a/network-resilience/.classpath
+++ b/network-resilience/.classpath
@@ -3,6 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/bdi-jade"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/bdi-jade-extensions"/>
<classpathentry kind="lib" path="/bdi-jade/lib/commons-logging-1.1.3.jar"/>
<classpathentry kind="lib" path="/bdi-jade/lib/jade-4.3.2.jar"/>
<classpathentry kind="lib" path="/bdi-jade/lib/log4j-1.2.17.jar"/>
network-resilience/.project 3(+3 -0)
diff --git a/network-resilience/.project b/network-resilience/.project
index 93b6f47..2e3b038 100644
--- a/network-resilience/.project
+++ b/network-resilience/.project
@@ -3,6 +3,9 @@
<name>network-resilience</name>
<comment></comment>
<projects>
+ <project>bdi-jade</project>
+ <project>bdi-jade-debugger</project>
+ <project>bdi-jade-extensions</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/network-resilience/.settings/org.eclipse.jdt.core.prefs b/network-resilience/.settings/org.eclipse.jdt.core.prefs
index 838bd9d..980b98c 100644
--- a/network-resilience/.settings/org.eclipse.jdt.core.prefs
+++ b/network-resilience/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
network-resilience/APDescription.txt 2(+1 -1)
diff --git a/network-resilience/APDescription.txt b/network-resilience/APDescription.txt
index f5daa80..685c43c 100644
--- a/network-resilience/APDescription.txt
+++ b/network-resilience/APDescription.txt
@@ -1 +1 @@
-( ap-description :name "143.54.13.160:1099/JADE" :ap-services (set ( ap-service :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://IngridNunes-PC.inf.ufrgs.br:7778/acc))))
+( ap-description :name "BDINetRApp" :ap-services (set ( ap-service :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://inf5090csm040-VirtualBox:7778/acc))))
diff --git a/network-resilience/MTPs-Main-Container.txt b/network-resilience/MTPs-Main-Container.txt
index 08cdd31..ce145e5 100644
--- a/network-resilience/MTPs-Main-Container.txt
+++ b/network-resilience/MTPs-Main-Container.txt
@@ -1 +1 @@
-http://IngridNunes-PC.inf.ufrgs.br:7778/acc
+http://inf5090csm040-VirtualBox:7778/acc
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/AnomalyDetectionCapability.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/AnomalyDetectionCapability.java
index b5bc5ef..9c9edd4 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/AnomalyDetectionCapability.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/AnomalyDetectionCapability.java
@@ -24,6 +24,9 @@ package br.ufrgs.inf.bdinetr.agent;
import java.util.Iterator;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.annotation.Parameter;
import bdi4jade.annotation.Parameter.Direction;
import bdi4jade.belief.Belief;
@@ -43,7 +46,6 @@ import bdi4jade.plan.Plan;
import bdi4jade.plan.Plan.EndState;
import bdi4jade.plan.planbody.BeliefGoalPlanBody;
import bdi4jade.reasoning.BeliefRevisionStrategy;
-import bdi4jade.reasoning.DeliberationFunction;
import bdi4jade.reasoning.OptionGenerationFunction;
import br.ufrgs.inf.bdinetr.agent.belief.AnomalousUsageBelief;
import br.ufrgs.inf.bdinetr.domain.AnomalyDetection;
@@ -95,6 +97,7 @@ public class AnomalyDetectionCapability extends RouterAgentCapability implements
private Ip ip;
private boolean subgoalDispatched;
+ protected Log log;
@Override
public void execute() {
@@ -104,6 +107,7 @@ public class AnomalyDetectionCapability extends RouterAgentCapability implements
this.subgoalDispatched = true;
} else {
GoalEvent event = getGoalEvent();
+
if (event != null) {
if (GoalStatus.ACHIEVED.equals(event.getStatus())) {
addBelief(((BeliefGoal<?>) event.getGoal())
@@ -195,7 +199,7 @@ public class AnomalyDetectionCapability extends RouterAgentCapability implements
setBeliefRevisionStrategy(this);
setOptionGenerationFunction(this);
-
+
beliefGoalRequestPlan.addGoalTemplate(GoalTemplateFactory
.hasBeliefOfTypeWithValue(IpRateLimited.class, true), this,
Role.RATE_LIMITER, false);
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/goal/LimitIpGoal.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/goal/LimitIpGoal.java
new file mode 100644
index 0000000..da6e7cc
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/goal/LimitIpGoal.java
@@ -0,0 +1,7 @@
+package br.ufrgs.inf.bdinetr.agent.goal;
+
+import bdi4jade.goal.Goal;
+
+public class LimitIpGoal implements Goal {
+ private static final long serialVersionUID = 5008348479798066431L;
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/IPRateLimiterCapability.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/IPRateLimiterCapability.java
new file mode 100644
index 0000000..6a690bd
--- /dev/null
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/IPRateLimiterCapability.java
@@ -0,0 +1,210 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+package br.ufrgs.inf.bdinetr.agent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import bdi4jade.annotation.Belief;
+import bdi4jade.annotation.Parameter;
+import bdi4jade.annotation.Parameter.Direction;
+import bdi4jade.belief.Predicate;
+import bdi4jade.extension.planselection.utilitybased.PlanContribution;
+import bdi4jade.extension.planselection.utilitybased.SoftgoalPreferences;
+import bdi4jade.extension.planselection.utilitybased.UtilityBasedPlanSelectionStrategy;
+import bdi4jade.goal.BeliefGoal;
+import bdi4jade.goal.Goal;
+import bdi4jade.goal.GoalTemplateFactory;
+import bdi4jade.goal.NamedSoftgoal;
+import bdi4jade.goal.Softgoal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+import bdi4jade.plan.planbody.BeliefGoalPlanBody;
+import bdi4jade.plan.planbody.PlanBody;
+import br.ufrgs.inf.bdinetr.agent.goal.LimitIpGoal;
+import br.ufrgs.inf.bdinetr.domain.Ip;
+import br.ufrgs.inf.bdinetr.domain.RateLimiter;
+import br.ufrgs.inf.bdinetr.domain.Role;
+import br.ufrgs.inf.bdinetr.domain.predicate.IpRateLimited;
+
+/**
+ * @author Ingrid Nunes and Frederico Schardong
+ */
+public class IPRateLimiterCapability extends RouterAgentCapability {
+ public interface Softgoals {
+ public static final Softgoal INTRUSION = new NamedSoftgoal("INTRUSION");
+ public static final Softgoal PROTECTION = new NamedSoftgoal("PROTECTION");
+ }
+
+ public class LimitIPRatePlanBody extends BeliefGoalPlanBody {
+ private static final long serialVersionUID = -3493377510830902861L;
+ protected Log log;
+
+ private Ip ip;
+
+ ParameterizedIPPlan plan;
+
+ private int getIPLimit(){
+ int intrusion = (int)(this.plan.getIntrusion() * 50);
+ int protection = (int)(this.plan.getProtection() * 50);
+
+ return 50 + protection - intrusion;
+ }
+
+ @Override
+ public void execute() {
+ this.plan = (ParameterizedIPPlan) this.getPlan();
+ this.log = LogFactory.getLog(getClass());
+
+ log.info("LimitIPRatePlanBody->execute called, ip: " + ip.getAddress()
+ + " protection: " + this.plan.getProtection() + " intrusion: " + this.plan.getIntrusion() + " limiting at: " + this.getIPLimit());
+
+ role.limitIp(ip, this.getIPLimit());
+ belief(new IpRateLimited(ip), true);
+ }
+
+ @Parameter(direction = Direction.IN)
+ public void setBeliefName(IpRateLimited ipRateLimited) {
+ this.ip = ipRateLimited.getConcept();
+ }
+ }
+
+ public class RestoreIPRatePlan extends BeliefGoalPlanBody {
+ private static final long serialVersionUID = -3493377510830902961L;
+
+ private Ip ip;
+
+ @Override
+ public void execute() {
+ role.unlimitIp(ip);
+ belief(new IpRateLimited(ip), false);
+ }
+
+ @Parameter(direction = Direction.IN)
+ public void setBeliefName(IpRateLimited ipRateLimited) {
+ this.ip = ipRateLimited.getConcept();
+ }
+ }
+
+ public class ParameterizedIPPlan extends DefaultPlan {
+ private double intrusion;
+ private double protection;
+
+ public ParameterizedIPPlan(double intrusion, double protection,
+ final Object beliefValue, Class<? extends PlanBody> planBodyClass) {
+ super(id + new Random().nextDouble(), GoalTemplateFactory.hasBeliefOfTypeWithValue(
+ IpRateLimited.class, beliefValue), planBodyClass);
+
+ this.intrusion = intrusion;
+ this.protection = protection;
+
+ this.generateMetadata();
+ }
+
+ private void generateMetadata(){
+ Map<Softgoal, List<PlanContribution>> contributions = new HashMap<Softgoal, List<PlanContribution>>();
+ List<PlanContribution> sgContributions = new ArrayList<PlanContribution>();
+
+ sgContributions = new ArrayList<PlanContribution>();
+ sgContributions.add(new PlanContribution(Softgoals.INTRUSION, 1.0, intrusion));
+ contributions.put(Softgoals.INTRUSION, sgContributions);
+
+ sgContributions = new ArrayList<PlanContribution>();
+ sgContributions.add(new PlanContribution(Softgoals.PROTECTION, 1.0, protection));
+ contributions.put(Softgoals.PROTECTION, sgContributions);
+
+ putMetadata(PlanContribution.METADATA_NAME, contributions);
+ }
+
+ public double getIntrusion(){
+ return this.intrusion;
+ }
+
+ public double getProtection(){
+ return this.protection;
+ }
+ }
+
+ //public static final int IP_LIMIT_RATE = 50;
+
+ @bdi4jade.annotation.Plan
+ private Plan limitIpRateIntrusive;
+ @bdi4jade.annotation.Plan
+ private Plan limitIpRateProtective;
+ @bdi4jade.annotation.Plan
+ private Plan limitIpRateBoth;
+ @bdi4jade.annotation.Plan
+ private Plan restoreIpRate;
+
+ @bdi4jade.annotation.TransientBelief
+ private final RateLimiter role;
+
+ @Belief(name = SoftgoalPreferences.NAME)
+ private SoftgoalPreferences preferences;
+
+ public IPRateLimiterCapability(RateLimiter rateLimiter) {
+ super();
+
+ this.preferences = new SoftgoalPreferences();
+ this.preferences.setPreferenceForSoftgoal(Softgoals.INTRUSION, 0.1);
+ this.preferences.setPreferenceForSoftgoal(Softgoals.PROTECTION, 0.9);
+
+ this.limitIpRateProtective = new ParameterizedIPPlan(0.1, 0.9, Boolean.TRUE, LimitIPRatePlanBody.class);
+ this.limitIpRateBoth = new ParameterizedIPPlan(0.5, 0.5, Boolean.TRUE, LimitIPRatePlanBody.class);
+ this.limitIpRateIntrusive = new ParameterizedIPPlan(0.9, 0.1, Boolean.TRUE, LimitIPRatePlanBody.class);
+
+ //somehow BDI4JADE didn't add my plans without getPlanLibrary().addPlan()
+ getPlanLibrary().addPlan(this.limitIpRateIntrusive);
+ getPlanLibrary().addPlan(this.limitIpRateProtective);
+ getPlanLibrary().addPlan(this.limitIpRateBoth);
+
+ this.role = rateLimiter;
+
+ this.restoreIpRate = new ParameterizedIPPlan(1, 1, Boolean.FALSE, RestoreIPRatePlan.class) {
+ public boolean isContextApplicable(Goal goal) {
+ BeliefGoal<IpRateLimited> bg = (BeliefGoal<IpRateLimited>) goal;
+ Predicate<IpRateLimited> rateLimited = (Predicate<IpRateLimited>) getBeliefBase()
+ .getBelief(bg.getBeliefName());
+ return rateLimited != null && rateLimited.getValue();
+ };
+ };
+
+ setPlanSelectionStrategy(new UtilityBasedPlanSelectionStrategy());
+ }
+
+ protected void setup() {
+ this.getMyAgent().addSoftgoal(Softgoals.INTRUSION);
+ this.getMyAgent().addSoftgoal(Softgoals.PROTECTION);
+ }
+
+ @Override
+ public Role getRole() {
+ return Role.RATE_LIMITER;
+ }
+
+}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RateLimiterCapability.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RateLimiterCapability.java
index ffb1044..91b25f6 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RateLimiterCapability.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RateLimiterCapability.java
@@ -21,29 +21,37 @@
//----------------------------------------------------------------------------
package br.ufrgs.inf.bdinetr.agent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import bdi4jade.annotation.Parameter;
import bdi4jade.annotation.Parameter.Direction;
import bdi4jade.belief.Predicate;
import bdi4jade.goal.BeliefGoal;
import bdi4jade.goal.Goal;
import bdi4jade.goal.GoalTemplateFactory;
+import bdi4jade.goal.NamedSoftgoal;
+import bdi4jade.goal.Softgoal;
import bdi4jade.plan.DefaultPlan;
import bdi4jade.plan.Plan;
import bdi4jade.plan.planbody.BeliefGoalPlanBody;
import br.ufrgs.inf.bdinetr.domain.Flow;
-import br.ufrgs.inf.bdinetr.domain.Ip;
import br.ufrgs.inf.bdinetr.domain.Link;
import br.ufrgs.inf.bdinetr.domain.RateLimiter;
import br.ufrgs.inf.bdinetr.domain.Role;
+import br.ufrgs.inf.bdinetr.domain.omnet.EventBroker;
import br.ufrgs.inf.bdinetr.domain.predicate.FlowRateLimited;
-import br.ufrgs.inf.bdinetr.domain.predicate.IpRateLimited;
import br.ufrgs.inf.bdinetr.domain.predicate.LinkRateLimited;
/**
* @author Ingrid Nunes
*/
public class RateLimiterCapability extends RouterAgentCapability {
-
+ public interface Softgoals {
+ public static final Softgoal INTRUSION = new NamedSoftgoal("INTRUSION");
+ public static final Softgoal PROTECTION = new NamedSoftgoal("PROTECTION");
+ }
+
public class LimitFlowRatePlan extends BeliefGoalPlanBody {
private static final long serialVersionUID = -3493377510830902961L;
@@ -61,27 +69,11 @@ public class RateLimiterCapability extends RouterAgentCapability {
}
}
- public class LimitIPRatePlan extends BeliefGoalPlanBody {
- private static final long serialVersionUID = -3493377510830902961L;
-
- private Ip ip;
-
- @Override
- public void execute() {
- role.limitIp(ip, IP_LIMIT_RATE);
- belief(new IpRateLimited(ip), true);
- }
-
- @Parameter(direction = Direction.IN)
- public void setBeliefName(IpRateLimited ipRateLimited) {
- this.ip = ipRateLimited.getConcept();
- }
- }
-
public class LimitLinkRatePlan extends BeliefGoalPlanBody {
private static final long serialVersionUID = -3493377510830902961L;
private Link link;
+ private final Log log = LogFactory.getLog(EventBroker.class);
@Override
public void execute() {
@@ -95,23 +87,6 @@ public class RateLimiterCapability extends RouterAgentCapability {
}
}
- public class RestoreIPRatePlan extends BeliefGoalPlanBody {
- private static final long serialVersionUID = -3493377510830902961L;
-
- private Ip ip;
-
- @Override
- public void execute() {
- role.unlimitIp(ip);
- belief(new IpRateLimited(ip), false);
- }
-
- @Parameter(direction = Direction.IN)
- public void setBeliefName(IpRateLimited ipRateLimited) {
- this.ip = ipRateLimited.getConcept();
- }
- }
-
public class RestoreLinkRate extends BeliefGoalPlanBody {
private static final long serialVersionUID = -3493377510830902961L;
@@ -130,19 +105,14 @@ public class RateLimiterCapability extends RouterAgentCapability {
}
public static final int FLOW_LIMIT_RATE = 90;
- public static final int IP_LIMIT_RATE = 50;
public static final int LINK_LIMIT_RATE = 90;
private static final long serialVersionUID = -1705728861020677126L;
@bdi4jade.annotation.Plan
private Plan limitFlowRate;
@bdi4jade.annotation.Plan
- private Plan limitIpRate;
- @bdi4jade.annotation.Plan
private Plan limitLinkRate;
@bdi4jade.annotation.Plan
- private Plan restoreIpRate;
- @bdi4jade.annotation.Plan
private Plan restoreLinkRate;
@bdi4jade.annotation.TransientBelief
private final RateLimiter role;
@@ -154,6 +124,7 @@ public class RateLimiterCapability extends RouterAgentCapability {
GoalTemplateFactory.hasBeliefOfTypeWithValue(
LinkRateLimited.class, Boolean.TRUE),
LimitLinkRatePlan.class);
+
this.restoreLinkRate = new DefaultPlan(
GoalTemplateFactory.hasBeliefOfTypeWithValue(
LinkRateLimited.class, Boolean.FALSE),
@@ -165,27 +136,13 @@ public class RateLimiterCapability extends RouterAgentCapability {
return (rateLimited != null && rateLimited.getValue());
};
};
- this.limitIpRate = new DefaultPlan(
- GoalTemplateFactory.hasBeliefOfTypeWithValue(
- IpRateLimited.class, Boolean.TRUE),
- LimitIPRatePlan.class);
- this.restoreIpRate = new DefaultPlan(
- GoalTemplateFactory.hasBeliefOfTypeWithValue(
- IpRateLimited.class, Boolean.FALSE),
- RestoreIPRatePlan.class) {
- public boolean isContextApplicable(Goal goal) {
- BeliefGoal<IpRateLimited> bg = (BeliefGoal<IpRateLimited>) goal;
- Predicate<IpRateLimited> rateLimited = (Predicate<IpRateLimited>) getBeliefBase()
- .getBelief(bg.getBeliefName());
- return rateLimited != null && rateLimited.getValue();
- };
- };
+
this.limitFlowRate = new DefaultPlan(
GoalTemplateFactory.hasBeliefOfTypeWithValue(
FlowRateLimited.class, Boolean.TRUE),
LimitFlowRatePlan.class);
}
-
+
@Override
public Role getRole() {
return Role.RATE_LIMITER;
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
index 9380ab7..be70958 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/agent/RouterAgent.java
@@ -59,7 +59,6 @@ public class RouterAgent extends SingleCapabilityAgent implements
AgentPlanSelectionStrategy {
public static class RootCapability extends Capability {
-
public static final String ROUTER_BELIEF = "router";
private static final long serialVersionUID = -2156730094556459899L;
@@ -75,7 +74,6 @@ public class RouterAgent extends SingleCapabilityAgent implements
this.beliefGoalRequestPlan = new GoalRequestPlan();
this.beliefGoalResponsePlan = new GoalResponsePlan();
}
-
}
private static final Log log = LogFactory.getLog(RouterAgent.class);
@@ -103,6 +101,11 @@ public class RouterAgent extends SingleCapabilityAgent implements
new RateLimiterCapability((RateLimiter) router
.getRole(Role.RATE_LIMITER)));
}
+ if (router.hasRole(Role.IP_RATE_LIMITER)) {
+ this.getCapability().addPartCapability(
+ new IPRateLimiterCapability((RateLimiter) router
+ .getRole(Role.IP_RATE_LIMITER)));
+ }
if (router.hasRole(Role.CLASSIFIER)) {
this.getCapability().addPartCapability(
new ClassifierCapability((Classifier) router
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/BDINetRApp.java b/network-resilience/src/br/ufrgs/inf/bdinetr/BDINetRApp.java
index d05796d..fbcd3f0 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/BDINetRApp.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/BDINetRApp.java
@@ -95,7 +95,8 @@ public class BDINetRApp {
new Ip("Inet.sas1.core0.flowExporter"), "flowexporter_one",
Role.FLOW_EXPORTER.getId(), factory));
NETWORK.addRouter(new Router(new Ip("Inet.sas1.core0.rateLimiter"),
- "ratelimiter_one", Role.RATE_LIMITER.getId(), factory));
+ "ratelimiter_one", Role.RATE_LIMITER.getId() |
+ Role.IP_RATE_LIMITER.getId(), factory));
break;
case SIMPLE_NETWORK:
factory = new DummyRouterComponentFactory();
@@ -105,7 +106,8 @@ public class BDINetRApp {
Role.ANOMALY_DETECTION.getId() | Role.RATE_LIMITER.getId(),
factory));
NETWORK.addRouter(new Router(new Ip("FC+RL"), Role.CLASSIFIER
- .getId() | Role.RATE_LIMITER.getId(), factory));
+ .getId() | Role.RATE_LIMITER.getId() |
+ Role.IP_RATE_LIMITER.getId(), factory));
NETWORK.addRouter(new Router(new Ip("FE"), Role.FLOW_EXPORTER
.getId(), factory));
@@ -116,7 +118,7 @@ public class BDINetRApp {
NETWORK.addRouter(new Router(new Ip("RouterLM"), Role.LINK_MONITOR
.getId(), factory));
NETWORK.addRouter(new Router(new Ip("RouterRL"), Role.RATE_LIMITER
- .getId(), factory));
+ .getId() | Role.IP_RATE_LIMITER.getId(), factory));
NETWORK.addRouter(new Router(new Ip("RouterAD"),
Role.ANOMALY_DETECTION.getId(), factory));
NETWORK.addRouter(new Router(new Ip("RouterCL"), Role.CLASSIFIER
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/AbstractRouterComponentFactory.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/AbstractRouterComponentFactory.java
index e8c0e56..c210a52 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/AbstractRouterComponentFactory.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/AbstractRouterComponentFactory.java
@@ -35,7 +35,7 @@ public abstract class AbstractRouterComponentFactory {
public abstract LinkMonitor createLinkMonitor(Router router);
public abstract RateLimiter createRateLimiter(Router router);
-
+
public RouterComponent createRouterComponent(Role role, Router router) {
if (Role.ANOMALY_DETECTION.equals(role)) {
return createAnomalyDetection(router);
@@ -52,6 +52,9 @@ public abstract class AbstractRouterComponentFactory {
if (Role.RATE_LIMITER.equals(role)) {
return createRateLimiter(router);
}
+ if (Role.IP_RATE_LIMITER.equals(role)) {
+ return createRateLimiter(router);
+ }
return null;
}
diff --git a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Role.java b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Role.java
index f90a7ed..12fcd6c 100644
--- a/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Role.java
+++ b/network-resilience/src/br/ufrgs/inf/bdinetr/domain/Role.java
@@ -24,7 +24,7 @@ package br.ufrgs.inf.bdinetr.domain;
public enum Role {
ANOMALY_DETECTION(1), CLASSIFIER(2), FLOW_EXPORTER(4), LINK_MONITOR(8), RATE_LIMITER(
- 16);
+ 16), IP_RATE_LIMITER(32);
private final int id;