Remove recordCount and locatorCount from LISP control message class

Because recordCount or locatorCount is only used when decoding the
LISP control message received from xTR, therefore, there is no
need to provide any interface to specify this value from obj builder.

Change-Id: I380b275e6f06feb4846b84f62ebf2430ad5a9ec6
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
index bfd64fc..2e09049 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotify.java
@@ -39,7 +39,6 @@
     private final short keyId;
     private final short authDataLength;
     private final byte[] authenticationData;
-    private final byte recordCount;
     private final List<LispMapRecord> mapRecords;
 
     /**
@@ -48,17 +47,14 @@
      * @param nonce              nonce
      * @param keyId              key identifier
      * @param authenticationData authentication data
-     * @param recordCount        record count number
      * @param mapRecords         a collection of map records
      */
     private DefaultLispMapNotify(long nonce, short keyId, short authDataLength,
-                                 byte[] authenticationData, byte recordCount,
-                                 List<LispMapRecord> mapRecords) {
+                                 byte[] authenticationData, List<LispMapRecord> mapRecords) {
         this.nonce = nonce;
         this.keyId = keyId;
         this.authDataLength = authDataLength;
         this.authenticationData = authenticationData;
-        this.recordCount = recordCount;
         this.mapRecords = mapRecords;
     }
 
@@ -83,8 +79,8 @@
     }
 
     @Override
-    public byte getRecordCount() {
-        return recordCount;
+    public int getRecordCount() {
+        return mapRecords.size();
     }
 
     @Override
@@ -116,7 +112,6 @@
         return toStringHelper(this)
                 .add("type", getType())
                 .add("nonce", nonce)
-                .add("recordCount", recordCount)
                 .add("keyId", keyId)
                 .add("authentication data length", authDataLength)
                 .add("authentication data", authenticationData)
@@ -133,7 +128,6 @@
         }
         DefaultLispMapNotify that = (DefaultLispMapNotify) o;
         return Objects.equal(nonce, that.nonce) &&
-                Objects.equal(recordCount, that.recordCount) &&
                 Objects.equal(keyId, that.keyId) &&
                 Objects.equal(authDataLength, that.authDataLength) &&
                 Arrays.equals(authenticationData, that.authenticationData);
@@ -141,7 +135,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(nonce, recordCount, keyId, authDataLength) +
+        return Objects.hashCode(nonce, keyId, authDataLength) +
                 Arrays.hashCode(authenticationData);
     }
 
@@ -151,7 +145,6 @@
         private short keyId;
         private short authDataLength;
         private byte[] authenticationData;
-        private byte recordCount;
         private List<LispMapRecord> mapRecords = Lists.newArrayList();
 
         @Override
@@ -166,12 +159,6 @@
         }
 
         @Override
-        public NotifyBuilder withRecordCount(byte recordCount) {
-            this.recordCount = recordCount;
-            return this;
-        }
-
-        @Override
         public NotifyBuilder withKeyId(short keyId) {
             this.keyId = keyId;
             return this;
@@ -209,7 +196,7 @@
             }
 
             return new DefaultLispMapNotify(nonce, keyId, authDataLength,
-                    authenticationData, recordCount, mapRecords);
+                    authenticationData, mapRecords);
         }
     }
 
@@ -252,7 +239,6 @@
             }
 
             return new DefaultNotifyBuilder()
-                        .withRecordCount(recordCount)
                         .withNonce(nonce)
                         .withKeyId(keyId)
                         .withAuthDataLength(authLength)
@@ -283,7 +269,7 @@
             byteBuf.writeShort((short) UNUSED_ZERO);
 
             // record count
