diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/pom.xml b/common/onap-common-configuration-management/onap-configuration-management-api/pom.xml
new file mode 100644
index 0000000..df2b77b
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/pom.xml
@@ -0,0 +1,15 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <name>onap-configuration-management-api</name>
+    <artifactId>onap-configuration-management-api</artifactId>
+
+    <parent>
+        <artifactId>onap-common-configuration-management</artifactId>
+        <groupId>org.onap.sdc.common</groupId>
+        <version>1.2.0-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+</project>
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
new file mode 100644
index 0000000..b4cd68d
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
@@ -0,0 +1,21 @@
+package org.onap.config.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The interface Config.
+ */
+@Target({ElementType.TYPE, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Config {
+
+  /**
+   * Key string.
+   *
+   * @return the string
+   */
+  String key() default "";
+}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
new file mode 100644
index 0000000..58eedd7
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
@@ -0,0 +1,831 @@
+package org.onap.config.api;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The interface Configuration.
+ */
+public interface Configuration {
+  /**
+   * The constant tenant.
+   */
+  public static ThreadLocal<String> tenant = new ThreadLocal<>();
+
+  /**
+   * Sets tenant id.
+   *
+   * @param id the id
+   */
+  public static void setTenantId(String id) {
+    if (id != null && id.trim().length() > 0) {
+      tenant.set(id);
+    }
+  }
+
+  /**
+   * Gets as string.
+   *
+   * @param key the key
+   * @return the as string
+   */
+  public default String getAsString(String key) {
+    return getAsString(null, key);
+  }
+
+  /**
+   * Gets as string.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as string
+   */
+  public default String getAsString(String namespace, String key) {
+    return getAsString(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as string.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as string
+   */
+  public default String getAsString(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, String.class);
+  }
+
+  /**
+   * Gets as byte value.
+   *
+   * @param key the key
+   * @return the as byte value
+   */
+  public default Byte getAsByteValue(String key) {
+    return getAsByteValue(null, key);
+  }
+
+  /**
+   * Gets as byte value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as byte value
+   */
+  public default Byte getAsByteValue(String namespace, String key) {
+    return getAsByteValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as byte value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as byte value
+   */
+  public default Byte getAsByteValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Byte.class);
+  }
+
+  /**
+   * Gets as short value.
+   *
+   * @param key the key
+   * @return the as short value
+   */
+  public default Short getAsShortValue(String key) {
+    return getAsShortValue(null, key);
+  }
+
+  /**
+   * Gets as short value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as short value
+   */
+  public default Short getAsShortValue(String namespace, String key) {
+    return getAsShortValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as short value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as short value
+   */
+  public default Short getAsShortValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Short.class);
+  }
+
+  /**
+   * Gets as integer value.
+   *
+   * @param key the key
+   * @return the as integer value
+   */
+  public default Integer getAsIntegerValue(String key) {
+    return getAsIntegerValue(null, key);
+  }
+
+  /**
+   * Gets as integer value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as integer value
+   */
+  public default Integer getAsIntegerValue(String namespace, String key) {
+    return getAsIntegerValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as integer value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as integer value
+   */
+  public default Integer getAsIntegerValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Integer.class);
+  }
+
+  /**
+   * Gets as long value.
+   *
+   * @param key the key
+   * @return the as long value
+   */
+  public default Long getAsLongValue(String key) {
+    return getAsLongValue(null, key);
+  }
+
+  /**
+   * Gets as long value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as long value
+   */
+  public default Long getAsLongValue(String namespace, String key) {
+    return getAsLongValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as long value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as long value
+   */
+  public default Long getAsLongValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Long.class);
+  }
+
+  /**
+   * Gets as float value.
+   *
+   * @param key the key
+   * @return the as float value
+   */
+  public default Float getAsFloatValue(String key) {
+    return getAsFloatValue(null, key);
+  }
+
+  /**
+   * Gets as float value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as float value
+   */
+  public default Float getAsFloatValue(String namespace, String key) {
+    return getAsFloatValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as float value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as float value
+   */
+  public default Float getAsFloatValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Float.class);
+  }
+
+  /**
+   * Gets as double value.
+   *
+   * @param key the key
+   * @return the as double value
+   */
+  public default Double getAsDoubleValue(String key) {
+    return getAsDoubleValue(null, key);
+  }
+
+  /**
+   * Gets as double value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as double value
+   */
+  public default Double getAsDoubleValue(String namespace, String key) {
+    return getAsDoubleValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as double value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as double value
+   */
+  public default Double getAsDoubleValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Double.class);
+  }
+
+  /**
+   * Gets as boolean value.
+   *
+   * @param key the key
+   * @return the as boolean value
+   */
+  public default Boolean getAsBooleanValue(String key) {
+    return getAsBooleanValue(null, key);
+  }
+
+  /**
+   * Gets as boolean value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as boolean value
+   */
+  public default Boolean getAsBooleanValue(String namespace, String key) {
+    return getAsBooleanValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as boolean value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as boolean value
+   */
+  public default Boolean getAsBooleanValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Boolean.class);
+  }
+
+  /**
+   * Gets as char value.
+   *
+   * @param key the key
+   * @return the as char value
+   */
+  public default Character getAsCharValue(String key) {
+    return getAsCharValue(null, key);
+  }
+
+  /**
+   * Gets as char value.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as char value
+   */
+  public default Character getAsCharValue(String namespace, String key) {
+    return getAsCharValue(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as char value.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as char value
+   */
+  public default Character getAsCharValue(String tenantId, String namespace, String key) {
+    return get(tenantId, namespace, key, Character.class);
+  }
+
+  /**
+   * Populate configuration t.
+   *
+   * @param <T>   the type parameter
+   * @param clazz the clazz
+   * @return the t
+   */
+  public default <T> T populateConfiguration(Class<T> clazz) {
+    return populateConfiguration(null, clazz);
+  }
+
+  /**
+   * Populate configuration t.
+   *
+   * @param <T>       the type parameter
+   * @param namespace the namespace
+   * @param clazz     the clazz
+   * @return the t
+   */
+  public default <T> T populateConfiguration(String namespace, Class<T> clazz) {
+    return populateConfiguration(tenant.get(), namespace, clazz);
+  }
+
+  /**
+   * Populate configuration t.
+   *
+   * @param <T>       the type parameter
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param clazz     the clazz
+   * @return the t
+   */
+  public default <T> T populateConfiguration(String tenantId, String namespace, Class<T> clazz) {
+    return get(tenantId, namespace, null, clazz, Hint.EXTERNAL_LOOKUP);
+  }
+
+  /**
+   * Gets dynamic configuration.
+   *
+   * @param <T>          the type parameter
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration
+   */
+  public default <T> DynamicConfiguration<T> getDynamicConfiguration(String key, Class<T> clazz,
+                                                                     T defaultValue) {
+    return getDynamicConfiguration(null, key, clazz, defaultValue);
+  }
+
+  /**
+   * Gets dynamic configuration.
+   *
+   * @param <T>          the type parameter
+   * @param namespace    the namespace
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration
+   */
+  public default <T> DynamicConfiguration<T> getDynamicConfiguration(String namespace, String key,
+                                                                     Class<T> clazz,
+                                                                     T defaultValue) {
+    return getDynamicConfiguration(tenant.get(), namespace, key, clazz, defaultValue);
+  }
+
+  /**
+   * Gets dynamic configuration.
+   *
+   * @param <T>          the type parameter
+   * @param tenant       the tenant
+   * @param namespace    the namespace
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration
+   */
+  public default <T> DynamicConfiguration<T> getDynamicConfiguration(String tenant,
+                                                                     String namespace, String key,
+                                                                     Class<T> clazz,
+                                                                     T defaultValue) {
+    return DynamicConfiguration
+        .getDynamicConfiguration(tenant, namespace, key, clazz, defaultValue, this);
+  }
+
+  /**
+   * Gets dynamic configuration values.
+   *
+   * @param <T>          the type parameter
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration values
+   */
+  public default <T> DynamicConfiguration<List<T>> getDynamicConfigurationValues(String key,
+                                                                                 Class<T> clazz,
+                                                                                 T defaultValue) {
+    return getDynamicConfigurationValues(null, key, clazz, defaultValue);
+  }
+
+  /**
+   * Gets dynamic configuration values.
+   *
+   * @param <T>          the type parameter
+   * @param namespace    the namespace
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration values
+   */
+  public default <T> DynamicConfiguration<List<T>> getDynamicConfigurationValues(String namespace,
+                                                                                 String key,
+                                                                                 Class<T> clazz,
+                                                                                 T defaultValue) {
+    return getDynamicConfigurationValues(tenant.get(), namespace, key, clazz, defaultValue);
+  }
+
+  /**
+   * Gets dynamic configuration values.
+   *
+   * @param <T>          the type parameter
+   * @param tenant       the tenant
+   * @param namespace    the namespace
+   * @param key          the key
+   * @param clazz        the clazz
+   * @param defaultValue the default value
+   * @return the dynamic configuration values
+   */
+  public default <T> DynamicConfiguration<List<T>> getDynamicConfigurationValues(String tenant,
+                                                                                 String namespace,
+                                                                                 String key,
+                                                                                 Class<T> clazz,
+                                                                                 T defaultValue) {
+    return DynamicConfiguration
+        .getDynConfiguration(tenant, namespace, key, clazz, defaultValue, this);
+  }
+
+  /**
+   * Gets as string values.
+   *
+   * @param key the key
+   * @return the as string values
+   */
+  public default List<String> getAsStringValues(String key) {
+    return getAsStringValues(null, key);
+  }
+
+  /**
+   * Gets as string values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as string values
+   */
+  public default List<String> getAsStringValues(String namespace, String key) {
+    return getAsStringValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as string values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as string values
+   */
+  public default List<String> getAsStringValues(String tenantId, String namespace, String key) {
+    String[] tempArray = get(tenantId, namespace, key, String[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as byte values.
+   *
+   * @param key the key
+   * @return the as byte values
+   */
+  public default List<Byte> getAsByteValues(String key) {
+    return getAsByteValues(null, key);
+  }
+
+  /**
+   * Gets as byte values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as byte values
+   */
+  public default List<Byte> getAsByteValues(String namespace, String key) {
+    return getAsByteValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as byte values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as byte values
+   */
+  public default List<Byte> getAsByteValues(String tenantId, String namespace, String key) {
+    Byte[] tempArray = get(tenantId, namespace, key, Byte[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as short values.
+   *
+   * @param key the key
+   * @return the as short values
+   */
+  public default List<Short> getAsShortValues(String key) {
+    return getAsShortValues(null, key);
+  }
+
+  /**
+   * Gets as short values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as short values
+   */
+  public default List<Short> getAsShortValues(String namespace, String key) {
+    return getAsShortValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as short values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as short values
+   */
+  public default List<Short> getAsShortValues(String tenantId, String namespace, String key) {
+    Short[] tempArray = get(tenantId, namespace, key, Short[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as integer values.
+   *
+   * @param key the key
+   * @return the as integer values
+   */
+  public default List<Integer> getAsIntegerValues(String key) {
+    return getAsIntegerValues(null, key);
+  }
+
+  /**
+   * Gets as integer values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as integer values
+   */
+  public default List<Integer> getAsIntegerValues(String namespace, String key) {
+    return getAsIntegerValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as integer values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as integer values
+   */
+  public default List<Integer> getAsIntegerValues(String tenantId, String namespace, String key) {
+    Integer[] tempArray = get(tenantId, namespace, key, Integer[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as double values.
+   *
+   * @param key the key
+   * @return the as double values
+   */
+  public default List<Double> getAsDoubleValues(String key) {
+    return getAsDoubleValues(null, key);
+  }
+
+  /**
+   * Gets as double values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as double values
+   */
+  public default List<Double> getAsDoubleValues(String namespace, String key) {
+    return getAsDoubleValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as double values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as double values
+   */
+  public default List<Double> getAsDoubleValues(String tenantId, String namespace, String key) {
+    Double[] tempArray = get(tenantId, namespace, key, Double[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as float values.
+   *
+   * @param key the key
+   * @return the as float values
+   */
+  public default List<Float> getAsFloatValues(String key) {
+    return getAsFloatValues(null, key);
+  }
+
+  /**
+   * Gets as float values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as float values
+   */
+  public default List<Float> getAsFloatValues(String namespace, String key) {
+    return getAsFloatValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as float values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as float values
+   */
+  public default List<Float> getAsFloatValues(String tenantId, String namespace, String key) {
+    Float[] tempArray = get(tenantId, namespace, key, Float[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as boolean values.
+   *
+   * @param key the key
+   * @return the as boolean values
+   */
+  public default List<Boolean> getAsBooleanValues(String key) {
+    return getAsBooleanValues(null, key);
+  }
+
+  /**
+   * Gets as boolean values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as boolean values
+   */
+  public default List<Boolean> getAsBooleanValues(String namespace, String key) {
+    return getAsBooleanValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as boolean values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as boolean values
+   */
+  public default List<Boolean> getAsBooleanValues(String tenantId, String namespace, String key) {
+    Boolean[] tempArray = get(tenantId, namespace, key, Boolean[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Gets as character values.
+   *
+   * @param key the key
+   * @return the as character values
+   */
+  public default List<Character> getAsCharacterValues(String key) {
+    return getAsCharacterValues(null, key);
+  }
+
+  /**
+   * Gets as character values.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as character values
+   */
+  public default List<Character> getAsCharacterValues(String namespace, String key) {
+    return getAsCharacterValues(tenant.get(), namespace, key);
+  }
+
+  /**
+   * Gets as character values.
+   *
+   * @param tenantId  the tenant id
+   * @param namespace the namespace
+   * @param key       the key
+   * @return the as character values
+   */
+  public default List<Character> getAsCharacterValues(String tenantId, String namespace,
+                                                      String key) {
+    Character[] tempArray = get(tenantId, namespace, key, Character[].class);
+    return tempArray == null ? Arrays.asList() : Arrays.asList(tempArray);
+  }
+
+  /**
+   * Get t.
+   *
+   * @param <T>       the type parameter
+   * @param tenant    the tenant
+   * @param namespace the namespace
+   * @param key       the key
+   * @param clazz     the clazz
+   * @param hints     the hints
+   * @return the t
+   */
+  public <T> T get(String tenant, String namespace, String key, Class<T> clazz, Hint... hints);
+
+  /**
+   * Add configuration change listener.
+   *
+   * @param key    the key
+   * @param myself the myself
+   */
+  public default void addConfigurationChangeListener(String key,
+                                                     ConfigurationChangeListener myself) {
+    addConfigurationChangeListener(null, key, myself);
+  }
+
+  /**
+   * Add configuration change listener.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @param myself    the myself
+   */
+  public default void addConfigurationChangeListener(String namespace, String key,
+                                                     ConfigurationChangeListener myself) {
+    addConfigurationChangeListener(tenant.get(), namespace, key, myself);
+  }
+
+  /**
+   * Add configuration change listener.
+   *
+   * @param tenant    the tenant
+   * @param namespace the namespace
+   * @param key       the key
+   * @param myself    the myself
+   */
+  public void addConfigurationChangeListener(String tenant, String namespace, String key,
+                                             ConfigurationChangeListener myself);
+
+  /**
+   * Remove configuration change listener.
+   *
+   * @param key    the key
+   * @param myself the myself
+   */
+  public default void removeConfigurationChangeListener(String key,
+                                                        ConfigurationChangeListener myself) {
+    removeConfigurationChangeListener(null, key, myself);
+  }
+
+  /**
+   * Remove configuration change listener.
+   *
+   * @param namespace the namespace
+   * @param key       the key
+   * @param myself    the myself
+   */
+  public default void removeConfigurationChangeListener(String namespace, String key,
+                                                        ConfigurationChangeListener myself) {
+    removeConfigurationChangeListener(tenant.get(), namespace, key, myself);
+  }
+
+  /**
+   * Remove configuration change listener.
+   *
+   * @param tenant    the tenant
+   * @param namespace the namespace
+   * @param key       the key
+   * @param myself    the myself
+   */
+  public void removeConfigurationChangeListener(String tenant, String namespace, String key,
+                                                ConfigurationChangeListener myself);
+
+  public default <T> Map<String, T> populateMap(String key, Class<T> clazz){
+    return populateMap(null, key, clazz);
+  }
+  public default <T> Map<String, T> populateMap(String namespace, String key, Class<T> clazz){
+    return populateMap(tenant.get(), namespace, key, clazz);
+  }
+  public <T> Map<String, T> populateMap(String tenantId, String namespace, String key, Class<T> clazz);
+
+  public default Map generateMap(String key){
+    return generateMap(null, key);
+  }
+  public default Map generateMap(String namespace, String key){
+    return generateMap(tenant.get(), namespace, key);
+  }
+  public Map generateMap(String tenantId, String namespace, String key);
+
+}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationChangeListener.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationChangeListener.java
new file mode 100644
index 0000000..451a75f
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationChangeListener.java
@@ -0,0 +1,14 @@
+package org.onap.config.api;
+
+public interface ConfigurationChangeListener {
+
+  public default void notify(String tenantId, String component, String key, Object oldValue,
+                             Object newValue) {
+  }
+
+  public default void notify(String component, String key, Object oldValue, Object newValue) {
+  }
+
+  public default void notify(String key, Object oldValue, Object newValue) {
+  }
+}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
new file mode 100644
index 0000000..0e8f1409
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
@@ -0,0 +1,98 @@
+package org.onap.config.api;
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
+import java.util.Collection;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+/**
+ * The interface Configuration manager.
+ */
+public interface ConfigurationManager extends Configuration {
+
+  /**
+   * The constant config.
+   */
+  public static final Configuration config = lookup();
+
+  /**
+   * Lookup configuration.
+   *
+   * @return the configuration
+   */
+  public static Configuration lookup() {
+    if (config == null) {
+      ServiceLoader<ConfigurationManager> loader = ServiceLoader.load(ConfigurationManager.class);
+      for (ConfigurationManager configuration : loader) {
+        return (Configuration) Proxy.newProxyInstance(ConfigurationManager.class.getClassLoader(),
+            new Class[]{Configuration.class}, (object, method, args) -> {
+              try {
+                return method.invoke(configuration, args);
+              } catch (InvocationTargetException ite) {
+                throw ite.getTargetException();
+              }
+            });
+      }
+    }
+    return config;
+  }
+
+  /**
+   * Gets configuration value.
+   *
+   * @param queryData the query data
+   * @return the configuration value
+   */
+  public String getConfigurationValue(Map<String, Object> queryData);
+
+  /**
+   * Update configuration value.
+   *
+   * @param updateData the update data
+   */
+  public void updateConfigurationValue(Map<String, Object> updateData);
+
+  /**
+   * List configuration map.
+   *
+   * @param query the query
+   * @return the map
+   */
+  public Map<String, String> listConfiguration(Map<String, Object> query);
+
+  /**
+   * Update configuration values boolean.
+   *
+   * @param tenant              the tenant
+   * @param namespace           the namespace
+   * @param configKeyValueStore the config key value store
+   * @return the boolean
+   */
+  public boolean updateConfigurationValues(String tenant, String namespace,
+                                           Map configKeyValueStore);
+
+  /**
+   * Gets tenants.
+   *
+   * @return the tenants
+   */
+  public Collection<String> getTenants();
+
+  /**
+   * Gets namespaces.
+   *
+   * @return the namespaces
+   */
+  public Collection<String> getNamespaces();
+
+  /**
+   * Gets keys.
+   *
+   * @param tenant    the tenant
+   * @param namespace the namespace
+   * @return the keys
+   */
+  public Collection<String> getKeys(String tenant, String namespace);
+}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/DynamicConfiguration.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/DynamicConfiguration.java
new file mode 100644
index 0000000..969749b
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/DynamicConfiguration.java
@@ -0,0 +1,146 @@
+package org.onap.config.api;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The type Dynamic configuration.
+ *
+ * @param <T> the type parameter
+ */
+public class DynamicConfiguration<T> {
+
+  /**
+   * The Tenant.
+   */
+  String tenant;
+  /**
+   * The Namespace.
+   */
+  String namespace;
+  /**
+   * The Key.
+   */
+  String key;
+  /**
+   * The Configuration.
+   */
+  Configuration configuration;
+  /**
+   * The Clazz.
+   */
+  Class clazz;
+  /**
+   * The Default value.
+   */
+  T defaultValue;
+
+  /**
+   * Gets dynamic configuration.
+   *
+   * @param <T>           the type parameter
+   * @param tenant        the tenant
+   * @param namespace     the namespace
+   * @param key           the key
+   * @param clazz         the clazz
+   * @param defaultValue  the default value
+   * @param configuration the configuration
+   * @return the dynamic configuration
+   */
+  public static <T> DynamicConfiguration<T> getDynamicConfiguration(String tenant, String namespace,
+                                                                    String key, Class<T> clazz,
+                                                                    T defaultValue,
+                                                                    Configuration configuration) {
+    DynamicConfiguration<T> dynamicConfiguration = new DynamicConfiguration<>();
+    dynamicConfiguration.tenant = tenant;
+    dynamicConfiguration.namespace = namespace;
+    dynamicConfiguration.key = key;
+    dynamicConfiguration.clazz = clazz;
+    dynamicConfiguration.defaultValue = defaultValue;
+    dynamicConfiguration.configuration = configuration;
+    return dynamicConfiguration;
+  }
+
+  /**
+   * Gets dyn configuration.
+   *
+   * @param <K>           the type parameter
+   * @param tenant        the tenant
+   * @param namespace     the namespace
+   * @param key           the key
+   * @param clazz         the clazz
+   * @param defaultValue  the default value
+   * @param configuration the configuration
+   * @return the dyn configuration
+   */
+  public static <K> DynamicConfiguration<List<K>> getDynConfiguration(String tenant,
+                                                                      String namespace, String key,
+                                                                      Class<K> clazz,
+                                                                      K defaultValue,
+                                                                      Configuration configuration) {
+    if (clazz.isPrimitive()) {
+      throw new RuntimeException(
+          "Only Wrapper classes like Integer, Long, Double, "
+              + "Boolean etc including String are supported.");
+    }
+    return getDynamicConfiguration(tenant, namespace, key, getArrayClass(clazz),
+        Arrays.asList(defaultValue), configuration);
+  }
+
+  /**
+   * Gets array class.
+   *
+   * @param clazz the clazz
+   * @return the array class
+   */
+  public static Class getArrayClass(Class clazz) {
+    Class arrayClass = null;
+    switch (clazz.getName()) {
+      case "java.lang.Byte":
+        arrayClass = Byte[].class;
+        break;
+      case "java.lang.Short":
+        arrayClass = Short[].class;
+        break;
+      case "java.lang.Integer":
+        arrayClass = Integer[].class;
+        break;
+      case "java.lang.Long":
+        arrayClass = Long[].class;
+        break;
+      case "java.lang.Float":
+        arrayClass = Float[].class;
+        break;
+      case "java.lang.Double":
+        arrayClass = Double[].class;
+        break;
+      case "java.lang.Boolean":
+        arrayClass = Boolean[].class;
+        break;
+      case "java.lang.Character":
+        arrayClass = Character[].class;
+        break;
+      case "java.lang.String":
+        arrayClass = String[].class;
+        break;
+      default:
+    }
+    return arrayClass;
+  }
+
+  /**
+   * Get t.
+   *
+   * @return the t
+   */
+  public T get() {
+    Object toReturn = configuration
+        .get(tenant, namespace, key, clazz, Hint.LATEST_LOOKUP, Hint.EXTERNAL_LOOKUP,
+            Hint.NODE_SPECIFIC);
+    if (toReturn != null && toReturn.getClass().isArray()) {
+      toReturn = Arrays.asList((Object[]) toReturn);
+    }
+    return toReturn == null ? defaultValue : (T) toReturn;
+  }
+
+}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
new file mode 100644
index 0000000..17b58f6
--- /dev/null
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
@@ -0,0 +1,18 @@
+package org.onap.config.api;
+
+public enum Hint {
+
+  DEFAULT(0b0), LATEST_LOOKUP(0b1), EXTERNAL_LOOKUP(0b10), NODE_SPECIFIC(0b100);
+
+  private final int lookupHint;
+
+  private Hint(int hnt) {
+    lookupHint = hnt;
+  }
+
+  public int value() {
+    return lookupHint;
+  }
+
+
+}
