Update rerouting features
- add REROUTE_REQ state to Intent class
- add static methods to PathIntent class to create IDs
- add getPathIntentId() to ShortestPathIntent class to retrieve low-level intent
- add mapping of inserting or replacing high level ids to lower level ids.
- change high level intent state to REROUTE_REQ if the state was INST_ACK and the intent was requested rerouting
Change-Id: I50970a0255e2b19451aaedb7dc3c19015031e5d0
diff --git a/src/main/java/net/onrc/onos/intent/Intent.java b/src/main/java/net/onrc/onos/intent/Intent.java
index 20088bd..9a40325 100644
--- a/src/main/java/net/onrc/onos/intent/Intent.java
+++ b/src/main/java/net/onrc/onos/intent/Intent.java
@@ -12,10 +12,11 @@
DEL_REQ,
DEL_PENDING,
DEL_ACK,
+ REROUTE_REQ,
}
- protected String id;
- protected IntentState state = IntentState.CREATED;
+ private String id;
+ private IntentState state = IntentState.CREATED;
/**
* Default constructor for Kryo deserialization
@@ -48,7 +49,22 @@
@Override
public int hashCode() {
- return id.hashCode();
+ return (id == null) ? 0 : id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if ((obj == null) || (getClass() != obj.getClass()))
+ return false;
+ Intent other = (Intent) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ return true;
}
@Override