adding some logging and checking Intent type more carefully
Checking for switch == null when install flow entries
(effect is we only install fe's on switches for which we are master)
Change-Id: I1645caf68ec6082737157737f3e12752a7515f5d
diff --git a/src/main/java/net/onrc/onos/intent/runtime/PlanInstallRuntime.java b/src/main/java/net/onrc/onos/intent/runtime/PlanInstallRuntime.java
index 4325c4e..844e620 100644
--- a/src/main/java/net/onrc/onos/intent/runtime/PlanInstallRuntime.java
+++ b/src/main/java/net/onrc/onos/intent/runtime/PlanInstallRuntime.java
@@ -40,14 +40,25 @@
log.debug("IOFSwitches: {}", switches);
for(Set<FlowEntry> phase : plan) {
Set<Pair<IOFSwitch, net.onrc.onos.ofcontroller.util.FlowEntry>> entries = new HashSet<>();
+ Set<IOFSwitch> modifiedSwitches = new HashSet<>();
+
// convert flow entries and create pairs
for(FlowEntry entry : phase) {
IOFSwitch sw = switches.get(entry.getSwitch());
+ if(sw == null) {
+ // no active switch, skip this flow entry
+ log.debug("Skipping flow entry: {}", entry);
+ continue;
+ }
entries.add(new Pair<>(sw, entry.getFlowEntry()));
+ modifiedSwitches.add(sw);
}
- log.debug("Pushing flow entries: {}", entries);
+
// push flow entries to switches
+ log.debug("Pushing flow entries: {}", entries);
pusher.pushFlowEntries(entries);
+
+ // TODO: insert a barrier after each phase on each modifiedSwitch
// TODO: wait for confirmation messages before proceeding
}
// TODO: we assume that the plan installation succeeds for now