OSPF protocol manual merge from 1.6, due to cherry pick merge conflict

Change-Id: I93653e745468722ce95533537a79e897b4292f5d
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfAreaImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfAreaImplTest.java
index 011397c..98baa0f 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfAreaImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfAreaImplTest.java
@@ -15,29 +15,25 @@
  */
 package org.onosproject.ospf.controller.area;
 
-import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.Ip4Address;
-import org.onosproject.ospf.controller.OspfArea;
-import org.onosproject.ospf.controller.OspfAreaAddressRange;
 import org.onosproject.ospf.controller.OspfInterface;
-import org.onosproject.ospf.controller.OspfNbr;
 import org.onosproject.ospf.controller.OspfNeighborState;
 import org.onosproject.ospf.controller.TopologyForDeviceAndLink;
-import org.onosproject.ospf.controller.impl.Controller;
-import org.onosproject.ospf.controller.impl.OspfInterfaceChannelHandler;
 import org.onosproject.ospf.controller.impl.OspfNbrImpl;
 import org.onosproject.ospf.controller.impl.TopologyForDeviceAndLinkImpl;
 import org.onosproject.ospf.controller.lsdb.LsaWrapperImpl;
 import org.onosproject.ospf.protocol.lsa.LsaHeader;
+import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
 import org.onosproject.ospf.protocol.lsa.types.NetworkLsa;
+import org.onosproject.ospf.protocol.lsa.types.OpaqueLsa10;
 import org.onosproject.ospf.protocol.lsa.types.RouterLsa;
 import org.onosproject.ospf.protocol.util.OspfInterfaceState;
+import org.onosproject.ospf.protocol.util.OspfParameters;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -50,66 +46,66 @@
 
     private OspfAreaImpl ospfArea;
     private int result;
-    private OspfInterfaceImpl ospfInterface;
-    private HashMap<String, OspfNbr> ospfNbrList;
-    private List<OspfInterface> ospfInterfaces;
+    private List<OspfInterface> ospfInterfaces = new ArrayList<>();
     private OspfInterfaceImpl ospfInterface1;
     private OspfInterfaceImpl ospfInterface2;
     private OspfInterfaceImpl ospfInterface3;
-    private OspfInterfaceImpl ospfInterface4;
-    private OspfInterfaceImpl ospfInterface5;
-    private OspfInterfaceImpl ospfInterface6;
-    private NetworkLsa networkLsa;
     private OspfNbrImpl ospfNbr;
-    private RouterLsa routerLsa;
-    private List<OspfAreaAddressRange> ospfAreaAddressRanges;
+    private OspfNbrImpl ospfNbr1;
+    private NetworkLsa networkLsa;
     private LsaHeader lsaHeader;
+    private Ip4Address ip4Address = Ip4Address.valueOf("10.10.10.10");
+    private Ip4Address ip4Address1 = Ip4Address.valueOf("11.11.11.11");
+    private Ip4Address networkAddress = Ip4Address.valueOf("255.255.255.255");
     private TopologyForDeviceAndLink topologyForDeviceAndLink;
+    private RouterLsa routerLsa;
+    private OpaqueLsaHeader opaqueLsaHeader;
+    private OpaqueLsa10 opaqueLsa10;
 
     @Before
     public void setUp() throws Exception {
+        lsaHeader = new LsaHeader();
+        opaqueLsaHeader = new OpaqueLsaHeader();
+        opaqueLsaHeader.setAdvertisingRouter(ip4Address);
+        lsaHeader.setAdvertisingRouter(ip4Address);
+        routerLsa = new RouterLsa(lsaHeader);
+        routerLsa.setAdvertisingRouter(ip4Address);
+        opaqueLsa10 = new OpaqueLsa10(opaqueLsaHeader);
         ospfArea = new OspfAreaImpl();
+        ospfInterface1 = new OspfInterfaceImpl();
         topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface1, ip4Address, ip4Address1,
+                                  2, topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfNbr1 = new OspfNbrImpl(ospfArea, ospfInterface1, ip4Address, ip4Address1,
+                                   2, topologyForDeviceAndLink);
+        ospfNbr1.setState(OspfNeighborState.FULL);
+        ospfNbr1.setNeighborId(ip4Address);
+        ospfNbr.setNeighborId(ip4Address);
+        ospfNbr.setIsOpaqueCapable(true);
+        ospfInterface1.addNeighbouringRouter(ospfNbr);
+        ospfInterface1.addNeighbouringRouter(ospfNbr1);
+        ospfInterface2 = new OspfInterfaceImpl();
+        ospfInterface2.setIpAddress(ip4Address);
+        ospfInterface2.setIpNetworkMask(networkAddress);
+        ospfInterface2.setState(OspfInterfaceState.LOOPBACK);
+        ospfInterface2.addNeighbouringRouter(ospfNbr);
+        ospfInterface2.addNeighbouringRouter(ospfNbr1);
+        ospfInterfaces.add(ospfInterface2);
     }
 
     @After
     public void tearDown() throws Exception {
         ospfArea = null;
-        ospfInterface = null;
-        ospfNbrList = null;
         ospfInterfaces = null;
-        ospfAreaAddressRanges = null;
         lsaHeader = null;
-        routerLsa = null;
-        ospfNbr = null;
         networkLsa = null;
         ospfInterface1 = null;
         ospfInterface2 = null;
         ospfInterface3 = null;
-        ospfInterface4 = null;
-        ospfInterface5 = null;
-        ospfInterface6 = null;
 
     }
 
-    /**
-     * Tests equals() method.
-     */
-    @Test
-    public void testEquals() throws Exception {
-        ospfArea = new OspfAreaImpl();
-        ospfInterface = new OspfInterfaceImpl();
-        ospfArea.setTransitCapability(true);
-        ospfArea.setExternalRoutingCapability(true);
-        ospfArea.setStubCost(100);
-        ospfArea.initializeDb();
-        ospfArea.setAddressRanges(ospfAreaAddressRanges);
-        assertThat(ospfArea.equals(ospfArea), is(true));
-        ospfArea = EasyMock.createMock(OspfAreaImpl.class);
-        assertThat(ospfArea.equals(ospfArea), is(true));
-        OspfArea ospfArea = new OspfAreaImpl();
-        assertThat(ospfArea.equals(ospfArea), is(true));
-    }
 
     /**
      * Tests hashCode() method.
@@ -165,66 +161,6 @@
         assertThat(ospfArea, is(notNullValue()));
     }
 
-    /**
-     * Tests refreshArea() method.
-     */
-    @Test
-    public void testRefreshArea() throws Exception {
-
-        ospfInterface = new OspfInterfaceImpl();
-        ospfInterface.setState(OspfInterfaceState.DR);
-        ospfNbrList = new HashMap();
-        ospfNbrList.put("1.1.1.1", new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                                   Ip4Address.valueOf("1.1.1.1"),
-                                                   Ip4Address.valueOf("2.2.2.2"), 2,
-                                                   new OspfInterfaceChannelHandler(new Controller(),
-                                                                                   new OspfAreaImpl(),
-                                                                                   new OspfInterfaceImpl()),
-                                                   topologyForDeviceAndLink));
-        ospfNbrList.put("2.2.2.2", new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                                   Ip4Address.valueOf("1.1.1.1"),
-                                                   Ip4Address.valueOf("2.2.2.2"), 2,
-                                                   new OspfInterfaceChannelHandler(new Controller(),
-                                                                                   new OspfAreaImpl(),
-                                                                                   new OspfInterfaceImpl()),
-                                                   topologyForDeviceAndLink));
-        ospfNbrList.put("3.3.3.3", new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                                   Ip4Address.valueOf("1.1.1.1"),
-                                                   Ip4Address.valueOf("2.2.2.2"), 2,
-                                                   new OspfInterfaceChannelHandler(new Controller(),
-                                                                                   new OspfAreaImpl(),
-                                                                                   new OspfInterfaceImpl()),
-                                                   topologyForDeviceAndLink));
-        ospfNbrList.put("4.4.4.4", new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                                   Ip4Address.valueOf("1.1.1.1"),
-                                                   Ip4Address.valueOf("2.2.2.2"), 2,
-                                                   new OspfInterfaceChannelHandler(new Controller(),
-                                                                                   new OspfAreaImpl(),
-                                                                                   new OspfInterfaceImpl()),
-                                                   topologyForDeviceAndLink));
-
-        ospfInterface.setListOfNeighbors(ospfNbrList);
-        ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.10"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfInterfaces.add(ospfInterface1);
-        ospfInterface2 = new OspfInterfaceImpl();
-        ospfInterface2.setIpAddress(Ip4Address.valueOf("2.2.2.2"));
-        ospfInterfaces.add(ospfInterface2);
-        ospfInterface3 = new OspfInterfaceImpl();
-        ospfInterface3.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterfaces.add(ospfInterface3);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-        networkLsa = ospfArea.buildNetworkLsa(Ip4Address.valueOf("1.1.1.1"),
-                                              Ip4Address.valueOf("255.255.255.255"));
-        ospfArea.refreshArea(ospfInterface);
-        assertThat(ospfNbrList.size(), is(4));
-        assertThat(networkLsa, is(notNullValue()));
-        assertThat(ospfArea, is(notNullValue()));
-    }
 
     /**
      * Tests buildNetworkLsa() method.
@@ -241,7 +177,7 @@
         ospfInterface3 = new OspfInterfaceImpl();
         ospfInterface3.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
         ospfInterfaces.add(ospfInterface3);
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
         networkLsa = ospfArea.buildNetworkLsa(Ip4Address.valueOf("1.1.1.1"),
                                               Ip4Address.valueOf("255.255.255.255"));
@@ -250,118 +186,6 @@
         assertThat(ospfArea, is(notNullValue()));
     }
 
-    /**
-     * Tests buildNetworkLsa() method.
-     */
-    @Test
-    public void testBuildNetworkLsa1() throws Exception {
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfInterface1.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface1.setState(OspfInterfaceState.POINT2POINT);
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-        networkLsa = ospfArea.buildNetworkLsa(Ip4Address.valueOf("1.1.1.1"),
-                                              Ip4Address.valueOf("255.255.255.255"));
-        assertThat(ospfInterfaces.size(), is(1));
-        assertThat(networkLsa, is(notNullValue()));
-        assertThat(ospfArea, is(notNullValue()));
-    }
-
-    /**
-     * Tests buildRouterLsa() method.
-     */
-    @Test
-    public void testBuildRouterLsa() throws Exception {
-        ospfNbrList = new HashMap();
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfInterface1.setState(OspfInterfaceState.DOWN);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfInterface2 = new OspfInterfaceImpl();
-        ospfInterface2.setState(OspfInterfaceState.LOOPBACK);
-        ospfInterface2.setIpAddress(Ip4Address.valueOf("2.2.2.2"));
-        ospfInterface2.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface2);
-        ospfInterface3 = new OspfInterfaceImpl();
-        ospfInterface3.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterface3.setState(OspfInterfaceState.POINT2POINT);
-        ospfInterface3.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface3.addNeighbouringRouter(ospfNbr);
-        ospfInterface3.setListOfNeighbors(ospfNbrList);
-        ospfInterfaces.add(ospfInterface3);
-        ospfInterface4 = new OspfInterfaceImpl();
-        ospfInterface4.setState(OspfInterfaceState.WAITING);
-        ospfInterface4.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterface4.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterfaces.add(ospfInterface4);
-        ospfInterface5 = new OspfInterfaceImpl();
-        ospfInterface5.setState(OspfInterfaceState.DR);
-        ospfInterface5.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterfaces.add(ospfInterface5);
-        ospfInterface6 = new OspfInterfaceImpl();
-        ospfInterface6.setState(OspfInterfaceState.BDR);
-        ospfInterface6.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterface6.setDr(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterfaces.add(ospfInterface6);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-        assertThat(ospfInterfaces.size(), is(6));
-        routerLsa = ospfArea.buildRouterLsa(ospfInterface1);
-        assertThat(routerLsa, is(notNullValue()));
-        routerLsa = ospfArea.buildRouterLsa(ospfInterface2);
-        assertThat(routerLsa, is(notNullValue()));
-        routerLsa = ospfArea.buildRouterLsa(ospfInterface3);
-        assertThat(routerLsa, is(notNullValue()));
-        assertThat(ospfArea, is(notNullValue()));
-    }
-
-    /**
-     * Tests buildRouterLsa() method.
-     */
-    @Test
-    public void testBuildRouterLsa1() throws Exception {
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfInterface1.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface1.setState(OspfInterfaceState.POINT2POINT);
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-        routerLsa = ospfArea.buildRouterLsa(ospfInterface1);
-        assertThat(routerLsa, is(notNullValue()));
-    }
 
     /**
      * Tests areaId() getter method.
@@ -381,51 +205,6 @@
         assertThat(ospfArea.areaId(), is(Ip4Address.valueOf("1.1.1.1")));
     }
 
-    /**
-     * Tests addressRanges() getter method.
-     */
-    @Test
-    public void testGetAddressRanges() throws Exception {
-        ospfAreaAddressRanges = new ArrayList();
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfArea.setAddressRanges(ospfAreaAddressRanges);
-        assertThat(ospfArea.addressRanges().size(), is(4));
-    }
-
-    /**
-     * Tests addressRanges() setter method.
-     */
-    @Test
-    public void testSetAddressRanges() throws Exception {
-        ospfAreaAddressRanges = new ArrayList();
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfAreaAddressRanges.add(new OspfAreaAddressRangeImpl());
-        ospfArea.setAddressRanges(ospfAreaAddressRanges);
-        assertThat(ospfArea.addressRanges().size(), is(4));
-    }
-
-    /**
-     * Tests isTransitCapability() getter method.
-     */
-    @Test
-    public void testIsTransitCapability() throws Exception {
-        ospfArea.setTransitCapability(true);
-        assertThat(ospfArea.isTransitCapability(), is(true));
-    }
-
-    /**
-     * Tests isTransitCapability() setter method.
-     */
-    @Test
-    public void testSetTransitCapability() throws Exception {
-        ospfArea.setTransitCapability(true);
-        assertThat(ospfArea.isTransitCapability(), is(true));
-    }
 
     /**
      * Tests isExternalRoutingCapability() getter method.
@@ -445,26 +224,9 @@
         assertThat(ospfArea.isExternalRoutingCapability(), is(true));
     }
 
-    /**
-     * Tests stubCost() getter method.
-     */
-    @Test
-    public void testGetStubCost() throws Exception {
-        ospfArea.setStubCost(100);
-        assertThat(ospfArea.stubCost(), is(100));
-    }
 
     /**
-     * Tests stubCost() setter method.
-     */
-    @Test
-    public void testSetStubCost() throws Exception {
-        ospfArea.setStubCost(100);
-        assertThat(ospfArea.stubCost(), is(100));
-    }
-
-    /**
-     * Tests getInterfacesLst() getter method.
+     * Tests ospfInterfaceList() getter method.
      */
     @Test
     public void testGetInterfacesLst() throws Exception {
@@ -478,9 +240,9 @@
         ospfInterface3 = new OspfInterfaceImpl();
         ospfInterface3.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
         ospfInterfaces.add(ospfInterface3);
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         assertThat(ospfInterfaces.size(), is(3));
-        assertThat(ospfArea.getInterfacesLst(), is(notNullValue()));
+        assertThat(ospfArea.ospfInterfaceList(), is(notNullValue()));
     }
 
     /**
@@ -498,32 +260,11 @@
         ospfInterface3 = new OspfInterfaceImpl();
         ospfInterface3.setIpAddress(Ip4Address.valueOf("3.3.3.3"));
         ospfInterfaces.add(ospfInterface3);
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         assertThat(ospfInterfaces.size(), is(3));
-        assertThat(ospfArea.getInterfacesLst(), is(notNullValue()));
+        assertThat(ospfArea.ospfInterfaceList(), is(notNullValue()));
     }
 
-    /**
-     * Tests noNeighborInLsaExchangeProcess() method.
-     */
-    @Test
-    public void testNoNeighborInLsaExchangeProcess() throws Exception {
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.EXCHANGE.EXCHANGE);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        assertThat(ospfArea.noNeighborInLsaExchangeProcess(), is(false));
-    }
 
     /**
      * Tests getLsaHeaders() method.
@@ -620,27 +361,6 @@
         assertThat(ospfArea.toString(), is(notNullValue()));
     }
 
-    /**
-     * Tests getNeighborsInFullState() method.
-     */
-    @Test
-    public void testGetNeighborsinFullState() throws Exception {
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        assertThat(ospfArea.getNeighborsInFullState(ospfInterface1).size(), is(1));
-    }
 
     /**
      * Tests getLsaKey() method.
@@ -652,30 +372,6 @@
         assertThat(ospfArea.getLsaKey(lsaHeader), is(notNullValue()));
     }
 
-    /**
-     * Tests addToOtherNeighborLsaTxList() method.
-     */
-    @Test
-    public void testAddToOtherNeighborLsaTxList() throws Exception {
-        ospfInterfaces = new ArrayList();
-        ospfInterface1 = new OspfInterfaceImpl();
-        ospfInterface1.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfInterface1.addNeighbouringRouter(ospfNbr);
-        ospfInterfaces.add(ospfInterface1);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        lsaHeader = new LsaHeader();
-        lsaHeader.setAdvertisingRouter(Ip4Address.valueOf("1.1.1.1"));
-        ospfArea.addToOtherNeighborLsaTxList(lsaHeader);
-        assertThat(ospfArea, is(notNullValue()));
-    }
 
     /**
      * Tests options() getter method.
@@ -719,4 +415,54 @@
     public void testOpaqueEnabledOptionsa() throws Exception {
         assertThat(ospfArea.opaqueEnabledOptions(), is(66));
     }
+
+    /**
+     * Tests noNeighborInLsaExchangeProcess()  method.
+     */
+    @Test
+    public void testNoNeighborInLsaExchangeProcess() throws Exception {
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        ospfArea.noNeighborInLsaExchangeProcess();
+        assertThat(ospfArea, is(notNullValue()));
+    }
+
+    /**
+     * Tests getNeighborsInFullState()  method.
+     */
+    @Test
+    public void testGetNeighborsInFullState() throws Exception {
+        ospfArea.getNeighborsInFullState(ospfInterface1);
+        assertThat(ospfArea, is(notNullValue()));
+    }
+
+    /**
+     * Tests addToOtherNeighborLsaTxList()  method.
+     */
+    @Test
+    public void testAddToOtherNeighborLsaTxList() throws Exception {
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        ospfArea.addToOtherNeighborLsaTxList(routerLsa);
+        assertThat(ospfArea, is(notNullValue()));
+
+        opaqueLsa10.setLsType(OspfParameters.LINK_LOCAL_OPAQUE_LSA);
+        ospfArea.addToOtherNeighborLsaTxList(opaqueLsa10);
+        assertThat(ospfArea, is(notNullValue()));
+    }
+
+    /**
+     * Tests buildRouterLsa()  method.
+     */
+    @Test
+    public void testBuildRouterLsa() throws Exception {
+        ospfArea.setRouterId(ip4Address);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        ospfInterface1.setState(OspfInterfaceState.POINT2POINT);
+        ospfInterface1.setIpAddress(ip4Address);
+        ospfInterface1.setIpNetworkMask(networkAddress);
+        ospfInterfaces.add(ospfInterface1);
+        ospfArea.buildRouterLsa(ospfInterface1);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        assertThat(ospfArea, is(notNullValue()));
+
+    }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfInterfaceImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfInterfaceImplTest.java
index 640aee0..438357b 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfInterfaceImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/area/OspfInterfaceImplTest.java
@@ -15,21 +15,55 @@
  */
 package org.onosproject.ospf.controller.area;
 
