Ignore state change notification of INST_REQ/DEL_REQ
Change-Id: Ic671dee28c37f3d948d43637119ced88253c6dfa
diff --git a/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java b/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java
index c5fc660..88a1352 100755
--- a/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java
+++ b/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java
@@ -176,6 +176,8 @@
for (IntentOperation op : list) {
if (op.intent.getState().equals(IntentState.INST_ACK))
states.put(op.intent.getId(), IntentState.REROUTE_REQ);
+ if (op.intent.getState().equals(IntentState.CREATED))
+ states.put(op.intent.getId(), IntentState.INST_REQ); // XXX
}
highLevelIntents.changeStates(states);
p.log("end_updateInMemoryIntents");
@@ -210,7 +212,7 @@
pathIntents.executeOperations(pathIntentOperations);
p.log("end_updateInMemoryPathIntents");
- // Demo special: add a complete path to remove operation
+ // XXX Demo special: add a complete path to remove operation
p.log("begin_addPathToRemoveOperation");
for (IntentOperation op: pathIntentOperations) {
if(op.operator.equals(Operator.REMOVE)) {
@@ -344,7 +346,8 @@
try {
// reflect state changes of path-level intent into application-level intents
p.log("begin_changeStateByNotification");
- IntentStateList parentStates = new IntentStateList();
+ IntentStateList highLevelIntentStates = new IntentStateList();
+ IntentStateList pathIntentStates = new IntentStateList();
for (Entry<String, IntentState> entry: value.entrySet()) {
PathIntent pathIntent = (PathIntent) pathIntents.getIntent(entry.getKey());
if (pathIntent == null) continue;
@@ -357,20 +360,21 @@
IntentState state = entry.getValue();
switch (state) {
- case INST_REQ:
+ //case INST_REQ:
case INST_ACK:
case INST_NACK:
- case DEL_REQ:
+ //case DEL_REQ:
case DEL_ACK:
case DEL_PENDING:
- parentStates.put(parentIntent.getId(), state);
+ highLevelIntentStates.put(parentIntent.getId(), state);
+ pathIntentStates.put(entry.getKey(), entry.getValue());
break;
default:
break;
}
}
- highLevelIntents.changeStates(parentStates);
- pathIntents.changeStates(value);
+ highLevelIntents.changeStates(highLevelIntentStates);
+ pathIntents.changeStates(pathIntentStates);
p.log("end_changeStateByNotification");
}
finally {