ISIS protocol manual merge from 1.6 due to cherry pick merge conflict

Change-Id: I6c3abf6a83ddaeba76293dc7864fcec88e9b4e7e
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/InterfaceIpAddress.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/InterfaceIpAddress.java
index cc6174f..e9b0a95 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/InterfaceIpAddress.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/InterfaceIpAddress.java
@@ -1,18 +1,18 @@
 /*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2016-present Open Networking Laboratory
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 package org.onosproject.isis.io.isispacket.tlv.subtlv;
 
 import com.google.common.base.MoreObjects;
@@ -32,8 +32,8 @@
  */
 public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringSubTlv {
     private static final Logger log =
-            LoggerFactory.getLogger(InterfaceIpAddress.class);
-    private List<Ip4Address> localInterfaceIPAddress = new ArrayList<>();
+            LoggerFactory.getLogger(NeighborIpAddress.class);
+    private Ip4Address localInterfaceIPAddress;
 
     /**
      * Creates an instance of local interface ip address.
@@ -50,16 +50,16 @@
      *
      * @param localAddress ip address
      */
-    public void addLocalInterfaceIPAddress(Ip4Address localAddress) {
-        localInterfaceIPAddress.add(localAddress);
+    public void setIpAddress(Ip4Address localAddress) {
+        this.localInterfaceIPAddress = localAddress;
     }
 
     /**
-     * Returns local interface ip address.
+     * Gets local interface ip address.
      *
      * @return localAddress ip address
      */
-    public List<Ip4Address> getLocalInterfaceIPAddress() {
+    public Ip4Address localInterfaceIPAddress() {
         return localInterfaceIPAddress;
     }
 
@@ -72,17 +72,19 @@
         while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) {
             byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES];
             channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES);
-            this.addLocalInterfaceIPAddress(Ip4Address.valueOf(tempByteArray));
+            this.setIpAddress(Ip4Address.valueOf(tempByteArray));
+
         }
     }
 
     /**
-     * Returns local interface ip address as byte array.
+     * Gets local interface ip address as byte array.
      *
      * @return local interface ip address as byte array
      */
     public byte[] asBytes() {
         byte[] linkSubType = null;
+
         byte[] linkSubTlvHeader = tlvHeaderAsByteArray();
         byte[] linkSubTlvBody = tlvBodyAsBytes();
         linkSubType = Bytes.concat(linkSubTlvHeader, linkSubTlvBody);
@@ -91,15 +93,16 @@
     }
 
     /**
-     * Returns byte array of local interface ip address.
+     * Gets byte array of local interface ip address.
      *
      * @return byte array of local interface ip address
      */
     public byte[] tlvBodyAsBytes() {
+
         List<Byte> linkSubTypeBody = new ArrayList<>();
-        for (Ip4Address remoteAddress : this.localInterfaceIPAddress) {
-            linkSubTypeBody.addAll(Bytes.asList(remoteAddress.toOctets()));
-        }
+
+        linkSubTypeBody.addAll(Bytes.asList(this.localInterfaceIPAddress.toOctets()));
+
 
         return Bytes.toArray(linkSubTypeBody);
     }
@@ -111,4 +114,4 @@
                 .add("localInterfaceIPAddress", localInterfaceIPAddress)
                 .toString();
     }