+import org.easymock.EasyMock;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.buffer.HeapChannelBufferFactory;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelConfig;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelStateEvent;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.Ip4Address;
+import org.onosproject.ospf.controller.OspfAreaAddressRange;
+import org.onosproject.ospf.controller.OspfInterface;
+import org.onosproject.ospf.controller.OspfLsaType;
+import org.onosproject.ospf.controller.OspfMessage;
 import org.onosproject.ospf.controller.OspfNbr;
+import org.onosproject.ospf.controller.OspfNeighborState;
+import org.onosproject.ospf.controller.OspfProcess;
 import org.onosproject.ospf.controller.TopologyForDeviceAndLink;
 import org.onosproject.ospf.controller.impl.Controller;
 import org.onosproject.ospf.controller.impl.OspfInterfaceChannelHandler;
+import org.onosproject.ospf.controller.impl.OspfLinkTedImpl;
 import org.onosproject.ospf.controller.impl.OspfNbrImpl;
+import org.onosproject.ospf.controller.impl.OspfRouterImpl;
 import org.onosproject.ospf.controller.impl.TopologyForDeviceAndLinkImpl;
+import org.onosproject.ospf.controller.util.OspfEligibleRouter;
+import org.onosproject.ospf.controller.util.OspfInterfaceType;
+import org.onosproject.ospf.exceptions.OspfParseException;
+import org.onosproject.ospf.protocol.lsa.LsaHeader;
 import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
+import org.onosproject.ospf.protocol.lsa.TlvHeader;
+import org.onosproject.ospf.protocol.lsa.tlvtypes.RouterTlv;
+import org.onosproject.ospf.protocol.lsa.types.OpaqueLsa10;
+import org.onosproject.ospf.protocol.lsa.types.RouterLsa;
+import org.onosproject.ospf.protocol.ospfpacket.subtype.LsRequestPacket;
+import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
+import org.onosproject.ospf.protocol.ospfpacket.types.HelloPacket;
+import org.onosproject.ospf.protocol.ospfpacket.types.LsAcknowledge;
+import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
+import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
+import org.onosproject.ospf.protocol.util.ChecksumCalculator;
 import org.onosproject.ospf.protocol.util.OspfInterfaceState;
 
+import java.net.UnknownHostException;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
@@ -39,18 +73,54 @@
  * Unit test class for OspfInterfaceImpl.
  */
 public class OspfInterfaceImplTest {
-
+    private List<OspfAreaAddressRange> addressRanges = new ArrayList();
+    private List<OspfInterface> ospfInterfaces = new ArrayList();
     private OspfInterfaceImpl ospfInterface;
     private OspfNbrImpl ospfNbr;
     private OpaqueLsaHeader opaqueLsaHeader;
     private int result;
+    private OspfAreaImpl ospfArea;
     private HashMap<String, OspfNbr> ospfNbrHashMap;
     private TopologyForDeviceAndLink topologyForDeviceAndLink;
+    private Channel channel;
+    private ChannelHandlerContext channelHandlerContext;
+    private ChannelStateEvent channelStateEvent;
+    private HelloPacket helloPacket;
+    private DdPacket ddPacket;
+    private ChecksumCalculator checksumCalculator;
+    private byte[] byteArray;
+    private byte[] checkArray;
+    private OspfInterfaceChannelHandler ospfInterfaceChannelHandler;
+    private LsRequest lsRequest;
+    private ChannelBuffer buf;
+    private LsUpdate lsUpdate;
+    private LsAcknowledge lsAck;
+    private Controller controller;
+    private List<OspfProcess> ospfProcesses = new ArrayList();
+    private OspfProcess ospfProcess;
+    private OspfEligibleRouter ospfEligibleRouter;
 
     @Before
     public void setUp() throws Exception {
+        ospfProcess = new OspfProcessImpl();
+        ospfProcesses.add(ospfProcess);
         ospfInterface = new OspfInterfaceImpl();
         topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
+        channel = EasyMock.createMock(Channel.class);
+        ospfArea = createOspfArea();
+        ospfInterface = createOspfInterface();
+        ospfNbrHashMap = new HashMap();
+        topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setNeighborId(Ip4Address.valueOf("10.10.10.10"));
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        controller = new Controller();
+        ospfInterfaceChannelHandler = new OspfInterfaceChannelHandler(controller, ospfProcesses);
+
     }
 
     @After
@@ -113,9 +183,7 @@
     public void testAddNeighbouringRouter() throws Exception {
         ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
                                   Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                                                    topologyForDeviceAndLink);
+                                  topologyForDeviceAndLink);
         ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
         ospfInterface.addNeighbouringRouter(ospfNbr);
         assertThat(ospfInterface, is(notNullValue()));
@@ -129,9 +197,7 @@
     public void testGetNeighbouringRouter() throws Exception {
         ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
                                   Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                                                    topologyForDeviceAndLink);
+                                  topologyForDeviceAndLink);
         ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
         ospfInterface.addNeighbouringRouter(ospfNbr);
         assertThat(ospfInterface.neighbouringRouter("111.111.111.111"), is(notNullValue()));
@@ -164,9 +230,7 @@
     public void testIsNeighborinList() throws Exception {
         ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
                                   Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                                                    topologyForDeviceAndLink);
+                                  topologyForDeviceAndLink);
         ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
         ospfInterface.addNeighbouringRouter(ospfNbr);
         assertThat(ospfInterface.isNeighborInList("111.111.111.111"), is(notNullValue()));
@@ -180,10 +244,7 @@
         ospfNbrHashMap = new HashMap();
         ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
                                   Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                                                    topologyForDeviceAndLink);
+                                  topologyForDeviceAndLink);
         ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
         ospfNbrHashMap.put("111.111.111.111", ospfNbr);
         ospfInterface.setListOfNeighbors(ospfNbrHashMap);
@@ -198,9 +259,7 @@
         ospfNbrHashMap = new HashMap();
         ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
                                   Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                                                    topologyForDeviceAndLink);
+                                  topologyForDeviceAndLink);
         ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
         ospfNbrHashMap.put("111.111.111.111", ospfNbr);
         ospfInterface.setListOfNeighbors(ospfNbrHashMap);
@@ -244,24 +303,6 @@
     }
 
     /**
-     * Tests areaId() getter method.
-     */
-    @Test
-    public void testGetAreaId() throws Exception {
-        ospfInterface.setAreaId(1);
-        assertThat(ospfInterface.areaId(), is(1));
-    }
-
-    /**
-     * Tests areaId() setter method.
-     */
-    @Test
-    public void testSetAreaId() throws Exception {
-        ospfInterface.setAreaId(1);
-        assertThat(ospfInterface.areaId(), is(1));
-    }
-
-    /**
      * Tests helloIntervalTime() getter method.
      */
     @Test
@@ -316,78 +357,6 @@
     }
 
     /**
-     * Tests interfaceCost() getter method.
-     */
-    @Test
-    public void testGetInterfaceCost() throws Exception {
-        ospfInterface.setInterfaceCost(100);
-        assertThat(ospfInterface.interfaceCost(), is(100));
-    }
-
-    /**
-     * Tests interfaceCost() setter method.
-     */
-    @Test
-    public void testSetInterfaceCost() throws Exception {
-        ospfInterface.setInterfaceCost(100);
-        assertThat(ospfInterface.interfaceCost(), is(100));
-    }
-
-    /**
-     * Tests authType() getter method.
-     */
-    @Test
-    public void testGetAuthType() throws Exception {
-        ospfInterface.setAuthType("00");
-        assertThat(ospfInterface.authType(), is("00"));
-    }
-
-    /**
-     * Tests authType() setter method.
-     */
-    @Test
-    public void testSetAuthType() throws Exception {
-        ospfInterface.setAuthType("00");
-        assertThat(ospfInterface.authType(), is("00"));
-    }
-
-    /**
-     * Tests authKey() getter method.
-     */
-    @Test
-    public void testGetAuthKey() throws Exception {
-        ospfInterface.setAuthKey("00");
-        assertThat(ospfInterface.authKey(), is("00"));
-    }
-
-    /**
-     * Tests authKey() setter method.
-     */
-    @Test
-    public void testSetAuthKey() throws Exception {
-        ospfInterface.setAuthKey("00");
-        assertThat(ospfInterface.authKey(), is("00"));
-    }
-
-    /**
-     * Tests pollInterval() getter method.
-     */
-    @Test
-    public void testGetPollInterval() throws Exception {
-        ospfInterface.setPollInterval(100);
-        assertThat(ospfInterface.pollInterval(), is(100));
-    }
-
-    /**
-     * Tests pollInterval() setter method.
-     */
-    @Test
-    public void testSetPollInterval() throws Exception {
-        ospfInterface.setPollInterval(100);
-        assertThat(ospfInterface.pollInterval(), is(100));
-    }
-
-    /**
      * Tests mtu() getter method.
      */
     @Test
