Move unit tests to a directory structure that follows the classes under test

Change-Id: Ibfa840e4aab4100125b4ead0f864f5ad1bea18b6
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java
new file mode 100755
index 0000000..68ce307
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2014-2015 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.bgpio.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.Test;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.BGPHeader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test case for BGP KEEPALIVE Message.
+ */
+public class BGPKeepaliveMsgTest {
+
+    /**
+     * This test case checks BGP Keepalive message.
+     */
+    @Test
+    public void keepaliveMessageTest1() throws BGPParseException {
+
+        // BGP KEEPALIVE Message
+        byte[] keepaliveMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                          (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                          (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                          (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                          0x00, 0x13, 0x04};
+
+        byte[] testKeepaliveMsg;
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(keepaliveMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPKeepaliveMsg.class));
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+
+        int readLen = buf.writerIndex();
+        testKeepaliveMsg = new byte[readLen];
+        buf.readBytes(testKeepaliveMsg, 0, readLen);
+
+        assertThat(testKeepaliveMsg, is(keepaliveMsg));
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java
new file mode 100755
index 0000000..d521017
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright 2014-2015 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.bgpio.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.Test;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.BGPHeader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for BGP Open Message.
+ */
+public class BGPOpenMsgTest {
+
+    /**
+     * This test case checks open message without optional parameter.
+     */
+    @Test
+    public void openMessageTest1() throws BGPParseException {
+        //Open message without optional parameter
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     0x00, 0x1d, 0x01, 0X04, (byte) 0xfe, 0x09, 0x00,
+                                     (byte) 0xb4, (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+                                     0x00};
+
+        byte[] testOpenMsg;
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+
+        int readLen = buf.writerIndex();
+        testOpenMsg = new byte[readLen];
+        buf.readBytes(testOpenMsg, 0, readLen);
+
+        assertThat(testOpenMsg, is(openMsg));
+    }
+
+    /**
+     * This test case checks open message with Multiprotocol extension
+     * capability.
+     */
+    @Test
+    public void openMessageTest2() throws BGPParseException {
+
+        // OPEN Message (MultiProtocolExtension-CAPABILITY).
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, 0x00, 0x25,
+                                     0x01, //BGP Header
+                                     0X04, //Version
+                                     (byte) 0x00, (byte) 0xc8, // AS Number
+                                     0x00, (byte) 0xb4, // Hold time
+                                     (byte) 0xb6, (byte) 0x02, 0x5d,
+                                     (byte) 0xc8, // BGP Identifier
+                                     0x08, 0x02, 0x06, // Opt Parameter length
+                                     0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8}; // Multiprotocol CAPABILITY
+
+        byte[] testOpenMsg;
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+
+        int readLen = buf.writerIndex();
+        testOpenMsg = new byte[readLen];
+        buf.readBytes(testOpenMsg, 0, readLen);
+
+        assertThat(testOpenMsg, is(openMsg));
+    }
+
+    /**
+     * This test case checks open message with Four-octet AS number
+     * capability.
+     */
+    @Test
+    public void openMessageTest3() throws BGPParseException {
+
+        // OPEN Message (Four-Octet AS number capability).
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, 0x00, 0x25,
+                                     0x01, //BGPHeader
+                                     0X04, //Version
+                                     (byte) 0x00, (byte) 0xc8, //AS Number
+                                     0x00, (byte) 0xb4, //Hold Time
+                                     (byte) 0xb6, (byte) 0x02, 0x5d,
+                                     (byte) 0xc8, //BGP Identifier
+                                     0x08, 0x02, 0x06, //Opt Parameter Length
+                                     0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
+
+        byte[] testOpenMsg;
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+
+        int readLen = buf.writerIndex();
+        testOpenMsg = new byte[readLen];
+        buf.readBytes(testOpenMsg, 0, readLen);
+
+        assertThat(testOpenMsg, is(openMsg));
+    }
+
+    /**
+     * This test case checks open message with capabilities.
+     */
+    @Test
+    public void openMessageTest4() throws BGPParseException {
+
+        // OPEN Message with capabilities.
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                     (byte) 0xff, 0x00, 0x2b,
+                                     0x01, //BGPHeader
+                                     0X04, //Version
+                                     (byte) 0x00, (byte) 0xc8, //AS Number
+                                     0x00, (byte) 0xb4, //Hold Time
+                                     (byte) 0xb6, (byte) 0x02, 0x5d, (byte) 0xc8, //BGP Identifier
+                                     0x0e, 0x02, 0x0c, //Opt Parameter Length
+                                     0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8, // Multiprotocol extension capability
+                                     0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
+
+        byte[] testOpenMsg;
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+
+        int readLen = buf.writerIndex();
+        testOpenMsg = new byte[readLen];
+        buf.readBytes(testOpenMsg, 0, readLen);
+
+        assertThat(testOpenMsg, is(openMsg));
+    }
+
+    /**
+     * In this test case, Invalid version is given as input and expecting
+     * an exception.
+     */
+    @Test(expected = BGPParseException.class)
+    public void openMessageTest5() throws BGPParseException {
+
+        // OPEN Message with invalid version number.
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, 0x00, 0x1d, 0x01, 0X05,
+                (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+                (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+                0x00};
+
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+    }
+
+    /**
+     * In this test case, Marker is set as 0 in input and expecting
+     * an exception.
+     */
+    @Test(expected = BGPParseException.class)
+    public void openMessageTest6() throws BGPParseException {
+
+        // OPEN Message with marker set to 0.
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0x00, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                 0x00, 0x00, 0x1d, 0x01, 0X04,
+                (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+                (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+                0x00};
+
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+    }
+
+    /**
+     * In this test case, Invalid message length is given as input and expecting
+     * an exception.
+     */
+    @Test(expected = BGPParseException.class)
+    public void openMessageTest7() throws BGPParseException {
+
+        // OPEN Message with invalid header length.
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, 0x00, 0x1e, 0x01, 0X04,
+                (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+                (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+                0x00};
+
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+    }
+
+    /**
+     * In this test case, Invalid message type is given as input and expecting
+     * an exception.
+     */
+    @Test(expected = BGPParseException.class)
+    public void openMessageTest8() throws BGPParseException {
+
+        // OPEN Message with invalid message type.
+        byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                (byte) 0xff, 0x00, 0x1d, 0x05, 0X04,
+                (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+                (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+                0x00};
+
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(openMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message;
+        BGPHeader bgpHeader = new BGPHeader();
+        message = reader.readFrom(buffer, bgpHeader);
+
+        assertThat(message, instanceOf(BGPOpenMsg.class));
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java
new file mode 100644
index 0000000..78edf13
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2015 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.bgpio.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.junit.Test;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.BGPHeader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test for Notification message.
+ */
+public class BgpNotificationMsgTest {
+
+    /**
+     * Notification message with error code, error subcode and data.
+     *
+     * @throws BGPParseException while decoding and encoding notification message
+     */
+    @Test
+    public void bgpNotificationMessageTest1() throws BGPParseException {
+        byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff, 0x00,
+                                             0x17, 0x03, 0x02, 0x02,
+                                             (byte) 0xfe, (byte) 0xb0};
+
+        byte[] testNotificationMsg = {0};
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(notificationMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message = null;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+        assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+        testNotificationMsg = buf.array();
+
+        int iReadLen = buf.writerIndex() - 0;
+        testNotificationMsg = new byte[iReadLen];
+        buf.readBytes(testNotificationMsg, 0, iReadLen);
+        assertThat(testNotificationMsg, is(notificationMsg));
+    }
+
+    /**
+     * Notification message without data.
+     *
+     * @throws BGPParseException  while decoding and encoding notification message
+     */
+    @Test
+    public void bgpNotificationMessageTest2() throws BGPParseException {
+        byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff, 0x00,
+                                             0x15, 0x03, 0x02, 0x00};
+
+        byte[] testNotificationMsg = {0};
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(notificationMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message = null;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+        assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+        testNotificationMsg = buf.array();
+
+        int iReadLen = buf.writerIndex() - 0;
+        testNotificationMsg = new byte[iReadLen];
+        buf.readBytes(testNotificationMsg, 0, iReadLen);
+        assertThat(testNotificationMsg, is(notificationMsg));
+    }
+
+    //Negative scenarios
+    /**
+     * Notification message with wrong maker value.
+     *
+     * @throws BGPParseException while decoding and encoding notification message
+     */
+    @Test(expected = BGPParseException.class)
+    public void bgpNotificationMessageTest3() throws BGPParseException {
+        byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                              0x01, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff, 0x00,
+                                             0x15, 0x03, 0x02, 0x00};
+
+        byte[] testNotificationMsg = {0};
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(notificationMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message = null;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+        assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+        testNotificationMsg = buf.array();
+
+        int iReadLen = buf.writerIndex() - 0;
+        testNotificationMsg = new byte[iReadLen];
+        buf.readBytes(testNotificationMsg, 0, iReadLen);
+        assertThat(testNotificationMsg, is(notificationMsg));
+    }
+
+    /**
+     * Notification message without error subcode.
+     *
+     * @throws BGPParseException while decoding and encoding notification message
+     */
+    @Test(expected = BGPParseException.class)
+    public void bgpNotificationMessageTest4() throws BGPParseException {
+        byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff, 0x00,
+                                             0x14, 0x03, 0x02};
+
+        byte[] testNotificationMsg = {0};
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(notificationMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message = null;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+        assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+        testNotificationMsg = buf.array();
+
+        int iReadLen = buf.writerIndex() - 0;
+        testNotificationMsg = new byte[iReadLen];
+        buf.readBytes(testNotificationMsg, 0, iReadLen);
+        assertThat(testNotificationMsg, is(notificationMsg));
+    }
+
+    /**
+     * Notification message with wrong message length.
+     *
+     * @throws BGPParseException while decoding and encoding notification message
+     */
+    @Test(expected = BGPParseException.class)
+    public void bgpNotificationMessageTest5() throws BGPParseException {
+        byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff,
+                                             (byte) 0xff, (byte) 0xff, 0x00,
+                                             0x14, 0x03, 0x02, 0x02};
+
+        byte[] testNotificationMsg = {0};
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(notificationMsg);
+
+        BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+        BGPMessage message = null;
+        BGPHeader bgpHeader = new BGPHeader();
+
+        message = reader.readFrom(buffer, bgpHeader);
+        assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+        message.writeTo(buf);
+        testNotificationMsg = buf.array();
+
+        int iReadLen = buf.writerIndex() - 0;
+        testNotificationMsg = new byte[iReadLen];
+        buf.readBytes(testNotificationMsg, 0, iReadLen);
+        assertThat(testNotificationMsg, is(notificationMsg));
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java
new file mode 100644
index 0000000..6a9e2ec
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for AreaID Tlv.
+ */
+public class AreaIdTest {
+    private final int value1 = 10;
+    private final int value2 = 20;
+    private final AreaIDTlv tlv1 = AreaIDTlv.of(value1);
+    private final AreaIDTlv sameAsTlv1 = AreaIDTlv.of(value1);
+    private final AreaIDTlv tlv2 = AreaIDTlv.of(value2);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+
+    /**
+     * Test for OSPFNonPseudonode Tlv.
+     */
+    public static class OspfNonPseudonodeTest {
+        private final int value1 = 0x12121212;
+        private final int value2 = 0x12121211;
+        private final OSPFNonPseudonode tlv1 = OSPFNonPseudonode.of(value1);
+        private final OSPFNonPseudonode sameAsTlv1 = OSPFNonPseudonode.of(value1);
+        private final OSPFNonPseudonode tlv2 = OSPFNonPseudonode.of(value2);
+
+        @Test
+        public void basics() {
+            new EqualsTester()
+            .addEqualityGroup(tlv1, sameAsTlv1)
+            .addEqualityGroup(tlv2)
+            .testEquals();
+        }
+    }
+
+    /**
+     * Test for IsIsNonPseudonode Tlv.
+     */
+    public static class IsIsNonPseudonodeTest {
+        private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
+        private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59};
+        private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1);
+        private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1);
+        private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2);
+
+        @Test
+        public void basics() {
+            new EqualsTester()
+            .addEqualityGroup(tlv1, sameAsTlv1)
+            .addEqualityGroup(tlv2)
+            .testEquals();
+        }
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
new file mode 100755
index 0000000..3ea56b6
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for As4Path BGP Path Attribute.
+ */
+public class As4PathTest {
+    //Two scenarios as4path set and sequence
+    private final List<Integer> as4pathSet1 = new ArrayList<>();
+    private final List<Integer> as4pathSeq1 = new ArrayList<>();
+    private final List<Integer> as4pathSet2 = new ArrayList<>();
+    private final List<Integer> as4pathSeq2 = new ArrayList<>();
+    private final As4Path attr1 = new As4Path(as4pathSet1, null);
+    private final As4Path sameAsAttr1 = new As4Path(as4pathSet1, null);
+    private final As4Path attr2 = new As4Path(as4pathSet2, null);
+    private final As4Path attr3 = new As4Path(null, as4pathSeq1);
+    private final As4Path sameAsAttr3 = new As4Path(null, as4pathSeq1);
+    private final As4Path attr4 = new As4Path(null, as4pathSeq2);
+
+    @Test
+    public void basics() {
+        as4pathSet1.add(197358);
+        as4pathSet1.add(12883);
+        as4pathSet2.add(2008989);
+        as4pathSeq1.add(3009009);
+        as4pathSeq2.add(409900);
+        new EqualsTester()
+        .addEqualityGroup(attr1, sameAsAttr1)
+        .addEqualityGroup(attr2)
+        .addEqualityGroup(attr3, sameAsAttr3)
+        .addEqualityGroup(attr4)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
new file mode 100644
index 0000000..e56ec5a
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for AsPath BGP Path Attribute.
+ */
+public class AsPathTest {
+    //Two scenarios aspath set and sequence
+    private final List<Short> aspathSet1 = new ArrayList<>();
+    private final List<Short> aspathSet2 = new ArrayList<>();
+    private final List<Short> aspathSeq1 = new ArrayList<>();
+    private final List<Short> aspathSeq2 = new ArrayList<>();
+    private final AsPath attr1 = new AsPath(aspathSet1, null);
+    private final AsPath sameAsAttr1 = new AsPath(aspathSet1, null);
+    private final AsPath attr2 = new AsPath(aspathSet2, null);
+    private final AsPath attr3 = new AsPath(null, aspathSeq1);
+    private final AsPath sameAsAttr3 = new AsPath(null, aspathSeq1);
+    private final AsPath attr4 = new AsPath(null, aspathSeq2);
+
+    @Test
+    public void basics() {
+        aspathSet1.add((short) 100);
+        aspathSet1.add((short) 300);
+        aspathSet2.add((short) 200);
+        aspathSeq2.add((short) 400);
+        aspathSeq1.add((short) 300);
+        new EqualsTester()
+        .addEqualityGroup(attr1, sameAsAttr1)
+        .addEqualityGroup(attr2)
+        .addEqualityGroup(attr3, sameAsAttr3)
+        .addEqualityGroup(attr4)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java
new file mode 100644
index 0000000..1695583
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for AutonomousSystem Tlv.
+ */
+public class AutonomousSystemTest {
+    private final int value1 = 101;
+    private final int value2 = 201;
+    private final AutonomousSystemTlv tlv1 = AutonomousSystemTlv.of(value1);
+    private final AutonomousSystemTlv sameAsTlv1 = AutonomousSystemTlv.of(value1);
+    private final AutonomousSystemTlv tlv2 = AutonomousSystemTlv.of(value2);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java
new file mode 100644
index 0000000..f3355d3
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014-2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGPLSIdentifier Tlv.
+ */
+public class BGPLSIdentifierTest {
+    private final int value1 = 8738;
+    private final int value2 = 13107;
+    private final BGPLSIdentifierTlv tlv1 = BGPLSIdentifierTlv.of(value1);
+    private final BGPLSIdentifierTlv sameAsTlv1 = new BGPLSIdentifierTlv(value1);
+    private final BGPLSIdentifierTlv tlv2 = new BGPLSIdentifierTlv(value2);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
new file mode 100644
index 0000000..7bea518
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014-2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPReachabilityInformation Tlv.
+ */
+public class IPReachabilityInformationTest {
+    private final byte[] value1 = new byte[] {(byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
+    private final byte[] value2 = new byte[] {(byte) 0xc0};
+    private final IPReachabilityInformationTlv tlv1 = IPReachabilityInformationTlv.of((byte) 0x17, value1, (short) 4);
+    private final IPReachabilityInformationTlv sameAsTlv1 = IPReachabilityInformationTlv
+                                                             .of((byte) 0x17, value1, (short) 4);
+    private final IPReachabilityInformationTlv tlv2 = IPReachabilityInformationTlv.of((byte) 0x05, value2, (short) 1);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
new file mode 100755
index 0000000..fdb7118
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014-2015 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.bgpio.types;
+
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPv4Address Tlv.
+ */
+public class IPv4AddressTest {
+    private final Ip4Address value1 = Ip4Address.valueOf("127.0.0.1");
+    private final Ip4Address value2 = Ip4Address.valueOf("127.0.0.1");
+    private final IPv4AddressTlv tlv1 = IPv4AddressTlv.of(value1, (short) 259);
+    private final IPv4AddressTlv sameAsTlv1 = IPv4AddressTlv.of(value1, (short) 259);
+    private final IPv4AddressTlv tlv2 = IPv4AddressTlv.of(value2, (short) 260);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java
new file mode 100644
index 0000000..781935b
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+import org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPv6Address Tlv.
+ */
+public class IPv6AddressTest {
+    private final Ip6Address value1 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
+    private final Ip6Address value2 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
+    private final IPv6AddressTlv tlv1 = IPv6AddressTlv.of(value1, (short) 261);
+    private final IPv6AddressTlv sameAsTlv1 = IPv6AddressTlv.of(value1, (short) 261);
+    private final IPv6AddressTlv tlv2 = IPv6AddressTlv.of(value2, (short) 262);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
new file mode 100644
index 0000000..a2a7c2b
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IsIsPseudonode Tlv.
+ */
+public class IsIsPseudonodeTest {
+    private final byte[] value1 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x02};
+    private final byte[] value2 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x03};
+    private final IsIsPseudonode tlv1 = IsIsPseudonode.of(value1, (byte) 1);
+    private final IsIsPseudonode sameAsTlv1 = IsIsPseudonode.of(value1, (byte) 1);
+    private final IsIsPseudonode tlv2 = IsIsPseudonode.of(value2, (byte) 1);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java
new file mode 100644
index 0000000..f1510b1
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for LinkLocalRemoteIdentifiers Tlv.
+ */
+public class LinkLocalRemoteIdentifiersTest {
+    private final int value1 = 0x12101010;
+    private final int value2 = 0x12101012;
+    private final LinkLocalRemoteIdentifiersTlv tlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
+    private final LinkLocalRemoteIdentifiersTlv sameAsTlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
+    private final LinkLocalRemoteIdentifiersTlv tlv2 = LinkLocalRemoteIdentifiersTlv.of(value2, value1);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
new file mode 100755
index 0000000..799419a
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for NextHop BGP Path Attribute.
+ */
+public class NextHopTest {
+    private final Ip4Address value1 = Ip4Address.valueOf("12.12.12.12");
+    private final Ip4Address value2 = Ip4Address.valueOf("12.12.12.13");
+    private final NextHop attr1 = new NextHop(value1);
+    private final NextHop sameAsAttr1 = new NextHop(value1);
+    private final NextHop attr2 = new NextHop(value2);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(attr1, sameAsAttr1)
+        .addEqualityGroup(attr2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java
new file mode 100644
index 0000000..da7b557
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for Origin BGP Path Attribute.
+ */
+public class OriginTest {
+    private final byte value1 = 0x01;
+    private final byte value2 = 0x02;
+    private final Origin attr1 = new Origin(value1);
+    private final Origin sameAsAttr1 = new Origin(value1);
+    private final Origin attr2 = new Origin(value2);
+
+    @Test
+    public void basics() {
+        new EqualsTester()
+        .addEqualityGroup(attr1, sameAsAttr1)
+        .addEqualityGroup(attr2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
new file mode 100644
index 0000000..a800231
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for OSPFPseudonode Tlv.
+ */
+public class OspfPseudonodeTest {
+    private final int value1 = 0xc3223409;
+    private final int value2 = 0xc3223406;
+    private final Ip4Address drInterface1 = Ip4Address.valueOf(0xaf91e01);
+    private final Ip4Address drInterface2 = Ip4Address.valueOf(0xaf91e02);
+    private final OSPFPseudonode tlv1 = OSPFPseudonode.of(value1, drInterface1);
+    private final OSPFPseudonode sameAsTlv1 = OSPFPseudonode.of(value1, drInterface1);
+    private final OSPFPseudonode tlv2 = OSPFPseudonode.of(value2, drInterface2);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java
new file mode 100644
index 0000000..859bdbe
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for OSPFRouteType Tlv.
+ */
+public class OspfRouteTypeTest {
+    private final byte value1 = 5;
+    private final byte value2 = 4;
+    private final OSPFRouteTypeTlv tlv1 = OSPFRouteTypeTlv.of(value1);
+    private final OSPFRouteTypeTlv sameAsTlv1 = OSPFRouteTypeTlv.of(value1);
+    private final OSPFRouteTypeTlv tlv2 = OSPFRouteTypeTlv.of(value2);
+
+    @Test
+    public void testEquality() {
+        new EqualsTester()
+        .addEqualityGroup(tlv1, sameAsTlv1)
+        .addEqualityGroup(tlv2)
+        .testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
new file mode 100644
index 0000000..4efb7f5
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP attribute node flag.
+ */
+public class BgpAttrNodeFlagBitTlvTest {
+
+    private final boolean bOverloadBit = true;
+    private final boolean bAttachedBit = true;
+    private final boolean bExternalBit = true;
+    private final boolean bABRBit = true;
+
+    private final boolean bOverloadBit1 = false;
+    private final boolean bAttachedBit1 = false;
+    private final boolean bExternalBit1 = false;
+    private final boolean bABRBit1 = false;
+
+    private final BgpAttrNodeFlagBitTlv data = BgpAttrNodeFlagBitTlv
+            .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
+    private final BgpAttrNodeFlagBitTlv sameAsData = BgpAttrNodeFlagBitTlv
+            .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
+    private final BgpAttrNodeFlagBitTlv diffData = BgpAttrNodeFlagBitTlv
+            .of(bOverloadBit1, bAttachedBit1, bExternalBit1, bABRBit1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
new file mode 100644
index 0000000..16ca58e
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+import org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP attribute node router ID.
+ */
+public class BgpAttrRouterIdV6Test {
+
+    private final short sType = 1;
+    private final Ip6Address ip6RouterId = Ip6Address
+            .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
+
+    private final short sType1 = 2;
+    private final Ip6Address ip6RouterId1 = Ip6Address
+            .valueOf("2004:0db8:0a0b:12f0:0000:0000:0000:0004");
+
+    private final BgpAttrRouterIdV6 data = BgpAttrRouterIdV6.of(ip6RouterId,
+                                                                sType);
+    private final BgpAttrRouterIdV6 sameAsData = BgpAttrRouterIdV6
+            .of(ip6RouterId, sType);
+    private final BgpAttrRouterIdV6 diffData = BgpAttrRouterIdV6
+            .of(ip6RouterId1, sType1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
new file mode 100644
index 0000000..ef1cfce
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP link IGP metric attribute.
+ */
+public class BgpLinkAttrIgpMetricTest {
+    private final int val = 0x010203;
+    private final int valLen = 3;
+    private final int val1 = 0x01020304;
+    private final int val1Len = 4;
+
+    private final BgpLinkAttrIgpMetric data = BgpLinkAttrIgpMetric.of(val,
+                                                                      valLen);
+    private final BgpLinkAttrIgpMetric sameAsData = BgpLinkAttrIgpMetric
+            .of(val, valLen);
+    private final BgpLinkAttrIgpMetric diffData = BgpLinkAttrIgpMetric
+            .of(val1, val1Len);
+
+    @Test
+    public void basics() {
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
new file mode 100644
index 0000000..c0d7f98
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for MPLS protocol mask attribute.
+ */
+public class BgpLinkAttrMplsProtocolMaskTest {
+    private final boolean val = true;
+    private final boolean val1 = false;
+
+    private final BgpLinkAttrMplsProtocolMask data = BgpLinkAttrMplsProtocolMask
+            .of(val, val);
+    private final BgpLinkAttrMplsProtocolMask sameAsData = BgpLinkAttrMplsProtocolMask
+            .of(val, val);
+    private final BgpLinkAttrMplsProtocolMask diffData = BgpLinkAttrMplsProtocolMask
+            .of(val, val1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
new file mode 100644
index 0000000..2fb7635
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for MPLS protocol mask attribute.
+ */
+public class BgpLinkAttrProtectionTypeTest {
+    boolean bExtraTraffic = true;
+    boolean bUnprotected = true;
+    boolean bShared = true;
+    boolean bDedOneIstoOne = true;
+    boolean bDedOnePlusOne = true;
+    boolean bEnhanced = true;
+
+    boolean bExtraTraffic1 = false;
+    boolean bUnprotected1 = false;
+    boolean bShared1 = false;
+    boolean bDedOneIstoOne1 = false;
+    boolean bDedOnePlusOne1 = false;
+    boolean bEnhanced1 = false;
+
+    private final BgpLinkAttrProtectionType data = BgpLinkAttrProtectionType
+            .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
+                bDedOnePlusOne, bEnhanced);
+    private final BgpLinkAttrProtectionType sameAsData = BgpLinkAttrProtectionType
+            .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
+                bDedOnePlusOne, bEnhanced);
+    private final BgpLinkAttrProtectionType diffData = BgpLinkAttrProtectionType
+            .of(bExtraTraffic1, bUnprotected1, bShared1, bDedOneIstoOne1,
+                bDedOnePlusOne1, bEnhanced1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
new file mode 100644
index 0000000..535518f
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP prefix IGP Flag attribute.
+ */
+public class BgpPrefixAttrIgpFlagsTest {
+
+    private final boolean bisisUpDownBit = true;
+    private final boolean bOspfNoUnicastBit = true;
+    private final boolean bOspfLclAddrBit = true;
+    private final boolean bOspfNSSABit = true;
+
+    private final boolean bisisUpDownBit1 = false;
+    private final boolean bOspfNoUnicastBit1 = false;
+    private final boolean bOspfLclAddrBit1 = false;
+    private final boolean bOspfNSSABit1 = false;
+
+    private final BgpPrefixAttrIgpFlags data = BgpPrefixAttrIgpFlags
+            .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
+                bOspfNSSABit);
+    private final BgpPrefixAttrIgpFlags sameAsData = BgpPrefixAttrIgpFlags
+            .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
+                bOspfNSSABit);
+    private final BgpPrefixAttrIgpFlags diffData = BgpPrefixAttrIgpFlags
+            .of(bisisUpDownBit1, bOspfNoUnicastBit1, bOspfLclAddrBit1,
+                bOspfNSSABit1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
new file mode 100644
index 0000000..fe6079f
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP prefix metric attribute.
+ */
+public class BgpPrefixAttrMetricTest {
+    private final int val = 1111;
+    private final int val1 = 2222;
+
+    private final BgpPrefixAttrMetric data = BgpPrefixAttrMetric.of(val);
+    private final BgpPrefixAttrMetric sameAsData = BgpPrefixAttrMetric.of(val);
+    private final BgpPrefixAttrMetric diffData = BgpPrefixAttrMetric.of(val1);
+
+    @Test
+    public void basics() {
+
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
new file mode 100644
index 0000000..f6fe39f
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 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.bgpio.types.attr;
+
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP prefix metric attribute.
+ */
+public class BgpPrefixAttrOspfFwdAddrTest {
+
+    private final short lsAttrLength = 4;
+    private final Ip4Address ip4RouterId = Ip4Address.valueOf("192.168.1.1");
+    private final Ip6Address ip6RouterId = Ip6Address
+            .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
+
+    private final short lsAttrLength1 = 16;
+    private final Ip4Address ip4RouterId1 = Ip4Address.valueOf("192.168.1.2");
+    private final Ip6Address ip6RouterId1 = Ip6Address
+            .valueOf("1002:0db8:0a0b:12f0:0000:0000:0000:0002");
+
+    private final BgpPrefixAttrOspfFwdAddr data = BgpPrefixAttrOspfFwdAddr
+            .of(lsAttrLength, ip4RouterId, ip6RouterId);
+    private final BgpPrefixAttrOspfFwdAddr sameAsData = BgpPrefixAttrOspfFwdAddr
+            .of(lsAttrLength, ip4RouterId, ip6RouterId);
+    private final BgpPrefixAttrOspfFwdAddr diffData = BgpPrefixAttrOspfFwdAddr
+            .of(lsAttrLength1, ip4RouterId1, ip6RouterId1);
+
+    @Test
+    public void basics() {
+        new EqualsTester().addEqualityGroup(data, sameAsData)
+        .addEqualityGroup(diffData).testEquals();
+    }
+}