diff --git a/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java b/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java
index e99ca81..b40d2af 100644
--- a/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java
+++ b/src/test/java/net/onrc/onos/graph/GraphDBOperationTest.java
@@ -3,16 +3,19 @@
  */
 package net.onrc.onos.graph;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 import junit.framework.TestCase;
-
-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.IIpv4Address;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
@@ -25,12 +28,14 @@
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.api.easymock.PowerMock;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
+import com.google.common.net.InetAddresses;
 import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
 import com.tinkerpop.blueprints.Vertex;
@@ -334,14 +339,14 @@
 		
 		IDeviceObject device = op.newDevice();
 		device.setMACAddress("11:22:33:44:55:66");
-		device.setIPAddress("192.168.1.1");
+		//device.setIPAddress("192.168.1.1");
 		op.commit();
 		
 		Iterator<Vertex> vertices = testdb.getVertices("type", "device").iterator();
 		assertTrue(vertices.hasNext());
 		Vertex v = vertices.next();
 		assertEquals("11:22:33:44:55:66", v.getProperty("dl_addr").toString());
-		assertEquals("192.168.1.1", v.getProperty("nw_addr").toString());
+		//assertEquals("192.168.1.1", v.getProperty("nw_addr").toString());
 	}
 
 	/**
@@ -395,6 +400,53 @@
 		op.commit();
 		assertNull(op.searchDevice("11:22:33:44:55:66"));
 	}
+	
+	/**
+	 * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newIpv4Address(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IIpv4Address)}.
+	 */
+	@Test
+	public final void testNewIpv4Address() {
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.10.1"));
+		
+		assertFalse(testdb.getVertices("type", "ipv4Address").iterator().hasNext());
+		
+		IIpv4Address ipv4Address = op.newIpv4Address();
+		ipv4Address.setIpv4Address(intIpv4Address);
+		//device.setIPAddress("192.168.1.1");
+		op.commit();
+		
+		Iterator<Vertex> vertices = testdb.getVertices("type", "ipv4Address").iterator();
+		assertTrue(vertices.hasNext());
+		Vertex v = vertices.next();
+		assertEquals(intIpv4Address, ((Integer) v.getProperty("ipv4_address")).intValue());
+	}
+	
+	/**
+	 * Test method for {@link net.onrc.onos.graph.GraphDBOperation#searchIpv4Address(net.onrc.onos.graph.GraphDBConnection, net.floodlightcontroller.core.INetMapTopologyObjects.IIpv4Address)}.
+	 */
+	@Test
+	public final void testSearchIpv4Address() {
+		int addr1 = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.20.1"));
+		int addr2 = InetAddresses.coerceToInteger(InetAddresses.forString("59.203.2.15"));
+		
+		assertNull(op.searchIpv4Address(addr1));
+		assertNull(op.searchIpv4Address(addr2));
+
+		op.newIpv4Address().setIpv4Address(addr1);
+		op.commit();
+		
+		IIpv4Address ipv4Address = op.searchIpv4Address(addr1);
+		assertNotNull(ipv4Address);
+		assertEquals(addr1, ipv4Address.getIpv4Address());
+		
+		assertNull(op.searchIpv4Address(addr2));
+	}
+	
+	@Ignore
+	@Test
+	public final void testEnsureIpv4Address() {
+		// TODO not yet implemented
+	}
 
 	/**
 	 * Test method for {@link net.onrc.onos.graph.GraphDBOperation#newFlowPath(net.onrc.onos.graph.GraphDBConnection)}.
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
index 880335b..7bd75d2 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjectsIDeviceObjectTest.java
@@ -1,16 +1,19 @@
 package net.onrc.onos.ofcontroller.core;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 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.IIpv4Address;
 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;
@@ -18,9 +21,10 @@
 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 org.slf4j.LoggerFactory;
 
+import com.google.common.net.InetAddresses;
 import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
 
@@ -89,10 +93,12 @@
 	 */
 	@Test
 	public void testSetGetIPAddress() {
-		String ipaddr = "192.168.0.1";
+		int ipaddr = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.0.1"));
 		IDeviceObject devObj = ope.newDevice();
-		devObj.setIPAddress(ipaddr);
-		assertEquals(devObj.getIPAddress(), ipaddr);
+		IIpv4Address ipv4Address = ope.newIpv4Address();
+		ipv4Address.setIpv4Address(ipaddr);
+		devObj.addIpv4Address(ipv4Address);
+		assertEquals(devObj.getIpv4Address(ipaddr), ipv4Address);
 	}
 	
 	/**
diff --git a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java
index 89d4b92..b81370a 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImplTest.java
@@ -6,21 +6,21 @@
 import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import net.floodlightcontroller.devicemanager.IDevice;
 import net.floodlightcontroller.devicemanager.SwitchPort;
-import net.floodlightcontroller.packet.IPv4;
 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.IIpv4Address;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
 import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
 import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
-import net.floodlightcontroller.devicemanager.internal.Device;
+
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Before;
@@ -33,12 +33,14 @@
 import org.powermock.modules.junit4.PowerMockRunner;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
+import com.google.common.net.InetAddresses;
 import com.thinkaurelius.titan.core.TitanFactory;
 
 //Add Powermock preparation
 @RunWith(PowerMockRunner.class)
 @PrepareForTest({TitanFactory.class, GraphDBConnection.class, GraphDBOperation.class, DeviceStorageImpl.class})
-public class DeviceStorageImplTest{ //extends FloodlightTestCase{
+public class DeviceStorageImplTest{
 	
 	protected final static Logger log = LoggerFactory.getLogger(SwitchStorageImpl.class);
 	
@@ -61,288 +63,187 @@
 		//PowerMock.mockStatic(GraphDBOperation.class);
 		mockOpe = PowerMock.createMock(GraphDBOperation.class);
 		PowerMock.expectNew(GraphDBOperation.class, new Class<?>[]{String.class}, conf).andReturn(mockOpe);
-		mockOpe.close();
+		//mockOpe.close();
 		PowerMock.replay(GraphDBOperation.class);
         // Replace the conf to dummy conf
 		// String conf = "/tmp/cassandra.titan";
 
-		
+		deviceImpl.init(conf);
 
 	}
 
 	@After
 	public void tearDown() throws Exception {	
-		deviceImpl.close();
-		deviceImpl = null;
-		
 		verify(mockOpe);
 	}
 	
-	private String makeIPStringFromArray(Integer[] ipaddresses){
-        String multiIntString = "";
-        for(Integer intValue : ipaddresses)
-        {
-        	if (multiIntString == null || multiIntString.isEmpty()){
-        		multiIntString = "[" + IPv4.fromIPv4Address(intValue);
-        	}
-        	else{
-           		multiIntString += "," + IPv4.fromIPv4Address(intValue);
-        	}
-        }
-        return multiIntString + "]";
+	private IPortObject getMockPort(long dpid, short port) {
+		IPortObject mockPortObject = createMock(IPortObject.class);
+		expect(mockPortObject.getNumber()).andReturn(port).anyTimes();
+		expect(mockPortObject.getDesc()).andReturn("test port").anyTimes();
+		return mockPortObject;
 	}
 	
-
+	private IDevice getMockDevice(String strMacAddress, long attachmentDpid, 
+			short attachmentPort, int ipv4Address) {
+		IDevice mockIDevice = createMock(IDevice.class);
+		
+		
+		long longMacAddress = HexString.toLong(strMacAddress);
+		
+		SwitchPort[] attachmentSwitchPorts = {new SwitchPort(attachmentDpid, attachmentPort)};
+		
+		expect(mockIDevice.getMACAddress()).andReturn(longMacAddress).anyTimes();
+		expect(mockIDevice.getMACAddressString()).andReturn(strMacAddress).anyTimes();
+		expect(mockIDevice.getAttachmentPoints()).andReturn(attachmentSwitchPorts).anyTimes();
+		expect(mockIDevice.getIPv4Addresses()).andReturn(new Integer[] {ipv4Address}).anyTimes();
+		
+		replay(mockIDevice);
+		
+		return mockIDevice;
+	}
+	
 	/**
-	 * Desc:
+	 * Description:
 	 *  Test method for addDevice method.
-	 * Codition:
-	 *  N/A
+	 * Condition:
+	 *  The device does not already exist in the database
 	 * Expect:
 	 * 	Get proper IDeviceObject
 	 */
