diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java
index 2c459de..498c533 100644
--- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java
+++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImplTest.java
@@ -15,7 +15,7 @@
 import net.onrc.onos.util.GraphDBConnection;
 import net.onrc.onos.util.GraphDBOperation;
 
-import org.easymock.*;
+import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestGraphDBOperation.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestGraphDBOperation.java
index f4ed4c8..5a957ec 100644
--- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestGraphDBOperation.java
+++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/TestGraphDBOperation.java
@@ -5,6 +5,7 @@
 
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
 import org.easymock.EasyMock;
 import org.openflow.util.HexString;
 import org.slf4j.Logger;
@@ -23,6 +24,7 @@
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.flowcache.web.DatapathSummarySerializer;
 import net.onrc.onos.ofcontroller.util.FlowEntryId;
 import net.onrc.onos.ofcontroller.util.FlowId;
 import net.onrc.onos.util.GraphDBConnection;
@@ -35,142 +37,28 @@
 	protected List<TestSwitchObject> switches;
 	protected List<TestPortObject> ports;
 	protected List<TestDeviceObject> devices;
-//	protected List<TestFlowEntry> flows;
+	protected List<TestFlowPath> paths;
+	protected List<TestFlowEntry> entries;
 
 	protected List<TestSwitchObject> switchesToAdd;
 	protected List<TestPortObject> portsToAdd;
 	protected List<TestDeviceObject> devicesToAdd;
-//	protected List<TestFlowEntry> flowsToAdd;
+	protected List<TestFlowPath> pathsToAdd;
+	protected List<TestFlowEntry> entriesToAdd;
 
 	protected List<TestSwitchObject> switchesToRemove;
 	protected List<TestPortObject> portsToRemove;
 	protected List<TestDeviceObject> devicesToRemove;
-//	protected List<TestFlowEntry> flowsToRemove;
-
+	protected List<TestFlowPath> pathsToRemove;
+	protected List<TestFlowEntry> entriesToRemove;
 
 	// Testable implementations of INetMapTopologyObject interfaces
-	public static class TestDeviceObject implements IDeviceObject {
-		private String state,type,mac,ipaddr;
-		private List<IPortObject> ports;
-		private List<ISwitchObject> switches;
-		
-		private String stateToUpdate,typeToUpdate,macToUpdate,ipaddrToUpdate;
-		private List<IPortObject> portsToAdd;
-		private List<IPortObject> portsToRemove;
 
-		public TestDeviceObject() {
-			ports = new ArrayList<IPortObject>();
-			portsToAdd = new ArrayList<IPortObject>();
-			portsToRemove = new ArrayList<IPortObject>();
-			switches = new ArrayList<ISwitchObject>();
-			
-			clearUncommitedData();
-		}
-		
-		public void commit() {
-			for(IPortObject port : portsToAdd) {
-				ports.add(port);
-			}
-			for(IPortObject port : portsToRemove) {
-				ports.remove(port);
-			}
-			
-			if(stateToUpdate != null) { state = stateToUpdate; }
-			if(typeToUpdate != null) { type = typeToUpdate; }
-			if(macToUpdate != null) { mac = macToUpdate; }
-			if(ipaddrToUpdate != null) { ipaddr = ipaddrToUpdate; }
-			
-			clearUncommitedData();
-		}
-		
-		public void rollback() {
-			clearUncommitedData();
-		}
-		
-		public void clearUncommitedData() {
-			ports.clear();
-			portsToAdd.clear();
-			portsToRemove.clear();
-			
-			stateToUpdate = typeToUpdate = macToUpdate = ipaddrToUpdate = null;
-		}
-		
-		public void addSwitchForTest(ISwitchObject sw) {
-			switches.add(sw);
-		}
-		
-		public void addPortForTest(IPortObject port) {
-			ports.add(port);
-		}
-		
-		@Override
-		@JsonProperty("state")
-		@Property("state")
-		public String getState() { return state; }
-	
-		@Override
-		@Property("state")
-		public void setState(String state) { stateToUpdate = state; }
-	
-		@Override
-		@JsonIgnore
-		@Property("type")
-		public String getType() { return type; }
-	
-		@Override
-		@Property("type")
-		public void setType(String type) { typeToUpdate = type; }
-	
-		@Override
-		public Vertex asVertex() {
-			// TODO Auto-generated method stub
-			return null;
-		}
-	
-		@Override
-		@JsonProperty("mac")
-		@Property("dl_addr")
-		public String getMACAddress() { return mac; }
-	
-		@Override
-		@Property("dl_addr")
-		public void setMACAddress(String macaddr) { macToUpdate = macaddr; }
-	
-		@Override
-		@JsonProperty("ipv4")
-		@Property("nw_addr")
-		public String getIPAddress() { return ipaddr; }
-
-		@Override
-		@Property("dl_addr")
-		public void setIPAddress(String ipaddr) { ipaddrToUpdate = ipaddr; }
-	
-		@Override
-		@JsonIgnore
-		@Incidence(label = "host", direction = Direction.IN)
-		public Iterable<IPortObject> getAttachedPorts() { return ports; }
-	
-		@Override
-		@JsonIgnore
-		@Incidence(label = "host", direction = Direction.IN)
-		public void setHostPort(IPortObject port) { portsToAdd.add(port); }
-	
-		@Override
-		@JsonIgnore
-		@Incidence(label = "host", direction = Direction.IN)
-		public void removeHostPort(IPortObject port) { portsToRemove.add(port); }
-	
-		@Override
-		@JsonIgnore
-		@GremlinGroovy("_().in('host').in('on')")
-		public Iterable<ISwitchObject> getSwitch() { return switches; }
-	}
-	
 	public static class TestSwitchObject implements ISwitchObject {
 		private String state,type,dpid;
 		private List<IPortObject> ports;
 		private List<IDeviceObject> devices;
-		private List<IFlowEntry> flows;
+		private List<IFlowEntry> entries;
 
 		private String stateToUpdate, typeToUpdate, dpidToUpdate;
 		private List<IPortObject> portsToAdd;
@@ -184,7 +72,7 @@
 			portsToAdd = new ArrayList<IPortObject>();
 			portsToRemove = new ArrayList<IPortObject>();
 			devices = new ArrayList<IDeviceObject>();
-			flows = new ArrayList<IFlowEntry>();
+			entries = new ArrayList<IFlowEntry>();
 			
 			clearUncommitedData();
 		}
