Added get db object
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
index 15c41f3..c50b2e8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImpl.java
@@ -142,6 +142,7 @@
log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
try {
+ op = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
ISwitchObject curr = op.searchSwitch(dpid);
if (curr != null) {
//If existing the switch. set The SW state ACTIVE.
@@ -193,6 +194,7 @@
log.info("SwitchStorage:addSwitch(): dpid {} ", dpid);
try {
+ op = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
ISwitchObject sw = op.searchSwitch(dpid);
if (sw != null) {
//If existing the switch. set The SW state ACTIVE.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index a6b7f32..9e1c1ec 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -236,6 +236,7 @@
flowEntry.setFlowId(new FlowId(flowPath.flowId().value()));
}
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
if (FlowDatabaseOperation.addFlow(this, dbHandlerApi, flowPath, flowId)) {
datagridService.notificationSendFlowAdded(flowPath);
return true;
@@ -251,6 +252,7 @@
* @return the added Flow Entry object on success, otherwise null.
*/
private IFlowEntry addFlowEntry(IFlowPath flowObj, FlowEntry flowEntry) {
+ dbHandlerInner = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.addFlowEntry(this, dbHandlerInner,
flowObj, flowEntry);
}
@@ -263,6 +265,7 @@
* @return true on success, otherwise false.
*/
private boolean deleteFlowEntry(IFlowPath flowObj, FlowEntry flowEntry) {
+ dbHandlerInner = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.deleteFlowEntry(dbHandlerInner,
flowObj, flowEntry);
}
@@ -274,6 +277,7 @@
*/
@Override
public boolean deleteAllFlows() {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
if (FlowDatabaseOperation.deleteAllFlows(dbHandlerApi)) {
datagridService.notificationSendAllFlowsRemoved();
return true;
@@ -289,6 +293,7 @@
*/
@Override
public boolean deleteFlow(FlowId flowId) {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
if (FlowDatabaseOperation.deleteFlow(dbHandlerApi, flowId)) {
datagridService.notificationSendFlowRemoved(flowId);
return true;
@@ -304,6 +309,7 @@
*/
@Override
public FlowPath getFlow(FlowId flowId) {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.getFlow(dbHandlerApi, flowId);
}
@@ -314,6 +320,7 @@
*/
@Override
public ArrayList<FlowPath> getAllFlows() {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.getAllFlows(dbHandlerApi);
}
@@ -328,6 +335,7 @@
@Override
public ArrayList<FlowPath> getAllFlows(CallerId installerId,
DataPathEndpoints dataPathEndpoints) {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.getAllFlows(dbHandlerApi, installerId,
dataPathEndpoints);
}
@@ -340,6 +348,7 @@
*/
@Override
public ArrayList<FlowPath> getAllFlows(DataPathEndpoints dataPathEndpoints) {
+ dbHandlerApi = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
return FlowDatabaseOperation.getAllFlows(dbHandlerApi,
dataPathEndpoints);
}
@@ -625,6 +634,7 @@
// just removed by some other controller instance.
//
System.out.println("writeModifiedFlowEntriesToDatabase");
+ dbHandlerInner = GraphDBManager.getDBOperation("ramcloud", "/tmp/ramcloudconf");
IFlowPath flowObj =
dbHandlerInner.searchFlowPath(flowEntry.flowId());
if (flowObj == null) {