-	//@Ignore
 	@Test
 	public void testAddNewDevice() {
-		try 
-		{	   
-			//Make mockDevice
-			IDevice mockDev = createMock(Device.class);
-			// Mac addr for test device.
-			String macAddr = "99:99:99:99:99:99";
-			// IP addr for test device
-			String ip = "192.168.100.1";
-			Integer[] ipaddrs = {IPv4.toIPv4Address(ip)};
-			// Mac addr for attached switch
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			// Port number for attached switch
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
 		
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs).anyTimes();
-			expect(mockDev.getAttachmentPoints()).andReturn(sps).anyTimes();
-			replay(mockDev);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList);
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-			//Add the device
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-			verify(mockIDev);
-			
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort); 
+		IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(null);
+		expect(mockOpe.newDevice()).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.<IPortObject>emptyList());
+		expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+		mockPortObject.setDevice(mockDeviceObject);
+		expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+		expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+		mockDeviceObject.addIpv4Address(mockIpv4Address);
+		expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+		expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+		
+		mockDeviceObject.setMACAddress(strMacAddress);
+		mockDeviceObject.setType("device");
+		mockDeviceObject.setState("ACTIVE");
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockPortObject);
+		replay(mockIpv4Address);
+		replay(mockOpe);
+		
+		IDeviceObject addedObject = deviceImpl.addDevice(device);
+		assertNotNull(addedObject);
+		
+		verify(mockDeviceObject);
 	}
 	
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for addDevice method.
 	 * Condition:
