Add option to skip rerouting but allow installing of intents
Change-Id: Ie02ca95840d533099138aac8e12c274d987ea90e
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 45043fe..c5fc660 100755
--- a/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java
+++ b/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntimeModule.java
@@ -100,8 +100,10 @@
IntentOperationList reroutingOperation = new IntentOperationList();
for (Intent intent : oldPaths) {
PathIntent pathIntent = (PathIntent) intent;
+ if (pathIntent.getId().startsWith("1:F")) // XXX: demo special, the intent start with "F" is skipped
+ continue;
if (pathIntent.getState().equals(IntentState.INST_ACK) && // XXX: path intents in flight
- !reroutingOperation.contains(pathIntent.getParentIntent())) {
+ !reroutingOperation.contains(pathIntent.getParentIntent())) {
reroutingOperation.add(Operator.ADD, pathIntent.getParentIntent());
}
}
@@ -265,7 +267,7 @@
PerfLogger p = new PerfLogger("networkGraphEvents");
HashSet<Intent> affectedPaths = new HashSet<>();
-
+
boolean rerouteAll = false;
for(LinkEvent le : addedLinkEvents) {
LinkEvent rev = new LinkEvent(le.getDst().getDpid(), le.getDst().getNumber(), le.getSrc().getDpid(), le.getSrc().getNumber());
diff --git a/web/rest-intent/intent-installer.rb b/web/rest-intent/intent-installer.rb
index b2d21d8..41361be 100755
--- a/web/rest-intent/intent-installer.rb
+++ b/web/rest-intent/intent-installer.rb
@@ -72,6 +72,9 @@
opts.on('b', '--bulk_limit bulk_limit', 'bulk request upto this limit') do |bulk_limit|
options[:bulk_limit] = bulk_limit
end
+ opts.on('f', '--freeze_intents', 'freeze dont reroute intents') do
+ options[:freeze] = "F"
+ end
opts.on('-h', '--help', 'Display help') do
puts opts
exit
@@ -173,13 +176,15 @@
@port ||= 8080
@bulk_limit = options[:bulk_limit]
@bulk_limit ||= 10000
+ @freeze = options[:freeze]
+ @freeze ||= ""
end
def _create_intent json_intents
(0...@max_switches).each do |idx|
intent = {
- :intent_id => "#{@intent_id}",
+ :intent_id => "#{@freeze}#{@intent_id}",
:intent_type => @intent_type,
:intent_op => @intent_op,
:srcSwitch => "258".to_s,