[ONOS-4718] Deserialize addresses from LISP control message class

With this commit, we try to deserilize all LispAfiAddress from
all LISP control message classes.

Change-Id: Iaf911bff90c45a70859285e426dc1649c3e6db32
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
index 24d159a..9da4a18 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/types/LispSourceDestLcafAddress.java
@@ -76,6 +76,31 @@
     }
 
     /**
+     * Initializes source/dest key type LCAF address.
+     *
+     * @param reserved1     reserved1
+     * @param reserved2     reserved2
+     * @param flag          flag
+     * @param length        length
+     * @param reserved      reserved
+     * @param srcMaskLength source mask length
+     * @param dstMaskLength destination mask length
+     * @param srcPrefix     source address prefix
+     * @param dstPrefix     destination address prefix
+     */
+    private LispSourceDestLcafAddress(byte reserved1, byte reserved2, byte flag, short length,
+                                      short reserved, byte srcMaskLength,
+                                      byte dstMaskLength, LispAfiAddress srcPrefix,
+                                      LispAfiAddress dstPrefix) {
+        super(LispCanonicalAddressFormatEnum.SOURCE_DEST, reserved1, reserved2, flag, length);
+        this.reserved = reserved;
+        this.srcMaskLength = srcMaskLength;
+        this.dstMaskLength = dstMaskLength;
+        this.srcPrefix = srcPrefix;
+        this.dstPrefix = dstPrefix;
+    }
+
+    /**
      * Obtains source address prefix.
      *
      * @return source address prefix
@@ -153,7 +178,8 @@
                 .toString();
     }
 
-    public static final class SourceDestAddressBuilder {
+    public static final class SourceDestAddressBuilder
+            extends LcafAddressBuilder<SourceDestAddressBuilder> {
         private LispAfiAddress srcPrefix;
         private LispAfiAddress dstPrefix;
         private byte srcMaskLength;
@@ -221,8 +247,8 @@
          * @return LispSourceDestLcafAddress instance
          */
         public LispSourceDestLcafAddress build() {
-            return new LispSourceDestLcafAddress(reserved, srcMaskLength,
-                    dstMaskLength, srcPrefix, dstPrefix);
+            return new LispSourceDestLcafAddress(reserved1, reserved2, flag, length,
+                    reserved, srcMaskLength, dstMaskLength, srcPrefix, dstPrefix);
         }
     }
 
@@ -235,20 +261,26 @@
         @Override
         public LispSourceDestLcafAddress readFrom(ByteBuf byteBuf) throws LispParseError, LispReaderException {
 
+            LispLcafAddress lcafAddress = LispLcafAddress.deserializeCommon(byteBuf);
+
             short reserved = byteBuf.readShort();
             byte srcMaskLength = (byte) byteBuf.readUnsignedByte();
             byte dstMaskLength = (byte) byteBuf.readUnsignedByte();
 
-            LispAfiAddress srcPrefix = new LispIpAddress.IpAddressReader().readFrom(byteBuf);
-            LispAfiAddress dstPrefix = new LispIpAddress.IpAddressReader().readFrom(byteBuf);
+            LispAfiAddress srcPrefix = new LispAfiAddress.AfiAddressReader().readFrom(byteBuf);
+            LispAfiAddress dstPrefix = new LispAfiAddress.AfiAddressReader().readFrom(byteBuf);
 
             return new SourceDestAddressBuilder()
-                            .withReserved(reserved)
-                            .withSrcMaskLength(srcMaskLength)
-                            .withDstMaskLength(dstMaskLength)
-                            .withSrcPrefix(srcPrefix)
-                            .withDstPrefix(dstPrefix)
-                            .build();
+                    .withReserved1(lcafAddress.getReserved1())
+                    .withReserved2(lcafAddress.getReserved2())
+                    .withFlag(lcafAddress.getFlag())
+                    .withLength(lcafAddress.getLength())
+                    .withReserved(reserved)
+                    .withSrcMaskLength(srcMaskLength)
+                    .withDstMaskLength(dstMaskLength)
+                    .withSrcPrefix(srcPrefix)
+                    .withDstPrefix(dstPrefix)
+                    .build();
         }
     }
 }