Success complication
diff --git a/lib/blueprints-ramcloud-graph-2.4.0.jar b/lib/blueprints-ramcloud-graph-2.4.0.jar
new file mode 100644
index 0000000..f796c94
--- /dev/null
+++ b/lib/blueprints-ramcloud-graph-2.4.0.jar
Binary files differ
diff --git a/pom.xml b/pom.xml
index cd28064..c1e5732 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
<artifactId>onos</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
- <name>ONOS</name>
+ <name>ONOS-RAMLCloud</name>
<url>http://onlab.us/</url>
<repositories>
<repository>
diff --git a/src/main/java/net/onrc/onos/graph/DBOperation.java b/src/main/java/net/onrc/onos/graph/DBOperation.java
index db3dad7..eae323f 100644
--- a/src/main/java/net/onrc/onos/graph/DBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/DBOperation.java
@@ -13,9 +13,11 @@
import java.util.Iterator;
import java.util.List;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IBaseObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IIpv4Address;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.onrc.onos.ofcontroller.core.ISwitchStorage;
@@ -182,5 +184,47 @@
}
return flowEntry;
}
+
+
+ public IIpv4Address newIpv4Address() {
+ return newVertex("ipv4Address", IIpv4Address.class);
+ }
+ private <T extends IBaseObject> T newVertex(String type, Class<T> vertexType) {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ T newVertex = fg.addVertex(null, vertexType);
+ if (newVertex != null) {
+ newVertex.setType(type);
+ }
+ return newVertex;
+ }
+
+ public IIpv4Address searchIpv4Address(int intIpv4Address) {
+ return searchForVertex("ipv4_address", intIpv4Address, IIpv4Address.class);
+ }
+
+
+ public IIpv4Address ensureIpv4Address(int intIpv4Address) {
+ IIpv4Address ipv4Vertex = searchIpv4Address(intIpv4Address);
+ if (ipv4Vertex == null) {
+ ipv4Vertex = newIpv4Address();
+ ipv4Vertex.setIpv4Address(intIpv4Address);
+ }
+ return ipv4Vertex;
+ }
+
+
+ private <T> T searchForVertex(String propertyName, Object propertyValue, Class<T> vertexType) {
+ if (conn.getFramedGraph() != null) {
+ Iterator<T> it = conn.getFramedGraph().getVertices(propertyName, propertyValue, vertexType).iterator();
+ if (it.hasNext()) {
+ return it.next();
+ }
+ }
+ return null;
+ }
+
+ public void removeIpv4Address(IIpv4Address ipv4Address) {
+ conn.getFramedGraph().removeVertex(ipv4Address.asVertex());
+ }
}
diff --git a/src/main/java/net/onrc/onos/graph/TitanDBOperation.java b/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
index 26289bd..66221f3 100644
--- a/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/TitanDBOperation.java
@@ -10,6 +10,7 @@
import com.tinkerpop.frames.structures.FramedVertexIterable;
import com.tinkerpop.gremlin.java.GremlinPipeline;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.*;
import net.onrc.onos.ofcontroller.core.ISwitchStorage;
@@ -82,8 +83,17 @@
fg.removeVertex(dev.asVertex());
}
}
-
-
+
+ /**
+ * Create and return a flow path object.
+ */
+ public IFlowPath newFlowPath() {
+ FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+ IFlowPath flowPath = fg.addVertex(null, IFlowPath.class);
+ if (flowPath != null) flowPath.setType("flow");
+ return flowPath;
+ }
+
@Override
public IFlowPath searchFlowPath(FlowId flowId) {
FramedGraph<TitanGraph> fg = conn.getFramedGraph();
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
index 73c4e51..4e67bf5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowDatabaseOperation.java
@@ -10,6 +10,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.graph.DBOperation;
import net.onrc.onos.graph.GraphDBOperation;
@@ -38,7 +39,7 @@
* @return true on success, otherwise false.
*/
static boolean addFlow(FlowManager flowManager,
- GraphDBOperation dbHandler,
+ DBOperation dbHandler,
FlowPath flowPath, FlowId flowId) {
IFlowPath flowObj = null;
boolean found = false;
@@ -180,7 +181,7 @@
* @return the added Flow Entry object on success, otherwise null.
*/
static IFlowEntry addFlowEntry(FlowManager flowManager,
- GraphDBOperation dbHandler,
+ DBOperation dbHandler,
IFlowPath flowObj,
FlowEntry flowEntry) {
// Flow edges
@@ -333,7 +334,7 @@
* @param flowEntry the Flow Entry to delete.
* @return true on success, otherwise false.
*/
- static boolean deleteFlowEntry(GraphDBOperation dbHandler,
+ static boolean deleteFlowEntry(DBOperation dbHandler,
IFlowPath flowObj,
FlowEntry flowEntry) {
IFlowEntry flowEntryObj = null;
@@ -369,7 +370,7 @@
* @param dbHandler the Graph Database handler to use.
* @return true on success, otherwise false.
*/
- static boolean deleteAllFlows(GraphDBOperation dbHandler) {
+ static boolean deleteAllFlows(DBOperation dbHandler) {
List<FlowId> allFlowIds = new LinkedList<FlowId>();
// Get all Flow IDs
@@ -399,7 +400,7 @@
* @param flowId the Flow ID of the flow to delete.
* @return true on success, otherwise false.
*/
- static boolean deleteFlow(GraphDBOperation dbHandler, FlowId flowId) {
+ static boolean deleteFlow(DBOperation dbHandler, FlowId flowId) {
IFlowPath flowObj = null;
try {
flowObj = dbHandler.searchFlowPath(flowId);
@@ -436,7 +437,7 @@
* @param flowId the Flow ID of the flow to get.
* @return the Flow Path if found, otherwise null.
*/
- static FlowPath getFlow(GraphDBOperation dbHandler, FlowId flowId) {
+ static FlowPath getFlow(DBOperation dbHandler, FlowId flowId) {
IFlowPath flowObj = null;
try {
flowObj = dbHandler.searchFlowPath(flowId);
@@ -466,7 +467,7 @@
* @param dbHandler the Graph Database handler to use.
* @return the Flow Paths if found, otherwise null.
*/
- static ArrayList<FlowPath> getAllFlows(GraphDBOperation dbHandler) {
+ static ArrayList<FlowPath> getAllFlows(DBOperation dbHandler) {
Iterable<IFlowPath> flowPathsObj = null;
ArrayList<FlowPath> flowPaths = new ArrayList<FlowPath>();
@@ -506,7 +507,7 @@
* @param dataPathEndpoints the data path endpoints of the flow to get.
* @return the Flow Paths if found, otherwise null.
*/
- static ArrayList<FlowPath> getAllFlows(GraphDBOperation dbHandler,
+ static ArrayList<FlowPath> getAllFlows(DBOperation dbHandler,
CallerId installerId,
DataPathEndpoints dataPathEndpoints) {
//
@@ -549,7 +550,7 @@
* @param dataPathEndpoints the data path endpoints of the flows to get.
* @return the Flow Paths if found, otherwise null.
*/
- static ArrayList<FlowPath> getAllFlows(GraphDBOperation dbHandler,
+ static ArrayList<FlowPath> getAllFlows(DBOperation dbHandler,
DataPathEndpoints dataPathEndpoints) {
//
// TODO: The implementation below is not optimal:
@@ -590,7 +591,7 @@
* @param maxFlows the maximum number of flows to be returned.
* @return the Flow Paths if found, otherwise null.
*/
- static ArrayList<IFlowPath> getAllFlowsSummary(GraphDBOperation dbHandler,
+ static ArrayList<IFlowPath> getAllFlowsSummary(DBOperation dbHandler,
FlowId flowId,
int maxFlows) {
//
@@ -630,7 +631,7 @@
* @param dbHandler the Graph Database handler to use.
* @return all Flows information, without the associated Flow Entries.
*/
- static ArrayList<IFlowPath> getAllFlowsWithoutFlowEntries(GraphDBOperation dbHandler) {
+ static ArrayList<IFlowPath> getAllFlowsWithoutFlowEntries(DBOperation dbHandler) {
Iterable<IFlowPath> flowPathsObj = null;
ArrayList<IFlowPath> flowPathsObjArray = new ArrayList<IFlowPath>();
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 db1e588..68450c2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -42,8 +42,8 @@
public class FlowManager implements IFloodlightModule, IFlowService, INetMapStorage {
// flag to use FlowPusher instead of FlowSwitchOperation/MessageDamper
private final static boolean enableFlowPusher = false;
-
- protected DBOperation op;
+ protected DBOperation dbHandlerApi;
+ protected DBOperation dbHandlerInner;
protected volatile IFloodlightProviderService floodlightProvider;
protected volatile IDatagridService datagridService;
@@ -82,8 +82,9 @@
*/
@Override
public void init(final String dbStore, final String conf) {
- op = GraphDBManager.getDBOperation(dbStore, conf);
- topoRouteService = new TopoRouteService(dbStore, conf);
+ dbHandlerApi = GraphDBManager.getDBOperation(dbStore, conf);
+ dbHandlerInner = GraphDBManager.getDBOperation(dbStore, conf);
+
}
/**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
index 686bee0..e5144ab 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -57,9 +57,9 @@
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
deviceStorage = new DeviceStorageImpl();
- deviceStorage.init("");
+ deviceStorage.init("","");
topologyService = new TopologyManager();
- topologyService.init("");
+ topologyService.init("","");
}
public void startUp() {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java
index 801e414..3dba4f8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/BgpProxyArpManager.java
@@ -143,7 +143,7 @@
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
deviceStorage = new DeviceStorageImpl();
- deviceStorage.init("");
+ deviceStorage.init("","");
Timer arpTimer = new Timer("arp-processing");
arpTimer.scheduleAtFixedRate(new TimerTask() {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index 85fd618..ec8065c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -160,7 +160,7 @@
datagrid.registerArpEventHandler(this);
deviceStorage = new DeviceStorageImpl();
- deviceStorage.init("");
+ deviceStorage.init("","");
Timer arpTimer = new Timer("arp-processing");
arpTimer.scheduleAtFixedRate(new TimerTask() {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java b/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java
index dbf9ada..c914bbe 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/Topology.java
@@ -13,6 +13,7 @@
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Vertex;
+import net.onrc.onos.graph.DBOperation;
/**
* A class for storing Node and Link information for fast computation
@@ -376,7 +377,7 @@
*
* @param dbHandler the Graph Database handler to use.
*/
- public void readFromDatabase(GraphDBOperation dbHandler) {
+ public void readFromDatabase(DBOperation dbHandler) {
//
// Fetch the relevant info from the Switch and Port vertices
// from the Titan Graph.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
index c0e04f2..dae0cf4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/TopologyManager.java
@@ -12,6 +12,8 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.onrc.onos.datagrid.IDatagridService;
+import net.onrc.onos.graph.DBOperation;
+import net.onrc.onos.graph.GraphDBManager;
import net.onrc.onos.graph.GraphDBOperation;
import net.onrc.onos.ofcontroller.floodlightlistener.INetworkGraphService;
import net.onrc.onos.ofcontroller.util.DataPath;
@@ -34,7 +36,7 @@
private final static Logger log = LoggerFactory.getLogger(TopologyManager.class);
protected IFloodlightProviderService floodlightProvider;
- protected GraphDBOperation dbHandler;
+ protected DBOperation dbHandler;
/**
@@ -50,7 +52,7 @@
* the initialization.
*/
public TopologyManager(String config) {
- this.init(config);
+ this.init("",config);
}
/**
@@ -59,19 +61,19 @@
* @param dbHandler the database operation handler to use for the
* initialization.
*/
- public TopologyManager(GraphDBOperation dbHandler) {
+ public TopologyManager(DBOperation dbHandler) {
this.dbHandler = dbHandler;
}
/**
* Init the module.
- *
+ * @param
* @param config the database configuration file to use for
* the initialization.
*/
- public void init(String config) {
+ public void init(final String dbStore, String config) {
try {
- dbHandler = new GraphDBOperation(config);
+ dbHandler = GraphDBManager.getDBOperation(dbStore, config);
} catch (Exception e) {
log.error(e.getMessage());
}
@@ -147,7 +149,7 @@
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
String conf = "";
- this.init(conf);
+ this.init("",conf);
}
/**