-	 * 	Already added device is existed.
+	 *  The device already exists in the database.
 	 * Expect:
 	 * 	Get proper IDeviceObject still.
 	 *  Check the IDeviceObject properties set expectedly. 
 	 */
-	//@Ignore
 	@Test
-	public void testAddDeviceExisting() {
-		try 
-		{	   
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer[] ipaddrs = {IPv4.toIPv4Address(ip)};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
+	public void testAddExistingDevice() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
 		
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs).times(2);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps).times(2);
-			replay(mockDev);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList).anyTimes();
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-			//Add the device
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-			//Add the same device
-	        IDeviceObject obj2 = deviceImpl.addDevice(mockDev);
-			assertNotNull(obj2);
-
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort); 
+		IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singleton(mockPortObject));
+		expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+		expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+		expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+		expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+		
+		mockDeviceObject.setMACAddress(strMacAddress);
+		mockDeviceObject.setType("device");
+		mockDeviceObject.setState("ACTIVE");
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockPortObject);
+		replay(mockIpv4Address);
+		replay(mockOpe);
+		
+		IDeviceObject addedObject = deviceImpl.addDevice(device);
+		assertNotNull(addedObject);
+		
+		verify(mockDeviceObject);
 	}
 	
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for updateDevice method.
+	 *  NB. this is the same test as testAddExistingDevice
 	 * Condition:
-	 * 	The mac address and attachment point are the same. 
+	 * 	The MAC address and attachment point are the same. 
 	 *  All of the other parameter are different.
 	 * Expect:
 	 * 	Changed parameters are set expectedly.
 	 */
-	//@Ignore
 	@Test
