Bug 5216: Fix Instance ID authentication failure 05/34005/2
authorLorand Jakab <lojakab@cisco.com>
Wed, 3 Feb 2016 18:34:16 +0000 (20:34 +0200)
committerLorand Jakab <lojakab@cisco.com>
Wed, 3 Feb 2016 18:34:16 +0000 (20:34 +0200)
Change-Id: Ib0f1ab5442c8c7062346522a0b0bbf151b3c08ad
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingSystem.java
mappingservice/lisp-proto/src/main/java/org/opendaylight/lispflowmapping/lisp/serializer/address/LcafSerializer.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/MapRegisterSerializationTest.java
mappingservice/lisp-proto/src/test/java/org/opendaylight/lispflowmapping/serializer/address/InstanceIdSerializerTest.java

index a818e505dfbd805306f9916689092d80ba0f8f47..3f5fd1c8fa88dbd8452d2075874093e67b38306b 100644 (file)
@@ -223,7 +223,7 @@ public class MappingSystem implements IMappingSystem {
 
     @Override
     public void addAuthenticationKey(Eid key, MappingAuthkey authKey) {
-        LOG.debug("Adding authentication key '{}' for {}", key,
+        LOG.debug("Adding authentication key '{}' for {}", authKey.getKeyString(),
                 LispAddressStringifier.getString(key));
         smc.addAuthenticationKey(key, authKey);
     }
index 6bc33b032150dab6547f36f2b549ac5bc1fa9049..1d0eca9e2a608120f7ece8841752ada19a482332 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rl
 public class LcafSerializer extends LispAddressSerializer {
 
     private static final LcafSerializer INSTANCE = new LcafSerializer();
+    private static final byte DEFAULT_IID_MASK_LENGTH = (byte) 32;
 
     // Private constructor prevents instantiation from other classes
     protected LcafSerializer() {
@@ -62,6 +63,7 @@ public class LcafSerializer extends LispAddressSerializer {
     protected void serializeLCAFAddressHeaderForInstanceId(ByteBuffer buffer, LispAddress lispAddress) {
         LispAddressSerializer lcafSerializer = InstanceIdSerializer.getInstance();
         serializeLCAFAddressHeader(buffer, lispAddress, lcafSerializer);
+        buffer.put(buffer.position() - 1, DEFAULT_IID_MASK_LENGTH);
         buffer.putShort((short) (lcafSerializer.getLcafLength(lispAddress) -
                 LispAddressSerializer.getInstance().getInstanceIdExtraSize()));
     }
index d7a35e86d635c1665145467354d5ab633ef6cd68..4bc12eb61736f5485b115f6fd4b695eba92fc46e 100644 (file)
@@ -212,7 +212,7 @@ public class MapRegisterSerializationTest extends BaseTestCase {
         ByteBuffer bb = hexToByteBuffer("32 00 01 01 63 99 "
                 + "83 64 23 06 a8 be 00 01 00 14 b8 c2 a2 e1 dc 4a "
                 + "08 0c f6 01 b0 9d 70 5a d4 88 95 f8 73 dd 00 00 "
-                + "05 a0 01 20 10 00 00 00 40 03 00 00 02 00 00 0a "
+                + "05 a0 01 20 10 00 00 00 40 03 00 00 02 20 00 0a "
                 + "00 00 00 01 00 01 c3 a8 c8 01 0a 32 ff 00 00 04 "
                 + "00 01 ac 10 01 02 15 1a 39 80 e3 35 e6 c4 49 a6 "
                 + "90 87 20 65 9a b7 00 00 00 00 00 00 00 00 ");
index a0ed3a441e953f5cd30c043e3289465c5bb33dc3..4af2637e73614e0b0e0a54a19b9a1c8357fc895a 100644 (file)
@@ -87,7 +87,7 @@ public class InstanceIdSerializerTest extends BaseTestCase {
         ByteBuffer buf = ByteBuffer.allocate(LispAddressSerializer.getInstance().getAddressSize(eid));
         LispAddressSerializer.getInstance().serialize(buf, eid);
         ByteBuffer expectedBuf = hexToByteBuffer("40 03 00 00 " + //
-                "02 00 00 0A " + //
+                "02 20 00 0A " + //
                 "00 02 03 04 " + // instance ID
                 "00 01 11 22 33 44");
         ArrayAssert.assertEquals(expectedBuf.array(), buf.array());