BGP linkstate system test issues fix

Change-Id: I4ad53e98cdf30ebae3f305f5dfdd19fbdf5eceac
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpLinkLSIdentifier.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpLinkLSIdentifier.java
index 3967a22..a4360fd 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpLinkLSIdentifier.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpLinkLSIdentifier.java
@@ -280,14 +280,15 @@
             ListIterator<BgpValueType> listIteratorOther = ((BgpLinkLSIdentifier) o).linkDescriptor.listIterator();
             while (listIterator.hasNext()) {
                 BgpValueType tlv = listIterator.next();
-                BgpValueType tlv1 = listIteratorOther.next();
-                if (linkDescriptor.contains(tlv) && ((BgpLinkLSIdentifier) o).linkDescriptor.contains(tlv1)) {
+                if (linkDescriptor.contains(tlv) && ((BgpLinkLSIdentifier) o).linkDescriptor.contains(tlv)) {
                     int res = linkDescriptor.get(linkDescriptor.indexOf(tlv)).compareTo(
                             ((BgpLinkLSIdentifier) o).linkDescriptor.get(((BgpLinkLSIdentifier) o).linkDescriptor
-                                    .indexOf(tlv1)));
+                                    .indexOf(tlv)));
                     if (res != 0) {
                         return res;
                     }
+                } else {
+                    return 1;
                 }
             }
         }
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpPrefixLSIdentifier.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpPrefixLSIdentifier.java
index d3beaae..22e6891 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpPrefixLSIdentifier.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/BgpPrefixLSIdentifier.java
@@ -255,14 +255,15 @@
             ListIterator<BgpValueType> listIteratorOther = ((BgpPrefixLSIdentifier) o).prefixDescriptor.listIterator();
             while (listIterator.hasNext()) {
                 BgpValueType tlv = listIterator.next();
-                BgpValueType tlv1 = listIteratorOther.next();
-                if (prefixDescriptor.contains(tlv) && ((BgpPrefixLSIdentifier) o).prefixDescriptor.contains(tlv1)) {
+                if (prefixDescriptor.contains(tlv) && ((BgpPrefixLSIdentifier) o).prefixDescriptor.contains(tlv)) {
                     int res = prefixDescriptor.get(prefixDescriptor.indexOf(tlv)).compareTo(
                             ((BgpPrefixLSIdentifier) o).prefixDescriptor
-                                    .get(((BgpPrefixLSIdentifier) o).prefixDescriptor.indexOf(tlv1)));
+                                    .get(((BgpPrefixLSIdentifier) o).prefixDescriptor.indexOf(tlv)));
                     if (res != 0) {
                         return res;
                     }
+                } else {
+                    return 1;
                 }
             }
         }
diff --git a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/NodeDescriptors.java b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/NodeDescriptors.java
index 7fb1b31..f91ac26 100644
--- a/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/NodeDescriptors.java
+++ b/protocols/bgp/bgpio/src/main/java/org/onosproject/bgpio/protocol/linkstate/NodeDescriptors.java
@@ -247,13 +247,15 @@
         } else {
             while (listIterator.hasNext()) {
             BgpValueType tlv = listIterator.next();
-                BgpValueType tlv1 = listIteratorOther.next();
-                if (subTlvs.contains(tlv) && ((NodeDescriptors) o).subTlvs.contains(tlv1)) {
+                log.debug("NodeDescriptor compare subtlv's");
+                if (subTlvs.contains(tlv) && ((NodeDescriptors) o).subTlvs.contains(tlv)) {
                     int result = subTlvs.get(subTlvs.indexOf(tlv)).compareTo(
-                            ((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv1)));
+                            ((NodeDescriptors) o).subTlvs.get(((NodeDescriptors) o).subTlvs.indexOf(tlv)));
                     if (result != 0) {
                         return result;
                     }
+                } else {
+                    return 1;
                 }
             }
         }