-	public void testUpdateDevice() {
-		try
-		{
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer[] ipaddrs = {ipInt};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev);
-			
-			//Dev2 (attached port is the same)
-			IDevice mockDev2 = createMock(Device.class);
-			String ip2 = "192.168.100.2";
-			Integer ipInt2 = IPv4.toIPv4Address(ip2);
-			Integer[] ipaddrs2 = {ipInt2};
-			
-			expect(mockDev2.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs2);
-			expect(mockDev2.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev2);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList).anyTimes();
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs2));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-			//update theDevice
-			IDeviceObject obj2 = deviceImpl.updateDevice(mockDev2);
-			assertNotNull(obj2);
-			
-			verify(mockIDev);
-			
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+	public void testAddUpdateDevice() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort); 
+		IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singleton(mockPortObject));
+		expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+		expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+		expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singleton(mockIpv4Address));
+		expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+		
+		mockDeviceObject.setMACAddress(strMacAddress);
+		mockDeviceObject.setType("device");
+		mockDeviceObject.setState("ACTIVE");
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockPortObject);
+		replay(mockIpv4Address);
+		replay(mockOpe);
+		
+		IDeviceObject addedObject = deviceImpl.updateDevice(device);
+		assertNotNull(addedObject);
+		
+		verify(mockDeviceObject);
 	}
 
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for testRemoveDevice method.
 	 * Condition:
 	 * 	1. Unregistered IDeviceObject argument is put. 
@@ -350,395 +251,174 @@
 	 *  1. Nothing happen when unregistered IDeviceObject is put
 	 * 	2. IDeviceObject will be removed.
 	 */
-	//@Ignore
 	@Test
 	public void testRemoveDevice() {
-		try
-		{
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer[] ipaddrs = {ipInt};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			replay(mockDev);
-			
-			//Dev2 (attached port is the same)
-			IDevice mockDev2 = createMock(Device.class);
-			String macAddr2 = "33:33:33:33:33:33";
-			expect(mockDev2.getMACAddressString()).andReturn(macAddr2).anyTimes();
-			expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev2.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev2);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList);
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr2)).andReturn(null);
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			mockOpe.removeDevice(mockIDev);	
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		IIpv4Address ipv4AddressObject = createMock(IIpv4Address.class);
+		IDeviceObject deviceObject = createMock(IDeviceObject.class);
+		expect(deviceObject.getIpv4Addresses()).andReturn(Collections.singleton(ipv4AddressObject));
+		replay(deviceObject);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(deviceObject);
+		mockOpe.removeIpv4Address(ipv4AddressObject);
+		mockOpe.removeDevice(deviceObject);
+		mockOpe.commit();
+		replay(mockOpe);
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
 
-			deviceImpl.removeDevice(mockDev2);
-		    IDeviceObject dev = deviceImpl.getDeviceByMac(macAddr);
-		    assertNotNull(dev);
-			
-			deviceImpl.removeDevice(mockDev);		
-		    IDeviceObject dev2 = deviceImpl.getDeviceByMac(macAddr);
-		    assertNull(dev2);
-		    
-			verify(mockIDev);
-
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+		deviceImpl.removeDevice(device);
+		
+		verify(mockOpe);
 	}
 
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for getDeviceByMac
 	 * Condition:
-	 * 	1. Unregistered mac address argument is set
+	 * 	1. Unregistered MAC address argument is set
 	 * Expect:
-	 * 	1.Nothing happen when you put unregistered mac address
+	 * 	1.Nothing happen when you put unregistered MAC address
 	 *  2.Get the proper IDeviceObject.
 	 *  3.Check the IDeviceObject properties set expectedly.
 	 */