-}
+}
\ No newline at end of file
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/NeighborIpAddress.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/NeighborIpAddress.java
new file mode 100644
index 0000000..72eb3a9
--- /dev/null
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/NeighborIpAddress.java
@@ -0,0 +1,135 @@
+/*
+* Copyright 2016-present Open Networking Laboratory
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.onosproject.isis.io.isispacket.tlv.subtlv;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.primitives.Bytes;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.onlab.packet.Ip4Address;
+import org.onosproject.isis.io.isispacket.tlv.TlvHeader;
+import org.onosproject.isis.io.util.IsisUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Representation of neighbor ip address TE value.
+ */
+public class NeighborIpAddress extends TlvHeader implements TrafficEngineeringSubTlv {
+    private static final Logger log =
+            LoggerFactory.getLogger(NeighborIpAddress.class);
+    private Ip4Address neighborIPAddress;
+
+    /**
+     * Creates an instance of neighbor ip address.
+     *
+     * @param header tlv header instance
+     */
+    public NeighborIpAddress(TlvHeader header) {
+        this.setTlvType(header.tlvType());
+        this.setTlvLength(header.tlvLength());
+    }
+
+    /**
+     * Sets the neighbor ip address.
+     *
+     * @param neighborIPAddress ip address
+     */
+    public void setIpAddress(Ip4Address neighborIPAddress) {
+        this.neighborIPAddress = neighborIPAddress;
+    }
+
+    /**
+     * Gets the neighbor ip address.
+     *
+     * @return neighbor ip address
+     */
+    public Ip4Address neighborIPAddress() {
+        return neighborIPAddress;
+    }
+
+    /**
+     * Reads bytes from channel buffer.
+     *
+     * @param channelBuffer channel buffer instance
+     */
+    public void readFrom(ChannelBuffer channelBuffer) {
+        while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) {
+            byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES];
+            channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES);
+            this.setIpAddress(Ip4Address.valueOf(tempByteArray));
+
+        }
+    }
+
+    /**
+     * Gets the neighbor ip address as byte array.
+     *
+     * @return neighbor ip address as byte array
+     */
+    public byte[] asBytes() {
+        byte[] linkSubType = null;
+
+        byte[] linkSubTlvHeader = tlvHeaderAsByteArray();
+        byte[] linkSubTlvBody = tlvBodyAsBytes();
+        linkSubType = Bytes.concat(linkSubTlvHeader, linkSubTlvBody);
+
+        return linkSubType;
+    }
+
+    /**
+     * Gets byte array of neighborIPAddress.
+     *
+     * @return byte array of neighborIPAddress
+     */
+    public byte[] tlvBodyAsBytes() {
+
+        List<Byte> linkSubTypeBody = new ArrayList<>();
+
+        linkSubTypeBody.addAll(Bytes.asList(this.neighborIPAddress.toOctets()));
+
+
+        return Bytes.toArray(linkSubTypeBody);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        NeighborIpAddress that = (NeighborIpAddress) o;
+        return Objects.equal(neighborIPAddress, that.neighborIPAddress);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(neighborIPAddress);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .omitNullValues()
+                .add("localInterfaceIPAddress", neighborIPAddress)
+                .toString();
+    }
+}
\ No newline at end of file
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvFinder.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvFinder.java
index 92ea143..bb3dfaf 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvFinder.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvFinder.java
@@ -71,6 +71,11 @@
                 ipInterfaceAddressTlv.readFrom(channelBuffer);
                 subTlv = ipInterfaceAddressTlv;
                 break;
+            case NEIGHBORADDRESS:
+                NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader);
+                ipNeighborAddressTlv.readFrom(channelBuffer);
+                subTlv = ipNeighborAddressTlv;
+                break;
             default:
                 //TODO
                 break;
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvToBytes.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvToBytes.java
index 8b41c4b..5c20a00 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvToBytes.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvToBytes.java
@@ -60,8 +60,8 @@
         } else if (subTlv instanceof UnreservedBandwidth) {
             UnreservedBandwidth unreservedBandwidth = (UnreservedBandwidth) subTlv;
             subTlvBytes.addAll(Bytes.asList(unreservedBandwidth.asBytes()));
-        } else if (subTlv instanceof InterfaceIpAddress) {
-            InterfaceIpAddress interfaceIpAddress = (InterfaceIpAddress) subTlv;
+        } else if (subTlv instanceof NeighborIpAddress) {
+            NeighborIpAddress interfaceIpAddress = (NeighborIpAddress) subTlv;
             subTlvBytes.addAll(Bytes.asList(interfaceIpAddress.asBytes()));
         } else {
             log.debug("TlvsToBytes::UNKNOWN TLV TYPE ::TlvsToBytes ");
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvType.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvType.java
index 5caecbf..027a50e 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvType.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvType.java
@@ -44,6 +44,10 @@
      */
     INTERFACEADDRESS(6),
     /**
+     * Represents traffic engineering neighbor address TLV.
+     */
+    NEIGHBORADDRESS(8),
+    /**
      * Represents traffic engineering unreserved bandwidth TLV.
      */
     UNRESERVEDBANDWIDTH(11);
diff --git a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/UnreservedBandwidth.java b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/UnreservedBandwidth.java
index 94db6bb..4b3e7b6 100644
--- a/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/UnreservedBandwidth.java
+++ b/protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/UnreservedBandwidth.java
@@ -54,7 +54,7 @@
      *
      * @return List of un reserved bandwidth
      */
-    public List<Float> getUnReservedBandwidthValue() {
+    public List<Float> unReservedBandwidthValue() {
         return this.unReservedBandwidth;
     }