Renamed the intent package
net.onrc.onos.intent.* => net.onrc.onos.core.intent.*
Change-Id: Id61f79ed52acf3b91af4ebad2515ac5b7d6dc5e1
diff --git a/src/main/java/net/onrc/onos/core/intent/PathIntent.java b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
new file mode 100644
index 0000000..c84d739
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
@@ -0,0 +1,60 @@
+package net.onrc.onos.core.intent;
+
+import net.onrc.onos.ofcontroller.networkgraph.Path;
+
+/**
+ * @author Toshio Koide (t-koide@onlab.us)
+ */
+public class PathIntent extends Intent {
+ protected Path path;
+ protected double bandwidth;
+ protected Intent parentIntent;
+
+ public static String createFirstId(String parentId) {
+ return String.format("%s___0", parentId);
+ }
+
+ public static String createNextId(String currentId) {
+ String parts[] = currentId.split("___");
+ return String.format("%s___%d", parts[0], Long.valueOf(parts[1])+1);
+ }
+
+ /**
+ * Default constructor for Kryo deserialization
+ */
+ protected PathIntent() {
+ }
+
+ /**
+ *
+ * @param graph
+ * @param path
+ * @param bandwidth bandwidth which should be allocated for the path.
+ * If 0, no intent for bandwidth allocation (best effort).
+ * @param parentIntent parent intent. If null, this is root intent.
+ * @param id
+ */
+ public PathIntent(String id, Path path, double bandwidth, Intent parentIntent) {
+ super(id);
+ this.path = path;
+ this.bandwidth = bandwidth;
+ this.parentIntent = parentIntent;
+ }
+
+ public double getBandwidth() {
+ return bandwidth;
+ }
+
+ public Path getPath() {
+ return path;
+ }
+
+ public Intent getParentIntent() {
+ return parentIntent;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s, %s, %s", getId(), getState(), getPath());
+ }
+}