@@ -213,10 +101,12 @@
 			stateToUpdate = typeToUpdate = dpidToUpdate = null;
 		}
 		
-		public void setDpidForTest(String dpid) { this.dpid = dpid; }
 		public void setStateForTest(String state) { this.state = state; }
 		public void setTypeForTest(String type) { this.type = type; }
+		public void setDpidForTest(String dpid) { this.dpid = dpid; }
 		public void addPortForTest(TestPortObject port) { ports.add(port);  }
+		public void addDeviceForTest(TestDeviceObject dev) { devices.add(dev); }
+		public void addEntryForTest(TestFlowEntry entry) { entries.add(entry); }
 		
 		@Override
 		@JsonProperty("state")
@@ -282,7 +172,7 @@
 		@Override
 		@JsonIgnore
 		@Incidence(label = "switch", direction = Direction.IN)
-		public Iterable<IFlowEntry> getFlowEntries() { return flows; }
+		public Iterable<IFlowEntry> getFlowEntries() { return entries; }
 	}
 	
 	public static class TestPortObject implements IPortObject {
@@ -292,7 +182,7 @@
 		private ISwitchObject sw;
 		private List<IPortObject> linkedPorts;
 		private List<IDeviceObject> devices;
-		private List<IFlowEntry> flows;
+		private List<IFlowEntry> inflows,outflows;
 		
 		private String stateToUpdate,typeToUpdate,descToUpdate;
 		private Short numberToUpdate;
@@ -313,7 +203,8 @@
 			devices = new ArrayList<IDeviceObject>();
 			devicesToAdd = new ArrayList<IDeviceObject>();
 			devicesToRemove = new ArrayList<IDeviceObject>();
-			flows = new ArrayList<IFlowEntry>();
+			inflows = new ArrayList<IFlowEntry>();
+			outflows = new ArrayList<IFlowEntry>();
 			
 			clearUncommitedData();
 		}
@@ -347,6 +238,7 @@
 			numberToUpdate = null;
 		}
 		
+		// Setter methods for test
 		public void setStateForTest(String state) { this.state = state; }
 		public void setTypeForTest(String type) { this.type = type; }
 		public void setDescForTest(String desc) { this.desc = desc; }
@@ -354,7 +246,10 @@
 		public void setPortStateForTest(Integer state) { this.port_state = state; }
 		public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
 		public void addLinkedPortForTest(TestPortObject port) { this.linkedPorts.add(port); }
+		public void addInflowForTest(TestFlowEntry entry) { inflows.add(entry); }
+		public void addOutflowForTest(TestFlowEntry entry) { outflows.add(entry); }
 		
+		// Override methods for mock IPortObject
 		@Override
 		@JsonProperty("state")
 		@Property("state")
@@ -427,24 +322,17 @@
 		@Override
 		@JsonIgnore
 		@Incidence(label = "inport", direction = Direction.IN)
-		public Iterable<IFlowEntry> getInFlowEntries() {
-			// TODO Auto-generated method stub
-			return null;
-		}
+		public Iterable<IFlowEntry> getInFlowEntries() { return inflows; }
 
 		@Override
 		@JsonIgnore
 		@Incidence(label = "outport", direction = Direction.IN)
-		public Iterable<IFlowEntry> getOutFlowEntries() {
-			// TODO Auto-generated method stub
-			return null;
-		}
+		public Iterable<IFlowEntry> getOutFlowEntries() { return outflows; }
 
 		@Override
 		@JsonIgnore
 		@Adjacency(label = "link")