-	//@Ignore
 	@Test
 	public void testGetDeviceByMac() {
-		try
-		{
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer[] ipaddrs = {ipInt};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			String dummyMac = "33:33:33:33:33:33";
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList);
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(dummyMac)).andReturn(null);
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-		    IDeviceObject dummyDev = deviceImpl.getDeviceByMac(dummyMac);
-		    assertNull(dummyDev);	
-			
-		    IDeviceObject dev = deviceImpl.getDeviceByMac(macAddr);
-		    assertNotNull(dev);
-		    
-			verify(mockIDev);
-
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+		String mac = "99:99:99:99:99:99";
+		
+		IDeviceObject mockDevice = createMock(IDeviceObject.class);
+		
+		expect(mockOpe.searchDevice(mac)).andReturn(mockDevice);
+		
+		replay(mockOpe);
+		
+		IDeviceObject result = deviceImpl.getDeviceByMac(mac);
+		assertNotNull(result);
+		
+		verify(mockOpe);
 	}
-
+	
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for getDeviceByIP method.
 	 * Condition:
-	 * 	1. Unregistered ip address argument is set
+	 * 	1. Unregistered IP address argument is set
 	 * Expect:
-	 * 	1. Nothing happen when you put unregistered mac address
+	 * 	1. Nothing happen when you put unregistered IP address
 	 * 	2. Get the proper IDeviceObject.
 	 *  3. Check the IDeviceObject properties set expectedly.
 	 */
-	//@Ignore
 	@Test
 	public void testGetDeviceByIP() {
-		try
-		{
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			String ip2 = "192.168.100.2";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer ipInt2 = IPv4.toIPv4Address(ip2);
-			Integer[] ipaddrs = {ipInt, ipInt2};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			String dummyIP = "222.222.222.222";
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList);
-			expect(mockIDev.getIPAddress()).andReturn(makeIPStringFromArray(ipaddrs)).times(2);
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			
-			//Make mock Iterator for IDeviceObject
-			List<IDeviceObject> deviceList = new ArrayList<IDeviceObject>();
-			deviceList.add(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.getDevices()).andReturn(deviceList).times(2);
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-	
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-		    IDeviceObject dummyDev = deviceImpl.getDeviceByIP(dummyIP);
-		    assertNull(dummyDev);
-			
-		    IDeviceObject dev = deviceImpl.getDeviceByIP(ip);
-		    assertNotNull(dev);
-		    
-			verify(mockIDev);
-
-			
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+		int nonExistingIp = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.10.50"));
+		int existingIp = InetAddresses.coerceToInteger(InetAddresses.forString("10.5.12.128"));
+		
+		IDeviceObject mockDevice = createMock(IDeviceObject.class);
+		IIpv4Address mockExistingIp = createMock(IIpv4Address.class);
+		expect(mockExistingIp.getDevice()).andReturn(mockDevice);
+		
+		expect(mockOpe.searchIpv4Address(nonExistingIp)).andReturn(null);
+		expect(mockOpe.searchIpv4Address(existingIp)).andReturn(mockExistingIp);
+		
+		replay(mockExistingIp);
+		replay(mockOpe);
+		
+		IDeviceObject result = deviceImpl.getDeviceByIP(nonExistingIp);
+		assertNull(result);
+		
+		result = deviceImpl.getDeviceByIP(existingIp);
+		assertNotNull(result);
+		
+		verify(mockOpe);
 	}
 
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for testChangeDeviceAttachmentsIDevice
 	 * Condition:
-	 * 	1. Unexisting attachment point argument is set
+	 * 	1. The device is not currently attached to any point.
 	 * Expect:
-	 * 	1. Nothing happen when you put unexisting attachment point.
+	 * 	1. Nothing happen when you put nonexistent attachment point.
 	 * 	2. Set the attachment point expectedly;
 	 */
-	//@Ignore
 	@Test
