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/PlanCalcRuntime.java b/src/main/java/net/onrc/onos/intent/runtime/PlanCalcRuntime.java
index 2e0c563..37ad7a2 100644
--- a/src/main/java/net/onrc/onos/intent/runtime/PlanCalcRuntime.java
+++ b/src/main/java/net/onrc/onos/intent/runtime/PlanCalcRuntime.java
@@ -9,6 +9,9 @@
import java.util.Map;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import net.floodlightcontroller.util.MACAddress;
import net.onrc.onos.intent.FlowEntry;
import net.onrc.onos.intent.Intent;
@@ -29,6 +32,7 @@
public class PlanCalcRuntime {
// NetworkGraph graph;
+ private final static Logger log = LoggerFactory.getLogger(PlanCalcRuntime.class);
public PlanCalcRuntime(/*NetworkGraph graph*/) {
// this.graph = graph;
@@ -42,6 +46,10 @@
private Set<Collection<FlowEntry>> computeFlowEntries(IntentOperationList intentOps) {
Set<Collection<FlowEntry>> flowEntries = new HashSet<>();
for(IntentOperation i : intentOps) {
+ if(!(i.intent instanceof PathIntent)) {
+ log.warn("Not a path intent: {}", i);
+ continue;
+ }
PathIntent intent = (PathIntent) i.intent;
Intent parent = intent.getParentIntent();
long srcPort, dstPort;
@@ -60,7 +68,7 @@
lastDstPort = pathIntent.getDstPortNumber();
}
else {
- // TODO: log this error
+ log.warn("Unsupported Intent: {}", parent);
continue;
}
List<FlowEntry> entries = new ArrayList<>();