Enable to handle LISP Info (request, reply) messages
by LISPMessageReaderFactory
Change-Id: I1dac2765ba5da27f09db01b649032fb16ef46322
diff --git a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMessageReaderFactory.java b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMessageReaderFactory.java
index 4bb47af..6a33720 100644
--- a/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMessageReaderFactory.java
+++ b/protocols/lisp/msg/src/main/java/org/onosproject/lisp/msg/protocols/LispMessageReaderFactory.java
@@ -16,18 +16,22 @@
package org.onosproject.lisp.msg.protocols;
import io.netty.buffer.ByteBuf;
+import org.onlab.util.ByteOperator;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapReply.ReplyReader;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapNotify.NotifyReader;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapRegister.RegisterReader;
import static org.onosproject.lisp.msg.protocols.DefaultLispMapRequest.RequestReader;
import static org.onosproject.lisp.msg.protocols.DefaultLispEncapsulatedControl.EcmReader;
+import static org.onosproject.lisp.msg.protocols.DefaultLispInfoRequest.InfoRequestReader;
+import static org.onosproject.lisp.msg.protocols.DefaultLispInfoReply.InfoReplyReader;
/**
* A factory class which helps to instantiate LISP reader class.
*/
public final class LispMessageReaderFactory {
private static final int TYPE_SHIFT_BIT = 4;
+ private static final int INFO_REPLY_INDEX = 3;
private LispMessageReaderFactory() {}
@@ -56,6 +60,15 @@
case LISP_MAP_NOTIFY:
reader = new NotifyReader();
break;
+ case LISP_INFO:
+ boolean isInfoReply = ByteOperator.getBit(
+ (byte) buffer.getUnsignedByte(0), INFO_REPLY_INDEX);
+ if (isInfoReply) {
+ reader = new InfoReplyReader();
+ } else {
+ reader = new InfoRequestReader();
+ }
+ break;
case LISP_ENCAPSULATED_CONTROL:
reader = new EcmReader();
break;