Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONOS
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
index 1372c60..21b8b88 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -126,19 +126,14 @@
new LinkedList<IFlowEntry>();
//
- // Fetch all Flow Entries and select only my Flow Entries
+ // Fetch all Flow Entries which need to be updated and select only my Flow Entries
// that need to be updated into the switches.
//
boolean processed_measurement_flow = false;
Iterable<IFlowEntry> allFlowEntries =
- conn.utils().getAllFlowEntries(conn);
+ conn.utils().getAllSwitchNotUpdatedFlowEntries(conn);
for (IFlowEntry flowEntryObj : allFlowEntries) {
counterAllFlowEntries++;
- String switchState = flowEntryObj.getSwitchState();
- if ((switchState == null) ||
- (! switchState.equals("FE_SWITCH_NOT_UPDATED"))) {
- continue; // Ignore the entry: nothing to do
- }
String dpidStr = flowEntryObj.getSwitchDpid();
if (dpidStr == null)
@@ -493,9 +488,9 @@
nextFlowEntryIdPrefix = randomGenerator.nextInt();
mapReaderScheduler.scheduleAtFixedRate(
- mapReader, 3, 3, TimeUnit.SECONDS);
+ mapReader, 100, 100, TimeUnit.MILLISECONDS);
shortestPathReconcileScheduler.scheduleAtFixedRate(
- shortestPathReconcile, 3, 3, TimeUnit.SECONDS);
+ shortestPathReconcile, 100, 100, TimeUnit.MILLISECONDS);
}
/**
diff --git a/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java b/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java
index e07196f..723fe1c 100644
--- a/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java
+++ b/src/main/java/net/floodlightcontroller/onoslistener/OnosPublisher.java
@@ -67,6 +67,7 @@
catch (Exception e) {
log.error("Error in cleanup thread", e);
} finally {
+ conn.close();
cleanupTask.reschedule(CLEANUP_TASK_INTERVAL,
TimeUnit.SECONDS);
}
@@ -85,8 +86,8 @@
}
protected void switchCleanup() {
- TopoSwitchServiceImpl impl = new TopoSwitchServiceImpl();
- Iterable<ISwitchObject> switches = impl.getActiveSwitches();
+ conn.close();
+ Iterable<ISwitchObject> switches = conn.utils().getActiveSwitches(conn);
log.debug("Checking for inactive switches");
// For each switch check if a controller exists in controller registry
@@ -109,6 +110,7 @@
e.printStackTrace();
}
}
+ conn.close();
}
@Override
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
index cc3cff2..cc3e0e7 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -68,6 +68,10 @@
graph.createKeyIndex("flow_entry_id",
Vertex.class);
}
+ if (!s.contains("switch_state")) {
+ graph.createKeyIndex("switch_state",
+ Vertex.class);
+ }
graph.stopTransaction(Conclusion.SUCCESS);
eg = new EventTransactionalGraph<TitanGraph>(graph);
}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
index 7ed51b9..2dac008 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
@@ -194,6 +194,13 @@
return fg.getVertices("type", "flow_entry", IFlowEntry.class);
}
+
+ @Override
+ public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries(GraphDBConnection conn) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ //TODO: Should use an enum for flow_switch_state
+ return fg.getVertices("switch_state", "FE_SWITCH_NOT_UPDATED", IFlowEntry.class);
+ }
@Override
public Iterable<ISwitchObject> getActiveSwitches(GraphDBConnection conn) {
diff --git a/src/main/java/net/onrc/onos/util/IDBUtils.java b/src/main/java/net/onrc/onos/util/IDBUtils.java
index 51948a2..4aa8168 100644
--- a/src/main/java/net/onrc/onos/util/IDBUtils.java
+++ b/src/main/java/net/onrc/onos/util/IDBUtils.java
@@ -37,4 +37,6 @@
ISwitchObject newSwitch(GraphDBConnection conn);
void removePort(GraphDBConnection conn, IPortObject port);
void removeSwitch(GraphDBConnection conn, ISwitchObject sw);
+ Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries(
+ GraphDBConnection conn);
}