Initial work on using ExtensionMappingAddress to abstract LCAF addr

Change-Id: I0db0682a1b15c8c7ba49ff82c82f06770b011dc6
diff --git a/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/ExtensionMappingAddressType.java b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/ExtensionMappingAddressType.java
new file mode 100644
index 0000000..824de13
--- /dev/null
+++ b/apps/mappingmanagement/api/src/main/java/org/onosproject/mapping/addresses/ExtensionMappingAddressType.java
@@ -0,0 +1,110 @@
+/*
+ * 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.mapping.addresses;
+
+import com.google.common.base.MoreObjects;
+
+import java.util.Objects;
+
+/**
+ * Type of mapping address extensions.
+ */
+public class ExtensionMappingAddressType {
+
+    /**
+     * A list of well-known named extension mapping address type codes.
+     * These numbers have no impact on the actual LISP type id.
+     */
+    public enum ExtensionMappingAddressTypes {
+        LIST_ADDRESS(1),
+        SEGMENT_ADDRESS(2),
+        AS_ADDRESS(3),
+        APPLICATION_DATA_ADDRESS(4),
+        GEO_COORDINATE_ADDRESS(5),
+        NAT_ADDRESS(7),
+        NONCE_ADDRESS(8),
+        MULTICAST_ADDRESS(9),
+        TRAFFIC_ENGINEERING_ADDRESS(10),
+        SECURITY_ADDRESS(11),
+        SOURCE_DEST_ADDRESS(12),
+
+        UNRESOLVED_TYPE(200);
+
+        private ExtensionMappingAddressType type;
+
+        /**
+         * Creates a new named extension mapping address type.
+         *
+         * @param type type code
+         */
+        ExtensionMappingAddressTypes(int type) {
+            this.type = new ExtensionMappingAddressType(type);
+        }
+
+        /**
+         * Obtains the extension type object for this named type code.
+         *
+         * @return extension type object
+         */
+        public ExtensionMappingAddressType type() {
+            return type;
+        }
+    }
+
+    private final int type;
+
+    /**
+     * Creates an extension type with the given int type code.
+     *
+     * @param type type code
+     */
+    public ExtensionMappingAddressType(int type) {
+        this.type = type;
+    }
+
+    /**
+     * Obtains the integer value associated with this type.
+     *
+     * @return an integer value
+     */
+    public int toInt() {
+        return this.type;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ExtensionMappingAddressType) {
+            final ExtensionMappingAddressType that = (ExtensionMappingAddressType) obj;
+            return this.type == that.type;
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(ExtensionMappingAddressType.class)
+                    .add("type", type)
+                    .toString();
+    }
+}