-		public Iterable<IPortObject> getLinkedPorts() {
-			return linkedPorts; }
+		public Iterable<IPortObject> getLinkedPorts() { return linkedPorts; }
 
 		@Override
 		@Adjacency(label = "link")
@@ -454,30 +342,658 @@
 		@Adjacency(label = "link")
 		public void setLinkPort(IPortObject dest_port) { linkedPortsToAdd.add(dest_port); }
 	}
+		
+	public static class TestDeviceObject implements IDeviceObject {
+		private String state,type,mac,ipaddr;
+		private List<IPortObject> ports;
+		private List<ISwitchObject> switches;
+		
+		private String stateToUpdate,typeToUpdate,macToUpdate,ipaddrToUpdate;
+		private List<IPortObject> portsToAdd;
+		private List<IPortObject> portsToRemove;
 	
+		public TestDeviceObject() {
+			ports = new ArrayList<IPortObject>();
+			portsToAdd = new ArrayList<IPortObject>();
+			portsToRemove = new ArrayList<IPortObject>();
+			switches = new ArrayList<ISwitchObject>();
+			
+			clearUncommitedData();
+		}
+		
+		public void commit() {
+			for(IPortObject port : portsToAdd) {
+				ports.add(port);
+			}
+			for(IPortObject port : portsToRemove) {
+				ports.remove(port);
+			}
+			
+			if(stateToUpdate != null) { state = stateToUpdate; }
+			if(typeToUpdate != null) { type = typeToUpdate; }
+			if(macToUpdate != null) { mac = macToUpdate; }
+			if(ipaddrToUpdate != null) { ipaddr = ipaddrToUpdate; }
+			
+			clearUncommitedData();
+		}
+		
+		public void rollback() {
+			clearUncommitedData();
+		}
+		
+		public void clearUncommitedData() {
+			ports.clear();
+			portsToAdd.clear();
+			portsToRemove.clear();
+			
+			stateToUpdate = typeToUpdate = macToUpdate = ipaddrToUpdate = null;
+		}
+		
+		// Setter methods for test
+		public void setStateForTest(String state) { this.state = state; }
+		public void setTypeForTest(String type) { this.type = type; }
+		public void setMacForTest(String mac) { this.mac = mac; }
+		public void setIpaddrForTest(String ipaddr) { this.ipaddr = ipaddr; }
+		public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+		public void addPortForTest(IPortObject port) { ports.add(port); }
+		
+		@Override
+		@JsonProperty("state")
+		@Property("state")
+		public String getState() { return state; }
 	
+		@Override
+		@Property("state")
+		public void setState(String state) { stateToUpdate = state; }
+	
+		@Override
+		@JsonIgnore
+		@Property("type")
+		public String getType() { return type; }
+	
+		@Override
+		@Property("type")
+		public void setType(String type) { typeToUpdate = type; }
+	
+		@Override
+		public Vertex asVertex() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+	
+		@Override
+		@JsonProperty("mac")
+		@Property("dl_addr")
+		public String getMACAddress() { return mac; }
+	
+		@Override
+		@Property("dl_addr")
+		public void setMACAddress(String macaddr) { macToUpdate = macaddr; }
+	
+		@Override
+		@JsonProperty("ipv4")
+		@Property("nw_addr")
+		public String getIPAddress() { return ipaddr; }
+	
+		@Override
+		@Property("dl_addr")
+		public void setIPAddress(String ipaddr) { ipaddrToUpdate = ipaddr; }
+	
+		@Override
+		@JsonIgnore
+		@Incidence(label = "host", direction = Direction.IN)
+		public Iterable<IPortObject> getAttachedPorts() {
+			return ports; }
+	
+		@Override
+		@JsonIgnore
+		@Incidence(label = "host", direction = Direction.IN)
+		public void setHostPort(IPortObject port) { portsToAdd.add(port); }
+	
+		@Override
+		@JsonIgnore
+		@Incidence(label = "host", direction = Direction.IN)
+		public void removeHostPort(IPortObject port) { portsToRemove.add(port); }
+	
+		@Override
+		@JsonIgnore
+		@GremlinGroovy("_().in('host').in('on')")
+		public Iterable<ISwitchObject> getSwitch() { return switches; }
+	}
+	
+	public static class TestFlowPath implements IFlowPath {
+		private String state,type,flowId,installerId,srcSw,dstSw;
+		private String dataPathSummary,userState;
+		private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
+		private Short srcPort,dstPort,matchEthernetFrameType;
+		
+		private List<IFlowEntry> entries;
+		private List<ISwitchObject> switches;
+
+		private String stateToUpdate,typeToUpdate,flowIdToUpdate,installerIdToUpdate,srcSwToUpdate,dstSwToUpdate;
+		private String dataPathSummaryToUpdate,userStateToUpdate;
+		private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+		private Short srcPortToUpdate,dstPortToUpdate,matchEthernetFrameTypeToUpdate;
+
+		private List<IFlowEntry> flowsToAdd;
+		private List<IFlowEntry> flowsToRemove;
+
+		public TestFlowPath() {
+			entries = new ArrayList<IFlowEntry>();
+			flowsToAdd = new ArrayList<IFlowEntry>();
+			flowsToRemove = new ArrayList<IFlowEntry>();
+			
+			switches = new ArrayList<ISwitchObject>();
+			
+			clear();
+		}
+		
+		public void commit() {
+			for(IFlowEntry flow : flowsToAdd) {
+				entries.add(flow);
+			}
+			for(IFlowEntry flow : flowsToRemove) {
+				entries.remove(flow);
+			}
+			if(stateToUpdate != null) { state = stateToUpdate; }
+			if(typeToUpdate != null) { type = typeToUpdate; }
+			if(flowIdToUpdate != null) { flowId = flowIdToUpdate; }
+			if(installerIdToUpdate != null) { installerId = installerIdToUpdate; }
+			if(srcSwToUpdate != null) { srcSw = srcSwToUpdate; }
+			if(dstSwToUpdate != null) { dstSw = dstSwToUpdate; }
+			if(dataPathSummaryToUpdate != null) { dataPathSummary = dataPathSummaryToUpdate; }
+			if(userStateToUpdate != null) { userState = userStateToUpdate; }
+			if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+			if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+			if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+			if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+			if(srcPortToUpdate != null) { srcPort = srcPortToUpdate; }
+			if(dstPortToUpdate != null) { dstPort = dstPortToUpdate; }
+			if(matchEthernetFrameTypeToUpdate != null) { matchEthernetFrameType = matchEthernetFrameTypeToUpdate; }
+		}
+		
+		public void rollback() {
+			clear();
+		}
+		
+		public void clear() {
+			flowsToAdd.clear();
+			flowsToRemove.clear();
+			
+			stateToUpdate = typeToUpdate = flowIdToUpdate = installerIdToUpdate = null;
+			srcSwToUpdate = dstSwToUpdate = dataPathSummaryToUpdate = userStateToUpdate = null;
+			matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+			srcPortToUpdate = dstPortToUpdate = matchEthernetFrameTypeToUpdate = null;
+		}
+		
+		// Setter methods for test
+		public void setStateForTest(String state) { this.state = state; }
+		public void setTypeForTest(String type) { this.type = type; }
+		public void setFlowIdForTest(String flowId) { this.flowId = flowId; }
+		public void setInstallerIdForTest(String installerId) { this.installerId = installerId; }
+		public void setSrcSwForTest(String srcSw) { this.srcSw = srcSw; }
+		public void setDstSwForTest(String dstSw) { this.dstSw = dstSw; }
+		public void setDataPathSummaryForTest(String dataPathSummary) { this.dataPathSummary = dataPathSummary; }
+		public void setUserStateForTest(String userState) { this.userState = userState; }
+		public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+		public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+		public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+		public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+		public void setSrcPortForTest(Short srcPort) { this.srcPort = srcPort; }
+		public void setDstPortForTest(Short dstPort) { this.dstPort = dstPort; }
+		public void setMatchEthernetFrameTypeForTest(Short matchEthernetFrameType) { this.matchEthernetFrameType = matchEthernetFrameType; }
+		public void addFlowEntryForTest(IFlowEntry entry) { entries.add(entry); }
+		public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+
+		@Override
+		@JsonProperty("state")
+		@Property("state")
+		public String getState() { return state; }
+
+		@Override
+		@Property("state")
+		public void setState(String state) { stateToUpdate = state; }
+
+		@Override
+		@JsonIgnore
+		@Property("type")
+		public String getType() { return type; }
+
+		@Override
+		@Property("type")
+		public void setType(String type) { typeToUpdate = type; }
+
+		@Override
+		public Vertex asVertex() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		@Override
+		@JsonProperty("flowId")
+		@Property("flow_id")
+		public String getFlowId() { return flowId; }
+
+		@Override
+		@Property("flow_id")
+		public void setFlowId(String flowId) { flowIdToUpdate = flowId; }
+
+		@Override
+		@JsonProperty("installerId")
+		@Property("installer_id")
+		public String getInstallerId() { return installerId; }
+
+		@Override
+		@Property("installer_id")
+		public void setInstallerId(String installerId) { installerIdToUpdate = installerId; }
+
+		@Override
+		@JsonProperty("srcDpid")
+		@Property("src_switch")
+		public String getSrcSwitch() { return srcSw; }
+
+		@Override
+		@Property("src_switch")
+		public void setSrcSwitch(String srcSwitch) { srcSwToUpdate = srcSwitch; }
+
+		@Override
+		@JsonProperty("srcPort")
+		@Property("src_port")
+		public Short getSrcPort() { return srcPort; }
+
+		@Override
+		@Property("src_port")
+		public void setSrcPort(Short srcPort) { srcPortToUpdate = srcPort; }
+
+		@Override
+		@JsonProperty("dstDpid")
+		@Property("dst_switch")
+		public String getDstSwitch() { return dstSw; }
+
+		@Override
+		@Property("dst_switch")
+		public void setDstSwitch(String dstSwitch) { dstSwToUpdate = dstSwitch; }
+
+		@Override
+		@JsonProperty("dstPort")
+		@Property("dst_port")
+		public Short getDstPort() { return dstPort; }
+
+		@Override
+		@Property("dst_port")
+		public void setDstPort(Short dstPort) { dstPortToUpdate = dstPort; }
+
+		@Override
+		@JsonProperty("dataPath")
+		@JsonSerialize(using = DatapathSummarySerializer.class)
+		@Property("data_path_summary")
+		public String getDataPathSummary() { return dataPathSummary; }
+
+		@Override
+		@Property("data_path_summary")
+		public void setDataPathSummary(String dataPathSummary) { dataPathSummaryToUpdate = dataPathSummary; }
+
+		@Override
+		@JsonIgnore
+		@Adjacency(label = "flow", direction = Direction.IN)
+		public Iterable<IFlowEntry> getFlowEntries() { return entries; }
+
+		@Override
+		@Adjacency(label = "flow", direction = Direction.IN)
+		public void addFlowEntry(IFlowEntry flowEntry) {
+			if(! entries.contains(flowEntry)) {
+				flowsToAdd.add(flowEntry);
+			}
+		}
+
+		@Override
+		@Adjacency(label = "flow", direction = Direction.IN)
+		public void removeFlowEntry(IFlowEntry flowEntry) {
+			if(entries.contains(flowEntry)) {
+				flowsToAdd.add(flowEntry);
+			}
+		}
+
+		@Override
+		@JsonIgnore
+		@Property("matchEthernetFrameType")
+		public Short getMatchEthernetFrameType() { return matchEthernetFrameType; }
+
+		@Override
+		@Property("matchEthernetFrameType")
+		public void setMatchEthernetFrameType(Short matchEthernetFrameType) {
+			matchEthernetFrameTypeToUpdate = matchEthernetFrameType; }
+
+		@Override
+		@JsonIgnore
+		@Property("matchSrcMac")
+		public String getMatchSrcMac() { return matchSrcMac; }
+
+		@Override
+		@Property("matchSrcMac")
+		public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+
+		@Override
+		@JsonIgnore
+		@Property("matchDstMac")
+		public String getMatchDstMac() { return matchDstMac; }
+
+		@Override
+		@Property("matchDstMac")
+		public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+		@Override
+		@JsonIgnore
+		@Property("matchSrcIPv4Net")
+		public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+
+		@Override
+		@Property("matchSrcIPv4Net")
+		public void setMatchSrcIPv4Net(String matchSrcIPv4Net) {
+			matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+
+		@Override
+		@JsonIgnore
+		@Property("matchDstIPv4Net")
+		public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+
+		@Override
+		@Property("matchDstIPv4Net")
+		public void setMatchDstIPv4Net(String matchDstIPv4Net) {
+			matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+		@Override
+		@JsonIgnore
+		@GremlinGroovy("_().in('flow').out('switch')")
+		public Iterable<ISwitchObject> getSwitches() { return switches; }
+
+		@Override
+		@JsonIgnore
+		@Property("user_state")
+		public String getUserState() { return userState; }
+
+		@Override
+		@Property("user_state")
+		public void setUserState(String userState) { userStateToUpdate = userState; }
+	}
+
+	public static class TestFlowEntry implements IFlowEntry {
+		private String state,type,entryId,dpid,userState,switchState,errorStateType,errorStateCode;
+		private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
+		private Short matchInPort,matchEtherFrameType,actionOutput;
+		
+		private IFlowPath flowPath;
+		private ISwitchObject sw;
+		private IPortObject inport,outport;
+	
+		private String stateToUpdate,typeToUpdate,entryIdToUpdate,dpidToUpdate,
+			userStateToUpdate,switchStateToUpdate,errorStateTypeToUpdate,errorStateCodeToUpdate;
+		private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+	
+		private Short matchInPortToUpdate,matchEtherFrameTypeToUpdate,actionOutputToUpdate;
+	
+		private IFlowPath flowPathToUpdate;
+		private ISwitchObject swToUpdate;
+		private IPortObject inportToUpdate,outportToUpdate;
+	
+		public TestFlowEntry() {
+			clearUncommitedData();
+		}
+		
+		public void commit() {
+			if(stateToUpdate != null) { state = stateToUpdate; }
+			if(typeToUpdate != null) { type = typeToUpdate; }
+			if(entryIdToUpdate != null) { entryId = entryIdToUpdate; }
+			if(dpidToUpdate != null) { dpid = dpidToUpdate; }
+			if(userStateToUpdate != null) { userState = userStateToUpdate; }
+			if(switchStateToUpdate != null) { switchState = switchStateToUpdate; }
+			if(errorStateTypeToUpdate != null) { errorStateType = errorStateTypeToUpdate; }
+			if(errorStateCodeToUpdate != null) { errorStateCode = errorStateCodeToUpdate; }
+			if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+			if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+			if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+			if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+			if(matchInPortToUpdate != null) { matchInPort = matchInPortToUpdate; }
+			if(matchEtherFrameTypeToUpdate != null) { matchEtherFrameType = matchEtherFrameTypeToUpdate; }
+			if(actionOutputToUpdate != null) { actionOutput = actionOutputToUpdate; }
+			
+			if(flowPathToUpdate != null) { flowPath = flowPathToUpdate; }
+			if(swToUpdate != null) { sw = swToUpdate; }
+			if(inportToUpdate != null) { inport = inportToUpdate; }
+			if(outportToUpdate != null) { outport = outportToUpdate; }
+	
+			clearUncommitedData();
+		}
+		
+		public void rollback() {
+			clearUncommitedData();
+		}
+		
+		public void clearUncommitedData() {
+			stateToUpdate = typeToUpdate = entryIdToUpdate = dpidToUpdate = null;
+			userStateToUpdate = switchStateToUpdate = errorStateTypeToUpdate = errorStateCodeToUpdate = null;
+			matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+			matchInPortToUpdate = matchEtherFrameTypeToUpdate = actionOutputToUpdate = null;
+			flowPathToUpdate = null;
+			swToUpdate = null;
+			inportToUpdate = outportToUpdate = null;
+		}
+		
+		// Setter methods for test
+		public void setStateForTest(String state) { this.state = state; }
+		public void setTypeForTest(String type) { this.type = type; }
+		public void setEntryIdForTest(String entryId) { this.entryId = entryId; }
+		public void setDpidForTest(String dpid) { this.dpid = dpid; }
+		public void setUserStateForTest(String userState) { this.userState = userState; }
+		public void setSwitchStateForTest(String switchState) { this.switchState = switchState; }
+		public void setErrorStateTypeForTest(String errorStateType) { this.errorStateType = errorStateType; }
+		public void setErrorStateCodeForTest(String errorStateCode) { this.errorStateCode = errorStateCode; }
+		public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+		public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+		public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+		public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+		public void setMatchInPortForTest(Short matchInPort) { this.matchInPort = matchInPort; }
+		public void setMatchEtherFrameTypeForTest(Short matchEtherFrameType) { this.matchEtherFrameType = matchEtherFrameType; }
+		public void setActionOutputForTest(Short actionOutput) { this.actionOutput = actionOutput; }
+		public void setFlowPathForTest(IFlowPath flowPath) { this.flowPath = flowPath; }
+		public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
+		public void setInportForTest(IPortObject inport) { this.inport = inport; }
+		public void setOutportForTest(IPortObject outport) { this.outport = outport; }
+		
+		@Override
+		@JsonProperty("state")
+		@Property("state")
+		public String getState() { return state; }
+	
+		@Override
+		@Property("state")
+		public void setState(String state) { stateToUpdate = state; }
+	
+		@Override
+		@JsonIgnore
+		@Property("type")
+		public String getType() { return type; }
+	
+		@Override
+		@Property("type")
+		public void setType(String type) { typeToUpdate = type; }
+	
+		@Override
+		public Vertex asVertex() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+	
+		@Override
+		@Property("flow_entry_id")
+		public String getFlowEntryId() { return entryId; }
+	
+		@Override
+		@Property("flow_entry_id")
+		public void setFlowEntryId(String flowEntryId) { entryIdToUpdate = flowEntryId; }
+	
+		@Override
+		@Property("switch_dpid")
+		public String getSwitchDpid() { return dpid; }
+	
+		@Override
+		@Property("switch_dpid")
+		public void setSwitchDpid(String switchDpid) { dpidToUpdate = switchDpid; }
+	
+		@Override
+		@Property("user_state")
+		public String getUserState() { return userState; }
+	
+		@Override
+		@Property("user_state")
+		public void setUserState(String userState) { userStateToUpdate = userState; }
+	
+		@Override
+		@Property("switch_state")
+		public String getSwitchState() { return switchState; }
+	
+		@Override
+		@Property("switch_state")
+		public void setSwitchState(String switchState) { switchStateToUpdate = switchState; }
+	
+		@Override
+		@Property("error_state_type")
+		public String getErrorStateType() { return errorStateType; }
+	
+		@Override
+		@Property("error_state_type")
+		public void setErrorStateType(String errorStateType) { errorStateTypeToUpdate = errorStateType; }
+	
+		@Override
+		@Property("error_state_code")
+		public String getErrorStateCode() { return errorStateCode; }
+	
+		@Override
+		@Property("error_state_code")
+		public void setErrorStateCode(String errorStateCode) { errorStateCodeToUpdate = errorStateCode; }
+	
+		@Override
+		@Property("matchInPort")
+		public Short getMatchInPort() { return matchInPort; }
+	
+		@Override
+		@Property("matchInPort")
+		public void setMatchInPort(Short matchInPort) { matchInPortToUpdate = matchInPort; }
+	
+		@Override
+		@Property("matchEthernetFrameType")
+		public Short getMatchEthernetFrameType() {return matchEtherFrameType; }
+	
+		@Override
+		@Property("matchEthernetFrameType")
+		public void setMatchEthernetFrameType(Short matchEthernetFrameType) { matchEtherFrameTypeToUpdate = matchEthernetFrameType; }
+		
+		@Override
+		@Property("matchSrcMac")
+		public String getMatchSrcMac() { return matchSrcMac; }
+	
+		@Override
+		@Property("matchSrcMac")
+		public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+	
+		@Override
+		@Property("matchDstMac")
+		public String getMatchDstMac() { return matchDstMac; }
+	
+		@Override
+		@Property("matchDstMac")
+		public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+	
+		@Override
+		@Property("matchSrcIPv4Net")
+		public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+	
+		@Override
+		@Property("matchSrcIPv4Net")
+		public void setMatchSrcIPv4Net(String matchSrcIPv4Net) { matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+	
+		@Override
+		@Property("matchDstIPv4Net")
+		public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+	
+		@Override
+		@Property("matchDstIPv4Net")
+		public void setMatchDstIPv4Net(String matchDstIPv4Net) { matchDstIpaddrToUpdate = matchDstIPv4Net; }
+	
+		@Override
+		@Property("actionOutput")
+		public Short getActionOutput() { return actionOutput; }
+	
+		@Override
+		@Property("actionOutput")
+		public void setActionOutput(Short actionOutput) { actionOutputToUpdate = actionOutput; }
+	
+		@Override
+		@Adjacency(label = "flow")
+		public IFlowPath getFlow() { return flowPath; }
+	
+		@Override
+		@Adjacency(label = "flow")
+		public void setFlow(IFlowPath flow) { flowPathToUpdate = flow; }
+	
+		@Override
+		@Adjacency(label = "switch")
+		public ISwitchObject getSwitch() { return sw; }
+	
+		@Override
+		@Adjacency(label = "switch")
+		public void setSwitch(ISwitchObject sw) { swToUpdate = sw; }
+	
+		@Override
+		@Adjacency(label = "inport")
+		public IPortObject getInPort() { return inport; }
+	
+		@Override
+		@Adjacency(label = "inport")
+		public void setInPort(IPortObject port) { inportToUpdate = port; }
+	
+		@Override
+		@Adjacency(label = "outport")
+		public IPortObject getOutPort() { return outport; }
+	
+		@Override
+		@Adjacency(label = "outport")
+		public void setOutPort(IPortObject port) { outportToUpdate = port; }
+	}
+
+
 	public TestGraphDBOperation() {
 		super(EasyMock.createNiceMock(GraphDBConnection.class));
 		
 		switches = new ArrayList<TestSwitchObject>();
 		ports = new ArrayList<TestPortObject>();
 		devices = new ArrayList<TestDeviceObject>();
-//		flows = new ArrayList<TestFlowEntry>();
+		paths = new ArrayList<TestFlowPath>();
+		entries = new ArrayList<TestFlowEntry>();
 		
 		switchesToAdd = new ArrayList<TestSwitchObject>();
 		portsToAdd = new ArrayList<TestPortObject>();
 		devicesToAdd = new ArrayList<TestDeviceObject>();
-//		flowsToAdd = new ArrayList<TestFlowEntry>();
+		pathsToAdd = new ArrayList<TestFlowPath>();
+		entriesToAdd = new ArrayList<TestFlowEntry>();
 
 		switchesToRemove = new ArrayList<TestSwitchObject>();
 		portsToRemove = new ArrayList<TestPortObject>();
 		devicesToRemove = new ArrayList<TestDeviceObject>();
-//		flowsToRemove = new ArrayList<TestFlowEntry>();
+		pathsToRemove = new ArrayList<TestFlowPath>();
+		entriesToRemove = new ArrayList<TestFlowEntry>();
 		
 		clearUncommitedData();
 	}
 	
 	private void clearUncommitedData() {
+		for(TestFlowEntry flow : entries) {
+			flow.clearUncommitedData();
+		}
+		for(TestFlowEntry flow : entriesToAdd) {
+			flow.clearUncommitedData();
+		}
+		
 		for(TestDeviceObject dev : devices) {
 			dev.clearUncommitedData();
 		}
@@ -499,6 +1015,8 @@
 			port.clearUncommitedData();
 		}
 		
+		entriesToAdd.clear();
+		entriesToRemove.clear();
 		devicesToAdd.clear();
 		devicesToRemove.clear();
 		switchesToAdd.clear();
@@ -509,6 +1027,12 @@
 	
 	
 	// this.*ForTest() methods below are supposed to be used for creation of test topology.
+	public TestSwitchObject createNewSwitchForTest() {
+		TestSwitchObject sw = new TestSwitchObject();
+		switches.add(sw);
+		return sw;
+	}
+	
 	/**
 	 * 
 	 * @param dpid
@@ -531,6 +1055,12 @@
 		return sw;
 	}
 	
+	public TestPortObject createNewPortForTest() {
+		TestPortObject port = new TestPortObject();
+		ports.add(port);
+		return port;
+	}
+	
 	public TestPortObject createNewPortForTest(String dpid, Short number) {
 		TestSwitchObject sw = null;
 		
@@ -558,6 +1088,25 @@
 		src.addLinkedPortForTest(dst);
 		//dst.addLinkedPortForTest(src);
 	}
+		
+	public TestDeviceObject createNewDeviceForTest() {
+		TestDeviceObject dev = new TestDeviceObject();
+		
+		return dev;
+	}
+	
+	public TestFlowPath createNewFlowPathForTest() {
+		TestFlowPath path = new TestFlowPath();
+		paths.add(path);
+		return path;
+	}
+
+	public TestFlowEntry createNewFlowEntryForTest() {
+		TestFlowEntry entry = new TestFlowEntry();
+		entries.add(entry);
+		return entry;
+	}
+
 	
 	public boolean hasLinkBetween(String srcSw_str, Short srcNumber, String dstSw_str, Short dstNumber) {
 		IPortObject srcPort = null, dstPort = null;
@@ -663,8 +1212,14 @@
 
 	@Override
 	public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
-		// TODO Auto-generated method stub
-		return null;
+		List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+		
+		for(TestFlowEntry entry : entries) {
+			if(entry.getSwitchState().equals("FE_SWITCH_NOT_UPDATED")) {
+				list.add(entry);
+			}
+		}
+		return list;
 	}
 
 	@Override
@@ -725,80 +1280,123 @@
 
 	@Override
 	public IDeviceObject newDevice() {
-		// TODO Auto-generated method stub
-		return null;
+		TestDeviceObject dev = new TestDeviceObject();
+		devicesToAdd.add(dev);
+		
+		return dev;
 	}
 
 	@Override
 	public IDeviceObject searchDevice(String macAddr) {
-		// TODO Auto-generated method stub
+		for(IDeviceObject dev : devices) {
+			if(dev.getMACAddress().equals(macAddr)) {
+				return dev;
+			}
+		}
 		return null;
 	}
 
 	@Override
 	public Iterable<IDeviceObject> getDevices() {
-		// TODO Auto-generated method stub
-		return null;
+		List<IDeviceObject> list = new ArrayList<IDeviceObject>();
+		
+		for(TestDeviceObject dev : devices) {
+			list.add(dev);
+		}
+		
+		return list;
 	}
 
 	@Override
 	public void removeDevice(IDeviceObject dev) {
-		// TODO Auto-generated method stub
-
+		if(devices.contains((TestDeviceObject)dev)) {
+			devicesToRemove.add((TestDeviceObject)dev);
+		}
 	}
 
 	@Override
 	public IFlowPath newFlowPath() {
-		// TODO Auto-generated method stub
-		return null;
+		TestFlowPath path = new TestFlowPath();
+		pathsToAdd.add(path);
+		
+		return path;
 	}
 
 	@Override
 	public IFlowPath searchFlowPath(FlowId flowId) {
-		// TODO Auto-generated method stub
+		for(IFlowPath path : paths) {
+			if(path.getFlowId().equals(flowId)) {
+				return path;
+			}
+		}
 		return null;
 	}
 
 	@Override
 	public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) {
-		// TODO Auto-generated method stub
+		for(IFlowPath path : paths) {
+			for(IFlowEntry entry : path.getFlowEntries()) {
+				if(entry.equals(flowEntry)) {
+					return path;
+				}
+			}
+
+		}
 		return null;
 	}
 
 	@Override
 	public Iterable<IFlowPath> getAllFlowPaths() {
-		// TODO Auto-generated method stub
-		return null;
+		List<IFlowPath> list = new ArrayList<IFlowPath>();
+		
+		for(IFlowPath path : paths) {
+			list.add(path);
+		}
+		
+		return list;
 	}
 
 	@Override
 	public void removeFlowPath(IFlowPath flowPath) {
-		// TODO Auto-generated method stub
-
+		if(paths.contains((TestFlowPath)flowPath)) {
+			pathsToRemove.add((TestFlowPath)flowPath);
+		}
 	}
 
 	@Override
 	public IFlowEntry newFlowEntry() {
-		// TODO Auto-generated method stub
-		return null;
+		TestFlowEntry entry = new TestFlowEntry();
+		entriesToAdd.add(entry);
+		return entry;
 	}
 
 	@Override
 	public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
-		// TODO Auto-generated method stub
+		for(TestFlowEntry entry : entries) {
+			// TODO check if this matching works
+			if(entry.getFlowEntryId().equals(flowEntryId)) {
+				return entry;
+			}
+		}
 		return null;
 	}
 
 	@Override
 	public Iterable<IFlowEntry> getAllFlowEntries() {
-		// TODO Auto-generated method stub
-		return null;
+		List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+		
+		for(TestFlowEntry entry : entries) {
+			list.add(entry);
+		}
+		
+		return list;
 	}
 
 	@Override
 	public void removeFlowEntry(IFlowEntry flowEntry) {
-		// TODO Auto-generated method stub
-
+		if(entries.contains((TestFlowEntry)flowEntry)) {
+			entriesToRemove.add((TestFlowEntry)flowEntry);
+		}
 	}
 
 	@Override