@@ -460,29 +429,11 @@
     }
 
     /**
-     * Tests transmitDelay() getter method.
-     */
-    @Test
-    public void testGetTransmitDelay() throws Exception {
-        ospfInterface.setTransmitDelay(100);
-        assertThat(ospfInterface.transmitDelay(), is(100));
-    }
-
-    /**
-     * Tests transmitDelay() setter method.
-     */
-    @Test
-    public void testSetTransmitDelay() throws Exception {
-        ospfInterface.setTransmitDelay(100);
-        assertThat(ospfInterface.transmitDelay(), is(100));
-    }
-
-    /**
      * Tests equals() method.
      */
     @Test
     public void testEquals() throws Exception {
-        assertThat(ospfInterface.equals(new OspfInterfaceImpl()), is(true));
+        assertThat(ospfInterface.equals(new OspfInterfaceImpl()), is(false));
     }
 
     /**
@@ -501,4 +452,1021 @@
     public void testToString() throws Exception {
         assertThat(ospfInterface.toString(), is(notNullValue()));
     }
+
+    /**
+     * Tests to interfaceUp() method.
+     */
+    @Test(expected = Exception.class)
+    public void testInterfaceUp() throws Exception {
+        ospfInterface.setInterfaceType(OspfInterfaceType.POINT_TO_POINT.value());
+        ospfInterface.interfaceUp();
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to interfaceUp() method.
+     */
+    @Test(expected = Exception.class)
+    public void testInterfaceUp1() throws Exception {
+
+        ospfInterface.setInterfaceType(OspfInterfaceType.BROADCAST.value());
+        ospfInterface.interfaceUp();
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to interfaceUp() method.
+     */
+    @Test(expected = Exception.class)
+    public void testInterfaceUp2() throws Exception {
+
+        ospfInterface.setRouterPriority(1);
+        ospfInterface.setInterfaceType(OspfInterfaceType.BROADCAST.value());
+        ospfInterface.interfaceUp();
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to backupSeen() method.
+     */
+    @Test
+    public void testBackupSeen() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setState(OspfInterfaceState.WAITING);
+        ospfInterface.backupSeen(channel);
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to waitTimer() method.
+     */
+    @Test
+    public void testWaitTimer() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setState(OspfInterfaceState.WAITING);
+        ospfInterface.waitTimer(channel);
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to callDrElection() method.
+     */
+    @Test
+    public void testCallDrElection() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setState(OspfInterfaceState.WAITING);
+        ospfInterface.callDrElection(channel);
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to neighborChange() method.
+     */
+    @Test
+    public void testNeighborChange() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setState(OspfInterfaceState.DR);
+        ospfInterface.neighborChange();
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests to interfaceDown() method.
+     */
+    @Test(expected = Exception.class)
+    public void testInterfaceDown() throws Exception {
+        ospfInterface.interfaceDown();
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests processOspfMessage() method.
+     */
+    @Test
+    public void testProcessOspfMessage() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setInterfaceType(OspfInterfaceType.POINT_TO_POINT.value());
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("0.0.0.0"));
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        helloPacket = new HelloPacket();
+        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.0.1"));
+        helloPacket.setRouterId(Ip4Address.valueOf("10.10.10.10"));
+        helloPacket.setOspfVer(2);
+        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        helloPacket.setOptions(2);
+        helloPacket.setNetworkMask(Ip4Address.valueOf("3.3.3.3"));
+        helloPacket.setOspftype(1);
+        helloPacket.setAuthType(0);
+        helloPacket.setHelloInterval(60);
+        helloPacket.setRouterDeadInterval(60);
+        helloPacket.setAuthentication(0);
+        helloPacket.setNetworkMask(Ip4Address.valueOf("1.1.1.1"));
+        checksumCalculator = new ChecksumCalculator();
+        byteArray = helloPacket.asBytes();
+        helloPacket.setOspfPacLength(byteArray.length);
+        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
+        checkArray[0] = -51;
+        checkArray[1] = 52;
+        buf = ChannelBuffers.copiedBuffer(checkArray);
+        helloPacket.setChecksum(buf.readUnsignedShort());
+        message = helloPacket;
+        ospfInterface.processOspfMessage(message, channelHandlerContext);
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setRouterId(Ip4Address.valueOf("10.10.10.10"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setOptions(2);
+        ddPacket.setOspftype(2);
+        ddPacket.setAuthType(0);
+        ddPacket.setAuthentication(0);
+        checksumCalculator = new ChecksumCalculator();
+        byteArray = ddPacket.asBytes();
+        ddPacket.setOspfPacLength(byteArray.length);
+        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
+        checkArray[0] = -49;
+        checkArray[1] = -79;
+        buf = ChannelBuffers.copiedBuffer(checkArray);
+        ddPacket.setChecksum(buf.readUnsignedShort());
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        message = ddPacket;
+        ospfInterface.processOspfMessage(message, channelHandlerContext);
+        lsRequest = new LsRequest();
+        lsRequest.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsRequest.setRouterId(Ip4Address.valueOf("10.10.10.10"));
+        lsRequest.setOspfVer(2);
+        lsRequest.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        lsRequest.setOspftype(3);
+        lsRequest.setAuthType(0);
+        lsRequest.setAuthentication(0);
+        checksumCalculator = new ChecksumCalculator();
+        byteArray = lsRequest.asBytes();
+        lsRequest.setOspfPacLength(byteArray.length);
+        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
+        checkArray[0] = -47;
+        checkArray[1] = -72;
+        buf = ChannelBuffers.copiedBuffer(checkArray);
+        lsRequest.setChecksum(buf.readUnsignedShort());
+        message = lsRequest;
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processOspfMessage(message, channelHandlerContext);
+        lsUpdate = new LsUpdate();
+        lsUpdate.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsUpdate.setRouterId(Ip4Address.valueOf("10.10.10.10"));
+        lsUpdate.setOspfVer(2);
+        lsUpdate.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        lsUpdate.setOspftype(4);
+        lsUpdate.setAuthType(0);
+        lsUpdate.setAuthentication(0);
+        checksumCalculator = new ChecksumCalculator();
+        byteArray = lsUpdate.asBytes();
+        lsUpdate.setOspfPacLength(byteArray.length);
+        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
+        checkArray[0] = -47;
+        checkArray[1] = -77;
+        buf = ChannelBuffers.copiedBuffer(checkArray);
+        lsUpdate.setChecksum(buf.readUnsignedShort());
+        message = lsUpdate;
+        ospfInterface.processOspfMessage(message, channelHandlerContext);
+        lsAck = new LsAcknowledge();
+        lsAck.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsAck.setRouterId(Ip4Address.valueOf("10.10.10.10"));
+        lsAck.setOspfVer(2);
+        lsAck.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        lsAck.setOspftype(5);
+        lsAck.setAuthType(0);
+        lsAck.setAuthentication(0);
+        checksumCalculator = new ChecksumCalculator();
+        byteArray = lsAck.asBytes();
+        lsAck.setOspfPacLength(byteArray.length);
+        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
+        checkArray[0] = -47;
+        checkArray[1] = -74;
+        buf = ChannelBuffers.copiedBuffer(checkArray);
+        lsAck.setChecksum(buf.readUnsignedShort());
+        message = lsAck;
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processOspfMessage(message, channelHandlerContext);
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests processHelloMessage() method.
+     */
+    @Test
+    public void testProcessHelloMessage() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(1);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("244.244.244.244"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        helloPacket = new HelloPacket();
+        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        helloPacket.setOspfVer(2);
+        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        helloPacket.setNetworkMask(Ip4Address.valueOf("244.244.244.244"));
+        helloPacket.setHelloInterval(10);
+        helloPacket.setRouterDeadInterval(10);
+        helloPacket.setDr(Ip4Address.valueOf("10.10.10.10"));
+        helloPacket.setBdr(Ip4Address.valueOf("11.11.11.11"));
+        helloPacket.setRouterId(Ip4Address.valueOf("111.111.111.111"));
+        message = helloPacket;
+        ospfInterface.processHelloMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests processHelloMessage() method.
+     */
+    @Test
+    public void testProcessHelloMessage1() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setRouterPriority(1);
+        ospfInterface.interfaceUp();
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setState(OspfInterfaceState.WAITING);
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("244.244.244.244"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        helloPacket = new HelloPacket();
+        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        helloPacket.setOspfVer(2);
+        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        helloPacket.setNetworkMask(Ip4Address.valueOf("244.244.244.244"));
+        helloPacket.setHelloInterval(10);
+        helloPacket.setRouterDeadInterval(10);
+        helloPacket.setDr(Ip4Address.valueOf("10.10.10.10"));
+        helloPacket.setBdr(Ip4Address.valueOf("11.11.11.11"));
+        helloPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        message = helloPacket;
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processHelloMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processHelloMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test
+    public void testProcessDdMessage() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage3() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(0);
+        ddPacket.setIsMaster(0);
+        ddPacket.setSequenceNo(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage1() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(0);
+        ddPacket.setIsMaster(0);
+        ddPacket.setSequenceNo(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage2() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.LOADING);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage4() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(0);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage5() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(0);
+        ddPacket.setSequenceNo(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests processDdMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessDdMessage6() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        ddPacket = new DdPacket();
+        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        ddPacket.setOspfVer(2);
+        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
+        ddPacket.setIsOpaqueCapable(true);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(1);
+        ddPacket.setSequenceNo(123);
+        message = ddPacket;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("2.2.2.2"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ddPacket.setIsMore(1);
+        ddPacket.setIsInitialize(1);
+        ddPacket.setIsMaster(0);
+        ddPacket.setSequenceNo(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processDdMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests processLsRequestMessage() method.
+     */
+    @Test(expected = Exception.class)
+    public void testProcessLSRequestMessage() throws Exception {
+        ospfArea.setRouterId(Ip4Address.valueOf("11.11.11.11"));
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        lsRequest = new LsRequest();
+        lsRequest.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsRequest.setOspfVer(2);
+        lsRequest.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        lsRequest.setRouterId(Ip4Address.valueOf("10.226.165.100"));
+        List<LsRequestPacket> lsRequests = new ArrayList();
+        LsRequestPacket lsRequestPacket = new LsRequestPacket();
+        lsRequestPacket.setLsType(OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value());
+        lsRequestPacket.setLinkStateId("2.2.2.2");
+        lsRequestPacket.setOwnRouterId("10.226.165.100");
+        lsRequests.add(lsRequestPacket);
+        lsRequests.add(lsRequestPacket);
+        lsRequest.addLinkStateRequests(lsRequestPacket);
+        message = lsRequest;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        OpaqueLsaHeader lsaHeader = new OpaqueLsaHeader();
+        lsaHeader.setLsType(OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value());
+        lsaHeader.setLinkStateId("2.2.2.2");
+        lsaHeader.setAdvertisingRouter(Ip4Address.valueOf("10.226.165.100"));
+        OpaqueLsa10 opaqueLsa10 = new OpaqueLsa10(lsaHeader);
+        ospfArea.addLsa(opaqueLsa10, false, ospfInterface);
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.processLsRequestMessage(message, channelHandlerContext);
+        assertThat(ospfInterface, is(notNullValue()));
+    }
+
+    /**
+     * Tests processLsUpdateMessage() method.
+     */
+    @Test
+    public void testProcessLSUpdateMessage() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        lsUpdate = new LsUpdate();
+        lsUpdate.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsUpdate.setOspfVer(2);
+        lsUpdate.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        lsUpdate.setRouterId(Ip4Address.valueOf("10.226.165.100"));
+        RouterLsa routerLsa = new RouterLsa();
+        lsUpdate.addLsa(routerLsa);
+        lsUpdate.setNumberOfLsa(1);
+        message = lsUpdate;
+        ospfNbrHashMap = new HashMap();
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processLsUpdateMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    @Test(expected = Exception.class)
+    public void testProcessLSAckMessage() throws Exception {
+        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setHelloIntervalTime(10);
+        ospfInterface.setRouterDeadIntervalTime(10);
+        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        OspfMessage message;
+        lsAck = new LsAcknowledge();
+        lsAck.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
+        lsAck.setOspfVer(2);
+        lsAck.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+        LsaHeader lsaHeader = new LsaHeader();
+        lsAck.addLinkStateHeader(lsaHeader);
+        message = lsAck;
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setLastDdPacket(createDdPacket());
+        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfNbr.setDdSeqNum(123);
+        channelHandlerContext = null;
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        ospfInterface.processLsAckMessage(message, channelHandlerContext);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+
+    }
+
+    /**
+     * Tests electRouter() method.
+     */
+    @Test
+    public void testElectRouter() throws Exception {
+        ospfInterface.setOspfArea(ospfArea);
+        ospfInterface.setDr(Ip4Address.valueOf("3.3.3.3"));
+        ospfInterface.setBdr(Ip4Address.valueOf("3.3.3.3"));
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ChannelConfig channelConfig = EasyMock.createMock(ChannelConfig.class);
+        EasyMock.expect(channelConfig.getBufferFactory()).andReturn(new HeapChannelBufferFactory());
+        Channel channel = EasyMock.createMock(Channel.class);
+        ospfInterface.electRouter(channel);
+        assertThat(ospfInterface.dr(), is(notNullValue()));
+    }
+
+    /**
+     * Tests electBdr() method.
+     */
+    @Test
+    public void testElectBdr() throws Exception {
+        ospfEligibleRouter = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
+
+        ospfEligibleRouters.add(ospfEligibleRouter);
+        ospfEligibleRouters.add(ospfEligibleRouter1);
+        ospfEligibleRouters.add(ospfEligibleRouter2);
+        OspfEligibleRouter eligibleRouter = ospfInterface.electBdr(ospfEligibleRouters);
+        assertThat(ospfEligibleRouters.size(), is(3));
+        assertThat(eligibleRouter, is(notNullValue()));
+    }
+
+    /**
+     * Tests electDr() method.
+     */
+    @Test
+    public void testElectDR() throws Exception {
+        ospfEligibleRouter = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
+        ospfEligibleRouters.add(ospfEligibleRouter);
+        ospfEligibleRouters.add(ospfEligibleRouter1);
+        ospfEligibleRouters.add(ospfEligibleRouter2);
+        OspfEligibleRouter eligibleRouter = ospfInterface.electDr(ospfEligibleRouters,
+                                                                  ospfEligibleRouter);
+        assertThat(ospfEligibleRouters.size(), is(3));
+        assertThat(eligibleRouter, is(notNullValue()));
+    }
+
+    /**
+     * Tests selectRouterBasedOnPriority() method.
+     */
+    @Test
+    public void testSelectRouterBasedOnPriority() throws Exception {
+        ospfEligibleRouter = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(10);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(11);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
+        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsDr(true);
+        ospfEligibleRouter.setRouterPriority(12);
+        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
+        ospfEligibleRouter.setIsBdr(false);
+        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
+        ospfEligibleRouters.add(ospfEligibleRouter);
+        ospfEligibleRouters.add(ospfEligibleRouter1);
+        ospfEligibleRouters.add(ospfEligibleRouter2);
+        OspfEligibleRouter eligibleRouter = ospfInterface.selectRouterBasedOnPriority(
+                ospfEligibleRouters);
+        assertThat(eligibleRouter, is(notNullValue()));
+    }
+
+    /**
+     * Tests addDeviceInformation() method.
+     */
+    @Test(expected = Exception.class)
+    public void testAddDeviceInformation() throws Exception {
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+
+        ospfInterface.addDeviceInformation(new OspfRouterImpl());
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests removeDeviceInformation() method.
+     */
+    @Test(expected = Exception.class)
+    public void testRemoveDeviceInformation() throws Exception {
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+
+        ospfInterface.removeDeviceInformation(new OspfRouterImpl());
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests addLinkInformation() method.
+     */
+    @Test(expected = Exception.class)
+    public void testaddLinkInformation() throws Exception {
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+
+        List topTlv = new ArrayList();
+        topTlv.add(new RouterTlv(new TlvHeader()));
+        ospfInterface.addLinkInformation(new OspfRouterImpl(), new OspfLinkTedImpl());
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests removeLinkInformation() method.
+     */
+    @Test(expected = Exception.class)
+    public void testRemoveLinkInformation() throws Exception {
+        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
+                                  Ip4Address.valueOf("10.226.165.100"), 2,
+                                  topologyForDeviceAndLink);
+
+        ospfInterface.removeLinkInformation(new OspfRouterImpl(), new OspfLinkTedImpl());
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private DdPacket createDdPacket() throws OspfParseException {
+        byte[] ddPacket = {2, 2, 0, 32, -64, -88, -86, 8, 0, 0, 0, 1, -96, 82,
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -36, 2, 7, 65, 119, -87, 126};
+        DdPacket ddPacket1 = new DdPacket();
+        ChannelBuffer buf = ChannelBuffers.buffer(ddPacket.length);
+        buf.writeBytes(ddPacket);
+        ddPacket1.readFrom(buf);
+        return ddPacket1;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfInterfaceImpl createOspfInterface() throws UnknownHostException {
+        ospfInterface = new OspfInterfaceImpl();
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
+                OspfInterfaceChannelHandler.class);
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
+                                  Ip4Address.valueOf("1.1.1.1"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
+        this.ospfInterface = new OspfInterfaceImpl();
+        this.ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
+        this.ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        this.ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
+        this.ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
+        this.ospfInterface.setHelloIntervalTime(20);
+        this.ospfInterface.setInterfaceType(2);
+        this.ospfInterface.setReTransmitInterval(2000);
+        this.ospfInterface.setMtu(6500);
+        this.ospfInterface.setRouterDeadIntervalTime(1000);
+        this.ospfInterface.setRouterPriority(1);
+        this.ospfInterface.setInterfaceType(1);
+        this.ospfInterface.addNeighbouringRouter(ospfNbr);
+        return this.ospfInterface;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfInterfaceImpl createOspfInterface1() throws UnknownHostException {
+        ospfInterface = new OspfInterfaceImpl();
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
+                OspfInterfaceChannelHandler.class);
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
+                                  Ip4Address.valueOf("1.1.1.1"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
+        ospfInterface = new OspfInterfaceImpl();
+        ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
+        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
+        ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
+        ospfInterface.setHelloIntervalTime(20);
+        ospfInterface.setInterfaceType(2);
+        ospfInterface.setReTransmitInterval(2000);
+        ospfInterface.setMtu(6500);
+        ospfInterface.setRouterDeadIntervalTime(1000);
+        ospfInterface.setRouterPriority(1);
+        ospfInterface.setInterfaceType(1);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        return ospfInterface;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaImpl createOspfArea() throws UnknownHostException {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange;
+        ospfAreaAddressRange = createOspfAreaAddressRange();
+        addressRanges.add(ospfAreaAddressRange);
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        ospfArea.setAreaId(Ip4Address.valueOf("10.226.165.164"));
+        ospfArea.setExternalRoutingCapability(true);
+        OspfInterfaceImpl ospfInterface = createOspfInterface();
+        ospfInterfaces.add(ospfInterface);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        RouterLsa routerLsa = new RouterLsa();
+        routerLsa.setLsType(1);
+        routerLsa.setLinkStateId("2.2.2.2");
+        routerLsa.setAdvertisingRouter(Ip4Address.valueOf("2.2.2.2"));
+        try {
+            ospfArea.addLsa(routerLsa, false, ospfInterface);
+        } catch (Exception e) {
+            System.out.println("ospfAreaImpl createOspfArea");
+        }
+        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
+
+        return ospfArea;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaAddressRangeImpl createOspfAreaAddressRange() {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange = new OspfAreaAddressRangeImpl();
+        ospfAreaAddressRange.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
+        ospfAreaAddressRange.setAdvertise(true);
+        ospfAreaAddressRange.setMask("mask");
+        return ospfAreaAddressRange;
+    }
+
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/ControllerTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/ControllerTest.java
index 8c700d0..f51b014 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/ControllerTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/ControllerTest.java
@@ -71,7 +71,7 @@
         ospfInterface.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
         ospfInterfaces.add(ospfInterface);
         ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         ospfProcess.setProcessId("10.10.10.10");
         ospfAreas = new ArrayList();
         ospfAreas.add(ospfArea);
@@ -82,7 +82,7 @@
         ospfProcess1.setProcessId("11.11.11.11");
         ospfArea1 = new OspfAreaImpl();
         ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea1.setInterfacesLst(ospfInterfaces);
+        ospfArea1.setOspfInterfaceList(ospfInterfaces);
         ospfAreas.add(ospfArea1);
         ospfProcess1.setAreas(ospfAreas);
         ospfProcesses.add(ospfProcess1);
@@ -167,83 +167,6 @@
         assertThat(controller, is(notNullValue()));
     }
 
-    /**
-     * Tests deleteInterfaceFromArea() method.
-     */
-    @Test
-    public void testDeleteInterfaceFromArea() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller.deleteInterfaceFromArea("10.10.10.10", "2.2.2.2", "1.1.1.1"), is(true));
-        assertThat(controller.deleteInterfaceFromArea("10.10.10.10", "2.2.2.2", "5.5.5.5"), is(false));
-    }
-
-    /**
-     * Tests checkArea() method.
-     */
-    @Test
-    public void testCheckArea() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller.checkArea("10.10.10.10", "2.2.2.2"), is(true));
-    }
-
-    /**
-     * Tests checkArea() method.
-     */
-    @Test
-    public void testCheckArea1() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller.checkArea("10.10.10.10", "111.111.111.111"), is(false));
-    }
-
-    /**
-     * Tests checkProcess() method.
-     */
-    @Test
-    public void testCheckProcess() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller.checkProcess("3.3.3.3"), is(false));
-        assertThat(controller.checkProcess("1.1.1.1"), is(false));
-    }
-
-    /**
-     * Tests checkInterface() method.
-     */
-    @Test
-    public void testCheckInterface() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller.checkInterface("10.10.10.10", "2.2.2.2", "1.1.1.1"), is(true));
-    }
-
-    /**
-     * Tests updateAreaInProcess() method.
-     */
-    @Test
-    public void testUpdateAreaInProcess() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.updateAreaInProcess("10.10.10.10", "2.2.2.2", ospfArea);
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests updateConfig() method.
-     */
-    @Test
-    public void testUpdateConfig() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.updateConfig(ospfProcesses);
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests updateConfig() method.
-     */
-    @Test
-    public void testUpdateConfig2() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller, is(notNullValue()));
-    }
 
     /**
      * Tests updateConfig() method.
@@ -257,7 +180,7 @@
         ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.5"));
         ospfInterfaces.add(ospfInterface);
         ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         ospfProcess.setProcessId("10.10.10.10");
         ospfAreas = new ArrayList();
         ospfAreas.add(ospfArea);
@@ -269,67 +192,6 @@
     }
 
     /**
-     * Tests deleteConfig() method.
-     */
-    @Test(expected = Exception.class)
-    public void testDeleteConfig() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.deleteConfig(ospfProcesses, "INTERFACE");
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests deleteConfig() method.
-     */
-    @Test(expected = Exception.class)
-    public void testDeleteConfig1() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.deleteConfig(ospfProcesses, "AREA");
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests deleteConfig() method.
-     */
-
-    @Test
-    public void testDeleteConfig2() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.deleteConfig(ospfProcesses, "PROCESS");
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests deleteConfig() method.
-     */
-    @Test
-    public void testDeleteConfig3() throws Exception {
-        ospfProcesses = new ArrayList();
-        controller.deleteConfig(ospfProcesses, "PROCESS");
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests deleteConfig() method.
-     */
-    @Test
-    public void testDeleteConfig4() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.deleteConfig(ospfProcesses, "PROCESS");
-        controller.updateConfig(ospfProcesses);
-        assertThat(controller, is(notNullValue()));
-    }
-
-    /**
-     * Tests deleteProcessWhenExists() method.
-     */
-    @Test
-    public void testDeleteProcessWhenExists() throws Exception {
-        controller.updateConfig(ospfProcesses);
-        controller.deleteProcessWhenExists(ospfProcesses, "PROCESS");
-    }
-
-    /**
      * Tests addLinkDetails() method.
      */
     @Test
@@ -350,7 +212,7 @@
         controller.start(ospfAgent, driverService);
         ospfRouter = new OspfRouterImpl();
         controller.addLinkDetails(ospfRouter, new OspfLinkTedImpl());
-        controller.removeLinkDetails(ospfRouter);
+        controller.removeLinkDetails(ospfRouter, new OspfLinkTedImpl());
         assertThat(controller, is(notNullValue()));
     }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfConfigUtilTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfConfigUtilTest.java
new file mode 100644
index 0000000..d578e24
--- /dev/null
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfConfigUtilTest.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.ospf.controller.impl;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onosproject.ospf.controller.OspfProcess;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * Unit test class for OspfJsonParsingUtilTest.
+ */
+public class OspfConfigUtilTest {
+    private ObjectMapper mapper;
+    private JsonNode jsonNode;
+    private List<OspfProcess> ospfProcessList = new ArrayList<>();
+    private String jsonString = "{\n" +
+            "\t\"processes\": {\n" +
+            "\t\t\"areas\": [{\n" +
+            "\t\t\t\"interface\": [{\n" +
+            "\t\t\t\t\"interfaceIndex\": \"2\",\n" +
+            "\n" +
+            "\t\t\t\t\"helloIntervalTime\": \"10\",\n" +
+            "\n" +
+            "\t\t\t\t\"routerDeadIntervalTime\": \"40\",\n" +
+            "\n" +
+            "\t\t\t\t\"interfaceType\": \"2\",\n" +
+            "\n" +
+            "\t\t\t\t\"reTransmitInterval\": \"5\"\n" +
+            "\t\t\t}],\n" +
+            "\t\t\t\"areaId\": \"5.5.5.5\",\n" +
+            "\n" +
+            "\t\t\t\"routerId\": \"7.7.7.7\",\n" +
+            "\n" +
+            "\t\t\t\"isOpaqueEnable\": \"false\",\n" +
+            "\n" +
+            "\t\t\t\"externalRoutingCapability\": \"true\"\n" +
+            "\t\t}]\n" +
+            "\t}\n" +
+            "}";
+
+    @Before
+    public void setUp() throws Exception {
+        mapper = new ObjectMapper();
+        jsonNode = mapper.readTree(jsonString);
+        mapper = new ObjectMapper();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+
+    }
+
+    @Test
+    public void testProcesses() throws Exception {
+        jsonNode.path("areas");
+        ospfProcessList = OspfConfigUtil.processes(jsonNode);
+        assertThat(ospfProcessList, is(notNullValue()));
+    }
+}
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfControllerImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfControllerImplTest.java
index 7c9816b..7c7f265 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfControllerImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfControllerImplTest.java
@@ -46,10 +46,8 @@
     private OspfControllerImpl ospfController;
     private OspfRouterListener ospfRouterListener;
     private OspfLinkListener ospfLinkListener;
-    private Controller controller;
     private List<OspfProcess> ospfProcesses;
     private OspfProcess process1;
-    private OspfProcess process2;
     private List<OspfArea> areas;
     private OspfAreaImpl ospfArea;
     private List<OspfInterface> ospfInterfaces;
@@ -61,7 +59,6 @@
     @Before
     public void setUp() throws Exception {
         ospfController = new OspfControllerImpl();
-        controller = new Controller();
     }
 
     @After
@@ -69,7 +66,6 @@
         ospfController = null;
         ospfRouterListener = null;
         ospfLinkListener = null;
-        controller = null;
         ospfProcesses = null;
         areas = null;
         ospfArea = null;
@@ -140,38 +136,6 @@
     }
 
     /**
-     * Tests updateConfig() method.
-     */
-    @Test
-    public void testUpdateConfig() throws Exception {
-        ospfProcess = new OspfProcessImpl();
-        ospfArea = new OspfAreaImpl();
-        ospfInterface = new OspfInterfaceImpl();
-        ospfInterfaces = new ArrayList();
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterfaces.add(ospfInterface);
-        ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        ospfProcess.setProcessId("10.10.10.10");
-        areas = new ArrayList();
-        areas.add(ospfArea);
-        ospfProcess.setAreas(areas);
-        ospfProcesses = new ArrayList();
-        ospfProcesses.add(ospfProcess);
-        process1 = new OspfProcessImpl();
-        process1.setProcessId("11.11.11.11");
-        ospfArea1 = new OspfAreaImpl();
-        ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea1.setInterfacesLst(ospfInterfaces);
-        areas.add(ospfArea1);
-        process1.setAreas(areas);
-        ospfProcesses.add(process1);
-        ospfController.updateConfig(ospfProcesses);
-        assertThat(ospfController, is(notNullValue()));
-
-    }
-
-    /**
      * Tests deleteConfig() method.
      */
     @Test
@@ -183,7 +147,7 @@
         ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.5"));
         ospfInterfaces.add(ospfInterface);
         ospfArea.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
         ospfProcess.setProcessId("10.10.10.10");
         areas = new ArrayList();
         areas.add(ospfArea);
@@ -194,7 +158,7 @@
         process1.setProcessId("11.11.11.11");
         ospfArea1 = new OspfAreaImpl();
         ospfArea1.setAreaId(Ip4Address.valueOf("2.2.2.2"));
-        ospfArea1.setInterfacesLst(ospfInterfaces);
+        ospfArea1.setOspfInterfaceList(ospfInterfaces);
         areas.add(ospfArea1);
         process1.setAreas(areas);
         ospfProcesses.add(process1);
@@ -221,7 +185,7 @@
         ospfRouter = new OspfRouterImpl();
 
         ospfController.agent.addLink(ospfRouter, new OspfLinkTedImpl());
-        ospfController.agent.deleteLink(ospfRouter);
+        ospfController.agent.deleteLink(ospfRouter, new OspfLinkTedImpl());
         assertThat(ospfController, is(notNullValue()));
     }
 
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfDeviceTedImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfDeviceTedImplTest.java
index e65ca9d..b11f537 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfDeviceTedImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfDeviceTedImplTest.java
@@ -21,6 +21,7 @@
 import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip6Address;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,8 +32,6 @@
  * Unit test class for OspfDeviceTedImpl.
  */
 public class OspfDeviceTedImplTest {
-    private static final Ip6Address LOCAL_ADDRESS = Ip6Address.valueOf("::1");
-
     private OspfDeviceTedImpl ospfDeviceTed;
 
     @Before
@@ -128,10 +127,10 @@
     /**
      * Tests ipv6RouterIds() getter method.
      */
-    @Test
+    @Test(expected = Exception.class)
     public void testIpv6RouterIds() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip6Address.valueOf(InetAddress.getLocalHost()));
         ospfDeviceTed.setIpv6RouterIds(list);
         assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1));
     }
