bdi4jade
Changes
network-resiliense/.classpath 10(+10 -0)
network-resiliense/.gitignore 1(+1 -0)
network-resiliense/.project 17(+17 -0)
network-resiliense/APDescription.txt 1(+1 -0)
Details
diff --git a/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java b/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java
new file mode 100644
index 0000000..081863b
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java
@@ -0,0 +1,43 @@
+//----------------------------------------------------------------------------
+// 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 bdi4jade.goal;
+
+/**
+ * This class represents the goal of an agent to believe in a certain belief
+ * with an specific boolean value, that is, the agent has a belief whose name
+ * and value are specified in this goal.
+ *
+ * @param <K>
+ * the type of the belief name.
+ *
+ * @author Ingrid Nunes
+ */
+public class PropositionalBeliefValueGoal<K> extends
+ BeliefValueGoal<K, Boolean> {
+
+ private static final long serialVersionUID = -6711494133447825608L;
+
+ public PropositionalBeliefValueGoal(K beliefName, Boolean value) {
+ super(beliefName, value);
+ }
+}
network-resiliense/.classpath 10(+10 -0)
diff --git a/network-resiliense/.classpath b/network-resiliense/.classpath
new file mode 100644
index 0000000..3d70dbc
--- /dev/null
+++ b/network-resiliense/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/bdi-jade"/>
+ <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"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
network-resiliense/.gitignore 1(+1 -0)
diff --git a/network-resiliense/.gitignore b/network-resiliense/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/network-resiliense/.gitignore
@@ -0,0 +1 @@
+/bin
network-resiliense/.project 17(+17 -0)
diff --git a/network-resiliense/.project b/network-resiliense/.project
new file mode 100644
index 0000000..8d5ee09
--- /dev/null
+++ b/network-resiliense/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>network-resiliense</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/network-resiliense/.settings/org.eclipse.jdt.ui.prefs b/network-resiliense/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..ba883d0
--- /dev/null
+++ b/network-resiliense/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">//----------------------------------------------------------------------------\n// Copyright (C) 2011 Ingrid Nunes\n// \n// This library is free software; you can redistribute it and/or\n// modify it under the terms of the GNU Lesser General Public\n// License as published by the Free Software Foundation; either\n// version 2.1 of the License, or (at your option) any later version.\n// \n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n// Lesser General Public License for more details.\n// \n// You should have received a copy of the GNU Lesser General Public\n// License along with this library; if not, write to the Free Software\n// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n// \n// To contact the authors\:\n// http\://inf.ufrgs.br/prosoft/bdi4jade/\n//\n//----------------------------------------------------------------------------</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
network-resiliense/APDescription.txt 1(+1 -0)
diff --git a/network-resiliense/APDescription.txt b/network-resiliense/APDescription.txt
new file mode 100644
index 0000000..aa4fc28
--- /dev/null
+++ b/network-resiliense/APDescription.txt
@@ -0,0 +1 @@
+( ap-description :name "localhost:1099/JADE" :ap-services (set ( ap-service :name fipa.mts.mtp.http.std :type fipa.mts.mtp.http.std :addresses (sequence http://localhost:7778/acc))))
diff --git a/network-resiliense/MTPs-Main-Container.txt b/network-resiliense/MTPs-Main-Container.txt
new file mode 100644
index 0000000..f5617c1
--- /dev/null
+++ b/network-resiliense/MTPs-Main-Container.txt
@@ -0,0 +1 @@
+http://localhost:7778/acc
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRAgent.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRAgent.java
new file mode 100644
index 0000000..2628e09
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRAgent.java
@@ -0,0 +1,68 @@
+//----------------------------------------------------------------------------
+// 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;
+
+import bdi4jade.belief.Belief;
+import bdi4jade.belief.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.core.SingleCapabilityAgent;
+import br.ufrgs.inf.bdinetr.domain.Device;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class BDINetRAgent extends SingleCapabilityAgent {
+
+ private static final long serialVersionUID = 6534875498063013722L;
+
+ public static class RootCapability extends Capability {
+
+ private static final long serialVersionUID = -2156730094556459899L;
+
+ public static final String DEVICE_BELIEF = "device";
+
+ @bdi4jade.annotation.Belief
+ private Belief<String, Device> device = new TransientBelief<>(
+ DEVICE_BELIEF);
+
+ public RootCapability(Device device) {
+ this.device.setValue(device);
+ }
+
+ }
+
+ public BDINetRAgent(Device device) {
+ this(device, new Capability[0]);
+ }
+
+ public BDINetRAgent(Device device, Capability capability) {
+ this(device, new Capability[] { capability });
+ }
+
+ public BDINetRAgent(Device device, Capability[] capabilities) {
+ super(new RootCapability(device));
+ for (Capability capability : capabilities) {
+ this.getCapability().addPartCapability(capability);
+ }
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRApp.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRApp.java
new file mode 100644
index 0000000..606a1b2
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/BDINetRApp.java
@@ -0,0 +1,133 @@
+//----------------------------------------------------------------------------
+// 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;
+
+import jade.BootProfileImpl;
+import jade.core.ProfileImpl;
+import jade.wrapper.AgentContainer;
+import jade.wrapper.AgentController;
+import jade.wrapper.PlatformController;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
+
+import bdi4jade.core.AbstractBDIAgent;
+import br.ufrgs.inf.bdinetr.capability.LinkMonitorCapability;
+import br.ufrgs.inf.bdinetr.capability.RateLimiterCapability;
+import br.ufrgs.inf.bdinetr.domain.Device;
+import br.ufrgs.inf.bdinetr.domain.Link;
+import br.ufrgs.inf.bdinetr.domain.Network;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class BDINetRApp {
+
+ private static final Map<String, AbstractBDIAgent> AGENTS;
+ private static final Network NETWORK;
+
+ static {
+ PropertyConfigurator.configure(BDINetRApp.class
+ .getResource("log4j.properties"));
+
+ NETWORK = new Network();
+ Device firewall1 = new Device("Firewall 1");
+ NETWORK.addDevice(firewall1);
+ Device firewall2 = new Device("Firewall 2");
+ NETWORK.addDevice(firewall2);
+ Device firewall3 = new Device("Firewall 3");
+ NETWORK.addDevice(firewall3);
+ Device rateLimiter1 = new Device("Rate Limiter 1");
+ NETWORK.addDevice(rateLimiter1);
+ Device rateLimiter2 = new Device("Rate Limiter 2");
+ NETWORK.addDevice(rateLimiter2);
+
+ NETWORK.addLink(new Link("F1_RL1", 10.0, firewall1, rateLimiter1));
+ NETWORK.addLink(new Link("F2_RL2", 8.0, firewall2, rateLimiter2));
+ NETWORK.addLink(new Link("F3_RL1", 7.0, firewall3, rateLimiter1));
+ NETWORK.addLink(new Link("F1_RL2", 7.0, firewall1, rateLimiter2));
+ NETWORK.addLink(new Link("F2_RL1", 8.0, firewall2, rateLimiter1));
+ NETWORK.addLink(new Link("F3_RL2", 10.0, firewall3, rateLimiter2));
+
+ AGENTS = new HashMap<>();
+ AGENTS.put(firewall1.getId(), new BDINetRAgent(firewall1,
+ new LinkMonitorCapability()));
+ AGENTS.put(firewall2.getId(), new BDINetRAgent(firewall2,
+ new LinkMonitorCapability()));
+ AGENTS.put(firewall3.getId(), new BDINetRAgent(firewall3,
+ new LinkMonitorCapability()));
+ AGENTS.put(rateLimiter1.getId(), new BDINetRAgent(rateLimiter1,
+ new RateLimiterCapability()));
+ AGENTS.put(rateLimiter2.getId(), new BDINetRAgent(rateLimiter2,
+ new RateLimiterCapability()));
+
+ }
+
+ public static void main(String[] args) {
+ new BDINetRApp().run();
+ }
+
+ private ProfileImpl bootProfile;
+ private final Log log;
+ private jade.core.Runtime runtime;
+
+ public BDINetRApp() {
+ this.log = LogFactory.getLog(this.getClass());
+
+ List<String> params = new ArrayList<String>();
+ params.add("-gui");
+ params.add("-detect-main:false");
+
+ log.info("Plataform parameters: " + params);
+
+ this.bootProfile = new BootProfileImpl(params.toArray(new String[0]));
+
+ this.runtime = jade.core.Runtime.instance();
+ PlatformController controller = runtime
+ .createMainContainer(bootProfile);
+
+ for (String agentName : AGENTS.keySet()) {
+ try {
+ AgentController ac = ((AgentContainer) controller)
+ .acceptNewAgent(agentName, AGENTS.get(agentName));
+ ac.start();
+ } catch (Exception e) {
+ log.error(e);
+ }
+ }
+ }
+
+ /**
+ * Creates and shows a GUI whose content pane is an
+ * {@link BDI4JADEExamplesPanel}.
+ */
+ public void run() {
+
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/AnomalyDetectionCapability.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/AnomalyDetectionCapability.java
new file mode 100644
index 0000000..e03f228
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/AnomalyDetectionCapability.java
@@ -0,0 +1,33 @@
+//----------------------------------------------------------------------------
+// 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.capability;
+
+import bdi4jade.core.Capability;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class AnomalyDetectionCapability extends Capability {
+
+ private static final long serialVersionUID = -1705728861020677126L;
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/ClassifierCapability.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/ClassifierCapability.java
new file mode 100644
index 0000000..2e36300
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/ClassifierCapability.java
@@ -0,0 +1,33 @@
+//----------------------------------------------------------------------------
+// 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.capability;
+
+import bdi4jade.core.Capability;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class ClassifierCapability extends Capability {
+
+ private static final long serialVersionUID = -1705728861020677126L;
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/FlowExporterCapability.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/FlowExporterCapability.java
new file mode 100644
index 0000000..19e51de
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/FlowExporterCapability.java
@@ -0,0 +1,35 @@
+//----------------------------------------------------------------------------
+// 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.capability;
+
+import bdi4jade.core.Capability;
+import bdi4jade.reasoning.AbstractReasoningStrategy;
+import bdi4jade.reasoning.BeliefRevisionStrategy;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class FlowExporterCapability extends Capability {
+
+ private static final long serialVersionUID = -1705728861020677126L;
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/LinkMonitorCapability.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/LinkMonitorCapability.java
new file mode 100644
index 0000000..b7fb6a0
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/LinkMonitorCapability.java
@@ -0,0 +1,133 @@
+//----------------------------------------------------------------------------
+// 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.capability;
+
+import java.util.Set;
+
+import bdi4jade.belief.Belief;
+import bdi4jade.belief.PropositionalBelief;
+import bdi4jade.belief.TransientBelief;
+import bdi4jade.belief.TransientPropositionalBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.core.GoalUpdateSet;
+import bdi4jade.goal.BeliefGoal;
+import bdi4jade.goal.PropositionalBeliefValueGoal;
+import bdi4jade.reasoning.AbstractReasoningStrategy;
+import bdi4jade.reasoning.BeliefRevisionStrategy;
+import bdi4jade.reasoning.OptionGenerationFunction;
+import br.ufrgs.inf.bdinetr.BDINetRAgent.RootCapability;
+import br.ufrgs.inf.bdinetr.domain.Device;
+import br.ufrgs.inf.bdinetr.domain.Link;
+import br.ufrgs.inf.bdinetr.domain.LinkProposition.AttackPrevented;
+import br.ufrgs.inf.bdinetr.domain.LinkProposition.OverUsage;
+import br.ufrgs.inf.bdinetr.domain.LinkProposition.RegularUsage;
+import br.ufrgs.inf.bdinetr.domain.LinkProposition.Usage;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class LinkMonitorCapability extends Capability {
+
+ private class ReasoningStrategy extends AbstractReasoningStrategy implements
+ BeliefRevisionStrategy, OptionGenerationFunction {
+ @Override
+ public void generateGoals(GoalUpdateSet goalUpdateSet) {
+ Set<Belief<?, ?>> overUsageBeliefs = getBeliefBase()
+ .getBeliefsByType(OverUsage.class);
+ for (Belief<?, ?> belief : overUsageBeliefs) {
+ PropositionalBelief<OverUsage> overUsage = (PropositionalBelief<OverUsage>) belief;
+ if (overUsage.getValue()) {
+ getMyAgent().addGoal(
+ LinkMonitorCapability.this,
+ new PropositionalBeliefValueGoal<AttackPrevented>(
+ new AttackPrevented(overUsage.getName()
+ .getLink()), Boolean.TRUE));
+ log.debug("goal(attackPrevented("
+ + overUsage.getName().getLink() + "))");
+ getMyAgent().addGoal(
+ LinkMonitorCapability.this,
+ new BeliefGoal<RegularUsage>(new RegularUsage(
+ overUsage.getName().getLink())));
+ log.debug("goal(regularUsage("
+ + overUsage.getName().getLink() + "))");
+ }
+ }
+ }
+
+ @Override
+ public void reviewBeliefs() {
+ Set<Belief<?, ?>> linkUsageBeliefs = getBeliefBase()
+ .getBeliefsByType(Usage.class);
+ for (Belief<?, ?> belief : linkUsageBeliefs) {
+ Belief<Usage, Double> linkUsage = (Belief<Usage, Double>) belief;
+ double percentageUsed = linkUsage.getValue()
+ / linkUsage.getName().getLink().getCapacity();
+ if (percentageUsed > overUsageThreshold.getValue()) {
+ getBeliefBase()
+ .addOrUpdateBelief(
+ new TransientPropositionalBelief<OverUsage>(
+ new OverUsage(linkUsage.getName()
+ .getLink()), Boolean.TRUE));
+ log.debug("belief(overUsage("
+ + linkUsage.getName().getLink() + "))");
+ getBeliefBase().removeBelief(
+ new RegularUsage(linkUsage.getName().getLink()));
+ log.debug("belief(~regularUsage("
+ + linkUsage.getName().getLink() + "))");
+ } else {
+ getBeliefBase()
+ .addOrUpdateBelief(
+ new TransientPropositionalBelief<OverUsage>(
+ new OverUsage(linkUsage.getName()
+ .getLink()), Boolean.FALSE));
+ log.debug("belief(not overUsage("
+ + linkUsage.getName().getLink() + "))");
+ }
+ }
+ }
+ }
+
+ public static final double OVER_USAGE_THRESHOLD = 0.8;
+
+ private static final long serialVersionUID = -1705728861020677126L;
+
+ @bdi4jade.annotation.Belief
+ private Belief<String, Double> overUsageThreshold = new TransientBelief<>(
+ "threshold", OVER_USAGE_THRESHOLD);
+
+ public LinkMonitorCapability() {
+ ReasoningStrategy strategy = new ReasoningStrategy();
+ setBeliefRevisionStrategy(strategy);
+ setOptionGenerationFunction(strategy);
+ }
+
+ @Override
+ protected void setup() {
+ Belief<String, Device> device = (Belief<String, Device>) getBeliefBase()
+ .getBelief(RootCapability.DEVICE_BELIEF);
+ for (Link link : device.getValue().getConnectedLinks()) {
+ getBeliefBase().addBelief(
+ new TransientBelief<Usage, Double>(new Usage(link), 0.0));
+ }
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/RateLimiterCapability.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/RateLimiterCapability.java
new file mode 100644
index 0000000..d1e5822
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/capability/RateLimiterCapability.java
@@ -0,0 +1,37 @@
+//----------------------------------------------------------------------------
+// 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.capability;
+
+import bdi4jade.core.Capability;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class RateLimiterCapability extends Capability {
+
+ private static final long serialVersionUID = -1705728861020677126L;
+
+ public static final String LINK_USAGE = "linkUsage";
+ public static final String LINK_OVER_USAGE = "overUsage";
+ public static final String LINK_REGULAR_USAGE = "regularUsage";
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Device.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Device.java
new file mode 100644
index 0000000..5e18984
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Device.java
@@ -0,0 +1,75 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Device {
+
+ private final Set<Link> connectedLinks;
+ private final String id;
+
+ public Device(final String id) {
+ this.id = id;
+ this.connectedLinks = new HashSet<>();
+ }
+
+ public void connectLink(Link link) {
+ connectedLinks.add(link);
+ }
+
+ public void disconnectLink(Link link) {
+ connectedLinks.remove(link);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Device) {
+ Device d = (Device) obj;
+ return this.id.equals(d.id);
+ }
+ return false;
+ }
+
+ public Set<Link> getConnectedLinks() {
+ return connectedLinks;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Flow.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Flow.java
new file mode 100644
index 0000000..0853dbf
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Flow.java
@@ -0,0 +1,54 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Flow {
+
+ private final String id;
+
+ public Flow(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Flow) {
+ Flow f = (Flow) obj;
+ return this.id.equals(f.id);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/FlowPreposition.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/FlowPreposition.java
new file mode 100644
index 0000000..255576f
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/FlowPreposition.java
@@ -0,0 +1,84 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class FlowPreposition {
+
+ public static class FlowRateLimited extends FlowPreposition {
+ public FlowRateLimited(Flow flow) {
+ super(flow);
+ }
+ }
+
+ public static class Threat extends FlowPreposition {
+ public Threat(Flow flow) {
+ super(flow);
+ }
+ }
+
+ public static class ThreatResponded extends FlowPreposition {
+ public ThreatResponded(Flow flow) {
+ super(flow);
+ }
+ }
+
+ protected Flow flow;
+
+ public FlowPreposition(Flow flow) {
+ this.flow = flow;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ FlowPreposition fp = (FlowPreposition) obj;
+ return this.flow.equals(fp.flow);
+ }
+ return false;
+ }
+
+ public Flow getFlow() {
+ return flow;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((this.getClass() == null) ? 0 : this.getClass().hashCode());
+ result = prime * result + ((flow == null) ? 0 : flow.hashCode());
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(this.getClass().getSimpleName());
+ sb.append("(").append(flow).append(")");
+ return sb.toString();
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpAddress.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpAddress.java
new file mode 100644
index 0000000..6cbbf4b
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpAddress.java
@@ -0,0 +1,54 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class IpAddress {
+
+ private final String id;
+
+ public IpAddress(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IpAddress) {
+ IpAddress ip = (IpAddress) obj;
+ return this.id.equals(ip.id);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpPreposition.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpPreposition.java
new file mode 100644
index 0000000..a6730d8
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/IpPreposition.java
@@ -0,0 +1,96 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class IpPreposition {
+
+ public static class Anomalous extends IpPreposition {
+ public Anomalous(IpAddress ip) {
+ super(ip);
+ }
+ }
+
+ public static class Benign extends IpPreposition {
+ public Benign(IpAddress ip) {
+ super(ip);
+ }
+ }
+
+ public static class FlowRecord extends IpPreposition {
+ public FlowRecord(IpAddress ip) {
+ super(ip);
+ }
+ }
+
+ public static class RateLimited extends IpPreposition {
+ public RateLimited(IpAddress ip) {
+ super(ip);
+ }
+ }
+
+ public static class Restricted extends IpPreposition {
+ public Restricted(IpAddress ip) {
+ super(ip);
+ }
+ }
+
+ protected IpAddress ip;
+
+ public IpPreposition(IpAddress ip) {
+ this.ip = ip;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ IpPreposition lp = (IpPreposition) obj;
+ return this.ip.equals(lp.ip);
+ }
+ return false;
+ }
+
+ public IpAddress getIp() {
+ return ip;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((this.getClass() == null) ? 0 : this.getClass().hashCode());
+ result = prime * result + ((ip == null) ? 0 : ip.hashCode());
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(this.getClass().getSimpleName());
+ sb.append("(").append(ip).append(")");
+ return sb.toString();
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Link.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Link.java
new file mode 100644
index 0000000..191fd13
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Link.java
@@ -0,0 +1,96 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Link {
+
+ private Double capacity;
+ private final String id;
+ private Device source;
+ private Device target;
+
+ public Link(String id) {
+ this.id = id;
+ }
+
+ public Link(String id, Double capacity, Device source, Device target) {
+ this(id);
+ this.capacity = capacity;
+ setSource(source);
+ setTarget(target);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Link) {
+ Link l = (Link) obj;
+ return this.id.equals(l.id);
+ }
+ return false;
+ }
+
+ public Double getCapacity() {
+ return capacity;
+ }
+
+ public Device getSource() {
+ return source;
+ }
+
+ public Device getTarget() {
+ return target;
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ public void setCapacity(Double capacity) {
+ this.capacity = capacity;
+ }
+
+ public void setSource(Device source) {
+ if (this.source != null) {
+ this.source.disconnectLink(this);
+ }
+ this.source = source;
+ this.source.connectLink(this);
+ }
+
+ public void setTarget(Device target) {
+ if (this.target != null) {
+ this.target.disconnectLink(this);
+ }
+ this.target = source;
+ this.target.connectLink(this);
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/LinkProposition.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/LinkProposition.java
new file mode 100644
index 0000000..e0bea91
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/LinkProposition.java
@@ -0,0 +1,90 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class LinkProposition {
+
+ public static class AttackPrevented extends LinkProposition {
+ public AttackPrevented(Link link) {
+ super(link);
+ }
+ }
+
+ public static class OverUsage extends LinkProposition {
+ public OverUsage(Link link) {
+ super(link);
+ }
+ }
+
+ public static class RegularUsage extends LinkProposition {
+ public RegularUsage(Link link) {
+ super(link);
+ }
+ }
+
+ public static class Usage extends LinkProposition {
+ public Usage(Link link) {
+ super(link);
+ }
+ }
+
+ protected Link link;
+
+ public LinkProposition(Link link) {
+ this.link = link;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && this.getClass().equals(obj.getClass())) {
+ LinkProposition lp = (LinkProposition) obj;
+ return this.link.equals(lp.link);
+ }
+ return false;
+ }
+
+ public Link getLink() {
+ return link;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((this.getClass() == null) ? 0 : this.getClass().hashCode());
+ result = prime * result + ((link == null) ? 0 : link.hashCode());
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(this.getClass().getSimpleName());
+ sb.append("(").append(link).append(")");
+ return sb.toString();
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Network.java b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Network.java
new file mode 100644
index 0000000..f0af313
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/domain/Network.java
@@ -0,0 +1,56 @@
+//----------------------------------------------------------------------------
+// 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.domain;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Network {
+
+ private final Set<Device> devices;
+ private final Set<Link> links;
+
+ public Network() {
+ this.devices = new HashSet<>();
+ this.links = new HashSet<>();
+ }
+
+ public void addDevice(Device device) {
+ this.devices.add(device);
+ }
+
+ public void addLink(Link link) {
+ this.links.add(link);
+ }
+
+ public Set<Device> getDevices() {
+ return devices;
+ }
+
+ public Set<Link> getLinks() {
+ return links;
+ }
+
+}
diff --git a/network-resiliense/src/br/ufrgs/inf/bdinetr/log4j.properties b/network-resiliense/src/br/ufrgs/inf/bdinetr/log4j.properties
new file mode 100644
index 0000000..4e28233
--- /dev/null
+++ b/network-resiliense/src/br/ufrgs/inf/bdinetr/log4j.properties
@@ -0,0 +1,34 @@
+#
+# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
+#
+# The five logging levels used by Log are (in order):
+#
+# 1. DEBUG (the least serious)
+# 2. INFO
+# 3. WARN
+# 4. ERROR
+# 5. FATAL (the most serious)
+
+
+# Set root logger level to WARN and append to stdout
+log4j.rootLogger=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+
+# Pattern to output the caller's file name and line number.
+log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p (%c{1}:%L) - %m%n
+
+# Print only messages of level ERROR or above in the package noModule.
+log4j.logger.noModule=FATAL
+
+# OpenSymphony Stuff
+log4j.logger.com.opensymphony=FATAL
+log4j.logger.org.apache.struts2=FATAL
+
+# Spring Stuff
+log4j.logger.org.springframework=FATAL
+
+log4j.logger.bdi4jade=WARN
+log4j.logger.br.ufrgs.inf.bdinetr=DEBUG
+