diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
new file mode 100644
index 0000000..7c1ea2a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -0,0 +1,84 @@
+package net.onrc.onos.util;
+
+import java.util.Set;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
+import com.tinkerpop.frames.FramedGraph;
+
+public class GraphDBConnection {
+	public enum Transaction {
+		COMMIT,
+		ROLLBACK
+	}
+	private static GraphDBConnection singleton = new GraphDBConnection( );
+	private static TitanGraph graph;
+	private static GraphDBUtils utils;
+	   
+	   /* A private Constructor prevents any other 
+	    * class from instantiating.
+	    */
+	   private GraphDBConnection(){ }
+	   
+	   /* Static 'instance' method */
+	   public static GraphDBConnection getInstance(String conf) {
+		   if (graph == null||graph.isOpen()) {
+		        graph = TitanFactory.open(conf);		        
+		        // FIXME: Creation on Indexes should be done only once
+		        Set<String> s = graph.getIndexedKeys(Vertex.class);
+		        if (!s.contains("dpid")) {
+		           graph.createKeyIndex("dpid", Vertex.class);
+		        }
+		        if (!s.contains("type")) {
+		        	graph.createKeyIndex("type", Vertex.class);
+		        }
+		        if (!s.contains("dl_address")) {
+		        	graph.createKeyIndex("dl_address", Vertex.class);
+		        }
+		   }
+		   graph.stopTransaction(Conclusion.SUCCESS);
+		   if (utils == null) {
+			   utils = new GraphDBUtils();
+		   }
+	      return singleton;
+	   }
+	   
+	   public IDBUtils utils() {
+		   return utils;
+	   }
+	   
+	   protected FramedGraph<TitanGraph> getFramedGraph() {
+	   
+		   	if (isValid()) {
+		   		FramedGraph<TitanGraph> fg = new FramedGraph<TitanGraph>(graph);
+		   		return fg;
+		   	} else {
+		   		return null;
+		   	}
+	   }
+	   
+	   public Boolean isValid() {
+		   
+		   return (graph != null||graph.isOpen());
+	   }
+	   
+	   public void startTx() {
+		   
+	   }
+	   
+	   public void endTx(Transaction tx) {
+		   switch (tx) {
+		   case COMMIT:
+			   graph.stopTransaction(Conclusion.SUCCESS);
+		   case ROLLBACK:
+			   graph.stopTransaction(Conclusion.FAILURE);
+		   }
+	   }
+	   
+	   public void close() {
+		   
+	   }
+	   
+}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBUtils.java b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
new file mode 100644
index 0000000..8bb83ea
--- /dev/null
+++ b/src/main/java/net/onrc/onos/util/GraphDBUtils.java
@@ -0,0 +1,59 @@
+package net.onrc.onos.util;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.graphdb.transaction.VertexIterable;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.frames.FramedGraph;
+import com.tinkerpop.frames.FramedVertexIterable;
+import com.tinkerpop.gremlin.java.GremlinPipeline;
+
+import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.floodlightcontroller.routing.Link;
+
+public class GraphDBUtils implements IDBUtils {
+
+	@Override
+	public ISwitchObject searchSwitch(GraphDBConnection conn, String dpid) {
+		// TODO Auto-generated method stub
+		FramedGraph<TitanGraph> fg = conn.getFramedGraph();
+		
+		return fg.getVertices("dpid",dpid).iterator().hasNext() ? 
+				fg.getVertices("dpid",dpid,ISwitchObject.class).iterator().next() : null;
+    			
+	}
+
+	@Override
+	public IDeviceObject searchDevice(GraphDBConnection conn, String macAddr) {
+		// TODO Auto-generated method stub
+		FramedGraph<TitanGraph> fg = conn.getFramedGraph();	
+		return fg.getVertices("dl_address",macAddr).iterator().hasNext() ? fg.getVertices("dl_address",macAddr,
+    			IDeviceObject.class).iterator().next() : null;
+    			
+	}
+
+	@Override
+	public IPortObject searchPort(GraphDBConnection conn, String dpid, short number) {
+		ISwitchObject sw = searchSwitch(conn, dpid);
+		GremlinPipeline<Vertex, IPortObject> pipe = new GremlinPipeline<Vertex, IPortObject>();
+		pipe.start(sw.asVertex());
+	    pipe.out("on").has("number", number);
+	    FramedVertexIterable<IPortObject> r = new FramedVertexIterable(conn.getFramedGraph(), pipe, IPortObject.class);
+	    return r.iterator().hasNext() ? r.iterator().next() : null;		
+	}
+
+	@Override
+	public IDeviceObject newDevice(GraphDBConnection conn) {
+		FramedGraph<TitanGraph> fg = conn.getFramedGraph();	
+		IDeviceObject obj = fg.addVertex(null,IDeviceObject.class);
+		return obj;
+	}
+
+	@Override
+	public void removeDevice(GraphDBConnection conn, IDeviceObject dev) {
+		FramedGraph<TitanGraph> fg = conn.getFramedGraph();	
+		fg.removeVertex(dev.asVertex());		
+	}
+
+}
diff --git a/src/main/java/net/onrc/onos/util/IDBUtils.java b/src/main/java/net/onrc/onos/util/IDBUtils.java
new file mode 100644
index 0000000..52dbc70
--- /dev/null
+++ b/src/main/java/net/onrc/onos/util/IDBUtils.java
@@ -0,0 +1,13 @@
+package net.onrc.onos.util;
+
+import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
+
+public interface IDBUtils {	
+	public ISwitchObject searchSwitch(GraphDBConnection conn, String dpid);
+	public IDeviceObject searchDevice(GraphDBConnection conn, String macAddr);
+	public IDeviceObject newDevice(GraphDBConnection conn);
+	public void removeDevice(GraphDBConnection conn, IDeviceObject dev);
+	public IPortObject searchPort(GraphDBConnection conn, String dpid, short number);
+}
