Add ExtensionAddressInterpreter with ExtensionMappingAddressCodec

Change-Id: I30e663581ff392b3adf0e366cb7984fc66d34d0b
diff --git a/protocols/lisp/api/BUCK b/protocols/lisp/api/BUCK
index 7e70e4e..8481517 100644
--- a/protocols/lisp/api/BUCK
+++ b/protocols/lisp/api/BUCK
@@ -2,6 +2,7 @@
     '//lib:CORE_DEPS',
     '//lib:netty-transport',
     '//protocols/lisp/msg:onos-protocols-lisp-msg',
+    '//apps/mappingmanagement/api:onos-apps-mappingmanagement-api',
 ]
 
 osgi_jar_with_tests (
diff --git a/protocols/lisp/api/pom.xml b/protocols/lisp/api/pom.xml
index 6bd81ff..574bfe3 100644
--- a/protocols/lisp/api/pom.xml
+++ b/protocols/lisp/api/pom.xml
@@ -44,6 +44,11 @@
             <artifactId>onos-lisp-msg</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-mapping-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/ExtensionMappingAddressInterpreter.java b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/ExtensionMappingAddressInterpreter.java
new file mode 100644
index 0000000..44e749f
--- /dev/null
+++ b/protocols/lisp/api/src/main/java/org/onosproject/lisp/ctl/ExtensionMappingAddressInterpreter.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.lisp.ctl;
+
+import org.onosproject.lisp.msg.types.lcaf.LispLcafAddress;
+import org.onosproject.mapping.addresses.ExtensionMappingAddress;
+import org.onosproject.mapping.addresses.ExtensionMappingAddressCodec;
+import org.onosproject.mapping.addresses.ExtensionMappingAddressType;
+
+/**
+ * Interprets extension addresses and converts them to/from LISP objects.
+ */
+public interface ExtensionMappingAddressInterpreter extends ExtensionMappingAddressCodec {
+
+    /**
+     * Returns true if the given extension mapping address is supported by this
+     * driver.
+     *
+     * @param extensionMappingAddressType extension mapping address type
+     * @return true if the address is supported, otherwise false
+     */
+    boolean supported(ExtensionMappingAddressType extensionMappingAddressType);
+
+    /**
+     * Maps an extension mapping address to a LCAF address.
+     *
+     * @param mappingAddress extension mapping address
+     * @return LISP LCAF address
+     */
+    LispLcafAddress mapMappingAddress(ExtensionMappingAddress mappingAddress);
+
+    /**
+     * Maps a LCAF address to an extension mapping address.
+     *
+     * @param lcafAddress LCAF address
+     * @return extension mapping address
+     */
+    ExtensionMappingAddress mapLcafAddress(LispLcafAddress lcafAddress);
+}