@@ -139,11 +138,11 @@
     /**
      * Tests ipv6RouterIds() setter method.
      */
-    @Test
+    @Test(expected = Exception.class)
     public void testSetIpv6RouterIds() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip6Address.valueOf(InetAddress.getLocalHost()));
         ospfDeviceTed.setIpv6RouterIds(list);
         assertThat(ospfDeviceTed.ipv6RouterIds().size(), is(1));
     }
-}
+}
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandlerTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandlerTest.java
index 51a949e..2ad4bd2 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandlerTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandlerTest.java
@@ -18,9 +18,7 @@
 import org.easymock.EasyMock;
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.buffer.HeapChannelBufferFactory;
 import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelConfig;
 import org.jboss.netty.channel.ChannelFuture;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.ChannelStateEvent;
@@ -30,34 +28,27 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.Ip4Address;
+import org.onosproject.ospf.controller.OspfArea;
 import org.onosproject.ospf.controller.OspfAreaAddressRange;
 import org.onosproject.ospf.controller.OspfInterface;
-import org.onosproject.ospf.controller.OspfNbr;
+import org.onosproject.ospf.controller.OspfLsaType;
 import org.onosproject.ospf.controller.OspfNeighborState;
+import org.onosproject.ospf.controller.OspfProcess;
 import org.onosproject.ospf.controller.TopologyForDeviceAndLink;
 import org.onosproject.ospf.controller.area.OspfAreaAddressRangeImpl;
 import org.onosproject.ospf.controller.area.OspfAreaImpl;
 import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
-import org.onosproject.ospf.controller.util.OspfEligibleRouter;
+import org.onosproject.ospf.controller.area.OspfProcessImpl;
 import org.onosproject.ospf.exceptions.OspfParseException;
 import org.onosproject.ospf.protocol.lsa.LsaHeader;
-import org.onosproject.ospf.protocol.lsa.TlvHeader;
-import org.onosproject.ospf.protocol.lsa.tlvtypes.RouterTlv;
 import org.onosproject.ospf.protocol.lsa.types.RouterLsa;
-import org.onosproject.ospf.protocol.ospfpacket.OspfMessage;
-import org.onosproject.ospf.protocol.ospfpacket.subtype.LsRequestPacket;
 import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
 import org.onosproject.ospf.protocol.ospfpacket.types.HelloPacket;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsAcknowledge;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
 import org.onosproject.ospf.protocol.util.ChecksumCalculator;
