[Emu] [ONOS-2603] Implement BGP Update Protocol Message and parse all Link State atrributes of Node and Prefix
Change-Id: I51f3cdbf273e7b82d1cccb21c9b2de83aba3a95d
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPMessageWriter.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPMessageWriter.java
new file mode 100644
index 0000000..11f161c
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/BGPMessageWriter.java
@@ -0,0 +1,36 @@
+/*
+ * 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.onosproject.bgpio.exceptions.BGPParseException;
+
+/**
+ * Abstraction of an entity providing BGP Message Writer.
+ */
+public interface BGPMessageWriter<T> {
+
+    /**
+     * Writes the Objects of the BGP Message into Channel Buffer.
+     *
+     * @param cb Channel Buffer
+     * @param message BGP Message
+     * @throws BGPParseException
+     *                     While writing message
+     */
+     void write(ChannelBuffer cb, T message) throws BGPParseException;
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/IGPRouterID.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/IGPRouterID.java
new file mode 100644
index 0000000..377d12b
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/IGPRouterID.java
@@ -0,0 +1,23 @@
+/*

+ * 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;

+

+/**

+ * Provides Abstraction of IGP RouterID TLV.

+ */

+public interface IGPRouterID {

+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/BGPPrefixLSIdentifier.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/BGPPrefixLSIdentifier.java
new file mode 100644
index 0000000..4fef47f
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/BGPPrefixLSIdentifier.java
@@ -0,0 +1,228 @@
+/*
+ * 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.link_state;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.BGPErrorType;
+import org.onosproject.bgpio.types.BGPValueType;
+import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
+import org.onosproject.bgpio.types.OSPFRouteTypeTlv;
+import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId;
+import org.onosproject.bgpio.util.UnSupportedAttribute;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides Implementation of Local node descriptors and prefix descriptors.
+ */
+public class BGPPrefixLSIdentifier {
+
+    protected static final Logger log = LoggerFactory.getLogger(BGPPrefixLSIdentifier.class);
+    public static final int TYPE_AND_LEN = 4;
+    private NodeDescriptors localNodeDescriptors;
+    private LinkedList<BGPValueType> prefixDescriptor;
+
+    /**
+     * Resets parameters.
+     */
+    public BGPPrefixLSIdentifier() {
+        this.localNodeDescriptors = null;
+        this.prefixDescriptor = null;
+    }
+
+    /**
+     * Constructor to initialize parameters.
+     *
+     * @param localNodeDescriptors Local node descriptors
+     * @param prefixDescriptor Prefix Descriptors
+     */
+    public BGPPrefixLSIdentifier(NodeDescriptors localNodeDescriptors, LinkedList<BGPValueType> prefixDescriptor) {
+        this.localNodeDescriptors = localNodeDescriptors;
+        this.prefixDescriptor = prefixDescriptor;
+    }
+
+    /**
+     * Reads the channel buffer and parses Prefix Identifier.
+     *
+     * @param cb ChannelBuffer
+     * @param protocolId protocol ID
+     * @return object of this class
+     * @throws BGPParseException while parsing Prefix Identifier
+     */
+    public static BGPPrefixLSIdentifier parsePrefixIdendifier(ChannelBuffer cb, byte protocolId)
+            throws BGPParseException {
+        //Parse Local Node descriptor
+        NodeDescriptors localNodeDescriptors = new NodeDescriptors();
+        localNodeDescriptors = parseLocalNodeDescriptors(cb, protocolId);
+
+        //Parse Prefix descriptor
+        LinkedList<BGPValueType> prefixDescriptor = new LinkedList<>();
+        prefixDescriptor = parsePrefixDescriptors(cb);
+        return new BGPPrefixLSIdentifier(localNodeDescriptors, prefixDescriptor);
+    }
+
+    /**
+     * Parse local node descriptors.
+     *
+     * @param cb ChannelBuffer
+     * @param protocolId protocol identifier
+     * @return LocalNodeDescriptors
+     * @throws BGPParseException while parsing local node descriptors
+     */
+    public static NodeDescriptors parseLocalNodeDescriptors(ChannelBuffer cb, byte protocolId)
+                                                                 throws BGPParseException {
+        ChannelBuffer tempBuf = cb;
+        short type = cb.readShort();
+        short length = cb.readShort();
+        if (cb.readableBytes() < length) {
+            //length + 4 implies data contains type, length and value
+            throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
+                    tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
+        }
+        NodeDescriptors localNodeDescriptors = new NodeDescriptors();
+        ChannelBuffer tempCb = cb.readBytes(length);
+
+        if (type == NodeDescriptors.LOCAL_NODE_DES_TYPE) {
+            localNodeDescriptors = NodeDescriptors.read(tempCb, length, type, protocolId);
+        } else {
+            throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
+                                           BGPErrorType.MALFORMED_ATTRIBUTE_LIST, null);
+        }
+        return localNodeDescriptors;
+    }
+
+    /**
+     * Parse list of prefix descriptors.
+     *
+     * @param cb ChannelBuffer
+     * @return list of prefix descriptors
+     * @throws BGPParseException while parsing list of prefix descriptors
+     */
+    public static LinkedList<BGPValueType> parsePrefixDescriptors(ChannelBuffer cb) throws BGPParseException {
+        LinkedList<BGPValueType> prefixDescriptor = new LinkedList<>();
+        BGPValueType tlv = null;
+        boolean isIpReachInfo = false;
+        ChannelBuffer tempCb;
+        int count = 0;
+
+        while (cb.readableBytes() > 0) {
+            ChannelBuffer tempBuf = cb;
+            short type = cb.readShort();
+            short length = cb.readShort();
+            if (cb.readableBytes() < length) {
+                //length + 4 implies data contains type, length and value
+                throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
+                        tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
+            }
+            tempCb = cb.readBytes(length);
+            switch (type) {
+            case OSPFRouteTypeTlv.TYPE:
+                tlv = OSPFRouteTypeTlv.read(tempCb);
+                break;
+            case IPReachabilityInformationTlv.TYPE:
+                tlv = IPReachabilityInformationTlv.read(tempCb, length);
+                isIpReachInfo = true;
+                break;
+            case BgpAttrNodeMultiTopologyId.ATTRNODE_MULTITOPOLOGY:
+                tlv = BgpAttrNodeMultiTopologyId.read(tempCb);
+                count = count + 1;
+                if (count > 1) {
+                    //length + 4 implies data contains type, length and value
+                    throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR,
+                           BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR, tempBuf.readBytes(length + TYPE_AND_LEN));
+                }
+                break;
+            default:
+                UnSupportedAttribute.skipBytes(tempCb, length);
+            }
+            prefixDescriptor.add(tlv);
+        }
+
+        if (!isIpReachInfo) {
+            throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
+                    null);
+        }
+        return prefixDescriptor;
+    }
+
+    /**
+     * Returns local node descriptors.
+     *
+     * @return local node descriptors
+     */
+    public NodeDescriptors getLocalNodeDescriptors() {
+        return this.localNodeDescriptors;
+    }
+
+    /**
+     * Returns Prefix descriptors.
+     *
+     * @return Prefix descriptors
+     */
+    public LinkedList<BGPValueType> getPrefixdescriptor() {
+        return this.prefixDescriptor;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(prefixDescriptor.hashCode(), localNodeDescriptors);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof BGPPrefixLSIdentifier) {
+            int countObjSubTlv = 0;
+            int countOtherSubTlv = 0;
+            boolean isCommonSubTlv = true;
+            BGPPrefixLSIdentifier other = (BGPPrefixLSIdentifier) obj;
+
+            Iterator<BGPValueType> objListIterator = other.prefixDescriptor.iterator();
+            countOtherSubTlv = other.prefixDescriptor.size();
+            countObjSubTlv = prefixDescriptor.size();
+            if (countObjSubTlv != countOtherSubTlv) {
+                return false;
+            } else {
+                while (objListIterator.hasNext() && isCommonSubTlv) {
+                    BGPValueType subTlv = objListIterator.next();
+                    isCommonSubTlv = Objects.equals(prefixDescriptor.contains(subTlv),
+                            other.prefixDescriptor.contains(subTlv));
+                }
+                return isCommonSubTlv && Objects.equals(this.localNodeDescriptors, other.localNodeDescriptors);
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("localNodeDescriptors", localNodeDescriptors)
+                .add("prefixDescriptor", prefixDescriptor)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/NodeDescriptors.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/NodeDescriptors.java
new file mode 100644
index 0000000..a03b2ba
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/link_state/NodeDescriptors.java
@@ -0,0 +1,225 @@
+/*
+ * 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.link_state;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.AreaIDTlv;
+import org.onosproject.bgpio.types.AutonomousSystemTlv;
+import org.onosproject.bgpio.types.BGPErrorType;
+import org.onosproject.bgpio.types.BGPLSIdentifierTlv;
+import org.onosproject.bgpio.types.BGPValueType;
+import org.onosproject.bgpio.types.IsIsNonPseudonode;
+import org.onosproject.bgpio.types.IsIsPseudonode;
+import org.onosproject.bgpio.types.OSPFNonPseudonode;
+import org.onosproject.bgpio.types.OSPFPseudonode;
+import org.onosproject.bgpio.util.UnSupportedAttribute;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides Local and Remote NodeDescriptors which contains Node Descriptor Sub-TLVs.
+ */
+public class NodeDescriptors {
+
+    /*
+     *Reference :draft-ietf-idr-ls-distribution-11
+          0                   1                   2                   3
+          0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         |              Type             |             Length            |
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         |                                                               |
+         //              Node Descriptor Sub-TLVs (variable)            //
+         |                                                               |
+         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+                   Figure : Local or Remote Node Descriptors TLV format
+     */
+
+    protected static final Logger log = LoggerFactory.getLogger(NodeDescriptors.class);
+
+    public static final short LOCAL_NODE_DES_TYPE = 256;
+    public static final short REMOTE_NODE_DES_TYPE = 257;
+    public static final short IGP_ROUTERID_TYPE = 515;
+    public static final short IS_IS_LEVEL_1_PROTOCOL_ID = 1;
+    public static final short IS_IS_LEVEL_2_PROTOCOL_ID = 2;
+    public static final short OSPF_V2_PROTOCOL_ID = 3;
+    public static final short OSPF_V3_PROTOCOL_ID = 6;
+    public static final int TYPE_AND_LEN = 4;
+    public static final int ISISNONPSEUDONODE_LEN = 6;
+    public static final int ISISPSEUDONODE_LEN = 7;
+    public static final int OSPFNONPSEUDONODE_LEN = 4;
+    public static final int OSPFPSEUDONODE_LEN = 8;
+    private LinkedList<BGPValueType> subTlvs;
+    private short deslength;
+    private short desType;
+
+    /**
+     * Resets parameters.
+     */
+    public NodeDescriptors() {
+        this.subTlvs = null;
+        this.deslength = 0;
+        this.desType = 0;
+    }
+
+    /**
+     * Constructor to initialize parameters.
+     *
+     * @param subTlvs list of subTlvs
+     * @param deslength Descriptors length
+     * @param desType local node descriptor or remote node descriptor type
+     */
+    public NodeDescriptors(LinkedList<BGPValueType> subTlvs, short deslength, short desType) {
+        this.subTlvs = subTlvs;
+        this.deslength = deslength;
+        this.desType = desType;
+    }
+
+    /**
+     * Returns list of subTlvs.
+     *
+     * @return subTlvs list of subTlvs
+     */
+    public LinkedList<BGPValueType> getSubTlvs() {
+        return subTlvs;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(subTlvs.hashCode());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof NodeDescriptors) {
+            int countObjSubTlv = 0;
+            int countOtherSubTlv = 0;
+            boolean isCommonSubTlv = true;
+            NodeDescriptors other = (NodeDescriptors) obj;
+            Iterator<BGPValueType> objListIterator = other.subTlvs.iterator();
+            countOtherSubTlv = other.subTlvs.size();
+            countObjSubTlv = subTlvs.size();
+            if (countObjSubTlv != countOtherSubTlv) {
+                return false;
+            } else {
+                while (objListIterator.hasNext() && isCommonSubTlv) {
+                    BGPValueType subTlv = objListIterator.next();
+                    isCommonSubTlv = Objects.equals(subTlvs.contains(subTlv), other.subTlvs.contains(subTlv));
+                }
+                return isCommonSubTlv;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Reads node descriptors Sub-TLVs.
+     *
+     * @param cb ChannelBuffer
+     * @param desLength node descriptor length
+     * @param desType local node descriptor or remote node descriptor type
+     * @param protocolId protocol ID
+     * @return object of NodeDescriptors
+     * @throws BGPParseException while parsing node descriptors
+     */
+    public static NodeDescriptors read(ChannelBuffer cb, short desLength, short desType, byte protocolId)
+            throws BGPParseException {
+        LinkedList<BGPValueType> subTlvs;
+        subTlvs = new LinkedList<>();
+        BGPValueType tlv = null;
+
+        while (cb.readableBytes() > 0) {
+            ChannelBuffer tempBuf = cb;
+            short type = cb.readShort();
+            short length = cb.readShort();
+            if (cb.readableBytes() < length) {
+                throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, BGPErrorType.OPTIONAL_ATTRIBUTE_ERROR,
+                        tempBuf.readBytes(cb.readableBytes() + TYPE_AND_LEN));
+            }
+            ChannelBuffer tempCb = cb.readBytes(length);
+            switch (type) {
+            case AutonomousSystemTlv.TYPE:
+                tlv = AutonomousSystemTlv.read(tempCb);
+                break;
+            case BGPLSIdentifierTlv.TYPE:
+                tlv = BGPLSIdentifierTlv.read(tempCb);
+                break;
+            case AreaIDTlv.TYPE:
+                tlv = AreaIDTlv.read(tempCb);
+                break;
+            case IGP_ROUTERID_TYPE:
+                if (protocolId == IS_IS_LEVEL_1_PROTOCOL_ID || protocolId == IS_IS_LEVEL_2_PROTOCOL_ID) {
+                    if (length == ISISNONPSEUDONODE_LEN) {
+                        tlv = IsIsNonPseudonode.read(tempCb);
+                    } else if (length == ISISPSEUDONODE_LEN) {
+                        tlv = IsIsPseudonode.read(tempCb);
+                    }
+                } else if (protocolId == OSPF_V2_PROTOCOL_ID || protocolId == OSPF_V3_PROTOCOL_ID) {
+                    if (length == OSPFNONPSEUDONODE_LEN) {
+                        tlv = OSPFNonPseudonode.read(tempCb);
+                    } else if (length == OSPFPSEUDONODE_LEN) {
+                        tlv = OSPFPseudonode.read(tempCb);
+                    }
+                }
+                break;
+            default:
+                UnSupportedAttribute.skipBytes(tempCb, length);
+            }
+            subTlvs.add(tlv);
+        }
+        return new NodeDescriptors(subTlvs, desLength, desType);
+    }
+
+    /**
+     * Returns node descriptors length.
+     *
+     * @return node descriptors length
+     */
+    public short getLength() {
+        return this.deslength;
+    }
+
+    /**
+     * Returns node descriptors type.
+     *
+     * @return node descriptors type
+     */
+    public short getType() {
+        return this.desType;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("desType", desType)
+                .add("deslength", deslength)
+                .add("subTlvs", subTlvs)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AreaIDTlv.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AreaIDTlv.java
new file mode 100644
index 0000000..52bae46
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AreaIDTlv.java
@@ -0,0 +1,126 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides AreaID Tlv which contains opaque value (32 Bit Area-ID).
+ */
+public class AreaIDTlv implements BGPValueType {
+
+    /* Reference :draft-ietf-idr-ls-distribution-11
+     *  0                   1                   2                   3
+      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |           Type= 514            |             Length=4         |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |                    opaque value (32 Bit Area-ID)              |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+
+    protected static final Logger log = LoggerFactory.getLogger(AreaIDTlv.class);
+
+    public static final short TYPE = 514;
+    public static final short LENGTH = 4;
+
+    private final int areaID;
+
+    /**
+     * Constructor to initialize areaID.
+     *
+     * @param areaID of BGP AreaID Tlv
+     */
+    public AreaIDTlv(int areaID) {
+        this.areaID = areaID;
+    }
+
+    /**
+     * Returns object of this class with specified areaID.
+     *
+     * @param areaID opaque value of area id
+     * @return object of AreaIDTlv
+     */
+    public static AreaIDTlv of(final int areaID) {
+        return new AreaIDTlv(areaID);
+    }
+
+    /**
+     * Returns opaque value of area id.
+     *
+     * @return opaque value of area id
+     */
+    public int getAreaID() {
+        return areaID;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(areaID);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof AreaIDTlv) {
+            AreaIDTlv other = (AreaIDTlv) obj;
+            return Objects.equals(areaID, other.areaID);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeInt(areaID);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of AreaIDTlv.
+     *
+     * @param cb ChannelBuffer
+     * @return object of AreaIDTlv
+     */
+    public static AreaIDTlv read(ChannelBuffer cb) {
+        return AreaIDTlv.of(cb.readInt());
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("Value", areaID)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AutonomousSystemTlv.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AutonomousSystemTlv.java
new file mode 100644
index 0000000..5d8a919
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/AutonomousSystemTlv.java
@@ -0,0 +1,126 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides Autonomous System Tlv which contains opaque value (32 Bit AS Number).
+ */
+public class AutonomousSystemTlv implements BGPValueType {
+
+    /* Reference :draft-ietf-idr-ls-distribution-11
+     *  0                   1                   2                   3
+      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |           Type= 512            |             Length=4         |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |                    opaque value (32 Bit AS Number)            |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+
+    protected static final Logger log = LoggerFactory.getLogger(AutonomousSystemTlv.class);
+
+    public static final short TYPE = 512;
+    public static final short LENGTH = 4;
+
+    private final int asNum;
+
+    /**
+     * Constructor to initialize asNum.
+     *
+     * @param asNum 32 Bit AS Number
+     */
+    public AutonomousSystemTlv(int asNum) {
+        this.asNum = asNum;
+    }
+
+    /**
+     * Returns object of this class with specified asNum.
+     *
+     * @param asNum 32 Bit AS Number
+     * @return object of AutonomousSystemTlv
+     */
+    public static AutonomousSystemTlv of(final int asNum) {
+        return new AutonomousSystemTlv(asNum);
+    }
+
+    /**
+     * Returns opaque value of AS Number.
+     *
+     * @return opaque value of AS Number
+     */
+    public int getAsNum() {
+        return asNum;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(asNum);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof AutonomousSystemTlv) {
+            AutonomousSystemTlv other = (AutonomousSystemTlv) obj;
+            return Objects.equals(asNum, other.asNum);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeInt(asNum);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of AutonomousSystemTlv.
+     *
+     * @param c ChannelBuffer
+     * @return object of AutonomousSystemTlv
+     */
+    public static AutonomousSystemTlv read(ChannelBuffer c) {
+        return AutonomousSystemTlv.of(c.readInt());
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("asNum", asNum)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPErrorType.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPErrorType.java
new file mode 100644
index 0000000..f643ae0
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPErrorType.java
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+/**
+ * BgpErrorType class defines all errorCodes and error Subcodes required for Notification message.
+ */
+public final class BGPErrorType {
+    private BGPErrorType() {
+    }
+
+    //Error Codes
+    public static final byte MESSAGE_HEADER_ERROR = 1;
+    public static final byte OPEN_MESSAGE_ERROR = 2;
+    public static final byte UPDATE_MESSAGE_ERROR = 3;
+    public static final byte HOLD_TIMER_EXPIRED = 4;
+    public static final byte FINITE_STATE_MACHINE_ERROR = 4;
+    public static final byte CEASE = 5;
+
+    //Message Header Error subcodes
+    public static final byte CONNECTION_NOT_SYNCHRONIZED = 1;
+    public static final byte BAD_MESSAGE_LENGTH = 2;
+    public static final byte BAD_MESSAGE_TYPE = 3;
+
+    //OPEN Message Error subcodes
+    public static final byte UNSUPPORTED_VERSION_NUMBER = 1;
+    public static final byte BAD_PEER_AS = 2;
+    public static final byte BAD_BGP_IDENTIFIER = 3;
+    public static final byte UNSUPPORTED_OPTIONAL_PARAMETER = 4;
+    public static final byte UNACCEPTABLE_HOLD_TIME = 5;
+
+    //UPDATE Message Error subcodes
+    public static final byte MALFORMED_ATTRIBUTE_LIST = 1;
+    public static final byte UNRECOGNIZED_WELLKNOWN_ATTRIBUTE = 2;
+    public static final byte MISSING_WELLKNOWN_ATTRIBUTE = 3;
+    public static final byte ATTRIBUTE_FLAGS_ERROR = 4;
+    public static final byte ATTRIBUTE_LENGTH_ERROR = 5;
+    public static final byte INVALID_ORIGIN_ATTRIBUTE = 6;
+    public static final byte INVALID_NEXTHOP_ATTRIBUTE = 8;
+    public static final byte OPTIONAL_ATTRIBUTE_ERROR = 9;
+    public static final byte INVALID_NETWORK_FIELD = 10;
+    public static final byte MALFORMED_ASPATH = 11;
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPLSIdentifierTlv.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPLSIdentifierTlv.java
new file mode 100644
index 0000000..f723d2c
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/BGPLSIdentifierTlv.java
@@ -0,0 +1,127 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides BGPLSIdentifier Tlv which contains opaque value (32 Bit BGPLS-Identifier).
+ */
+public class BGPLSIdentifierTlv implements BGPValueType {
+
+    /* Reference :draft-ietf-idr-ls-distribution-11
+     *  0                   1                   2                   3
+      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |           Type= 513            |             Length=4         |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |                    opaque value (32 Bit BGPLS-Identifier)     |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     */
+
+    protected static final Logger log = LoggerFactory.getLogger(BGPLSIdentifierTlv.class);
+
+    public static final short TYPE = 513;
+    public static final short LENGTH = 4;
+
+    private final int bgpLSIdentifier;
+
+    /**
+     * Constructor to initialize bgpLSIdentifier.
+     *
+     * @param bgpLSIdentifier BgpLS-Identifier
+     */
+    public BGPLSIdentifierTlv(int bgpLSIdentifier) {
+        this.bgpLSIdentifier = bgpLSIdentifier;
+    }
+
+    /**
+     * Returns object of this class with specified rbgpLSIdentifier.
+     *
+     * @param bgpLSIdentifier BgpLS-Identifier
+     * @return BgpLS-Identifier
+     */
+    public static BGPLSIdentifierTlv of(final int bgpLSIdentifier) {
+        return new BGPLSIdentifierTlv(bgpLSIdentifier);
+    }
+
+    /**
+     * Returns opaque value of BgpLS-Identifier.
+     *
+     * @return opaque value of BgpLS-Identifier
+     */
+    public int getBgpLSIdentifier() {
+        return bgpLSIdentifier;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(bgpLSIdentifier);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof BGPLSIdentifierTlv) {
+            BGPLSIdentifierTlv other = (BGPLSIdentifierTlv) obj;
+            return Objects.equals(bgpLSIdentifier, other.bgpLSIdentifier);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeInt(bgpLSIdentifier);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+     /**
+     * Reads the channel buffer and parses BGPLS Identifier TLV.
+     *
+     * @param cb ChannelBuffer
+     * @return object of BGPLSIdentifierTlv
+     */
+    public static BGPLSIdentifierTlv read(ChannelBuffer cb) {
+        return BGPLSIdentifierTlv.of(cb.readInt());
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("Value", bgpLSIdentifier)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IPReachabilityInformationTlv.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IPReachabilityInformationTlv.java
new file mode 100644
index 0000000..85fb748
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IPReachabilityInformationTlv.java
@@ -0,0 +1,156 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.packet.IpPrefix;
+import org.onosproject.bgpio.util.Validation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides IP Reachability InformationTlv Tlv which contains IP Prefix.
+ */
+public class IPReachabilityInformationTlv implements BGPValueType {
+
+    /*
+     * Reference :draft-ietf-idr-ls-distribution-11
+
+      0                   1                   2                   3
+      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |              Type             |             Length            |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     | Prefix Length | IP Prefix (variable)                         //
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+             Figure 14: IP Reachability Information TLV Format
+    */
+
+    protected static final Logger log = LoggerFactory.getLogger(IPReachabilityInformationTlv.class);
+
+    public static final short TYPE = 265;
+    public static final int ONE_BYTE_LEN = 8;
+    private byte prefixLen;
+    private byte[] ipPrefix;
+    public short length;
+
+    /**
+     * Constructor to initialize parameters.
+     *
+     * @param prefixLen length of IP Prefix
+     * @param ipPrefix IP Prefix
+     * @param length length of value field
+     */
+    public IPReachabilityInformationTlv(byte prefixLen, byte[] ipPrefix, short length) {
+        this.ipPrefix = ipPrefix;
+        this.prefixLen = prefixLen;
+        this.length = length;
+    }
+
+    /**
+     * Returns IP Prefix.
+     *
+     * @return IP Prefix
+     */
+    public IpPrefix getPrefixValue() {
+        IpPrefix prefix = Validation.bytesToPrefix(ipPrefix, prefixLen);
+        return prefix;
+    }
+
+    /**
+     * Returns IP Prefix length.
+     *
+     * @return IP Prefix length
+     */
+    public byte getPrefixLen() {
+        return this.prefixLen;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ipPrefix, prefixLen);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof IPReachabilityInformationTlv) {
+            IPReachabilityInformationTlv other = (IPReachabilityInformationTlv) obj;
+            return Objects.equals(prefixLen, other.prefixLen) && Objects.equals(ipPrefix, other.ipPrefix);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        int iLenStartIndex = cb.writerIndex();
+        cb.writeShort(TYPE);
+        cb.writeShort(length);
+        cb.writeByte(prefixLen);
+        cb.writeBytes(ipPrefix);
+        return cb.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of IPReachabilityInformationTlv.
+     *
+     * @param cb ChannelBuffer
+     * @param length of value field
+     * @return object of IPReachabilityInformationTlv
+     */
+    public static IPReachabilityInformationTlv read(ChannelBuffer cb, short length) {
+        byte preficLen = cb.readByte();
+        byte[] prefix;
+        if (preficLen == 0) {
+            prefix = new byte[] {0};
+        } else {
+            int len = preficLen / ONE_BYTE_LEN;
+            int reminder = preficLen % ONE_BYTE_LEN;
+            if (reminder > 0) {
+                len = len + 1;
+            }
+            prefix = new byte[len];
+            cb.readBytes(prefix, 0, len);
+        }
+        return IPReachabilityInformationTlv.of(preficLen, prefix, length);
+    }
+
+    public static IPReachabilityInformationTlv of(final byte preficLen, final byte[] prefix, final short  length) {
+        return new IPReachabilityInformationTlv(preficLen, prefix, length);
+    }
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", length)
+                .add("Prefixlength", getPrefixLen())
+                .add("Prefixvalue", getPrefixValue())
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsNonPseudonode.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsNonPseudonode.java
new file mode 100644
index 0000000..d5f3e7f
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsNonPseudonode.java
@@ -0,0 +1,117 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.protocol.IGPRouterID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides Implementation of IsIsNonPseudonode Tlv.
+ */
+public class IsIsNonPseudonode implements IGPRouterID, BGPValueType {
+    protected static final Logger log = LoggerFactory.getLogger(IsIsNonPseudonode.class);
+
+    public static final short TYPE = 515;
+    public static final short LENGTH = 6;
+
+    private final byte[] isoNodeID;
+
+    /**
+     * Constructor to initialize isoNodeID.
+     *
+     * @param isoNodeID ISO system-ID
+     */
+    public IsIsNonPseudonode(byte[] isoNodeID) {
+        this.isoNodeID = isoNodeID;
+    }
+
+    /**
+     * Returns object of this class with specified isoNodeID.
+     *
+     * @param isoNodeID ISO system-ID
+     * @return object of IsIsNonPseudonode
+     */
+    public static IsIsNonPseudonode of(final byte[] isoNodeID) {
+        return new IsIsNonPseudonode(isoNodeID);
+    }
+
+    /**
+     * Returns ISO NodeID.
+     *
+     * @return ISO NodeID
+     */
+    public byte[] getISONodeID() {
+        return isoNodeID;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(isoNodeID);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof IsIsNonPseudonode) {
+            IsIsNonPseudonode other = (IsIsNonPseudonode) obj;
+            return Objects.equals(isoNodeID, other.isoNodeID);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeBytes(isoNodeID);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of IsIsNonPseudonode.
+     *
+     * @param cb ChannelBuffer
+     * @return object of IsIsNonPseudonode
+     */
+    public static IsIsNonPseudonode read(ChannelBuffer cb) {
+        byte[] isoNodeID = new byte[LENGTH];
+        cb.readBytes(isoNodeID, 0, LENGTH);
+        return IsIsNonPseudonode.of(isoNodeID);
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("ISONodeID", isoNodeID)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsPseudonode.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsPseudonode.java
new file mode 100644
index 0000000..5c742d0
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/IsIsPseudonode.java
@@ -0,0 +1,133 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.protocol.IGPRouterID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of IsIsPseudonode Tlv.
+ */
+public class IsIsPseudonode implements IGPRouterID, BGPValueType {
+    protected static final Logger log = LoggerFactory.getLogger(IsIsPseudonode.class);
+
+    public static final short TYPE = 515;
+    public static final short LENGTH = 7;
+
+    private final byte[] isoNodeID;
+    private byte psnIdentifier;
+
+    /**
+     * Constructor to initialize isoNodeID.
+     *
+     * @param isoNodeID ISO system-ID
+     * @param psnIdentifier PSN identifier
+     */
+    public IsIsPseudonode(byte[] isoNodeID, byte psnIdentifier) {
+        this.isoNodeID = isoNodeID;
+        this.psnIdentifier = psnIdentifier;
+    }
+
+    /**
+     * Returns object of this class with specified values.
+     *
+     * @param isoNodeID ISO system-ID
+     * @param psnIdentifier PSN identifier
+     * @return object of IsIsPseudonode
+     */
+    public static IsIsPseudonode of(final byte[] isoNodeID, final byte psnIdentifier) {
+        return new IsIsPseudonode(isoNodeID, psnIdentifier);
+    }
+
+    /**
+     * Returns ISO NodeID.
+     *
+     * @return ISO NodeID
+     */
+    public byte[] getISONodeID() {
+        return isoNodeID;
+    }
+
+    /**
+     * Returns PSN Identifier.
+     *
+     * @return PSN Identifier
+     */
+    public byte getPSNIdentifier() {
+        return this.psnIdentifier;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(isoNodeID, psnIdentifier);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof IsIsPseudonode) {
+            IsIsPseudonode other = (IsIsPseudonode) obj;
+            return Objects.equals(isoNodeID, other.isoNodeID) && Objects.equals(psnIdentifier, other.psnIdentifier);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeBytes(isoNodeID);
+        c.writeByte(psnIdentifier);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of IsIsPseudonode.
+     *
+     * @param cb ChannelBuffer
+     * @return object of IsIsPseudonode
+     */
+    public static IsIsPseudonode read(ChannelBuffer cb) {
+        byte[] isoNodeID = new byte[LENGTH - 1];
+        cb.readBytes(isoNodeID, 0, LENGTH - 1);
+        byte psnIdentifier = cb.readByte();
+        return IsIsPseudonode.of(isoNodeID, psnIdentifier);
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("isoNodeID", isoNodeID)
+                .add("psnIdentifier", psnIdentifier)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFNonPseudonode.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFNonPseudonode.java
new file mode 100644
index 0000000..6d8282b
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFNonPseudonode.java
@@ -0,0 +1,118 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.protocol.IGPRouterID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of OSPFNonPseudonode Tlv.
+ */
+public class OSPFNonPseudonode implements IGPRouterID, BGPValueType {
+
+    protected static final Logger log = LoggerFactory.getLogger(OSPFNonPseudonode.class);
+
+    public static final short TYPE = 515;
+    public static final short LENGTH = 4;
+
+    private final int routerID;
+
+    /**
+     * Constructor to initialize routerID.
+     *
+     * @param routerID routerID
+     */
+    public OSPFNonPseudonode(int routerID) {
+        this.routerID = routerID;
+    }
+
+    /**
+     * Returns object of this class with specified routerID.
+     *
+     * @param routerID routerID
+     * @return object of OSPFNonPseudonode
+     */
+    public static OSPFNonPseudonode of(final int routerID) {
+        return new OSPFNonPseudonode(routerID);
+    }
+
+    /**
+     * Returns RouterID.
+     *
+     * @return RouterID
+     */
+    public int getrouterID() {
+        return this.routerID;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(routerID);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof OSPFNonPseudonode) {
+            OSPFNonPseudonode other = (OSPFNonPseudonode) obj;
+            return Objects.equals(routerID, other.routerID);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeInt(routerID);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of OSPFNonPseudonode.
+     *
+     * @param cb ChannelBuffer
+     * @return object of OSPFNonPseudonode
+     */
+    public static OSPFNonPseudonode read(ChannelBuffer cb) {
+        return OSPFNonPseudonode.of(cb.readInt());
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("RouterID", routerID)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFPseudonode.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFPseudonode.java
new file mode 100644
index 0000000..82a39bd
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFPseudonode.java
@@ -0,0 +1,125 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.bgpio.protocol.IGPRouterID;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides implementation of OSPFPseudonode Tlv.
+ */
+public class OSPFPseudonode implements IGPRouterID, BGPValueType {
+
+    protected static final Logger log = LoggerFactory.getLogger(OSPFPseudonode.class);
+
+    public static final short TYPE = 515;
+    public static final short LENGTH = 8;
+
+    private final int routerID;
+    private final Ip4Address drInterface;
+
+    /**
+     * Constructor to initialize parameters.
+     *
+     * @param routerID routerID
+     * @param drInterface IPv4 address of the DR's interface
+     */
+    public OSPFPseudonode(int routerID, Ip4Address drInterface) {
+        this.routerID = routerID;
+        this.drInterface = drInterface;
+    }
+
+    /**
+     * Returns object of this class with specified values.
+     *
+     * @param routerID routerID
+     * @param drInterface IPv4 address of the DR's interface
+     * @return object of OSPFPseudonode
+     */
+    public static OSPFPseudonode of(final int routerID, final Ip4Address drInterface) {
+        return new OSPFPseudonode(routerID, drInterface);
+    }
+
+    /**
+     * Returns RouterID.
+     *
+     * @return RouterID
+     */
+    public int getrouterID() {
+        return this.routerID;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(routerID, drInterface);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof OSPFPseudonode) {
+            OSPFPseudonode other = (OSPFPseudonode) obj;
+            return Objects.equals(routerID, other.routerID) && Objects.equals(drInterface, other.drInterface);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeInt(routerID);
+        c.writeInt(drInterface.toInt());
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads the channel buffer and returns object of OSPFPseudonode.
+     *
+     * @param cb ChannelBuffer
+     * @return object of OSPFPseudonode
+     */
+    public static OSPFPseudonode read(ChannelBuffer cb) {
+        int routerID = cb.readInt();
+        Ip4Address drInterface = Ip4Address.valueOf(cb.readInt());
+        return OSPFPseudonode.of(routerID, drInterface);
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("RouterID", routerID)
+                .add("DRInterface", drInterface)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFRouteTypeTlv.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFRouteTypeTlv.java
new file mode 100644
index 0000000..20fffbf
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/OSPFRouteTypeTlv.java
@@ -0,0 +1,163 @@
+/*
+ * 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.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Provides OSPF Route Type Tlv which contains route type.
+ */
+public class OSPFRouteTypeTlv implements BGPValueType {
+
+    /* Reference :draft-ietf-idr-ls-distribution-11
+      0                   1                   2                   3
+      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |              Type             |             Length            |
+     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+     |  Route Type   |
+     +-+-+-+-+-+-+-+-+
+
+                   Figure : OSPF Route Type TLV Format
+    */
+
+    protected static final Logger log = LoggerFactory.getLogger(OSPFRouteTypeTlv.class);
+
+    public static final short TYPE = 264;
+    public static final short LENGTH = 1;
+    public static final int INTRA_AREA_TYPE = 1;
+    public static final short INTER_AREA_TYPE = 2;
+    public static final short EXTERNAL_TYPE_1 = 3;
+    public static final short EXTERNAL_TYPE_2 = 4;
+    public static final short NSSA_TYPE_1 = 5;
+    public static final short NSSA_TYPE_2 = 6;
+    private final byte routeType;
+
+    /**
+     * Enum for Route Type.
+     */
+    public enum ROUTETYPE {
+        Intra_Area(1), Inter_Area(2), External_1(3), External_2(4), NSSA_1(5), NSSA_2(6);
+        int value;
+        ROUTETYPE(int val) {
+            value = val;
+        }
+        public byte getType() {
+            return (byte) value;
+        }
+    }
+
+    /**
+     * Constructor to initialize routeType.
+     *
+     * @param routeType Route type
+     */
+    public OSPFRouteTypeTlv(byte routeType) {
+        this.routeType = routeType;
+    }
+
+    /**
+     * Returns object of this class with specified routeType.
+     *
+     * @param routeType Route type
+     * @return object of OSPFRouteTypeTlv
+     */
+    public static OSPFRouteTypeTlv of(final byte routeType) {
+        return new OSPFRouteTypeTlv(routeType);
+    }
+
+    /**
+     * Returns RouteType.
+     *
+     * @return RouteType
+     * @throws BGPParseException if routeType is not matched
+     */
+    public ROUTETYPE getValue() throws BGPParseException {
+        switch (routeType) {
+        case INTRA_AREA_TYPE:
+            return ROUTETYPE.Intra_Area;
+        case INTER_AREA_TYPE:
+            return ROUTETYPE.Inter_Area;
+        case EXTERNAL_TYPE_1:
+            return ROUTETYPE.External_1;
+        case EXTERNAL_TYPE_2:
+            return ROUTETYPE.External_2;
+        case NSSA_TYPE_1:
+            return ROUTETYPE.NSSA_1;
+        case NSSA_TYPE_2:
+            return ROUTETYPE.NSSA_2;
+        default:
+            throw new BGPParseException(BGPErrorType.UPDATE_MESSAGE_ERROR, (byte) 0, null);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(routeType);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof OSPFRouteTypeTlv) {
+            OSPFRouteTypeTlv other = (OSPFRouteTypeTlv) obj;
+            return Objects.equals(routeType, other.routeType);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer c) {
+        int iLenStartIndex = c.writerIndex();
+        c.writeShort(TYPE);
+        c.writeShort(LENGTH);
+        c.writeByte(routeType);
+        return c.writerIndex() - iLenStartIndex;
+    }
+
+    /**
+     * Reads from ChannelBuffer and parses OSPFRouteTypeTlv.
+     *
+     * @param cb channelBuffer
+     * @return object of OSPFRouteTypeTlv
+     */
+    public static OSPFRouteTypeTlv read(ChannelBuffer cb) {
+        return OSPFRouteTypeTlv.of(cb.readByte());
+    }
+
+    @Override
+    public short getType() {
+        return TYPE;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("Type", TYPE)
+                .add("Length", LENGTH)
+                .add("Value", routeType)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java
new file mode 100644
index 0000000..194d6da
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/types/attr/BgpAttrNodeMultiTopologyId.java
@@ -0,0 +1,127 @@
+/*
+ * 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 java.util.Objects;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+import org.onosproject.bgpio.types.BGPErrorType;
+import org.onosproject.bgpio.types.BGPValueType;
+import org.onosproject.bgpio.util.Validation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * BGP Multi-Topology ID of the LS attribute.
+ */
+public class BgpAttrNodeMultiTopologyId implements BGPValueType {
+
+    private static final Logger log = LoggerFactory
+            .getLogger(BgpAttrNodeMultiTopologyId.class);
+
+    public static final int ATTRNODE_MULTITOPOLOGY = 263;
+
+    /* Opaque Node Attribute */
+    private short[] multiTopologyId;
+
+    /**
+     * Constructor to initialize the Node attribute multi-topology ID.
+     *
+     * @param multiTopologyId multi-topology ID
+     */
+    BgpAttrNodeMultiTopologyId(short[] multiTopologyId) {
+        this.multiTopologyId = multiTopologyId;
+    }
+
+    /**
+     * Reads the Multi-topology ID of Node attribute.
+     *
+     * @param cb ChannelBuffer
+     * @return Constructor of BgpAttrNodeMultiTopologyId
+     * @throws BGPParseException while parsing BgpAttrNodeMultiTopologyId
+     */
+    public static BgpAttrNodeMultiTopologyId read(ChannelBuffer cb)
+            throws BGPParseException {
+
+        log.debug("BgpAttrNodeMultiTopologyId");
+        short lsAttrLength = cb.readShort();
+        int len = lsAttrLength / 2; // Length is 2*n and n is the number of MT-IDs
+
+        if (cb.readableBytes() < lsAttrLength) {
+            Validation.validateLen(BGPErrorType.UPDATE_MESSAGE_ERROR,
+                                   BGPErrorType.ATTRIBUTE_LENGTH_ERROR,
+                                   cb.readableBytes());
+        }
+
+        short[] multiTopologyId;
+        multiTopologyId = new short[len];
+        for (int i = 0; i < len; i++) {
+            multiTopologyId[i] = cb.readShort();
+        }
+
+        return new BgpAttrNodeMultiTopologyId(multiTopologyId);
+    }
+
+    /**
+     * to get the multi-topology ID.
+     *
+     * @return multitopology ID
+     */
+    short[] getAttrMultiTopologyId() {
+        return multiTopologyId;
+    }
+
+    @Override
+    public short getType() {
+        return ATTRNODE_MULTITOPOLOGY;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(multiTopologyId);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (obj instanceof BgpAttrNodeMultiTopologyId) {
+            BgpAttrNodeMultiTopologyId other = (BgpAttrNodeMultiTopologyId) obj;
+            return Objects.equals(multiTopologyId, other.multiTopologyId);
+        }
+        return false;
+    }
+
+    @Override
+    public int write(ChannelBuffer cb) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("multiTopologyId", multiTopologyId)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/UnSupportedAttribute.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/UnSupportedAttribute.java
new file mode 100644
index 0000000..663b1e9
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/UnSupportedAttribute.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.util;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provides methods to handle UnSupportedAttribute.
+ */
+public final class UnSupportedAttribute {
+    protected static final Logger log = LoggerFactory.getLogger(UnSupportedAttribute.class);
+
+    private UnSupportedAttribute() {
+    }
+
+    /**
+     * Reads channel buffer parses attribute header and skips specified length.
+     *
+     * @param cb channelBuffer
+     */
+    public static void read(ChannelBuffer cb) {
+        Validation parseFlags = Validation.parseAttributeHeader(cb);
+        cb.skipBytes(parseFlags.getLength());
+    }
+
+    /**
+     * Skip specified bytes in channel buffer.
+     *
+     * @param cb channelBuffer
+     * @param length to be skipped
+     */
+    public static void skipBytes(ChannelBuffer cb, short length) {
+        cb.skipBytes(length);
+    }
+}
\ No newline at end of file
diff --git a/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/Validation.java b/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/Validation.java
new file mode 100644
index 0000000..915aa58
--- /dev/null
+++ b/bgp/bgpio/src/main/java/org/onosproject/bgpio/util/Validation.java
@@ -0,0 +1,189 @@
+/*
+ * 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.util;
+
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onosproject.bgpio.exceptions.BGPParseException;
+
+import com.google.common.primitives.Ints;
+
+/**
+ * Provides methods to parse attribute header, validate length and type.
+ */
+public class Validation {
+    public static final byte FIRST_BIT = (byte) 0x80;
+    public static final byte SECOND_BIT = 0x40;
+    public static final byte THIRD_BIT = 0x20;
+    public static final byte FOURTH_BIT = 0x01;
+    public static final byte IPV4_SIZE = 4;
+    private boolean firstBit;
+    private boolean secondBit;
+    private boolean thirdBit;
+    private boolean fourthBit;
+    private int len;
+    private boolean isShort;
+
+    Validation(boolean firstBit, boolean secondBit, boolean thirdBit, boolean fourthBit, int len, boolean isShort) {
+        this.firstBit = firstBit;
+        this.secondBit = secondBit;
+        this.thirdBit = thirdBit;
+        this.fourthBit = fourthBit;
+        this.len = len;
+        this.isShort = isShort;
+    }
+
+    /**
+     * Parses attribute Header.
+     *
+     * @param cb ChannelBuffer
+     * @return object of Validation
+     */
+    public static Validation parseAttributeHeader(ChannelBuffer cb) {
+
+        boolean firstBit;
+        boolean secondBit;
+        boolean thirdBit;
+        boolean fourthBit;
+        boolean isShort;
+        byte flags = cb.readByte();
+        byte typeCode = cb.readByte();
+        byte temp = flags;
+        //first Bit : Optional (1) or well-known (0)
+        firstBit = ((temp & FIRST_BIT) == FIRST_BIT);
+        //second Bit : Transitive (1) or non-Transitive (0)
+        secondBit = ((temp & SECOND_BIT) == SECOND_BIT);
+        //third Bit : partial (1) or complete (0)
+        thirdBit = ((temp & THIRD_BIT) == THIRD_BIT);
+        //forth Bit(Extended Length bit) : Attribute Length is 1 octects (0) or 2 octects (1)
+        fourthBit = ((temp & FOURTH_BIT) == FOURTH_BIT);
+        int len;
+        if (fourthBit) {
+            isShort = true;
+            short length = cb.readShort();
+            len = length;
+        } else {
+            isShort = false;
+            byte length = cb.readByte();
+            len = length;
+        }
+        return new Validation(firstBit, secondBit, thirdBit, fourthBit, len, isShort);
+    }
+
+    /**
+     * Throws exception if length is not correct.
+     *
+     * @param errorCode Error code
+     * @param subErrCode Sub Error Code
+     * @param length erroneous length
+     * @throws BGPParseException for erroneous length
+     */
+    public static void validateLen(byte errorCode, byte subErrCode, int length) throws BGPParseException {
+        byte[] errLen = Ints.toByteArray(length);
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(errLen);
+        throw new BGPParseException(errorCode, subErrCode, buffer);
+    }
+
+    /**
+     * Throws exception if type is not correct.
+     *
+     * @param errorCode Error code
+     * @param subErrCode Sub Error Code
+     * @param type erroneous type
+     * @throws BGPParseException for erroneous type
+     */
+    public static void validateType(byte errorCode, byte subErrCode, int type) throws BGPParseException {
+        byte[] errType = Ints.toByteArray(type);
+        ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+        buffer.writeBytes(errType);
+        throw new BGPParseException(errorCode, subErrCode, buffer);
+    }
+
+    /**
+     * Returns first bit in type flags.
+     *
+     * @return first bit in type flags
+     */
+    public boolean getFirstBit() {
+        return this.firstBit;
+    }
+
+    /**
+     * Returns second bit in type flags.
+     *
+     * @return second bit in type flags
+     */
+    public boolean getSecondBit() {
+        return this.secondBit;
+    }
+
+    /**
+     * Returns third bit in type flags.
+     *
+     * @return third bit in type flags
+     */
+    public boolean getThirdBit() {
+        return this.thirdBit;
+    }
+
+    /**
+     * Returns fourth bit in type flags.
+     *
+     * @return fourth bit in type flags
+     */
+    public boolean getFourthBit() {
+        return this.fourthBit;
+    }
+
+    /**
+     * Returns attribute length.
+     *
+     * @return attribute length
+     */
+    public int getLength() {
+        return this.len;
+    }
+
+    /**
+     * Returns whether attribute length read in short or byte.
+     *
+     * @return whether attribute length read in short or byte
+     */
+    public boolean isShort() {
+        return this.isShort;
+    }
+
+    /**
+     * Converts byte array of prefix value to IpPrefix object.
+     *
+     * @param value byte array of prefix value
+     * @param length prefix length in bits
+     * @return object of IpPrefix
+     */
+    public static IpPrefix bytesToPrefix(byte[] value, int length) {
+        if (value.length != IPV4_SIZE) {
+            value = Arrays.copyOf(value, IPV4_SIZE);
+        }
+        IpPrefix ipPrefix = IpPrefix.valueOf(IpAddress.Version.INET, value, length);
+        return ipPrefix;
+    }
+}
\ No newline at end of file