-	public void testChangeDeviceAttachmentsIDevice() {
-		try
-		{
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer[] ipaddrs = {ipInt};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev);
-			
-			//Dev2
-			IDevice mockDev2 = createMock(Device.class);
-			String switchMacAddr2 = "00:00:00:00:00:00:0a:02";
-			long lSwitchMacAddr2 = HexString.toLong(switchMacAddr2);
-			short portNum2 = 2; 
-			SwitchPort sp2 = new SwitchPort(lSwitchMacAddr2, portNum2);
-			SwitchPort sps2[] = {sp2};
-			
-			expect(mockDev2.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev2.getAttachmentPoints()).andReturn(sps2);
-			replay(mockDev2);
-			
-			//Dev3
-			IDevice mockDev3 = createMock(Device.class);
-			String switchMacAddr3 = "00:00:00:00:00:00:00:00";
-			long lSwitchMacAddr3 = HexString.toLong(switchMacAddr3);
-			short portNum3 = 1; 
-			SwitchPort sp3 = new SwitchPort(lSwitchMacAddr3, portNum3);
-			SwitchPort sps3[] = {sp3};
-			
-			expect(mockDev3.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev3.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev3.getAttachmentPoints()).andReturn(sps3);
-			replay(mockDev3);
-			
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			mockIPort.removeDevice(mockIDev);
-			mockIPort.removeDevice(mockIDev);
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			expect(mockIDev.getAttachedPorts()).andReturn(portList).anyTimes();
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			replay(mockIDev);	
-			
-			//Mock IPortObject 2 with dpid "00:00:00:00:00:00:0a:02" and port "2"
-			IPortObject mockIPort2 = createMock(IPortObject.class);
-			mockIPort2.setNumber(portNum2);
-			mockIPort2.setType("port");
-			String iPortDesc2 = "port 2 at LAX Switch";
-			expect(mockIPort2.getNumber()).andReturn(portNum2).anyTimes();
-			expect(mockIPort2.getDesc()).andReturn(iPortDesc2).anyTimes();
-			mockIPort2.setDevice(mockIDev);
-			replay(mockIPort2);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList2 = new ArrayList<IPortObject>();
-			portList2.add(mockIPort2);
-			
-			//Mock IPortObject 3 with dpid "00:00:00:00:00:00:00:00" and port "1"
-			IPortObject mockIPort3 = createMock(IPortObject.class);
-			mockIPort3.setNumber(portNum3);
-			mockIPort3.setType("port");
-			String iPortDesc3 = "n/a";
-			expect(mockIPort3.getNumber()).andReturn(portNum3).anyTimes();
-			expect(mockIPort3.getDesc()).andReturn(iPortDesc3).anyTimes();
-			mockIPort3.setDevice(mockIDev);
-			replay(mockIPort3);
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr2, portNum2)).andReturn(mockIPort2);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr3, portNum3)).andReturn(null);
-			mockOpe.commit();
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
+	public void testChangeDeviceAttachementsWhenUnattached() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort); 
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.<IPortObject>emptyList());
+		expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+		mockPortObject.setDevice(mockDeviceObject);
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockPortObject);
+		replay(mockOpe);
+		
+		deviceImpl.changeDeviceAttachments(device);
+		
+		verify(mockDeviceObject);
+		verify(mockPortObject);
+		verify(mockOpe);
+	}
 	
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-			
-		    deviceImpl.changeDeviceAttachments(mockDev2);
-			
-		    deviceImpl.changeDeviceAttachments(mockDev3);
-		    
-			verify(mockIDev);
-
-			
-		} catch(Exception e) {
-			fail(e.getMessage());
-		}
+	/**
+	 * Description:
+	 * 	Test method for testChangeDeviceAttachmentsIDevice
+	 * Condition:
+	 * 	1. The device is currently attached to a switch, but this attachment point
+	 *     has now changed.
+	 * Expect:
+	 * 	1. The device should be removed from the old attachment point.
+	 * 	2. Set the attachment point expectedly;
+	 */
+	@Test
+	public void testChangeDeviceAttachementsWhenAttached() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		//Details for the port the device will be moved from
+		long alreadyAttachedDpid = HexString.toLong("00:00:00:00:00:00:0b:01");
+		short alreadyAttachedPort = 5;
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IPortObject mockPortObject = getMockPort(attachmentDpid, attachmentPort);
+		IPortObject alreadyAttachedPortObject = getMockPort(alreadyAttachedDpid, alreadyAttachedPort);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getAttachedPorts()).andReturn(Collections.singletonList(alreadyAttachedPortObject));
+		expect(mockOpe.searchPort(HexString.toHexString(attachmentDpid), attachmentPort)).andReturn(mockPortObject);
+		mockPortObject.setDevice(mockDeviceObject);
+		alreadyAttachedPortObject.removeDevice(mockDeviceObject);
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(alreadyAttachedPortObject);
+		replay(mockPortObject);
+		replay(mockOpe);
+		
+		deviceImpl.changeDeviceAttachments(device);
+		
+		verify(mockDeviceObject);
+		verify(alreadyAttachedPortObject);
+		verify(mockPortObject);
+		verify(mockOpe);
 	}
 
 	@Ignore