-            byteBuf.writeByte(message.getRecordCount());
+            byteBuf.writeByte(message.getMapRecords().size());
 
             // nonce
             byteBuf.writeLong(message.getNonce());
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecord.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecord.java
index b4e5139..9c4bece 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecord.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecord.java
@@ -38,7 +38,6 @@
 public final class DefaultLispMapRecord implements LispMapRecord {
 
     private final int recordTtl;
-    private final int locatorCount;
     private final byte maskLength;
     private final LispMapReplyAction action;
     private final boolean authoritative;
@@ -50,19 +49,17 @@
      * A private constructor that protects object instantiation from external.
      *
      * @param recordTtl        record time-to-live value
-     * @param locatorCount     locator's count number
      * @param maskLength       mask length
      * @param action           lisp map reply action
      * @param authoritative    authoritative flag
      * @param mapVersionNumber map version number
      * @param eidPrefixAfi     EID prefix AFI address
      */
-    private DefaultLispMapRecord(int recordTtl, int locatorCount, byte maskLength,
+    private DefaultLispMapRecord(int recordTtl, byte maskLength,
                                  LispMapReplyAction action, boolean authoritative,
                                  short mapVersionNumber, LispAfiAddress eidPrefixAfi,
                                  List<LispLocatorRecord> locatorRecords) {
         this.recordTtl = recordTtl;
-        this.locatorCount = locatorCount;
         this.maskLength = maskLength;
         this.action = action;
         this.authoritative = authoritative;
@@ -78,7 +75,7 @@
 
     @Override
     public int getLocatorCount() {
-        return locatorCount;
+        return locatorRecords.size();
     }
 
     @Override
@@ -120,7 +117,6 @@
     public String toString() {
         return toStringHelper(this)
                 .add("record TTL", recordTtl)
-                .add("locatorCount", locatorCount)
                 .add("maskLength", maskLength)
                 .add("action", action)
                 .add("authoritative", authoritative)
@@ -140,7 +136,6 @@
         }
         DefaultLispMapRecord that = (DefaultLispMapRecord) o;
         return Objects.equal(recordTtl, that.recordTtl) &&
-                Objects.equal(locatorCount, that.locatorCount) &&
                 Objects.equal(maskLength, that.maskLength) &&
                 Objects.equal(action, that.action) &&
                 Objects.equal(authoritative, that.authoritative) &&
@@ -151,14 +146,13 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(recordTtl, locatorCount, maskLength, action,
+        return Objects.hashCode(recordTtl, maskLength, action,
                                 authoritative, mapVersionNumber, eidPrefixAfi, locatorRecords);
     }
 
     public static final class DefaultMapRecordBuilder implements MapRecordBuilder {
 
         private int recordTtl;
-        private int locatorCount;
         private byte maskLength;
         private LispMapReplyAction action;
         private boolean authoritative;
@@ -173,12 +167,6 @@
         }
 
         @Override
-        public MapRecordBuilder withLocatorCount(int locatorCount) {
-            this.locatorCount = locatorCount;
-            return this;
-        }
-
-        @Override
         public MapRecordBuilder withMaskLength(byte maskLength) {
             this.maskLength = maskLength;
             return this;
@@ -221,8 +209,8 @@
 
             checkNotNull(eidPrefixAfi, "Must specify an EID prefix");
 
-            return new DefaultLispMapRecord(recordTtl, locatorCount, maskLength,
-                    action, authoritative, mapVersionNumber, eidPrefixAfi, locatorRecords);
+            return new DefaultLispMapRecord(recordTtl, maskLength, action,
+                    authoritative, mapVersionNumber, eidPrefixAfi, locatorRecords);
         }
     }
 
@@ -275,7 +263,6 @@
 
             return new DefaultMapRecordBuilder()
                         .withRecordTtl(recordTtl)
-                        .withLocatorCount(locatorCount)
                         .withMaskLength(maskLength)
                         .withAction(action)
                         .withAuthoritative(authoritative)
@@ -304,7 +291,7 @@
             byteBuf.writeInt(message.getRecordTtl());
 
             // locator count
-            byteBuf.writeByte((byte) message.getLocatorCount());
+            byteBuf.writeByte((byte) message.getLocators().size());
 
             // EID mask length
             byteBuf.writeByte(message.getMaskLength());
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
index e0d1490..1d63782 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegister.java
@@ -42,7 +42,6 @@
     private final short keyId;
     private final short authDataLength;
     private final byte[] authenticationData;
-    private final byte recordCount;
     private final List<LispMapRecord> mapRecords;
     private final boolean proxyMapReply;
     private final boolean wantMapNotify;
@@ -53,20 +52,17 @@
      * @param nonce              nonce
      * @param keyId              key identifier
      * @param authenticationData authentication data
-     * @param recordCount        record count number
      * @param mapRecords         a collection of map records
      * @param proxyMapReply      proxy map reply flag
      * @param wantMapNotify      want map notify flag
      */
     private DefaultLispMapRegister(long nonce, short keyId, short authDataLength,
-                                   byte[] authenticationData, byte recordCount,
-                                   List<LispMapRecord> mapRecords,
+                                   byte[] authenticationData, List<LispMapRecord> mapRecords,
                                    boolean proxyMapReply, boolean wantMapNotify) {
         this.nonce = nonce;
         this.keyId = keyId;
         this.authDataLength = authDataLength;
         this.authenticationData = authenticationData;
-        this.recordCount = recordCount;
         this.mapRecords = mapRecords;
         this.proxyMapReply = proxyMapReply;
         this.wantMapNotify = wantMapNotify;
@@ -98,8 +94,8 @@
     }
 
     @Override
-    public byte getRecordCount() {
-        return recordCount;
+    public int getRecordCount() {
+        return mapRecords.size();
     }
 
     @Override
@@ -136,7 +132,6 @@
         return toStringHelper(this)
                 .add("type", getType())
                 .add("nonce", nonce)
-                .add("recordCount", recordCount)
                 .add("keyId", keyId)
                 .add("authentication data length", authDataLength)
                 .add("authentication data", authenticationData)
@@ -156,7 +151,6 @@
 
         DefaultLispMapRegister that = (DefaultLispMapRegister) o;
         return Objects.equal(nonce, that.nonce) &&
-                Objects.equal(recordCount, that.recordCount) &&
                 Objects.equal(keyId, that.keyId) &&
                 Objects.equal(authDataLength, that.authDataLength) &&
                 Arrays.equals(authenticationData, that.authenticationData) &&
@@ -166,7 +160,7 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(nonce, recordCount, keyId, authDataLength,
+        return Objects.hashCode(nonce, keyId, authDataLength,
                 proxyMapReply, wantMapNotify) + Arrays.hashCode(authenticationData);
     }
 
@@ -176,7 +170,6 @@
         private short keyId;
         private short authDataLength;
         private byte[] authenticationData = new byte[0];
-        private byte recordCount;
         private List<LispMapRecord> mapRecords = Lists.newArrayList();
         private boolean proxyMapReply;
         private boolean wantMapNotify;
@@ -199,12 +192,6 @@
         }
 
         @Override
-        public RegisterBuilder withRecordCount(byte recordCount) {
-            this.recordCount = recordCount;
-            return this;
-        }
-
-        @Override
         public RegisterBuilder withNonce(long nonce) {
             this.nonce = nonce;
             return this;
@@ -241,7 +228,7 @@
         @Override
         public LispMapRegister build() {
             return new DefaultLispMapRegister(nonce, keyId, authDataLength,
-                    authenticationData, recordCount, mapRecords, proxyMapReply, wantMapNotify);
+                    authenticationData, mapRecords, proxyMapReply, wantMapNotify);
         }
     }
 
@@ -296,7 +283,6 @@
             return new DefaultRegisterBuilder()
                     .withIsProxyMapReply(proxyMapReplyFlag)
                     .withIsWantMapNotify(wantMapNotifyFlag)
-                    .withRecordCount(recordCount)
                     .withNonce(nonce)
                     .withKeyId(keyId)
                     .withAuthenticationData(authData)
@@ -346,7 +332,7 @@
             byteBuf.writeByte(wantMapNotify);
 
             // record count
-            byteBuf.writeByte(message.getRecordCount());
+            byteBuf.writeByte(message.getMapRecords().size());
 
             // nonce
             byteBuf.writeLong(message.getNonce());
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
index 75c1689..3cdfa42 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReply.java
@@ -35,7 +35,6 @@
 public final class DefaultLispMapReply implements LispMapReply {
 
     private final long nonce;
-    private final byte recordCount;
     private final boolean probe;
     private final boolean etr;
     private final boolean security;
@@ -45,15 +44,13 @@
      * A private constructor that protects object instantiation from external.
      *
      * @param nonce       nonce
-     * @param recordCount record count number
      * @param probe       probe flag
      * @param etr         etr flag
      * @param security    security flag
      */
-    private DefaultLispMapReply(long nonce, byte recordCount, boolean probe,
-                                boolean etr, boolean security, List<LispMapRecord> mapRecords) {
+    private DefaultLispMapReply(long nonce, boolean probe, boolean etr,
+                                boolean security, List<LispMapRecord> mapRecords) {
         this.nonce = nonce;
-        this.recordCount = recordCount;
         this.probe = probe;
         this.etr = etr;
         this.security = security;
@@ -91,8 +88,8 @@
     }
 
     @Override
-    public byte getRecordCount() {
-        return recordCount;
+    public int getRecordCount() {
+        return mapRecords.size();
     }
 
     @Override
@@ -110,7 +107,6 @@
         return toStringHelper(this)
                 .add("type", getType())
                 .add("nonce", nonce)
-                .add("recordCount", recordCount)
                 .add("probe", probe)
                 .add("etr", etr)
                 .add("security", security)
@@ -127,7 +123,6 @@
         }
         DefaultLispMapReply that = (DefaultLispMapReply) o;
         return Objects.equal(nonce, that.nonce) &&
-                Objects.equal(recordCount, that.recordCount) &&
                 Objects.equal(probe, that.probe) &&
                 Objects.equal(etr, that.etr) &&
                 Objects.equal(security, that.security) &&
@@ -136,13 +131,12 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(nonce, recordCount, probe, etr, security, mapRecords);
+        return Objects.hashCode(nonce, probe, etr, security, mapRecords);
     }
 
     public static final class DefaultReplyBuilder implements ReplyBuilder {
 
         private long nonce;
-        private byte recordCount;
         private boolean probe;
         private boolean etr;
         private boolean security;
@@ -172,12 +166,6 @@
         }
 
         @Override
-        public ReplyBuilder withRecordCount(byte recordCount) {
-            this.recordCount = recordCount;
-            return this;
-        }
-
-        @Override
         public ReplyBuilder withNonce(long nonce) {
             this.nonce = nonce;
             return this;
@@ -193,7 +181,7 @@
 
         @Override
         public LispMapReply build() {
-            return new DefaultLispMapReply(nonce, recordCount, probe, etr, security, mapRecords);
+            return new DefaultLispMapReply(nonce, probe, etr, security, mapRecords);
         }
     }
 
@@ -243,7 +231,6 @@
                         .withIsProbe(probe)
                         .withIsEtr(etr)
                         .withIsSecurity(security)
-                        .withRecordCount(recordCount)
                         .withNonce(nonce)
                         .build();
         }
@@ -296,7 +283,7 @@
             byteBuf.writeShort((short) UNUSED_ZERO);
 
             // record count
-            byteBuf.writeByte(message.getRecordCount());
+            byteBuf.writeByte(message.getMapRecords().size());
 
             // nonce
             byteBuf.writeLong(message.getNonce());
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
index c44c909..16585f5 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequest.java
@@ -39,7 +39,6 @@
 public final class DefaultLispMapRequest implements LispMapRequest {
 
     private final long nonce;
-    private final byte recordCount;
     private final LispAfiAddress sourceEid;
     private final List<LispAfiAddress> itrRlocs;
     private final List<LispEidRecord> eidRecords;
@@ -54,7 +53,6 @@
      * A private constructor that protects object instantiation from external.
      *
      * @param nonce          nonce
-     * @param recordCount    record count number
      * @param sourceEid      source EID address
      * @param itrRlocs       a collection of ITR RLOCs
      * @param eidRecords     a collection of EID records
@@ -65,12 +63,11 @@
      * @param pitr           pitr flag
      * @param smrInvoked     smrInvoked flag
      */
-    private DefaultLispMapRequest(long nonce, byte recordCount, LispAfiAddress sourceEid,
+    private DefaultLispMapRequest(long nonce, LispAfiAddress sourceEid,
                                   List<LispAfiAddress> itrRlocs, List<LispEidRecord> eidRecords,
                                   boolean authoritative, boolean mapDataPresent, boolean probe,
                                   boolean smr, boolean pitr, boolean smrInvoked) {
         this.nonce = nonce;
-        this.recordCount = recordCount;
         this.sourceEid = sourceEid;
         this.itrRlocs = itrRlocs;
         this.eidRecords = eidRecords;
@@ -128,8 +125,8 @@
     }
 
     @Override
-    public byte getRecordCount() {
-        return recordCount;
+    public int getRecordCount() {
+        return eidRecords.size();
     }
 
     @Override
@@ -157,7 +154,6 @@
         return toStringHelper(this)
                 .add("type", getType())
                 .add("nonce", nonce)
-                .add("recordCount", recordCount)
                 .add("source EID", sourceEid)
                 .add("ITR rlocs", itrRlocs)
                 .add("EID records", eidRecords)
@@ -179,7 +175,6 @@
         }
         DefaultLispMapRequest that = (DefaultLispMapRequest) o;
         return Objects.equal(nonce, that.nonce) &&
-                Objects.equal(recordCount, that.recordCount) &&
                 Objects.equal(sourceEid, that.sourceEid) &&
                 Objects.equal(authoritative, that.authoritative) &&
                 Objects.equal(mapDataPresent, that.mapDataPresent) &&
@@ -191,14 +186,13 @@
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(nonce, recordCount, sourceEid, authoritative,
+        return Objects.hashCode(nonce, sourceEid, authoritative,
                 mapDataPresent, probe, smr, pitr, smrInvoked);
     }
 
     public static final class DefaultRequestBuilder implements RequestBuilder {
 
         private long nonce;
-        private byte recordCount;
         private LispAfiAddress sourceEid;
         private List<LispAfiAddress> itrRlocs = Lists.newArrayList();
         private List<LispEidRecord> eidRecords = Lists.newArrayList();
@@ -251,12 +245,6 @@
         }
 
         @Override
-        public RequestBuilder withRecordCount(byte recordCount) {
-            this.recordCount = recordCount;
-            return this;
-        }
-
-        @Override
         public RequestBuilder withNonce(long nonce) {
             this.nonce = nonce;
             return this;
@@ -290,8 +278,8 @@
             checkNotNull(sourceEid, "Must have a source EID");
             checkArgument((itrRlocs != null) && (itrRlocs.size() > 0), "Must have an ITR RLOC entry");
 
-            return new DefaultLispMapRequest(nonce, recordCount, sourceEid, itrRlocs,
-                    eidRecords, authoritative, mapDataPresent, probe, smr, pitr, smrInvoked);
+            return new DefaultLispMapRequest(nonce, sourceEid, itrRlocs, eidRecords,
+                    authoritative, mapDataPresent, probe, smr, pitr, smrInvoked);
         }
     }
 
@@ -369,7 +357,6 @@
                         .withIsPitr(pitr)
                         .withIsSmrInvoked(smrInvoked)
                         .withNonce(nonce)
-                        .withRecordCount((byte) recordCount)
                         .withSourceEid(sourceEid)
                         .withEidRecords(eidRecords)
                         .withItrRlocs(itrRlocs)
@@ -445,7 +432,7 @@
             byteBuf.writeByte((byte) message.getItrRlocs().size());
 
             // record count
-            byteBuf.writeByte(message.getRecordCount());
+            byteBuf.writeByte(message.getEids().size());
 
             // nonce
             byteBuf.writeLong(message.getNonce());
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapNotify.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapNotify.java
index 052df6a..4b8abca 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapNotify.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapNotify.java
@@ -68,7 +68,7 @@
      *
      * @return record count value
      */
-    byte getRecordCount();
+    int getRecordCount();
 
     /**
      * Obtains key identifier.
@@ -112,14 +112,6 @@
         NotifyBuilder withNonce(long nonce);
 
         /**
-         * Sets record count.
-         *
-         * @param recordCount record count
-         * @return NotifyBuilder object
-         */
-        NotifyBuilder withRecordCount(byte recordCount);
-
-        /**
          * Sets key identitifer.
          *
          * @param keyId key identifier
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRecord.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRecord.java
index 49ff541..4e8536c 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRecord.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRecord.java
@@ -102,14 +102,6 @@
         MapRecordBuilder withRecordTtl(int recordTtl);
 
         /**
-         * Sets locator count.
-         *
-         * @param locatorCount locator count
-         * @return MapRecordBuilder object
-         */
-        MapRecordBuilder withLocatorCount(int locatorCount);
-
-        /**
          * Sets mask length.
          *
          * @param maskLength mask length
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRegister.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRegister.java
index beb79dd..f5341c2 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRegister.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRegister.java
@@ -75,7 +75,7 @@
      *
      * @return record count value
      */
-    byte getRecordCount();
+    int getRecordCount();
 
     /**
      * Obtains nonce value.
@@ -134,14 +134,6 @@
         RegisterBuilder withIsWantMapNotify(boolean isWantMapNotify);
 
         /**
-         * Sets record count.
-         *
-         * @param recordCount record count
-         * @return RegisterBuilder object
-         */
-        RegisterBuilder withRecordCount(byte recordCount);
-
-        /**
          * Sets nonce value.
          *
          * @param nonce nonce value
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapReply.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapReply.java
index a710fb6..6e171ae 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapReply.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapReply.java
@@ -78,7 +78,7 @@
      *
      * @return record count value
      */
-    byte getRecordCount();
+    int getRecordCount();
 
     /**
      * Obtains nonce value.
@@ -124,14 +124,6 @@
         ReplyBuilder withIsSecurity(boolean security);
 
         /**
-         * Sets record count.
-         *
-         * @param recordCount record count
-         * @return ReplyBuilder object
-         */
-        ReplyBuilder withRecordCount(byte recordCount);
-
-        /**
          * Sets nonce value.
          *
          * @param nonce nonce value
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRequest.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRequest.java
index 8cfe2aa..aeaa21c 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRequest.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMapRequest.java
@@ -102,7 +102,7 @@
      *
      * @return record count value
      */
-    byte getRecordCount();
+    int getRecordCount();
 
     /**
      * Obtains nonce value.
@@ -186,14 +186,6 @@
         RequestBuilder withIsSmrInvoked(boolean smrInvoked);
 
         /**
-         * Sets record count.
-         *
-         * @param recordCount record count
-         * @return RequestBuilder object
-         */
-        RequestBuilder withRecordCount(byte recordCount);
-
-        /**
          * Sets nonce value.
          *
          * @param nonce nonce value
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotifyTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotifyTest.java
index 819da3d..3cea68e 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotifyTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapNotifyTest.java
@@ -46,7 +46,6 @@
         notify1 = builder1
                         .withKeyId((short) 1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapNotify.NotifyBuilder builder2 =
@@ -55,7 +54,6 @@
         sameAsNotify1 = builder2
                         .withKeyId((short) 1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapNotify.NotifyBuilder builder3 =
@@ -64,7 +62,6 @@
         notify2 = builder3
                         .withKeyId((short) 2)
                         .withNonce(2L)
-                        .withRecordCount((byte) 0x02)
                         .build();
     }
 
@@ -81,7 +78,6 @@
 
         assertThat(notify.getKeyId(), is((short) 1));
         assertThat(notify.getNonce(), is(1L));
-        assertThat(notify.getRecordCount(), is((byte) 0));
     }
 
     @Test
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecordTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecordTest.java
index 25ce27f..8a1190e 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecordTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRecordTest.java
@@ -50,7 +50,6 @@
         record1 = builder1
                         .withRecordTtl(100)
                         .withAuthoritative(true)
-                        .withLocatorCount(0)
                         .withMapVersionNumber((short) 1)
                         .withMaskLength((byte) 0x01)
                         .withAction(LispMapReplyAction.NativelyForward)
@@ -63,7 +62,6 @@
         sameAsRecord1 = builder2
                         .withRecordTtl(100)
                         .withAuthoritative(true)
-                        .withLocatorCount(0)
                         .withMapVersionNumber((short) 1)
                         .withMaskLength((byte) 0x01)
                         .withAction(LispMapReplyAction.NativelyForward)
@@ -78,7 +76,6 @@
         record2 = builder3
                         .withRecordTtl(200)
                         .withAuthoritative(false)
-                        .withLocatorCount(200)
                         .withMapVersionNumber((short) 2)
                         .withMaskLength((byte) 0x02)
                         .withAction(LispMapReplyAction.Drop)
@@ -101,7 +98,6 @@
 
         assertThat(record.getRecordTtl(), is(100));
         assertThat(record.isAuthoritative(), is(true));
-        assertThat(record.getLocatorCount(), is(0));
         assertThat(record.getMapVersionNumber(), is((short) 1));
         assertThat(record.getMaskLength(), is((byte) 0x01));
         assertThat(record.getAction(), is(LispMapReplyAction.NativelyForward));
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegisterTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegisterTest.java
index f7c5e49..f7d8d46 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegisterTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRegisterTest.java
@@ -49,7 +49,6 @@
                         .withIsWantMapNotify(false)
                         .withKeyId((short) 1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapRegister.RegisterBuilder builder2 =
@@ -60,7 +59,6 @@
                         .withIsWantMapNotify(false)
                         .withKeyId((short) 1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapRegister.RegisterBuilder builder3 =
@@ -71,7 +69,6 @@
                         .withIsWantMapNotify(false)
                         .withKeyId((short) 2)
                         .withNonce(2L)
-                        .withRecordCount((byte) 0x02)
                         .build();
     }
 
@@ -90,7 +87,6 @@
         assertThat(register.isWantMapNotify(), is(false));
         assertThat(register.getKeyId(), is((short) 1));
         assertThat(register.getNonce(), is(1L));
-        assertThat(register.getRecordCount(), is((byte) 0));
     }
 
     @Test
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
index 5b3c899..e771d15 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapReplyTest.java
@@ -49,7 +49,6 @@
                         .withIsProbe(false)
                         .withIsSecurity(true)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapReply.ReplyBuilder builder2 =
@@ -60,7 +59,6 @@
                         .withIsProbe(false)
                         .withIsSecurity(true)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         LispMapReply.ReplyBuilder builder3 =
@@ -70,7 +68,6 @@
                         .withIsProbe(true)
                         .withIsSecurity(false)
                         .withNonce(2L)
-                        .withRecordCount((byte) 0x02)
                         .build();
     }
 
@@ -89,7 +86,6 @@
         assertThat(reply.isProbe(), is(false));
         assertThat(reply.isSecurity(), is(true));
         assertThat(reply.getNonce(), is(1L));
-        assertThat(reply.getRecordCount(), is((byte) 0));
     }
 
     @Test
diff --git a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequestTest.java b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequestTest.java
index 088c4f8..469ce50 100644
--- a/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequestTest.java
+++ b/protocols/lisp/msg/src/test/java/org/onosproject/lisp/msg/protocols/DefaultLispMapRequestTest.java
@@ -65,7 +65,6 @@
                         .withSourceEid(ipv4Eid1)
                         .withItrRlocs(rlocs1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         RequestBuilder builder2 = new DefaultRequestBuilder();
@@ -80,7 +79,6 @@
                         .withSourceEid(ipv4Eid1)
                         .withItrRlocs(rlocs1)
                         .withNonce(1L)
-                        .withRecordCount((byte) 0)
                         .build();
 
         RequestBuilder builder3 = new DefaultRequestBuilder();
@@ -102,7 +100,6 @@
                         .withSourceEid(ipv4Eid2)
                         .withItrRlocs(rlocs2)
                         .withNonce(2L)
-                        .withRecordCount((byte) 0x02)
                         .build();
     }
 
@@ -124,7 +121,6 @@
         assertThat(request.isSmr(), is(true));
         assertThat(request.isSmrInvoked(), is(false));
         assertThat(request.getNonce(), is(1L));
-        assertThat(request.getRecordCount(), is((byte) 0));
     }
 
     @Test