-import org.onosproject.ospf.protocol.util.OspfInterfaceState;
 
 import java.net.SocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -69,179 +60,59 @@
  * Unit test class for OspfInterfaceChannelHandler.
  */
 public class OspfInterfaceChannelHandlerTest {
-
-    private List<OspfAreaAddressRange> addressRanges;
-    private List<OspfInterface> ospfInterfaces;
+    private final String string1 = "2.2.2.2";
+    private List<OspfAreaAddressRange> addressRanges = new ArrayList();
+    private List<OspfInterface> ospfInterfaces = new ArrayList<>();
     private Controller controller;
     private OspfAreaImpl ospfArea;
     private OspfInterfaceImpl ospfInterface;
     private OspfInterfaceChannelHandler ospfInterfaceChannelHandler;
-    private HashMap<String, OspfNbr> ospfNbrHashMap;
     private OspfNbrImpl ospfNbr;
-    private Channel channel;
     private ChannelHandlerContext channelHandlerContext;
     private ChannelStateEvent channelStateEvent;
-    private HelloPacket helloPacket;
-    private DdPacket ddPacket;
-    private ChecksumCalculator checksumCalculator;
+    private TopologyForDeviceAndLink topologyForDeviceAndLink;
+    private List<OspfProcess> ospfProcesses = new ArrayList<>();
+    private OspfProcess ospfProcess;
+    private Ip4Address ip4Address1 = Ip4Address.valueOf("10.10.10.10");
+    private Ip4Address ip4Address2 = Ip4Address.valueOf("2.2.2.2");
+    private Ip4Address ip4Address3 = Ip4Address.valueOf("13.13.13.13");
+    private Ip4Address ip4Address4 = Ip4Address.valueOf("111.111.111.111");
+    private Ip4Address ip4Address5 = Ip4Address.valueOf("10.226.165.164");
+    private Ip4Address ip4Address6 = Ip4Address.valueOf("1.1.1.1");
+    private Ip4Address ip4Address7 = Ip4Address.valueOf("10.226.165.100");
+    private Ip4Address subnetAddress = Ip4Address.valueOf("255.255.255.255");
     private byte[] byteArray;
     private byte[] checkArray;
+    private HelloPacket helloPacket;
+    private ChecksumCalculator checksumCalculator;
     private ChannelBuffer buf;
-    private OspfEligibleRouter ospfEligibleRouter;
-    private LsUpdate lsUpdate;
-    private LsAcknowledge lsAck;
-    private LsRequest lsRequest;
-    private TopologyForDeviceAndLink topologyForDeviceAndLink;
+    private List<OspfArea> ospfAreas = new ArrayList<>();
 
     @Before
     public void setUp() throws Exception {
-        addressRanges = new ArrayList();
-        ospfInterfaces = new ArrayList<>();
+        ospfProcess = new OspfProcessImpl();
         ospfArea = createOspfArea();
-        ospfInterface = createOspfInterface();
-        ospfNbrHashMap = new HashMap();
-        topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setNeighborId(Ip4Address.valueOf("10.10.10.10"));
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfAreas.add(ospfArea);
+        ospfProcess.setAreas(ospfAreas);
+        ospfProcesses.add(ospfProcess);
         controller = new Controller();
-        ospfInterfaceChannelHandler = new OspfInterfaceChannelHandler();
-        ospfInterfaceChannelHandler = new OspfInterfaceChannelHandler(controller, ospfArea,
-                                                                      ospfInterface);
+        topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, ip4Address1,
+                                  ip4Address2, 2, topologyForDeviceAndLink);
+        ospfNbr.setNeighborId(ip4Address1);
+        ospfNbr.setRouterPriority(0);
+        ospfNbr.setNeighborDr(ip4Address3);
+        ospfInterface.addNeighbouringRouter(ospfNbr);
+        ospfInterfaceChannelHandler = new OspfInterfaceChannelHandler(controller, ospfProcesses);
     }
 
     @After
     public void tearDown() throws Exception {
         ospfInterfaceChannelHandler = null;
-        addressRanges = null;
-        ospfInterfaces = null;
-        controller = null;
-        ospfArea = null;
         ospfInterfaceChannelHandler = null;
         ospfInterface = null;
-        ospfNbrHashMap = null;
-        channel = null;
         channelHandlerContext = null;
         channelStateEvent = null;
-        helloPacket = null;
-        ddPacket = null;
-        checksumCalculator = null;
-        byteArray = null;
-        checkArray = null;
-        ospfEligibleRouter = null;
-        lsUpdate = null;
-        lsAck = null;
-        lsRequest = null;
-    }
-
-    /**
-     * Tests interfaceUp() method.
-     */
-    @Test
-    public void testInterfaceUp() throws Exception {
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setRouterPriority(0);
-        ospfInterfaceChannelHandler.interfaceUp();
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests interfaceUp() method.
-     */
-    @Test
-    public void testInterfaceUp1() throws Exception {
-
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setRouterPriority(0);
-        ospfInterfaceChannelHandler.interfaceUp();
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests interfaceUp() method.
-     */
-    @Test
-    public void testInterfaceUp2() throws Exception {
-        ospfInterface.setInterfaceType(1);
-        ospfInterface.setRouterPriority(1);
-        ospfInterfaceChannelHandler.interfaceUp();
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests interfaceUp() method.
-     */
-    @Test
-    public void testInterfaceUp3() throws Exception {
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setRouterPriority(1);
-        ospfInterfaceChannelHandler.interfaceUp();
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests backupSeen() method.
-     */
-    @Test
-    public void testBackupSeen() throws Exception {
-        channel = EasyMock.createMock(Channel.class);
-        ospfInterface.setState(OspfInterfaceState.WAITING);
-        ospfInterfaceChannelHandler.backupSeen(channel);
-        assertThat(ospfInterface.dr(), is(notNullValue()));
-    }
-
-    /**
-     * Tests waitTimer() method.
-     */
-    @Test
-    public void testWaitTimer() throws Exception {
-        channel = EasyMock.createMock(Channel.class);
-        ospfInterface.setState(OspfInterfaceState.WAITING);
-        ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.10"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterfaceChannelHandler.waitTimer(channel);
-        assertThat(ospfInterface.dr(), is(notNullValue()));
-    }
-
-    /**
-     * Tests neighborChange() method.
-     */
-    @Test
-    public void testNeighborChange() throws Exception {
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(new OspfAreaImpl(), new OspfInterfaceImpl(),
-                                  Ip4Address.valueOf("1.1.1.1"), Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  new OspfAreaImpl(),
-                                                                  new OspfInterfaceImpl()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setNeighborId(Ip4Address.valueOf("111.111.111.111"));
-        ospfNbrHashMap.put("111.111.111.111", ospfNbr);
-        ospfNbr.setState(OspfNeighborState.EXCHANGE);
-        ospfInterface.setListOfNeighbors(ospfNbrHashMap);
-        ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.10"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setIpAddress(Ip4Address.valueOf("10.10.10.10"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        channel = EasyMock.createMock(Channel.class);
-        ospfInterface.setState(OspfInterfaceState.DR);
-        ospfInterfaceChannelHandler.waitTimer(channel);
-        assertThat(ospfInterface.dr(), is(Ip4Address.valueOf("0.0.0.0")));
-    }
-
-    /**
-     * Tests interfaceDown() method.
-     */
-    @Test(expected = Exception.class)
-    public void testInterfaceDown() throws Exception {
-        ospfInterfaceChannelHandler.interfaceDown();
-        assertThat(ospfInterface.state(), is(OspfInterfaceState.DOWN));
     }
 
     /**
@@ -252,7 +123,6 @@
         channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
         channelStateEvent = EasyMock.createMock(ChannelStateEvent.class);
         ospfInterfaceChannelHandler.channelConnected(channelHandlerContext, channelStateEvent);
-        assertThat(ospfInterface.state(), is(notNullValue()));
     }
 
     /**
@@ -269,14 +139,64 @@
     /**
      * Tests channelDisconnected() method.
      */
-    @Test(expected = Exception.class)
+    @Test
     public void testChannelDisconnected() throws Exception {
         channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
         channelStateEvent = EasyMock.createMock(ChannelStateEvent.class);
-
         ospfInterfaceChannelHandler.channelDisconnected(channelHandlerContext, channelStateEvent);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
 
-        assertThat(ospfInterface.state(), is(notNullValue()));
+    /**
+     * Tests initializeInterfaceMap() method.
+     */
+    @Test
+    public void testInitializeInterfaceMap() throws Exception {
+        ospfInterfaceChannelHandler.initializeInterfaceMap();
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Tests updateInterfaceMap() method.
+     */
+    @Test
+    public void testUpdateInterfaceMap() throws Exception {
+        ospfInterfaceChannelHandler.updateInterfaceMap(ospfProcesses);
+        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaImpl createOspfArea() throws Exception {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange;
+        ospfAreaAddressRange = createOspfAreaAddressRange();
+        addressRanges.add(ospfAreaAddressRange);
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        ospfArea.setAreaId(ip4Address5);
+        ospfArea.setExternalRoutingCapability(true);
+        OspfInterfaceImpl ospfInterface = createOspfInterface();
+        ospfInterfaces.add(ospfInterface);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        RouterLsa routerLsa = new RouterLsa();
+        routerLsa.setLsType(1);
+        routerLsa.setLinkStateId(string1);
+        routerLsa.setAdvertisingRouter(ip4Address2);
+        ospfArea.addLsa(routerLsa, false, ospfInterface);
+        ospfArea.setRouterId(ip4Address4);
+
+        return ospfArea;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaAddressRangeImpl createOspfAreaAddressRange() {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange = new OspfAreaAddressRangeImpl();
+        ospfAreaAddressRange.setIpAddress(ip4Address5);
+        ospfAreaAddressRange.setAdvertise(true);
+        ospfAreaAddressRange.setMask("mask");
+        return ospfAreaAddressRange;
     }
 
     /**
@@ -333,701 +253,63 @@
     }
 
     /**
-     * Tests processOspfMessage() method.
+     * Utility for test method.
      */
-    @Test
-    public void testProcessOspfMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("225.225.225.225"));
+    private OspfInterfaceImpl createOspfInterface1() throws UnknownHostException {
+        ospfInterface = new OspfInterfaceImpl();
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
+                OspfInterfaceChannelHandler.class);
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, ip4Address5,
+                                  ip4Address6, 2, topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setNeighborId(ip4Address7);
+        ospfInterface = new OspfInterfaceImpl();
+        ospfInterface.setIpAddress(ip4Address5);
+        ospfInterface.setIpNetworkMask(subnetAddress);
+        ospfInterface.setBdr(ip4Address4);
+        ospfInterface.setDr(ip4Address4);
+        ospfInterface.setHelloIntervalTime(20);
         ospfInterface.setInterfaceType(2);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        helloPacket = new HelloPacket();
-        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        helloPacket.setRouterId(Ip4Address.valueOf("10.10.10.10"));
-        helloPacket.setOspfVer(2);
-        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        helloPacket.setOptions(2);
-        helloPacket.setNetworkMask(Ip4Address.valueOf("3.3.3.3"));
-        helloPacket.setOspftype(1);
-        helloPacket.setAuthType(0);
-        helloPacket.setHelloInterval(60);
-        helloPacket.setRouterDeadInterval(60);
-        helloPacket.setAuthentication(0);
-        checksumCalculator = new ChecksumCalculator();
-        byteArray = helloPacket.asBytes();
-        helloPacket.setOspfPacLength(byteArray.length);
-        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
-        checkArray[0] = -53;
-        checkArray[1] = 37;
-        buf = ChannelBuffers.copiedBuffer(checkArray);
-        helloPacket.setChecksum(buf.readUnsignedShort());
-        message = helloPacket;
-        ospfInterfaceChannelHandler.processOspfMessage(message, channelHandlerContext);
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setRouterId(Ip4Address.valueOf("10.10.10.10"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        ddPacket.setOptions(2);
-        ddPacket.setOspftype(2);
-        ddPacket.setAuthType(0);
-        ddPacket.setAuthentication(0);
-        checksumCalculator = new ChecksumCalculator();
-        byteArray = ddPacket.asBytes();
-        ddPacket.setOspfPacLength(byteArray.length);
-        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
-        checkArray[0] = -49;
-        checkArray[1] = -79;
-        buf = ChannelBuffers.copiedBuffer(checkArray);
-        ddPacket.setChecksum(buf.readUnsignedShort());
-        message = ddPacket;
-        ospfInterfaceChannelHandler.processOspfMessage(message, channelHandlerContext);
-        lsRequest = new LsRequest();
-        lsRequest.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsRequest.setRouterId(Ip4Address.valueOf("10.10.10.10"));
-        lsRequest.setOspfVer(2);
-        lsRequest.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        lsRequest.setOspftype(3);
-        lsRequest.setAuthType(0);
-        lsRequest.setAuthentication(0);
-        checksumCalculator = new ChecksumCalculator();
-        byteArray = lsRequest.asBytes();
-        lsRequest.setOspfPacLength(byteArray.length);
-        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
-        checkArray[0] = -33;
-        checkArray[1] = -58;
-        buf = ChannelBuffers.copiedBuffer(checkArray);
-        lsRequest.setChecksum(buf.readUnsignedShort());
-        message = lsRequest;
-        ospfInterfaceChannelHandler.processOspfMessage(message, channelHandlerContext);
-        lsUpdate = new LsUpdate();
-        lsUpdate.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsUpdate.setRouterId(Ip4Address.valueOf("10.10.10.10"));
-        lsUpdate.setOspfVer(2);
-        lsUpdate.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        lsUpdate.setOspftype(4);
-        lsUpdate.setAuthType(0);
-        lsUpdate.setAuthentication(0);
-        checksumCalculator = new ChecksumCalculator();
-        byteArray = lsUpdate.asBytes();
-        lsUpdate.setOspfPacLength(byteArray.length);
-        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
-        checkArray[0] = -47;
-        checkArray[1] = -77;
-        buf = ChannelBuffers.copiedBuffer(checkArray);
-        lsUpdate.setChecksum(buf.readUnsignedShort());
-        message = lsUpdate;
-        ospfInterfaceChannelHandler.processOspfMessage(message, channelHandlerContext);
-        lsAck = new LsAcknowledge();
-        lsAck.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsAck.setRouterId(Ip4Address.valueOf("10.10.10.10"));
-        lsAck.setOspfVer(2);
-        lsAck.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        lsAck.setOspftype(5);
-        lsAck.setAuthType(0);
-        lsAck.setAuthentication(0);
-        checksumCalculator = new ChecksumCalculator();
-        byteArray = lsAck.asBytes();
-        lsAck.setOspfPacLength(byteArray.length);
-        checkArray = checksumCalculator.calculateOspfCheckSum(byteArray, 12, 13);
-        checkArray[0] = -47;
-        checkArray[1] = -74;
-        buf = ChannelBuffers.copiedBuffer(checkArray);
-        lsAck.setChecksum(buf.readUnsignedShort());
-        message = lsAck;
-        ospfInterfaceChannelHandler.processOspfMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    /**
-     * Tests processHelloMessage() method.
-     */
-    @Test
-    public void testProcessHelloMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(1);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("244.244.244.244"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        helloPacket = new HelloPacket();
-        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        helloPacket.setOspfVer(2);
-        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        helloPacket.setNetworkMask(Ip4Address.valueOf("244.244.244.244"));
-        helloPacket.setHelloInterval(10);
-        helloPacket.setRouterDeadInterval(10);
-        helloPacket.setDr(Ip4Address.valueOf("10.10.10.10"));
-        helloPacket.setBdr(Ip4Address.valueOf("11.11.11.11"));
-        helloPacket.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-        message = helloPacket;
-        ospfInterfaceChannelHandler.processHelloMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests processHelloMessage() method.
-     */
-    @Test
-    public void testProcessHelloMessage1() throws Exception {
-        ospfInterface.setInterfaceType(2);
+        ospfInterface.setReTransmitInterval(2000);
+        ospfInterface.setMtu(6500);
+        ospfInterface.setRouterDeadIntervalTime(1000);
         ospfInterface.setRouterPriority(1);
-        ospfInterfaceChannelHandler.interfaceUp();
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setState(OspfInterfaceState.WAITING);
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("244.244.244.244"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        helloPacket = new HelloPacket();
-        helloPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        helloPacket.setOspfVer(2);
-        helloPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        helloPacket.setNetworkMask(Ip4Address.valueOf("244.244.244.244"));
-        helloPacket.setHelloInterval(10);
-        helloPacket.setRouterDeadInterval(10);
-        helloPacket.setDr(Ip4Address.valueOf("10.10.10.10"));
-        helloPacket.setBdr(Ip4Address.valueOf("11.11.11.11"));
-        helloPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
-        message = helloPacket;
-        ospfInterfaceChannelHandler.processHelloMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
+        ospfInterface.setInterfaceType(1);
         ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processHelloMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+        return ospfInterface;
     }
 
     /**
-     * Tests processDdMessage() method.
+     * Utility for test method.
      */
-    @Test
-    public void testProcessDdMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
-        ddPacket.setIsOpaqueCapable(true);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(1);
-        ddPacket.setIsMaster(1);
-        ddPacket.setSequenceNo(123);
-        message = ddPacket;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.EXSTART);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processDdMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests processDdMessage() method.
-     */
-    @Test(expected = Exception.class)
-    public void testProcessDdMessage3() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
-        ddPacket.setIsOpaqueCapable(true);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(1);
-        ddPacket.setIsMaster(1);
-        ddPacket.setSequenceNo(123);
-        message = ddPacket;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.EXSTART);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(0);
-        ddPacket.setIsMaster(0);
-        ddPacket.setSequenceNo(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processDdMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests processDdMessage() method.
-     */
-    @Test(expected = Exception.class)
-    public void testProcessDdMessage1() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
-        ddPacket.setIsOpaqueCapable(true);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(1);
-        ddPacket.setIsMaster(1);
-        ddPacket.setSequenceNo(123);
-        message = ddPacket;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.EXCHANGE);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(0);
-        ddPacket.setIsMaster(0);
-        ddPacket.setSequenceNo(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processDdMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    /**
-     * Tests processDdMessage() method.
-     */
-    @Test(expected = Exception.class)
-    public void testProcessDdMessage2() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        ddPacket.setRouterId(Ip4Address.valueOf("2.2.2.2"));
-        ddPacket.setIsOpaqueCapable(true);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(1);
-        ddPacket.setIsMaster(1);
-        ddPacket.setSequenceNo(123);
-        message = ddPacket;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  ospfInterface),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.LOADING);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processDdMessage(message, channelHandlerContext);
-        ddPacket.setIsMore(1);
-        ddPacket.setIsInitialize(0);
-        ddPacket.setIsMaster(0);
-        ddPacket.setSequenceNo(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfNbr.setState(OspfNeighborState.LOADING);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-
-        ospfInterfaceChannelHandler.processDdMessage(message, channelHandlerContext);
-
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    /**
-     * Tests processLsRequestMessage() method.
-     */
-    @Test
-    public void testProcessLSRequestMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        lsRequest = new LsRequest();
-        lsRequest.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsRequest.setOspfVer(2);
-        lsRequest.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        lsRequest.setRouterId(Ip4Address.valueOf("10.226.165.100"));
-        List<LsRequestPacket> lsRequests = new ArrayList();
-        LsRequestPacket lsRequestPacket = new LsRequestPacket();
-        lsRequestPacket.setLsType(3);
-        lsRequestPacket.setLinkStateId("2.2.2.2");
-        lsRequestPacket.setOwnRouterId("2.2.2.2");
-        lsRequests.add(lsRequestPacket);
-        lsRequests.add(lsRequestPacket);
-        lsRequest.addLinkStateRequests(new LsRequestPacket());
-        lsRequest.addLinkStateRequests(new LsRequestPacket());
-        message = lsRequest;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr.setState(OspfNeighborState.EXCHANGE);
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface1()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterface.setListOfNeighbors(ospfNbrHashMap);
-        ospfInterfaceChannelHandler.processLsRequestMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    /**
-     * Tests processLsUpdateMessage() method.
-     */
-    @Test
-    public void testProcessLSUpdateMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        lsUpdate = new LsUpdate();
-        lsUpdate.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsUpdate.setOspfVer(2);
-        lsUpdate.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        lsUpdate.setRouterId(Ip4Address.valueOf("10.226.165.100"));
-        RouterLsa routerLsa = new RouterLsa();
-        lsUpdate.addLsa(routerLsa);
-        lsUpdate.setNumberOfLsa(1);
-        message = lsUpdate;
-        ospfNbrHashMap = new HashMap();
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface1()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        ospfInterfaceChannelHandler.processLsUpdateMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    @Test(expected = Exception.class)
-    public void testProcessLSAckMessage() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        lsAck = new LsAcknowledge();
-        lsAck.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        lsAck.setOspfVer(2);
-        lsAck.setAreaId(Ip4Address.valueOf("12.12.12.12"));
+    private OspfInterfaceImpl createOspfInterface() throws Exception {
+        ospfInterface = new OspfInterfaceImpl();
         LsaHeader lsaHeader = new LsaHeader();
-        lsAck.addLinkStateHeader(lsaHeader);
-        message = lsAck;
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface()),
-                                  topologyForDeviceAndLink);
-        ospfNbr.setLastDdPacket(createDdPacket());
-        ospfNbr.setNeighborId(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfNbr.setRouterPriority(0);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("13.13.13.13"));
-        ospfNbr.setDdSeqNum(123);
-        ospfInterfaceChannelHandler.processLsAckMessage(message, channelHandlerContext);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-
-    }
-
-    /**
-     * Tests compareDdPackets() method.
-     */
-    @Test
-    public void testCompareDDPackets() throws Exception {
-        ospfInterface.setIpAddress(Ip4Address.valueOf("11.11.11.11"));
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setHelloIntervalTime(10);
-        ospfInterface.setRouterDeadIntervalTime(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-        OspfMessage message;
-        ddPacket = new DdPacket();
-        ddPacket.setSourceIp(Ip4Address.valueOf("1.1.1.1"));
-        ddPacket.setOspfVer(2);
-        ddPacket.setIsInitialize(1);
-        ddPacket.setIsMaster(1);
-        ddPacket.setIsMore(1);
-        ddPacket.setOptions(2);
-        ddPacket.setAreaId(Ip4Address.valueOf("12.12.12.12"));
-        assertThat(ospfInterfaceChannelHandler.compareDdPackets(ddPacket, ddPacket), is(true));
-    }
-
-    @Test(expected = Exception.class)
-    public void testCloseChannel() throws Exception {
-        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
-
-        ospfInterfaceChannelHandler.closeChannel(channelHandlerContext);
-
-        assertThat(ospfInterface.dr(), is(notNullValue()));
-    }
-
-    /**
-     * Tests electRouter() method.
-     */
-    @Test
-    public void testElectRouter() throws Exception {
-        ospfInterface.setDr(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterface.setBdr(Ip4Address.valueOf("3.3.3.3"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ChannelConfig channelConfig = EasyMock.createMock(ChannelConfig.class);
-        EasyMock.expect(channelConfig.getBufferFactory()).andReturn(new HeapChannelBufferFactory());
-        Channel channel = EasyMock.createMock(Channel.class);
-        ospfInterfaceChannelHandler.electRouter(channel);
-        assertThat(ospfInterface.dr(), is(notNullValue()));
-    }
-
-    /**
-     * Tests electBdr() method.
-     */
-    @Test
-    public void testElectBdr() throws Exception {
-        ospfEligibleRouter = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
-
-        ospfEligibleRouters.add(ospfEligibleRouter);
-        ospfEligibleRouters.add(ospfEligibleRouter1);
-        ospfEligibleRouters.add(ospfEligibleRouter2);
-        OspfEligibleRouter eligibleRouter = ospfInterfaceChannelHandler.electBdr(ospfEligibleRouters);
-        assertThat(ospfEligibleRouters.size(), is(3));
-        assertThat(eligibleRouter, is(notNullValue()));
-    }
-
-    /**
-     * Tests electDr() method.
-     */
-    @Test
-    public void testElectDR() throws Exception {
-        ospfEligibleRouter = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
-        ospfEligibleRouters.add(ospfEligibleRouter);
-        ospfEligibleRouters.add(ospfEligibleRouter1);
-        ospfEligibleRouters.add(ospfEligibleRouter2);
-        OspfEligibleRouter eligibleRouter = ospfInterfaceChannelHandler.electDr(ospfEligibleRouters,
-                                                                                ospfEligibleRouter);
-        assertThat(ospfEligibleRouters.size(), is(3));
-        assertThat(eligibleRouter, is(notNullValue()));
-    }
-
-    /**
-     * Tests selectRouterBasedOnPriority() method.
-     */
-    @Test
-    public void testSelectRouterBasedOnPriority() throws Exception {
-        ospfEligibleRouter = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(10);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter1 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(11);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        OspfEligibleRouter ospfEligibleRouter2 = new OspfEligibleRouter();
-        ospfEligibleRouter.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsDr(true);
-        ospfEligibleRouter.setRouterPriority(12);
-        ospfEligibleRouter.setRouterId(Ip4Address.valueOf("1.1.1.1"));
-        ospfEligibleRouter.setIsBdr(false);
-        List<OspfEligibleRouter> ospfEligibleRouters = new ArrayList<>();
-        ospfEligibleRouters.add(ospfEligibleRouter);
-        ospfEligibleRouters.add(ospfEligibleRouter1);
-        ospfEligibleRouters.add(ospfEligibleRouter2);
-        OspfEligibleRouter eligibleRouter = ospfInterfaceChannelHandler.selectRouterBasedOnPriority(
-                ospfEligibleRouters);
-        assertThat(eligibleRouter, is(notNullValue()));
-    }
-
-    /**
-     * Tests addDeviceInformation() method.
-     */
-    @Test(expected = Exception.class)
-    public void testAddDeviceInformation() throws Exception {
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface()),
-                                  topologyForDeviceAndLink);
-
-        ospfInterfaceChannelHandler.addDeviceInformation(new OspfRouterImpl());
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests removeDeviceInformation() method.
-     */
-    @Test(expected = Exception.class)
-    public void testRemoveDeviceInformation() throws Exception {
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface()),
-                                  topologyForDeviceAndLink);
-
-        ospfInterfaceChannelHandler.removeDeviceInformation(new OspfRouterImpl());
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests addLinkInformation() method.
-     */
-    @Test(expected = Exception.class)
-    public void testaddLinkInformation() throws Exception {
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface()),
-                                  topologyForDeviceAndLink);
-
-        List topTlv = new ArrayList();
-        topTlv.add(new RouterTlv(new TlvHeader()));
-        ospfInterfaceChannelHandler.addLinkInformation(new OspfRouterImpl(), new OspfLinkTedImpl());
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
-    }
-
-    /**
-     * Tests removeLinkInformation() method.
-     */
-    @Test(expected = Exception.class)
-    public void testRemoveLinkInformation() throws Exception {
-        ospfNbr = new OspfNbrImpl(ospfArea, createOspfInterface(), Ip4Address.valueOf("10.10.10.10"),
-                                  Ip4Address.valueOf("10.226.165.100"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(), ospfArea,
-                                                                  createOspfInterface()),
-                                  topologyForDeviceAndLink);
-
-        ospfInterfaceChannelHandler.removeLinkInformation(ospfNbr);
-        assertThat(ospfInterfaceChannelHandler, is(notNullValue()));
+        lsaHeader.setLsType(OspfLsaType.ROUTER.value());
+        RouterLsa routerLsa = new RouterLsa();
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        ospfArea.addLsa(routerLsa, true, ospfInterface);
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, ip4Address5,
+                                  ip4Address6, 2, topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setNeighborId(ip4Address7);
+        this.ospfInterface = new OspfInterfaceImpl();
+        this.ospfInterface.setIpAddress(ip4Address5);
+        this.ospfInterface.setIpNetworkMask(subnetAddress);
+        this.ospfInterface.setBdr(ip4Address4);
+        this.ospfInterface.setDr(ip4Address4);
+        this.ospfInterface.setHelloIntervalTime(20);
+        this.ospfInterface.setInterfaceType(2);
+        this.ospfInterface.setReTransmitInterval(2000);
+        this.ospfInterface.setMtu(6500);
+        this.ospfInterface.setRouterDeadIntervalTime(1000);
+        this.ospfInterface.setRouterPriority(1);
+        this.ospfInterface.setInterfaceType(1);
+        this.ospfInterface.setInterfaceIndex(1);
+        this.ospfInterface.addNeighbouringRouter(ospfNbr);
+        this.ospfInterface.setOspfArea(ospfArea);
+        return this.ospfInterface;
     }
 
     /**
@@ -1042,115 +324,4 @@
         ddPacket1.readFrom(buf);
         return ddPacket1;
     }
-
-    /**
-     * Utility for test method.
-     */
-    private OspfInterfaceImpl createOspfInterface() throws UnknownHostException {
-        ospfInterface = new OspfInterfaceImpl();
-        OspfAreaImpl ospfArea = new OspfAreaImpl();
-        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
-                OspfInterfaceChannelHandler.class);
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
-                                  Ip4Address.valueOf("1.1.1.1"), 2, ospfInterfaceChannelHandler,
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.EXSTART);
-        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
-        this.ospfInterface = new OspfInterfaceImpl();
-        this.ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
-        this.ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        this.ospfInterface.setAreaId(2);
-        this.ospfInterface.setAuthKey("authKey");
-        this.ospfInterface.setAuthType("AuthReq");
-        this.ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
-        this.ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
-        this.ospfInterface.setHelloIntervalTime(20);
-        this.ospfInterface.setInterfaceCost(10);
-        this.ospfInterface.setInterfaceType(2);
-        this.ospfInterface.setReTransmitInterval(2000);
-        this.ospfInterface.setMtu(6500);
-        this.ospfInterface.setPollInterval(1000);
-        this.ospfInterface.setRouterDeadIntervalTime(1000);
-        this.ospfInterface.setRouterPriority(1);
-        this.ospfInterface.setTransmitDelay(500);
-        this.ospfInterface.setInterfaceType(1);
-        this.ospfInterface.addNeighbouringRouter(ospfNbr);
-        return this.ospfInterface;
-    }
-
-    /**
-     * Utility for test method.
-     */
-    private OspfInterfaceImpl createOspfInterface1() throws UnknownHostException {
-        ospfInterface = new OspfInterfaceImpl();
-        OspfAreaImpl ospfArea = new OspfAreaImpl();
-        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
-                OspfInterfaceChannelHandler.class);
-        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
-                                  Ip4Address.valueOf("1.1.1.1"), 2, ospfInterfaceChannelHandler,
-                                  topologyForDeviceAndLink);
-        ospfNbr.setState(OspfNeighborState.FULL);
-        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
-        ospfInterface = new OspfInterfaceImpl();
-        ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
-        ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
-        ospfInterface.setAreaId(2);
-        ospfInterface.setAuthKey("authKey");
-        ospfInterface.setAuthType("AuthReq");
-        ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
-        ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
-        ospfInterface.setHelloIntervalTime(20);
-        ospfInterface.setInterfaceCost(10);
-        ospfInterface.setInterfaceType(2);
-        ospfInterface.setReTransmitInterval(2000);
-        ospfInterface.setMtu(6500);
-        ospfInterface.setPollInterval(1000);
-        ospfInterface.setRouterDeadIntervalTime(1000);
-        ospfInterface.setRouterPriority(1);
-        ospfInterface.setTransmitDelay(500);
-        ospfInterface.setInterfaceType(1);
-        ospfInterface.addNeighbouringRouter(ospfNbr);
-        return ospfInterface;
-    }
-
-    /**
-     * Utility for test method.
-     */
-    private OspfAreaImpl createOspfArea() throws UnknownHostException {
-        OspfAreaAddressRangeImpl ospfAreaAddressRange;
-        ospfAreaAddressRange = createOspfAreaAddressRange();
-        addressRanges.add(ospfAreaAddressRange);
-        OspfAreaImpl ospfArea = new OspfAreaImpl();
-        ospfArea.setStubCost(10);
-        ospfArea.setAreaId(Ip4Address.valueOf("10.226.165.164"));
-        ospfArea.setExternalRoutingCapability(true);
-        ospfArea.setTransitCapability(true);
-        ospfArea.setAddressRanges(addressRanges);
-        OspfInterfaceImpl ospfInterface = createOspfInterface();
-        ospfInterfaces.add(ospfInterface);
-        ospfArea.setInterfacesLst(ospfInterfaces);
-        RouterLsa routerLsa = new RouterLsa();
-        routerLsa.setLsType(1);
-        routerLsa.setLinkStateId("2.2.2.2");
-        routerLsa.setAdvertisingRouter(Ip4Address.valueOf("2.2.2.2"));
-        try {
-            ospfArea.addLsa(routerLsa, false, ospfInterface);
-        } catch (Exception e) {
-            System.out.println("ospfAreaImpl createOspfArea");
-        }
-        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
-
-        return ospfArea;
-    }
-
-    /**
-     * Utility for test method.
-     */
-    private OspfAreaAddressRangeImpl createOspfAreaAddressRange() {
-        OspfAreaAddressRangeImpl ospfAreaAddressRange = new OspfAreaAddressRangeImpl();
-        ospfAreaAddressRange.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
-        ospfAreaAddressRange.setAdvertise(true);
-        ospfAreaAddressRange.setMask("mask");
-        return ospfAreaAddressRange;
-    }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfLinkTedImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfLinkTedImplTest.java
index 7415ed0..d4f0e2e 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfLinkTedImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfLinkTedImplTest.java
@@ -21,6 +21,7 @@
 import org.onlab.packet.Ip4Address;
 import org.onlab.util.Bandwidth;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -32,8 +33,6 @@
  * Unit test class for OspfDeviceTedImpl.
  */
 public class OspfLinkTedImplTest {
-    private static final Ip4Address LOCAL_ADDRESS = Ip4Address.valueOf("127.0.0.1");
-
     private OspfLinkTedImpl ospfLinkTed;
 
     @Before
@@ -91,7 +90,7 @@
     @Test
     public void testIpv4RemRouterId() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
         ospfLinkTed.setIpv4RemRouterId(list);
         assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1));
     }
@@ -102,7 +101,7 @@
     @Test
     public void testSetIpv4RemRouterId() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
         ospfLinkTed.setIpv4RemRouterId(list);
         assertThat(ospfLinkTed.ipv4RemRouterId().size(), is(1));
     }
@@ -133,7 +132,7 @@
     @Test
     public void testIpv4LocRouterId() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
         ospfLinkTed.setIpv4LocRouterId(list);
         assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1));
     }