@@ -748,90 +428,89 @@
 	}
 
 	/**
-	 * Desc:
+	 * Description:
 	 * 	Test method for testChangeDeviceIPv4Address
 	 * Condition:
 	 * 	N/A
 	 * Expect:
-	 *  1. Set the ipadress expectedly.
+	 *  1. Set the IP address expectedly.
 	 */
-	//@Ignore
 	@Test
-	public void testChangeDeviceIPv4Address() {
-		try
-		{
-			//Dev1
-			IDevice mockDev = createMock(Device.class);
-			String macAddr = "99:99:99:99:99:99";
-			String ip = "192.168.100.1";
-			Integer ipInt = IPv4.toIPv4Address(ip);
-			Integer[] ipaddrs = {ipInt};
-			String switchMacAddr = "00:00:00:00:00:00:0a:01";		
-			long switchMacAddrL = HexString.toLong(switchMacAddr);
-			short portNum = 2; 
-			SwitchPort sp1 = new SwitchPort(switchMacAddrL, portNum);
-			SwitchPort[] sps = {sp1};
-			
-			expect(mockDev.getMACAddressString()).andReturn(macAddr).anyTimes();
-			expect(mockDev.getIPv4Addresses()).andReturn(ipaddrs);
-			expect(mockDev.getAttachmentPoints()).andReturn(sps);
-			replay(mockDev);
-			
-			//Dev2
-			IDevice mockDev2 = createMock(Device.class);
-			String ip2 = "192.168.100.2";
-			Integer ipInt2 = IPv4.toIPv4Address(ip2);
-			Integer[] ipaddrs2 = {ipInt2};
-			expect(mockDev2.getMACAddressString()).andReturn(macAddr);
-			expect(mockDev2.getIPv4Addresses()).andReturn(ipaddrs2);
-			replay(mockDev2);
-			
-			//Mock IPortObject 1 with dpid "00:00:00:00:00:00:0a:01" and port "1"
-			IPortObject mockIPort = createMock(IPortObject.class);
-			mockIPort.setNumber(portNum);
-			mockIPort.setType("port");
-			String iPortDesc = "port 1 at SEA Switch";
-			expect(mockIPort.getNumber()).andReturn(portNum).anyTimes();
-			expect(mockIPort.getDesc()).andReturn(iPortDesc).anyTimes();
-			replay(mockIPort);
-			
-			//Make Iterator for mockIport
-			List<IPortObject> portList = new ArrayList<IPortObject>();
-			portList.add(mockIPort);
-			
-			//Expectation for mockIDeviceObject
-			IDeviceObject mockIDev = createMock(IDeviceObject.class);	
-			expect(mockIDev.getAttachedPorts()).andReturn(portList);
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs));
-			mockIDev.setMACAddress(macAddr);
-			mockIDev.setType("device");
-			mockIDev.setState("ACTIVE");
-			mockIDev.setIPAddress(makeIPStringFromArray(ipaddrs2));
-			replay(mockIDev);	
-			
-			//Expectation for mockOpe
-			expect(mockOpe.searchDevice(macAddr)).andReturn(null);
-			expect(mockOpe.newDevice()).andReturn(mockIDev);
-			expect(mockOpe.searchPort(switchMacAddr, portNum)).andReturn(mockIPort);
-			mockOpe.commit();
-			expect(mockOpe.searchDevice(macAddr)).andReturn(mockIDev);
-			mockOpe.commit();
-			replay(mockOpe);				
-			
-			deviceImpl.init(conf);
-			
-	        IDeviceObject obj = deviceImpl.addDevice(mockDev);	
-			assertNotNull(obj);
-
-	        deviceImpl.changeDeviceIPv4Address(mockDev2);	
-	        
-			verify(mockIDev);
-
-					
-		} 
-		catch(Exception e) {
-			fail(e.getMessage());
-		}
+	public void testChangeDeviceIpv4Address() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+		expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+		mockDeviceObject.addIpv4Address(mockIpv4Address);
+		expect(mockDeviceObject.getIpv4Addresses()).andReturn(Collections.singletonList(mockIpv4Address));
+		expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockIpv4Address);
+		replay(mockOpe);
+		
+		deviceImpl.changeDeviceIPv4Address(device);
+		
+		verify(mockDeviceObject);
+		verify(mockIpv4Address);
+		verify(mockOpe);
+	}
+	
+	/**
+	 * Description:
+	 * 	Test method for testChangeDeviceIPv4Address
+	 * Condition:
+	 * 	1. The device had an old IP address which has now changed.
+	 * Expect:
+	 *  1. The old IP address should be removed from the device.
+	 *  2. Set the IP address expectedly.
+	 */
+	@Test
+	public void testChangeDeviceIpv4AddressAndRemoveExisting() {
+		String strMacAddress = "99:99:99:99:99:99";
+		long attachmentDpid = HexString.toLong("00:00:00:00:00:00:0a:01");
+		short attachmentPort = 2;
+		int intIpv4Address = InetAddresses.coerceToInteger(InetAddresses.forString("192.168.100.1"));
+		
+		IDevice device = getMockDevice(strMacAddress, attachmentDpid, attachmentPort, intIpv4Address);
+		
+		IDeviceObject mockDeviceObject = createMock(IDeviceObject.class);
+		
+		IIpv4Address mockIpv4Address = createMock(IIpv4Address.class);
+		IIpv4Address mockDeletingIpv4Address = createMock(IIpv4Address.class);
+		List<IIpv4Address> ipv4Vertices = new ArrayList<IIpv4Address>(2);
+		ipv4Vertices.add(mockIpv4Address);
+		ipv4Vertices.add(mockDeletingIpv4Address);
+		
+		expect(mockOpe.searchDevice(strMacAddress)).andReturn(mockDeviceObject);
+		expect(mockDeviceObject.getIpv4Address(intIpv4Address)).andReturn(null);
+		expect(mockOpe.ensureIpv4Address(intIpv4Address)).andReturn(mockIpv4Address);
+		mockDeviceObject.addIpv4Address(mockIpv4Address);
+		expect(mockDeviceObject.getIpv4Addresses()).andReturn(ipv4Vertices);
+		expect(mockIpv4Address.getIpv4Address()).andReturn(intIpv4Address);
+		expect(mockDeletingIpv4Address.getIpv4Address()).andReturn(1);
+		mockDeviceObject.removeIpv4Address(mockDeletingIpv4Address);
+		mockOpe.commit();
+		
+		replay(mockDeviceObject);
+		replay(mockIpv4Address);
+		replay(mockOpe);
+		
+		deviceImpl.changeDeviceIPv4Address(device);
+		
+		verify(mockDeviceObject);
+		verify(mockIpv4Address);
+		verify(mockOpe);
 	}
 
 }
