diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
index d08da7c..3a5c9e2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -14,6 +14,12 @@
 import com.tinkerpop.frames.annotations.gremlin.GremlinParam;
 import com.tinkerpop.frames.VertexFrame;
 
+/*
+ * This is the interfaces to make the objects for Cassandra DB.
+ * They are interfaces, but it is also implementation,
+ * so this handles various control to the objects.  
+ * Please take a look at tinkerpop/frames annotation doc to understand more.
+ */
 public interface INetMapTopologyObjects {
 	
 public interface IBaseObject extends VertexFrame {
@@ -62,7 +68,7 @@
 		public Iterable<IDeviceObject> getDevices();
 		
 		@JsonIgnore
-		@Incidence(label="switch",direction = Direction.IN)
+		@Adjacency(label="switch",direction = Direction.IN)
 		public Iterable<IFlowEntry> getFlowEntries();
 
 	}
@@ -114,11 +120,11 @@
 		public void removeDevice(final IDeviceObject device);
 		
 		@JsonIgnore
-		@Incidence(label="inport",direction = Direction.IN)
+		@Adjacency(label="inport",direction = Direction.IN)
 		public Iterable<IFlowEntry> getInFlowEntries();
 		
 		@JsonIgnore
-		@Incidence(label="outport",direction = Direction.IN)
+		@Adjacency(label="outport",direction = Direction.IN)
 		public Iterable<IFlowEntry> getOutFlowEntries();
 		
 		@JsonIgnore
@@ -155,11 +161,11 @@
 		public Iterable<IPortObject> getAttachedPorts();
 			
 		@JsonIgnore
-		@Incidence(label="host",direction=Direction.IN)
+		@Adjacency(label="host",direction=Direction.IN)
 		public void setHostPort(final IPortObject port);
 		
 		@JsonIgnore
-		@Incidence(label="host",direction=Direction.IN)
+		@Adjacency(label="host",direction=Direction.IN)
 		public void removeHostPort(final IPortObject port);
 		
 		@JsonIgnore
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
new file mode 100644
index 0000000..3ea90ba
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
@@ -0,0 +1,206 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+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.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIDeviceObjectTest {
+	
+	//The test network is ./titan/schema/test-network.xml
+
+	protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+	String conf;
+    private GraphDBConnection conn = null;
+    private GraphDBOperation ope = null;
+    private TitanGraph titanGraph = null;
+	
+	@Before
+	public void setUp() throws Exception {
+		conf = "/dummy/path/to/db";
+		
+		// Make mock cassandra DB
+		// Replace TitanFactory.open() to return mock DB
+		TestDatabaseManager.deleteTestDatabase();
+		titanGraph = TestDatabaseManager.getTestDatabase();
+		//TestDatabaseManager.populateTestData(titanGraph);
+		PowerMock.mockStatic(TitanFactory.class);
+		EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+		PowerMock.replay(TitanFactory.class);
+		
+		conn = GraphDBConnection.getInstance(conf);
+		ope = new GraphDBOperation(conn);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		titanGraph.shutdown();
+		TestDatabaseManager.deleteTestDatabase();
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set MacAddress method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the mac address.
+	 * 2. Should get the mac address.
+	 */
+	@Test
+	public void testSetGetMacAddress() {
+		String macaddr = "00:00:00:00:00:00:0a:07";
+		IDeviceObject devObj = ope.newDevice();
+		devObj.setMACAddress(macaddr);
+		assertEquals(devObj.getMACAddress(), macaddr);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set IPAddress method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the ip address.
+	 * 2. Should get the ip address.
+	 */
+	@Test
+	public void testSetGetIPAddress() {
+		String ipaddr = "192.168.0.1";
+		IDeviceObject devObj = ope.newDevice();
+		devObj.setIPAddress(ipaddr);
+		assertEquals(devObj.getIPAddress(), ipaddr);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get attached port.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the attached ports.
+	 */
+	@Test
+	public void testGetAttachedPort() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short number = 1;	
+		Short number2 = 2;
+		IPortObject portObj = ope.newPort(dpid, number);
+		IPortObject portObj2 = ope.newPort(dpid, number2);
+		
+		String ipaddr = "192.168.0.1";
+		IDeviceObject devObj = ope.newDevice();
+		
+		portObj.setDevice(devObj);
+		portObj2.setDevice(devObj);
+		
+		HashMap<Short, IPortObject> portObjectList = new HashMap<Short, IPortObject>();
+		for(IPortObject port : devObj.getAttachedPorts())
+		{
+			portObjectList.put(port.getNumber(), port);
+		}
+		
+		assertTrue(portObjectList.containsValue(portObj));
+		assertTrue(portObjectList.containsValue(portObj2));
+		
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and remove host port method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set host port from the device.
+	 * 2. Should remove host port from the device.
+	 */
+	@Test
+	public void testSetRemoveHostPort() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short number = 1;	
+		Short number2 = 2;
+		IPortObject portObj = ope.newPort(dpid, number);
+		IPortObject portObj2 = ope.newPort(dpid, number2);
+		
+		String ipaddr = "192.168.0.1";
+		IDeviceObject devObj = ope.newDevice();
+		
+		devObj.setHostPort(portObj);
+		
+		HashMap<String, IDeviceObject> portObjectList = new HashMap<String, IDeviceObject>();
+		for(IDeviceObject dev : portObj.getDevices())
+		{
+			portObjectList.put(dev.getMACAddress(), dev);
+		}
+		assertTrue(portObjectList.containsValue(devObj));
+		
+		devObj.removeHostPort(portObj);
+		
+		HashMap<String, IDeviceObject> portObjectList2 = new HashMap<String, IDeviceObject>();
+		for(IDeviceObject dev : portObj.getDevices())
+		{
+			portObjectList2.put(dev.getMACAddress(), dev);
+		}
+		assertTrue(!portObjectList2.containsValue(devObj));
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for getSwitch method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the switch connected to the device.
+	 */
+	@Test
+	public void testGetSwitches() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		String dpid2 = "00:00:00:00:00:00:0a:08";
+		Short number = 1;	
+		Short number2 = 2;	
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		ISwitchObject swObj2 = ope.newSwitch(dpid2);
+		IPortObject portObj = ope.newPort(dpid, number);
+		IPortObject portObj2 = ope.newPort(dpid2, number2);
+		swObj.addPort(portObj);
+		swObj2.addPort(portObj2);
+		IDeviceObject devObj = ope.newDevice();
+		portObj.setDevice(devObj);
+		portObj2.setDevice(devObj);
+		
+		HashMap<String, ISwitchObject> switchObjectList = new HashMap<String, ISwitchObject>();
+		for(ISwitchObject sw : devObj.getSwitch())
+		{
+			switchObjectList.put(sw.getDPID(), sw);
+		}
+		assertTrue(switchObjectList.containsValue(swObj));
+		assertTrue(switchObjectList.containsValue(swObj2));
+	}
+	
+	
+}
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
new file mode 100644
index 0000000..eba7447
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowEntryTest.java
@@ -0,0 +1,348 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+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.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIFlowEntryTest {
+	
+	//The test network is ./titan/schema/test-network.xml
+
+	protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+	String conf;
+    private GraphDBConnection conn = null;
+    private GraphDBOperation ope = null;
+    private TitanGraph titanGraph = null;
+	private IFlowEntry flowEntry = null;
+	
+	@Before
+	public void setUp() throws Exception {
+		conf = "/dummy/path/to/db";
+		
+		// Make mock cassandra DB
+		// Replace TitanFactory.open() to return mock DB
+		TestDatabaseManager.deleteTestDatabase();
+		titanGraph = TestDatabaseManager.getTestDatabase();
+		//TestDatabaseManager.populateTestData(titanGraph);
+		PowerMock.mockStatic(TitanFactory.class);
+		EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+		PowerMock.replay(TitanFactory.class);
+		
+		conn = GraphDBConnection.getInstance(conf);
+		ope = new GraphDBOperation(conn);
+		
+		flowEntry = ope.newFlowEntry();
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		titanGraph.shutdown();
+		TestDatabaseManager.deleteTestDatabase();
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get FlowEntryId.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set FlowEntryId.
+	 * 2. Should get FlowEntryId.
+	 */
+	@Test
+	public void testSetGetFlowEntryId() {
+		String flowEntryId = "xx";
+		flowEntry.setFlowEntryId(flowEntryId);
+		assertEquals(flowEntry.getFlowEntryId(), flowEntryId);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get SwitchDpid.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set SwitchDpid.
+	 * 2. Should get SwitchDpid.
+	 */
+	@Test
+	public void testSetGetSwitchDpid() {
+		String switchDpid = "00:00:00:00:00:11";
+		flowEntry.setSwitchDpid(switchDpid);
+		assertEquals(flowEntry.getSwitchDpid(), switchDpid);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get UserState.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set UserState.
+	 * 2. Should get UserState.
+	 */
+	@Test
+	public void testSetGetUserState() {
+		String userStete = "good";
+		flowEntry.setUserState(userStete);
+		assertEquals(flowEntry.getUserState(), userStete);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get SwitchState.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set SwitchState.
+	 * 2. Should get SwitchState.
+	 */
+	@Test
+	public void testSetGetSwitchState() {
+		String switchStete = "ACTIVE";
+		flowEntry.setSwitchState(switchStete);
+		assertEquals(flowEntry.getSwitchState(), switchStete);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get ErrorStateType.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set ErrorStateType.
+	 * 2. Should get ErrorStateType.
+	 */
+	@Test
+	public void testSetGetErrorStateType() {
+		String errorSteteType = "error";
+		flowEntry.setErrorStateType(errorSteteType);
+		assertEquals(flowEntry.getErrorStateType(), errorSteteType);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get ErrorStateCode.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set ErrorStateCode.
+	 * 2. Should get ErrorStateCode.
+	 */
+	@Test
+	public void testSetGetErrorStateCode() {
+		String errorSteteCode = "error";
+		flowEntry.setErrorStateCode(errorSteteCode);
+		assertEquals(flowEntry.getErrorStateCode(), errorSteteCode);
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchInPort.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchInPort.
+	 * 2. Should get MatchInPort.
+	 */
+	@Test
+	public void testSetGetMatchInPort() {
+		Short inPort = 1;
+		flowEntry.setMatchInPort(inPort);
+		assertEquals(flowEntry.getMatchInPort(), inPort);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchEthernetFrameType.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchEthernetFrameType.
+	 * 2. Should get MatchEthernetFrameType.
+	 */
+	@Test
+	public void testSetGetMatchEthernetFrameType() {
+		Short matchEthernetFrameType = 1;
+		flowEntry.setMatchEthernetFrameType(matchEthernetFrameType);
+		assertEquals(flowEntry.getMatchEthernetFrameType(), matchEthernetFrameType);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchSrcMac.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchSrcMac.
+	 * 2. Should get MatchSrcMac.
+	 */
+	@Test
+	public void testSetGetMatchSrcMac() {
+		String matchSrcMac = "00:00:00:00:00:11";
+		flowEntry.setMatchSrcMac(matchSrcMac);
+		assertEquals(flowEntry.getMatchSrcMac(), matchSrcMac);
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchDstMac.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchDstMac.
+	 * 2. Should get MatchDstMac.
+	 */
+	@Test
+	public void testSetGetMatchDstMac() {
+		String matchDstMac = "00:00:00:00:00:11";
+		flowEntry.setMatchDstMac(matchDstMac);
+		assertEquals(flowEntry.getMatchDstMac(), matchDstMac);
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get SrcIPv4Net.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set SrcIPv4Net.
+	 * 2. Should get SrcIPv4Net.
+	 */
+	@Test
+	public void testSetGetMatchSrcIPv4Net() {
+		String srcIPv4Net = "192.168.0.1";
+		flowEntry.setMatchSrcIPv4Net(srcIPv4Net);
+		assertEquals(flowEntry.getMatchSrcIPv4Net(), srcIPv4Net);
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchDstIPv4Net.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchDstIPv4Net.
+	 * 2. Should get MatchDstIPv4Net.
+	 */
+	@Test
+	public void testSetGetMatchDstIPv4Net() {
+		String dstIPv4Net = "192.168.0.1";
+		flowEntry.setMatchDstIPv4Net(dstIPv4Net);
+		assertEquals(flowEntry.getMatchDstIPv4Net(), dstIPv4Net);
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get ActionOutput.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set ActionOutput.
+	 * 2. Should get ActionOutput.
+	 */
+	@Test
+	public void testSetGetActionOutput() {
+		Short actionOutput = 1;
+		flowEntry.setActionOutput(actionOutput);
+		assertEquals(flowEntry.getActionOutput(), actionOutput);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get FlowPath.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set FlowPath.
+	 * 2. Should get FlowPath.
+	 */
+	@Test
+	public void testSetGetFlowPath() {
+		IFlowPath fp = ope.newFlowPath();
+		String flowId = "xx";
+		fp.setFlowId(flowId);
+		flowEntry.setFlow(fp);
+		IFlowPath fp2 = flowEntry.getFlow();
+		assertEquals(fp2.getFlowId(), flowId);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get Switch.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set Switch.
+	 * 2. Should get Switch.
+	 */
+	@Test
+	public void testSetGetSwitch() {
+		String dpid = "00:00:00:00:00:22";
+		ISwitchObject sw1 = ope.newSwitch(dpid);
+		flowEntry.setSwitch(sw1);
+		ISwitchObject sw2 = flowEntry.getSwitch();
+		assertEquals(sw2, sw1);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get InPort.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set InPort.
+	 * 2. Should get InPort.
+	 */
+	@Test
+	public void testSetGetInPort() {
+		String dpid = "00:00:00:00:00:22";
+		Short portNum = 4;
+		IPortObject port1 = ope.newPort(dpid, portNum);
+		flowEntry.setInPort(port1);
+		IPortObject port2 = flowEntry.getInPort();
+		assertEquals(port2, port1);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get OutPort.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set OutPort.
+	 * 2. Should get OutPort.
+	 */
+	@Test
+	public void testSetGetOutPort() {
+		String dpid = "00:00:00:00:00:22";
+		Short portNum = 4;
+		IPortObject port1 = ope.newPort(dpid, portNum);
+		flowEntry.setOutPort(port1);
+		IPortObject port2 = flowEntry.getOutPort();
+		assertEquals(port2, port1);
+	}
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
new file mode 100644
index 0000000..9765af8
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIFlowPathTest.java
@@ -0,0 +1,383 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIFlowPathTest {
+	
+	//The test network is ./titan/schema/test-network.xml
+
+	protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+	String conf;
+    private GraphDBConnection conn = null;
+    private GraphDBOperation ope = null;
+    private TitanGraph titanGraph = null;
+	private IFlowPath flowPath = null;
+	private IFlowEntry flowEntry = null;
+	
+	@Before
+	public void setUp() throws Exception {
+		conf = "/dummy/path/to/db";
+		
+		// Make mock cassandra DB
+		// Replace TitanFactory.open() to return mock DB
+		TestDatabaseManager.deleteTestDatabase();
+		titanGraph = TestDatabaseManager.getTestDatabase();
+		//TestDatabaseManager.populateTestData(titanGraph);
+		PowerMock.mockStatic(TitanFactory.class);
+		EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+		PowerMock.replay(TitanFactory.class);
+		
+		conn = GraphDBConnection.getInstance(conf);
+		ope = new GraphDBOperation(conn);
+		
+		flowPath = ope.newFlowPath();
+		flowEntry = ope.newFlowEntry();
+		flowEntry.setState("zz");
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		titanGraph.shutdown();
+		TestDatabaseManager.deleteTestDatabase();
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set FlowId method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the flow id.
+	 * 2. Should get the flow id.
+	 */
+	@Test
+	public void testSetGetFlowId() {
+		String flowId = "xx";
+		flowPath.setFlowId(flowId);
+		assertEquals(flowPath.getFlowId(), flowId);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set InstallerId method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the installer id.
+	 * 2. Should get the installer id.
+	 */
+	@Test
+	public void testSetGetInstallerId() {
+		String flowId = "xx";
+		String installerId = "yy";
+		flowPath.setFlowId(flowId);
+		flowPath.setInstallerId(installerId);
+		assertEquals(flowPath.getInstallerId(), installerId);
+	}
+
+	/**
+	 * Desc:
+	 *  Test method for get and set SourceSwitch method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the source switch.
+	 * 2. Should get the source switch.
+	 */
+	@Test
+	public void testSetGetSourceSwitch() {
+		String flowId = "xx";
+		String sourceSwitch = "aa";
+		flowPath.setFlowId(flowId);
+		flowPath.setSrcSwitch(sourceSwitch);
+		assertEquals(flowPath.getSrcSwitch(), sourceSwitch);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set SourcePort method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the source port.
+	 * 2. Should get the source port.
+	 */
+	@Test
+	public void testSetGetSourcePort() {
+		String flowId = "xx";
+		Short sourcePort = 1;
+		flowPath.setFlowId(flowId);
+		flowPath.setSrcPort(sourcePort);
+		assertEquals(flowPath.getSrcPort(), sourcePort);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set DestSwitch method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the dest switch.
+	 * 2. Should get the dest switch.
+	 */
+	@Test
+	public void testSetGetDestSwitch() {
+		String flowId = "xx";
+		String destSwitch = "bb";
+		flowPath.setFlowId(flowId);
+		flowPath.setDstSwitch(destSwitch);
+		assertEquals(flowPath.getDstSwitch(), destSwitch);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set DestPort method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the source dest port.
+	 * 2. Should get the source dest port.
+	 */
+	@Test
+	public void testSetGetDstPort() {
+		String flowId = "xx";
+		Short dstPort = 2;
+		flowPath.setFlowId(flowId);
+		flowPath.setDstPort(dstPort);
+		assertEquals(flowPath.getDstPort(), dstPort);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set DataPathSummary method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the data path summary.
+	 * 2. Should get the data path summary.
+	 */
+	@Test
+	public void testSetGetDataPathSummary() {
+		String flowId = "xx";
+		String dataPathSummary = "yy";
+		flowPath.setFlowId(flowId);
+		flowPath.setInstallerId(dataPathSummary);
+		assertEquals(flowPath.getInstallerId(), dataPathSummary);
+	}
+	
+	public boolean testIFlowEntry(IFlowPath fp, IFlowEntry fe)
+	{
+		ArrayList<IFlowEntry> flowEntryList = new ArrayList<IFlowEntry>();
+		for(IFlowEntry inFlowEntry : fp.getFlowEntries())
+		{
+			flowEntryList.add(inFlowEntry);
+		}
+		return flowEntryList.contains(fe);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for addFlowEntry and getFlorEntries method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should add the FlowEntry.
+	 * 2. Should get the FlowEntries. It is tested in the testIFlowEntry method.
+	 */
+	@Test
+	public void testAddFlowEntryAndGetFlowEntries() {
+		String flowId = "xx";
+		flowPath.setFlowId(flowId);
+		flowPath.addFlowEntry(flowEntry);
+		IFlowEntry flowEntry2 = ope.newFlowEntry();
+		flowPath.addFlowEntry(flowEntry2);
+		assertTrue(testIFlowEntry(flowPath, flowEntry));
+		assertTrue(testIFlowEntry(flowPath, flowEntry2));
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for remove FlowEntry.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should remove FlowEntry.
+	 */
+	@Test
+	public void testRemoveFlowEntry() {
+		String flowId = "xx";
+		flowPath.setFlowId(flowId);
+		flowPath.addFlowEntry(flowEntry);
+		flowPath.removeFlowEntry(flowEntry);
+		assertTrue(!testIFlowEntry(flowPath, flowEntry));
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchEthernetFrameType
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchEthernetFrameType.
+	 * 2. Should get MatchEthernetFrameType.
+	 */
+	@Test
+	public void testSetGetMatchEthernetFrameType() {
+		String flowId = "xx";
+		Short matchEthernetFrameTypeShort = 1;
+		flowPath.setFlowId(flowId);
+		flowPath.setMatchEthernetFrameType(matchEthernetFrameTypeShort);
+		assertEquals(flowPath.getMatchEthernetFrameType(), matchEthernetFrameTypeShort);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchSrcMac
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchSrcMac.
+	 * 2. Should get MatchSrcMac.
+	 */
+	@Test
+	public void testSetGetMatchSrcMac() {
+		String flowId = "xx";
+		String matchSrcMac = "00:00:00:00:00:11";
+		flowPath.setFlowId(flowId);
+		flowPath.setMatchSrcMac(matchSrcMac);
+		assertEquals(flowPath.getMatchSrcMac(), matchSrcMac);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get MatchDstMac.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set MatchDstMac.
+	 * 2. Should get MatchDstMac.
+	 */
+	@Test
+	public void testSetGetMatchDstMac() {
+		String flowId = "xx";
+		String matchDstMac = "00:00:00:00:00:11";
+		flowPath.setFlowId(flowId);
+		flowPath.setMatchDstMac(matchDstMac);
+		assertEquals(flowPath.getMatchDstMac(), matchDstMac);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get SrcIPv4Net.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set SrcIPv4Net.
+	 * 2. Should get SrcIPv4Net.
+	 */
+	@Test
+	public void testSetGetMatchSrcIPv4Net() {
+		String flowId = "xx";
+		String ip = "192.168.0.1";
+		flowPath.setFlowId(flowId);
+		flowPath.setMatchSrcIPv4Net(ip);
+		assertEquals(flowPath.getMatchSrcIPv4Net(), ip);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get DstIPv4Net.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set DstIPv4Net.
+	 * 2. Should get DstIPv4Net.
+	 */
+	@Test
+	public void testSetGetMatchDstIPv4Net() {
+		String flowId = "xx";
+		String ip = "192.168.0.1";
+		flowPath.setFlowId(flowId);
+		flowPath.setMatchDstIPv4Net(ip);
+		assertEquals(flowPath.getMatchDstIPv4Net(), ip);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get UserState.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set UserState.
+	 * 2. Should get UserState.
+	 */
+	@Test
+	public void testSetGetUserState() {
+		String flowId = "xx";
+		String userStatus = "Good";
+		flowPath.setFlowId(flowId);
+		flowPath.setUserState(userStatus);
+		assertEquals(flowPath.getUserState(), userStatus);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get Switches.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get switches.
+	 */
+	@Test
+	public void testGetSwitches() {
+		String flowId = "xx";
+		String dpid = "1";
+		flowPath.setFlowId(flowId);
+		ISwitchObject sw = ope.newSwitch(dpid);
+		flowEntry.setSwitch(sw);
+		flowPath.addFlowEntry(flowEntry);
+		
+		HashMap<String, ISwitchObject> swList = new HashMap<String, ISwitchObject>();
+		for(ISwitchObject insw : flowPath.getSwitches()){
+			swList.put(sw.getDPID(), insw);
+		}
+		
+		assertTrue(swList.containsKey(dpid));
+	}
+	
+	//TODO Dont know how to set the state property.
+	@Test
+	public void testGetState() {
+		String status = null;
+		assertEquals(flowPath.getState(), status);
+	}
+	
+	
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java
new file mode 100644
index 0000000..2ddab3d
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIPortObjectTest.java
@@ -0,0 +1,359 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+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.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import net.onrc.onos.ofcontroller.flowmanager.FlowManager;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsIPortObjectTest {
+	
+	//The test network is ./titan/schema/test-network.xml
+
+	protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+	String conf;
+    private GraphDBConnection conn = null;
+    private GraphDBOperation ope = null;
+    private TitanGraph titanGraph = null;
+    
+    private ISwitchObject swObj;
+    private IPortObject portObj;
+    private IPortObject portObj2;
+    String dpid;
+    Short number;
+    Short number2;
+    
+    private ISwitchObject swObjParty;
+    private IPortObject portObjParty1;
+    private IPortObject portObjParty2;  
+    String dpidParty;
+    Short numberParty1;
+    Short numberParty2;
+    
+    
+	@Before
+	public void setUp() throws Exception {
+		conf = "/dummy/path/to/db";
+		
+		// Make mock cassandra DB
+		// Replace TitanFactory.open() to return mock DB
+		TestDatabaseManager.deleteTestDatabase();
+		titanGraph = TestDatabaseManager.getTestDatabase();
+		//TestDatabaseManager.populateTestData(titanGraph);
+		PowerMock.mockStatic(TitanFactory.class);
+		EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+		PowerMock.replay(TitanFactory.class);
+		
+		conn = GraphDBConnection.getInstance(conf);
+		ope = new GraphDBOperation(conn);
+		
+		dpid = "00:00:00:00:00:00:0a:07";
+		number = 1;	
+		number2 = 2;
+		swObj = ope.newSwitch(dpid);
+		portObj = ope.newPort(dpid, number);
+		portObj2 = ope.newPort(dpid, number2);
+
+		swObj.addPort(portObj);	
+		swObj.addPort(portObj2);
+		
+		dpidParty = "00:00:00:00:00:00:0a:08";
+		numberParty1 = 1;
+		numberParty2 = 2;
+		swObjParty = ope.newSwitch(dpidParty);
+		portObjParty1 = ope.newPort(dpidParty, numberParty1);
+		portObjParty2 = ope.newPort(dpidParty, numberParty2);
+		swObjParty.addPort(portObjParty1);	
+		swObjParty.addPort(portObjParty2);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		titanGraph.shutdown();
+		TestDatabaseManager.deleteTestDatabase();
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get port number property.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the port number.
+	 * 2. Should get the port number.
+	 */
+	@Test
+	public void testSetGetNumber() {
+		assertEquals(portObj.getNumber(), number);
+		Short testedNumber = 4;
+		portObj.setNumber(testedNumber);
+		assertEquals(portObj.getNumber(), testedNumber);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get port id property.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the port id.
+	 * 2. Should get the port id.
+	 */
+	@Test
+	public void testSetGetPortId() {
+		String portId = "test1";
+		portObj.setPortId(portId);
+		assertEquals(portObj.getPortId(), portId);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get port desc property.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the port desc.
+	 * 2. Should get the port desc.
+	 */
+	@Test
+	public void testSetGetDesc() {
+		String testedDesc = "port 4 at ATL Switch";
+		portObj.setDesc(testedDesc);
+		assertEquals(portObj.getDesc(), testedDesc);
+	}
+	
+	
+	/**
+	 * Desc:
+	 *  Test method for set and get port status property.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the port status.
+	 * 2. Should get the port status.
+	 */
+	@Test
+	public void testSetGetPortState() {
+		Integer portState = OFPortState.OFPPS_STP_FORWARD.getValue();
+		portObj.setPortState(portState);
+		assertEquals(portObj.getPortState(), portState);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get switch object.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the switch status.
+	 */
+	@Test
+	public void testGetSwitch() {
+		ISwitchObject sw = portObj.getSwitch();
+		assertEquals(sw.getDPID(), dpid);
+	}
+	
+	private boolean checkIDeviceObject(IPortObject IportObj, String mac)
+	{
+		HashMap<String, IDeviceObject> devList = new HashMap<String, IDeviceObject>();
+		for(IDeviceObject IdevObj : IportObj.getDevices())
+		{
+			devList.put(IdevObj.getMACAddress(), IdevObj);
+		}
+		return devList.containsKey(mac);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set and remove device object.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the device object.
+	 * 2. SHould remove the device object.
+	 */
+	@Test
+	public void testSetAndRemoveDevice() {
+		IDeviceObject devObj = ope.newDevice();
+		String devMac = "00:00:00:00:00:11";
+		devObj.setMACAddress(devMac);
+		
+		boolean b = checkIDeviceObject(portObj, devMac);
+		assertTrue(!b);
+		portObj.setDevice(devObj);
+		boolean b2 = checkIDeviceObject(portObj, devMac);
+		assertTrue(b2);
+		
+		portObj.removeDevice(devObj);
+		boolean b3 = checkIDeviceObject(portObj, devMac);
+		assertTrue(!b3);
+		
+	}	
+	
+	/**
+	 * Desc:
+	 *  Test method for get devices object.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the device objects.
+	 */
+	@Test
+	public void testGetDevices() {
+		IDeviceObject devObj = ope.newDevice();
+		String devMac = "58:55:ca:c4:1b:a0";
+		devObj.setMACAddress(devMac);
+		
+		portObj.setDevice(devObj);
+		boolean b = checkIDeviceObject(portObj, devMac);
+		assertTrue(b);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for set, get and remove linked port.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the linked objects.
+	 * 2. Should get the linked objects.
+	 * 3. SHould remove the liked objects.
+	 */
+	@Test
+	public void testSetGetRemoveLinkedPorts() {
+		String dpidParty = "00:00:00:00:00:00:00:08";
+		ISwitchObject swParty = ope.newSwitch(dpidParty);
+		Short poShort = 1;
+		IPortObject poParty = ope.newPort(dpidParty, poShort);
+		swParty.addPort(poParty);
+		
+		portObj.setLinkPort(poParty);
+		
+		ArrayList<IPortObject> iPortList = new ArrayList<IPortObject>();
+		for(IPortObject port : portObj.getLinkedPorts()) {
+			iPortList.add(port);
+		}	
+		assertTrue(iPortList.contains(poParty));	
+		
+		portObj.removeLink(poParty);
+		
+		ArrayList<IPortObject> iPortList2 = new ArrayList<IPortObject>();
+		for(IPortObject port : portObj.getLinkedPorts()) {
+			iPortList2.add(port);
+		}	
+		
+		assertTrue(!iPortList2.contains(poParty));
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get inbound flowEntry
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the inbound flowEntry.
+	 */
+	@Test
+	public void testGetInFlowEntries() {
+
+		portObj.setLinkPort(portObj2);
+		
+		IFlowPath flowPathObj = ope.newFlowPath();
+		
+		String flowEId = "1";
+		IFlowEntry flowEntryObj = ope.newFlowEntry();		
+		flowEntryObj.setFlowEntryId(flowEId);
+		flowEntryObj.setInPort(portObj);
+		flowEntryObj.setOutPort(portObj2);
+		flowEntryObj.setSwitch(swObj);
+		flowEntryObj.setFlow(flowPathObj);
+		
+		String flowEId2 = "2";
+		IFlowEntry flowEntryObj2 = ope.newFlowEntry();		
+		flowEntryObj2.setFlowEntryId(flowEId2);
+		flowEntryObj2.setInPort(portObjParty1);
+		flowEntryObj2.setOutPort(portObjParty2);
+		flowEntryObj.setSwitch(swObjParty);
+		flowEntryObj2.setFlow(flowPathObj);
+		
+		HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+		for(IFlowEntry flowEnt : portObj.getInFlowEntries())
+		{				
+			flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+		}
+		
+		assertTrue(flowEntryList.containsValue(flowEntryObj));
+		
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get outbound flowEntry
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the outbound flowEntry.
+	 */
+	@Test
+	public void testGetOutFlowEntries() {
+		
+		portObj.setLinkPort(portObj2);
+		
+		IFlowPath flowPathObj = ope.newFlowPath();
+		
+		String flowEId = "1";
+		IFlowEntry flowEntryObj = ope.newFlowEntry();		
+		flowEntryObj.setFlowEntryId(flowEId);
+		flowEntryObj.setInPort(portObj);
+		flowEntryObj.setOutPort(portObj2);
+		flowEntryObj.setSwitch(swObj);
+		flowEntryObj.setFlow(flowPathObj);
+		
+		String flowEId2 = "2";
+		IFlowEntry flowEntryObj2 = ope.newFlowEntry();		
+		flowEntryObj2.setFlowEntryId(flowEId2);
+		flowEntryObj2.setInPort(portObjParty1);
+		flowEntryObj2.setOutPort(portObjParty2);
+		flowEntryObj.setSwitch(swObjParty);
+		flowEntryObj2.setFlow(flowPathObj);
+		
+		HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+		for(IFlowEntry flowEnt : portObj2.getOutFlowEntries())
+		{				
+			flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+		}
+		
+		assertTrue(flowEntryList.containsValue(flowEntryObj));
+		
+	}
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
new file mode 100644
index 0000000..c4dca4b
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsISwitchObjectTest.java
@@ -0,0 +1,285 @@
+package net.onrc.onos.ofcontroller.core;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+
+import net.onrc.onos.graph.GraphDBConnection;
+import net.onrc.onos.graph.GraphDBOperation;
+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.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.slf4j.LoggerFactory;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+
+//Add Powermock preparation
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, SwitchStorageImpl.class})
+public class INetMapTopologyObjectsISwitchObjectTest {
+	
+	//The test network is ./titan/schema/test-network.xml
+
+	protected static org.slf4j.Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
+
+	String conf;
+    private GraphDBConnection conn = null;
+    private GraphDBOperation ope = null;
+    private TitanGraph titanGraph = null;
+	
+	@Before
+	public void setUp() throws Exception {
+		conf = "/dummy/path/to/db";
+		
+		// Make mock cassandra DB
+		// Replace TitanFactory.open() to return mock DB
+		TestDatabaseManager.deleteTestDatabase();
+		titanGraph = TestDatabaseManager.getTestDatabase();
+		//TestDatabaseManager.populateTestData(titanGraph);
+		PowerMock.mockStatic(TitanFactory.class);
+		EasyMock.expect(TitanFactory.open((String)EasyMock.anyObject())).andReturn(titanGraph);
+		PowerMock.replay(TitanFactory.class);
+		
+		conn = GraphDBConnection.getInstance(conf);
+		ope = new GraphDBOperation(conn);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		titanGraph.shutdown();
+		TestDatabaseManager.deleteTestDatabase();
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set state method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the status of the switch.
+	 * 2. Should get the status of the switch.
+	 */
+	@Test
+	public void testSetGetState() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		String state = "ACTIVE";
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		swObj.setState(state);
+		assertEquals(swObj.getState(), state);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for get and set Type method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the Type of the switch.
+	 * 2. Should get the Type of the switch.
+	 */
+	@Test
+	public void testSetGetType() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		String type = "Switch";
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		swObj.setType("Switch");
+		assertEquals(swObj.getType(), type);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for getDPID method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get the dpid of the switch.
+	 */
+	@Test
+	public void testGetDPID() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		
+		assertEquals(swObj.getDPID(), dpid);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for setDPID method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should set the dpid of the switch.
+	 */
+	@Test
+	public void testSetDPID() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		String dpid2 = "00:00:00:00:00:00:0a:08";
+		ISwitchObject obj = ope.newSwitch(dpid);
+		assertEquals(obj.getDPID(), dpid);
+		
+		obj.setDPID(dpid2);
+		assertEquals(obj.getDPID(), dpid2);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for getPorts method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get all of ports taken by the switch.
+	 */
+	@Test
+	public void testGetPorts() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short portNumber = 1;
+		int testSwitchPortNumber = 1;
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		IPortObject portObj = ope.newPort(dpid, portNumber);
+
+		swObj.addPort(portObj);
+		int i = 0;
+		for(IPortObject port : swObj.getPorts()){
+			i++;
+		}
+		assertEquals(testSwitchPortNumber, 1);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for add and getPort method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should add the port.
+	 * 1. Should get the port.
+	 */
+	@Test
+	public void testGetPort() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short portNumber = 1;
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		IPortObject portObj = ope.newPort(dpid, portNumber);
+		
+		swObj.addPort(portObj);
+		IPortObject portObj2 = swObj.getPort(portNumber);
+		assertEquals(portObj, portObj2);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for add and removePort method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should add a port to the switch.
+	 * 1. Should remove a port from the switch.
+	 */
+	@Test
+	public void testAddRemovePorts() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short portNum = 1;
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		IPortObject portObj = ope.newPort(dpid, portNum);
+		swObj.addPort(portObj);
+		
+		IPortObject portObj2 = swObj.getPort(portNum);
+		assertEquals(portObj2, portObj);
+		swObj.removePort(portObj);
+		assertNull(swObj.getPort(portNum));
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for getDevices method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get all devices attached to the switch.
+	 */
+	@Test
+	public void testGetDevices() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short portNum = 1;
+		String devMac = "00:00:00:00:00:11";
+		int numOfDev = 1;
+		
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		IPortObject portObj = ope.newPort(dpid, portNum);
+		IDeviceObject devObj = ope.newDevice();
+		devObj.setMACAddress(devMac);
+		swObj.addPort(portObj);
+		portObj.setDevice(devObj);
+		
+		int i = 0;
+		for(IDeviceObject dev : swObj.getDevices()){
+			i++;
+		}
+		assertEquals(i, numOfDev);
+	}
+	
+	/**
+	 * Desc:
+	 *  Test method for getFlowEntries method.
+	 * Condition:
+	 *  N/A
+	 * Expect:
+	 * 1. Should get all flowEntries attached to the switch.
+	 */
+	@Test
+	public void testGetFlowEntries() {
+		String dpid = "00:00:00:00:00:00:0a:07";
+		Short number = 1;	
+		Short number2 = 2;
+		Short number3 = 3;
+		ISwitchObject swObj = ope.newSwitch(dpid);
+		IPortObject portObj = ope.newPort(dpid, number);
+		IPortObject portObj2 = ope.newPort(dpid, number2);
+		IPortObject portObj3 = ope.newPort(dpid, number3);
+
+		swObj.addPort(portObj);	
+		swObj.addPort(portObj2);
+		swObj.addPort(portObj3);
+		
+		IFlowPath flowPathObj = ope.newFlowPath();
+		
+		String flowEId = "1";
+		IFlowEntry flowEntryObj = ope.newFlowEntry();		
+		flowEntryObj.setFlowEntryId(flowEId);
+		flowEntryObj.setInPort(portObj);
+		flowEntryObj.setOutPort(portObj2);
+		flowEntryObj.setSwitch(swObj);
+		flowEntryObj.setFlow(flowPathObj);
+		
+		String flowEId2 = "2";
+		IFlowEntry flowEntryObj2 = ope.newFlowEntry();		
+		flowEntryObj2.setFlowEntryId(flowEId2);
+		flowEntryObj2.setInPort(portObj);
+		flowEntryObj2.setOutPort(portObj3);
+		flowEntryObj2.setSwitch(swObj);
+		flowEntryObj2.setFlow(flowPathObj);
+		
+		HashMap<String, IFlowEntry> flowEntryList = new HashMap<String, IFlowEntry>();
+		for(IFlowEntry flowEnt : swObj.getFlowEntries())
+		{				
+			flowEntryList.put(flowEnt.getFlowEntryId(), flowEnt);
+		}
+		
+		assertTrue(flowEntryList.containsValue(flowEntryObj));
+		assertTrue(flowEntryList.containsValue(flowEntryObj2));
+	}
+
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
index b8091fc..5b0a5b1 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
@@ -56,20 +56,22 @@
         
         //Change the type of all port numbers to short in the database
         Iterator<Vertex> it = titanGraph.getVertices("type", "port").iterator();
-	while (it.hasNext()){
-		Vertex port = it.next();
 
-		if(port.getProperty("number") instanceof Short)
-		{
-			Short portNum = (Short) port.getProperty("number");
-			port.setProperty("number", portNum.shortValue());
-		}
-		else{
-			Integer portNum = (Integer) port.getProperty("number");	
-			port.setProperty("number", portNum.shortValue());
-		}
+        while (it.hasNext()){
+        	Vertex port = it.next();
+
+        	if(port.getProperty("number") instanceof Short)
+        	{
+        		Short portNum = (Short) port.getProperty("number");
+        		port.setProperty("number", portNum.shortValue());
+        	}
+        	else{
+        		Integer portNum = (Integer) port.getProperty("number");	
+        		port.setProperty("number", portNum.shortValue());
+        	}
 
         }
+        
         titanGraph.stopTransaction(Conclusion.SUCCESS);
 	}
 	