@@ -144,7 +143,7 @@
     @Test
     public void testSetIpv4LocRouterId() throws Exception {
         List list = new ArrayList();
-        list.add(LOCAL_ADDRESS);
+        list.add(Ip4Address.valueOf(InetAddress.getLocalHost()));
         ospfLinkTed.setIpv4LocRouterId(list);
         assertThat(ospfLinkTed.ipv4LocRouterId().size(), is(1));
     }
@@ -202,4 +201,4 @@
         ospfLinkTed.setMaxUnResBandwidth(Bandwidth.bps(1234.0));
         assertThat(ospfLinkTed.maxUnResBandwidth(), is(notNullValue()));
     }
-}
+}
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageDecoderTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageDecoderTest.java
index 696469c..8bb8a2c 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageDecoderTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageDecoderTest.java
@@ -28,7 +28,7 @@
 import java.net.SocketAddress;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
@@ -36,7 +36,7 @@
  */
 public class OspfMessageDecoderTest {
 
-    private final byte[] hellopacket = {0, 0, 0, 0, 2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39, 59,
+    private final byte[] hellopacket = {0, 0, 0, 0, 0, 2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39, 59,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0, 0,
             40, -64, -88, -86, 8, 0, 0, 0, 0};
     private final byte[] ddpacket = {0, 0, 0, 0, 2, 2, 0, 32, -64, -88, -86, 8, 0, 0, 0, 1, -96, 82,
@@ -75,10 +75,10 @@
      */
     @Test
     public void testDecode() throws Exception {
-
         channel = EasyMock.createMock(Channel.class);
         socketAddress = InetSocketAddress.createUnresolved("127.0.0.1", 7000);
         channelBuffer = ChannelBuffers.copiedBuffer(hellopacket);
-        assertThat(ospfMessageDecoder.decode(ctx, channel, channelBuffer), is(nullValue()));
+        ospfMessageDecoder.decode(ctx, channel, channelBuffer);
+        assertThat(ospfMessageDecoder, is(notNullValue()));
     }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageEncoderTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageEncoderTest.java
index 0e40cb7..5bb7dec 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageEncoderTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfMessageEncoderTest.java
@@ -17,24 +17,11 @@
 
 
 import org.easymock.EasyMock;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.Channel;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.onlab.packet.Ip4Address;
-import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
-import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
-import org.onosproject.ospf.protocol.ospfpacket.types.HelloPacket;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsAcknowledge;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
-import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
-import org.onosproject.ospf.protocol.util.OspfInterfaceState;
-
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
@@ -44,55 +31,24 @@
  * Created by sdn on 13/1/16.
  */
 public class OspfMessageEncoderTest {
-    private final byte[] hpacket = {2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39, 59,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0, 0,
-            40, -64, -88, -86, 8, 0, 0, 0, 0};
-    private final byte[] dpacket = {2, 2, 0, 32, -64, -88, -86, 8, 0, 0, 0, 1, -96, 82,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -36, 2, 7, 65, 119, -87, 126};
-    private final byte[] lrpacket = {2, 3, 0, 36, -64, -88, -86, 3, 0, 0, 0, 1, -67, -57,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -64, -88, -86, 8, -64, -88, -86, 8};
-    private byte[] lAckpacket = {2, 5, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, -30, -12,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 16, 2, 1, -64, -88, -86, 2, -64,
-            -88, -86, 2, -128, 0, 0, 1, 74, -114, 0, 48};
-    private HelloPacket helloPacket;
-    private DdPacket ddPacket;
-    private LsAcknowledge lsAcknowledge;
-    private LsRequest lsRequest;
-    private LsUpdate lsUpdate;
-    private ChannelHandlerContext ctx;
+
+    private final byte[] object = {2, 1, 0, 44, -64, -88, -86, 8, 0, 0, 0, 1, 39,
+            59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 10, 2, 1, 0, 0,
+            0, 40, -64, -88, -86, 8, 0, 0, 0, 0};
     private OspfMessageEncoder ospfMessageEncoder;
-    private ChannelBuffer buf;
-    private SocketAddress socketAddress;
+    private ChannelHandlerContext channelHandlerContext;
     private Channel channel;
 
     @Before
     public void setUp() throws Exception {
         ospfMessageEncoder = new OspfMessageEncoder();
-        helloPacket = new HelloPacket();
-        ddPacket = new DdPacket();
-        lsAcknowledge = new LsAcknowledge();
-        lsRequest = new LsRequest();
-        lsUpdate = new LsUpdate();
-        helloPacket.setOspftype(1);
-        ddPacket.setOspftype(2);
-        lsAcknowledge.setOspftype(5);
-        lsRequest.setOspftype(3);
-        lsUpdate.setOspftype(4);
-        OspfInterfaceImpl ospfInterface = new OspfInterfaceImpl();
-        ospfInterface.setState(OspfInterfaceState.DROTHER);
-        ospfMessageEncoder = new OspfMessageEncoder(ospfInterface);
-
+        channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class);
+        channel = EasyMock.createMock(Channel.class);
     }
 
     @After
     public void tearDown() throws Exception {
-        helloPacket = null;
-        ddPacket = null;
-        lsAcknowledge = null;
-        lsRequest = null;
-        lsUpdate = null;
         ospfMessageEncoder = null;
-        buf = null;
     }
 
     /**
@@ -100,33 +56,6 @@
      */
     @Test
     public void testEncode() throws Exception {
-        socketAddress = InetSocketAddress.createUnresolved("127.0.0.1", 8600);
-        channel = EasyMock.createMock(Channel.class);
-        helloPacket = new HelloPacket();
-        helloPacket.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
-        buf = ChannelBuffers.buffer(hpacket.length);
-        buf.writeBytes(hpacket);
-        helloPacket.readFrom(buf);
-        ospfMessageEncoder.encode(ctx, channel, helloPacket);
-        ddPacket = new DdPacket();
-        ddPacket.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
-        buf = ChannelBuffers.buffer(dpacket.length);
-        buf.writeBytes(dpacket);
-        ddPacket.readFrom(buf);
-        ospfMessageEncoder.encode(ctx, channel, ddPacket);
-        lsRequest = new LsRequest();
-        lsRequest.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
-        buf = ChannelBuffers.buffer(lrpacket.length);
-        buf.writeBytes(lrpacket);
-        lsRequest.readFrom(buf);
-        ospfMessageEncoder.encode(ctx, channel, lsRequest);
-
-        lsAcknowledge = new LsAcknowledge();
-        lsAcknowledge.setDestinationIp(Ip4Address.valueOf("15.15.15.15"));
-        buf = ChannelBuffers.buffer(lAckpacket.length);
-        buf.writeBytes(lAckpacket);
-        lsAcknowledge.readFrom(buf);
-        ospfMessageEncoder.encode(ctx, channel, lsAcknowledge);
-        assertThat(ospfMessageEncoder, is(notNullValue()));
+        assertThat(ospfMessageEncoder.encode(channelHandlerContext, channel, object), is(notNullValue()));
     }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfNbrImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfNbrImplTest.java
index 5c7c27a..295f0ab 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfNbrImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfNbrImplTest.java
@@ -19,31 +19,37 @@
 import org.easymock.EasyMock;
 import org.jboss.netty.channel.Channel;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.onlab.packet.Ip4Address;
+import org.onosproject.ospf.controller.OspfAreaAddressRange;
 import org.onosproject.ospf.controller.OspfInterface;
 import org.onosproject.ospf.controller.OspfLsa;
 import org.onosproject.ospf.controller.OspfLsaType;
+import org.onosproject.ospf.controller.OspfMessage;
 import org.onosproject.ospf.controller.OspfNeighborState;
 import org.onosproject.ospf.controller.TopologyForDeviceAndLink;
+import org.onosproject.ospf.controller.area.OspfAreaAddressRangeImpl;
 import org.onosproject.ospf.controller.area.OspfAreaImpl;
 import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
 import org.onosproject.ospf.controller.lsdb.LsaWrapperImpl;
 import org.onosproject.ospf.controller.lsdb.LsdbAgeImpl;
+import org.onosproject.ospf.controller.util.OspfInterfaceType;
 import org.onosproject.ospf.protocol.lsa.LsaHeader;
+import org.onosproject.ospf.protocol.lsa.OpaqueLsaHeader;
 import org.onosproject.ospf.protocol.lsa.types.NetworkLsa;
+import org.onosproject.ospf.protocol.lsa.types.OpaqueLsa10;
 import org.onosproject.ospf.protocol.lsa.types.RouterLsa;
-import org.onosproject.ospf.protocol.ospfpacket.OspfMessage;
 import org.onosproject.ospf.protocol.ospfpacket.types.DdPacket;
 import org.onosproject.ospf.protocol.ospfpacket.types.HelloPacket;
 import org.onosproject.ospf.protocol.ospfpacket.types.LsRequest;
 import org.onosproject.ospf.protocol.ospfpacket.types.LsUpdate;
 import org.onosproject.ospf.protocol.util.ChecksumCalculator;
+import org.onosproject.ospf.protocol.util.OspfInterfaceState;
 import org.onosproject.ospf.protocol.util.OspfUtil;
 
 import java.net.SocketAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -55,54 +61,68 @@
  * Unit test class for OspfNbrImpl.
  */
 public class OspfNbrImplTest {
-
+    private List<OspfAreaAddressRange> addressRanges = new ArrayList();
     private OspfNbrImpl ospfNbr;
+    private OspfNbrImpl ospfNbr1;
     private OspfInterfaceImpl ospfInterface;
     private OspfAreaImpl ospfArea;
     private OspfInterfaceImpl ospfInterface1;
     private OspfInterfaceImpl ospfInterface2;
-    private List<OspfInterface> ospfInterfaces;
+    private List<OspfInterface> ospfInterfaces = new ArrayList();
     private List<OspfLsa> ospfLsaList;
     private Channel channel;
     private Channel channel1;
     private Channel channel2;
     private OspfMessage ospfMessage;
     private TopologyForDeviceAndLink topologyForDeviceAndLink;
+    private LsaHeader lsaHeader;
 
     @Before
     public void setUp() throws Exception {
+        lsaHeader = new LsaHeader();
+        lsaHeader.setLsType(OspfLsaType.ROUTER.value());
+        RouterLsa routerLsa = new RouterLsa(lsaHeader);
+        routerLsa.setLsType(OspfLsaType.ROUTER.value());
         ospfInterface = new OspfInterfaceImpl();
         ospfInterface.setInterfaceType(2);
+        ospfInterface.setInterfaceIndex(1);
         ospfInterface.setRouterDeadIntervalTime(30);
         ospfInterface.setReTransmitInterval(30);
         ospfInterface.setDr(Ip4Address.valueOf("1.1.1.1"));
         ospfInterface.setIpAddress(Ip4Address.valueOf("1.1.1.1"));
-        ospfArea = new OspfAreaImpl();
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
+        ospfArea = createOspfArea();
+        ospfArea.addLsa(routerLsa, true, ospfInterface);
+        ospfInterface.setOspfArea(ospfArea);
         ospfInterface1 = new OspfInterfaceImpl();
         ospfInterface1.setInterfaceType(2);
+        ospfInterface1.setInterfaceIndex(1);
         ospfInterface1.setRouterDeadIntervalTime(30);
         ospfInterface1.setReTransmitInterval(30);
         ospfInterface1.setDr(Ip4Address.valueOf("7.7.7.7"));
         ospfInterface1.setIpAddress(Ip4Address.valueOf("7.7.7.7"));
+        ospfInterface1.setState(OspfInterfaceState.DOWN);
+        ospfInterface1.setOspfArea(ospfArea);
         ospfInterface2 = new OspfInterfaceImpl();
         ospfInterface2.setInterfaceType(2);
+        ospfInterface2.setInterfaceIndex(1);
         ospfInterface2.setRouterDeadIntervalTime(30);
         ospfInterface2.setReTransmitInterval(30);
         ospfInterface2.setDr(Ip4Address.valueOf("6.6.6.6"));
         ospfInterface2.setIpAddress(Ip4Address.valueOf("6.6.6.6"));
+        ospfInterface2.setOspfArea(ospfArea);
+        ospfInterface1.setState(OspfInterfaceState.DR);
         ospfInterfaces = new ArrayList();
         ospfInterfaces.add(ospfInterface);
         ospfInterfaces.add(ospfInterface1);
         ospfInterfaces.add(ospfInterface2);
-        ospfArea.setInterfacesLst(ospfInterfaces);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        ospfInterface.setState(OspfInterfaceState.POINT2POINT);
         ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
         topologyForDeviceAndLink = new TopologyForDeviceAndLinkImpl();
         ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("1.1.1.1"),
                                   Ip4Address.valueOf("2.2.2.2"), 2,
-                                  new OspfInterfaceChannelHandler(new Controller(),
-                                                                  ospfArea, ospfInterface),
                                   topologyForDeviceAndLink);
-
     }
 
     @After
@@ -184,12 +204,19 @@
     /**
      * Tests negotiationDone() method.
      */
-    @Test(expected = Exception.class)
+    @Test
     public void testNegotiationDone() throws Exception {
+
         ospfLsaList = new ArrayList();
-        ospfLsaList.add(new RouterLsa());
-        ospfMessage = new HelloPacket();
+        RouterLsa routerLsa = new RouterLsa();
+        routerLsa.setLsType(OspfLsaType.ROUTER.value());
+        ospfLsaList.add(routerLsa);
+        DdPacket ddPacket = new DdPacket();
+        ddPacket.setIsOpaqueCapable(true);
+        ospfMessage = ddPacket;
         ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setIsOpaqueCapable(true);
+        channel = null;
         channel = EasyMock.createMock(Channel.class);
         ospfNbr.negotiationDone(ospfMessage, true, ospfLsaList, channel);
         channel1 = EasyMock.createMock(Channel.class);
@@ -230,7 +257,7 @@
     @Test
     public void testBadLSReq() throws Exception {
         channel = EasyMock.createMock(Channel.class);
-        ospfNbr.setState(OspfNeighborState.FULL);
+        ospfNbr.setState(OspfNeighborState.EXCHANGE);
         ospfNbr.badLSReq(channel);
         assertThat(ospfNbr, is(notNullValue()));
     }
@@ -294,11 +321,24 @@
     @Test
     public void testAdjOk() throws Exception {
         channel = EasyMock.createMock(Channel.class);
+        ospfInterface.setInterfaceType(OspfInterfaceType.BROADCAST.value());
         ospfInterface.setIpAddress(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.setState(OspfNeighborState.TWOWAY);
-        ospfNbr.setNeighborDr(Ip4Address.valueOf("2.2.2.2"));
-        ospfNbr.adjOk(channel);
-        Assert.assertNotNull(ospfNbr);
+        ospfNbr1 = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("1.1.1.1"),
+                                   Ip4Address.valueOf("2.2.2.2"), 2,
+                                   topologyForDeviceAndLink);
+        ospfNbr1.setState(OspfNeighborState.TWOWAY);
+        ospfNbr1.setNeighborDr(Ip4Address.valueOf("2.2.2.2"));
+        ospfNbr1.adjOk(channel);
+        assertThat(ospfNbr1, is(notNullValue()));
+
+        ospfInterface.setInterfaceType(OspfInterfaceType.POINT_TO_POINT.value());
+        ospfNbr1 = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("1.1.1.1"),
+                                   Ip4Address.valueOf("2.2.2.2"), 2,
+                                   topologyForDeviceAndLink);
+        channel = null;
+        channel = EasyMock.createMock(Channel.class);
+        ospfNbr1.adjOk(channel);
+        assertThat(ospfNbr1, is(notNullValue()));
     }
 
     /**
@@ -321,8 +361,11 @@
      */
     @Test
     public void testLoadingDone() throws Exception {
-        ospfArea.addLsa(new RouterLsa(), false, ospfInterface);
-        ospfArea.addLsa(new RouterLsa(), ospfInterface);
+        LsaHeader lsaHeader = new LsaHeader();
+        lsaHeader.setLsType(OspfLsaType.ROUTER.value());
+        RouterLsa routerLsa = new RouterLsa(lsaHeader);
+        ospfArea.addLsa(routerLsa, false, ospfInterface);
+        ospfArea.addLsa(routerLsa, ospfInterface);
         ospfArea.addLsaToMaxAgeBin("lsa", new LsaWrapperImpl());
         ospfNbr.loadingDone();
         assertThat(ospfNbr, is(notNullValue()));
@@ -362,6 +405,7 @@
         channel1 = EasyMock.createMock(Channel.class);
         assertThat(ospfNbr.processReceivedLsa(routerlsa, true, channel1,
                                               Ip4Address.valueOf("10.10.10.10")), is(true));
+
     }
 
     /**
@@ -394,7 +438,7 @@
     @Test
     public void testSendLsa() throws Exception {
         channel = EasyMock.createMock(Channel.class);
-        ospfNbr.sendLsa(new LsaHeader(), Ip4Address.valueOf("1.1.1.1"), channel);
+        ospfNbr.sendLsa(lsaHeader, Ip4Address.valueOf("1.1.1.1"), channel);
         assertThat(ospfNbr, is(notNullValue()));
     }
 
@@ -648,4 +692,77 @@
     public void testGetPendingReTxList() throws Exception {
         assertThat(ospfNbr.getPendingReTxList(), is(notNullValue()));
     }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaImpl createOspfArea() throws UnknownHostException {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange;
+        ospfAreaAddressRange = createOspfAreaAddressRange();
+        addressRanges.add(ospfAreaAddressRange);
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        ospfArea.setAreaId(Ip4Address.valueOf("10.226.165.164"));
+        ospfArea.setExternalRoutingCapability(true);
+        OspfInterfaceImpl ospfInterface = createOspfInterface();
+        ospfInterfaces.add(ospfInterface);
+        ospfArea.setOspfInterfaceList(ospfInterfaces);
+        RouterLsa routerLsa = new RouterLsa();
+        routerLsa.setLsType(1);
+        routerLsa.setLinkStateId("2.2.2.2");
+        routerLsa.setAdvertisingRouter(Ip4Address.valueOf("2.2.2.2"));
+        OpaqueLsaHeader opaqueLsaHeader = new OpaqueLsaHeader();
+        OpaqueLsa10 opaqueLsa10 = new OpaqueLsa10(opaqueLsaHeader);
+        opaqueLsa10.setLsType(OspfLsaType.AREA_LOCAL_OPAQUE_LSA.value());
+        opaqueLsa10.setLinkStateId("2.2.2.2");
+        opaqueLsa10.setAdvertisingRouter(Ip4Address.valueOf("2.2.2.2"));
+        try {
+            ospfArea.addLsa(routerLsa, false, ospfInterface);
+            ospfArea.addLsa(opaqueLsa10, false, ospfInterface);
+        } catch (Exception e) {
+            System.out.println("ospfAreaImpl createOspfArea");
+        }
+        ospfArea.setRouterId(Ip4Address.valueOf("111.111.111.111"));
+
+        return ospfArea;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfAreaAddressRangeImpl createOspfAreaAddressRange() {
+        OspfAreaAddressRangeImpl ospfAreaAddressRange = new OspfAreaAddressRangeImpl();
+        ospfAreaAddressRange.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
+        ospfAreaAddressRange.setAdvertise(true);
+        ospfAreaAddressRange.setMask("mask");
+        return ospfAreaAddressRange;
+    }
+
+    /**
+     * Utility for test method.
+     */
+    private OspfInterfaceImpl createOspfInterface() throws UnknownHostException {
+        ospfInterface = new OspfInterfaceImpl();
+        OspfAreaImpl ospfArea = new OspfAreaImpl();
+        OspfInterfaceChannelHandler ospfInterfaceChannelHandler = EasyMock.createMock(
+                OspfInterfaceChannelHandler.class);
+        ospfNbr = new OspfNbrImpl(ospfArea, ospfInterface, Ip4Address.valueOf("10.226.165.164"),
+                                  Ip4Address.valueOf("1.1.1.1"), 2,
+                                  topologyForDeviceAndLink);
+        ospfNbr.setState(OspfNeighborState.EXSTART);
+        ospfNbr.setNeighborId(Ip4Address.valueOf("10.226.165.100"));
+        this.ospfInterface = new OspfInterfaceImpl();
+        this.ospfInterface.setIpAddress(Ip4Address.valueOf("10.226.165.164"));
+        this.ospfInterface.setIpNetworkMask(Ip4Address.valueOf("255.255.255.255"));
+        this.ospfInterface.setBdr(Ip4Address.valueOf("111.111.111.111"));
+        this.ospfInterface.setDr(Ip4Address.valueOf("111.111.111.111"));
+        this.ospfInterface.setHelloIntervalTime(20);
+        this.ospfInterface.setInterfaceType(2);
+        this.ospfInterface.setReTransmitInterval(2000);
+        this.ospfInterface.setMtu(6500);
+        this.ospfInterface.setRouterDeadIntervalTime(1000);
+        this.ospfInterface.setRouterPriority(1);
+        this.ospfInterface.setInterfaceType(1);
+        this.ospfInterface.addNeighbouringRouter(ospfNbr);
+        return this.ospfInterface;
+    }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfPipelineFactoryTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfPipelineFactoryTest.java
index b4678a8..3357dc9 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfPipelineFactoryTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/impl/OspfPipelineFactoryTest.java
@@ -18,12 +18,6 @@
 import org.jboss.netty.channel.ChannelPipeline;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.ospf.controller.area.OspfAreaImpl;
-import org.onosproject.ospf.controller.area.OspfInterfaceImpl;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * Unit test class for OspfPipelineFactory.
@@ -35,8 +29,6 @@
 
     @Before
     public void setUp() throws Exception {
-        ospfPipelineFactory = new OspfPipelineFactory(new Controller(), new OspfAreaImpl(), new OspfInterfaceImpl());
-
     }
 
     @After
@@ -44,22 +36,4 @@
         ospfPipelineFactory = null;
         channelPipeline = null;
     }
-
-    /**
-     * Tests getPipeline() method.
-     */
-    @Test
-    public void testGetPipeline() throws Exception {
-        channelPipeline = ospfPipelineFactory.getPipeline();
-        assertThat(channelPipeline, is(notNullValue()));
-    }
-
-    /**
-     * Tests releaseExternalResources() method.
-     */
-    @Test
-    public void testReleaseExternalResources() throws Exception {
-        ospfPipelineFactory.releaseExternalResources();
-        assertThat(channelPipeline, is(nullValue()));
-    }
 }
\ No newline at end of file
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumerTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumerTest.java
index 679e6cc..0145b01 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumerTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsaQueueConsumerTest.java
@@ -74,8 +74,9 @@
     @Test
     public void testRun() throws Exception {
         blockingQueue = new ArrayBlockingQueue(5);
-        channel = EasyMock.createMock(Channel.class);
         ospfArea = new OspfAreaImpl();
+        lsdbAge = new LsdbAgeImpl(ospfArea);
+        channel = EasyMock.createMock(Channel.class);
         lsaWrapper = new LsaWrapperImpl();
         lsaWrapper.setLsaProcessing("verifyChecksum");
         blockingQueue.add(lsaWrapper);
@@ -104,7 +105,7 @@
         lsaHeader.setLsType(1);
         lsaWrapper.setLsaHeader(lsaHeader);
         lsaWrapper.setLsaProcessing("refreshLsa");
-        lsaWrapper.setLsdbAge(new LsdbAgeImpl(new OspfAreaImpl()));
+        lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
         blockingQueue.add(lsaWrapper);
         lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
         lsaQueueConsumer.run();
@@ -128,7 +129,7 @@
         lsaHeader.setLsType(2);
         lsaWrapper.setLsaHeader(lsaHeader);
         lsaWrapper.setLsaProcessing("refreshLsa");
-        lsaWrapper.setLsdbAge(new LsdbAgeImpl(new OspfAreaImpl()));
+        lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
         blockingQueue.add(lsaWrapper);
         lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
         lsaQueueConsumer.run();
@@ -155,7 +156,7 @@
         lsaHeader.setLsType(2);
         lsaWrapper.setLsaHeader(lsaHeader);
         lsaWrapper.setLsaProcessing("maxAgeLsa");
-        lsaWrapper.setLsdbAge(new LsdbAgeImpl(new OspfAreaImpl()));
+        lsaWrapper.setLsdbAge(new LsdbAgeImpl(ospfArea));
         blockingQueue.add(lsaWrapper);
         lsaQueueConsumer = new LsaQueueConsumer(blockingQueue, channel, ospfArea);
         lsaQueueConsumer.run();
@@ -168,7 +169,7 @@
     @Test
     public void testSetChannel() throws Exception {
         channel = EasyMock.createMock(Channel.class);
-        lsdbAge = new LsdbAgeImpl(new OspfAreaImpl());
+        lsdbAge = new LsdbAgeImpl(ospfArea);
         lsdbAge.startDbAging();
         lsdbAge.setChannel(channel);
         assertThat(lsaQueueConsumer, is(notNullValue()));
diff --git a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImplTest.java b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImplTest.java
index 65a79aa..fdde205 100644
--- a/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImplTest.java
+++ b/protocols/ospf/ctl/src/test/java/org/onosproject/ospf/controller/lsdb/LsdbAgeImplTest.java
@@ -23,6 +23,7 @@
 import org.junit.Test;
 import org.onosproject.ospf.controller.LsaBin;
 import org.onosproject.ospf.controller.OspfArea;
+import org.onosproject.ospf.controller.OspfLsaType;
 import org.onosproject.ospf.controller.area.OspfAreaImpl;
 
 import static org.hamcrest.CoreMatchers.*;
@@ -181,14 +182,10 @@
     public void testRefereshLsa() throws Exception {
         lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class);
         lsaWrapper.setBinNumber(0);
+        lsaWrapper.setLsaType(OspfLsaType.NETWORK);
         lsdbAge.addLsaToMaxAgeBin("lsa1", lsaWrapper);
         lsdbAge.ageLsaAndFlood();
-        lsaWrapper.setBinNumber(0);
-        lsaWrapper = EasyMock.createMock(LsaWrapperImpl.class);
-        lsdbAge.addLsaToMaxAgeBin("lsa2", lsaWrapper);
-        lsdbAge.ageLsaAndFlood();
         lsdbAge.startDbAging();
-        lsaBin = new LsaBinImpl(1809);
         lsdbAge.refreshLsa();
         assertThat(lsdbAge, is(notNullValue()));
     }