ONOS-5318 Proprietary Config Store

Change-Id: Ic787d73d9d541a93f5e957a3369dbab4b5fa9a6c
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
index 46b8415..ada10b8 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentPath.java
@@ -86,6 +86,17 @@
     }
 
     /**
+     * Returns the relative  path to the given node.
+     *
+     * @return relative  path to the given node.
+     */
+    public DocumentPath childPath() {
+        if (pathElements.size() <= 1) {
+            return null;
+        }
+        return new DocumentPath(this.pathElements.subList(pathElements.size() - 1, pathElements.size()));
+    }
+    /**
      * Returns a path for the parent of this node.
      *
      * @return parent node path. If this path is for the root, returns {@code null}.
@@ -183,7 +194,6 @@
                 return this.pathElements.get(i).compareTo(that.pathElements.get(i));
             }
         }
-
         if (this.pathElements.size() > that.pathElements.size()) {
             return 1;
         } else if (that.pathElements.size() > this.pathElements.size()) {
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigFilter.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigFilter.java
new file mode 100644
index 0000000..5df2593
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigFilter.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import java.util.Set;
+
+/**
+ * Abstraction for Filters that can be used while traversing the PropConfig stores.
+ * This abstraction allows to select entries of interest based on various criteria
+ * defined by this interface.
+ * Only criteria based on {@code ConfigNodePath} are supported currently.
+ * Filters can be used with "GET" methods of {@code ProprietaryConfigService}
+ */
+public interface ConfigFilter {
+    /**
+     * Builder for ConfigFilter.
+     */
+    interface Builder {
+        /**
+         * Adds new ConfigNodePath filtering criteria to a ConfigFilter object.
+         * If the same ConfigNodePath is already part of the criteria
+         * for the object, it will not be added again, but will not throw any exceptions.
+         * This will not check for the validity of the ConfigNodePath.
+         *
+         * @param add new criteria
+         * @return a ConfigFilter builder
+         */
+        Builder addCriteria(Set<ConfigNodePath> add);
+
+        /**
+         * Removes the given ConfigNodePath filtering criteria from a ConfigFilter object.
+         * If the ConfigNodePath was NOT already part of the criteria for
+         * the object, it will not be removed, but will not throw any exceptions.
+         * This will not check for the validity of the PropCfgInstancePaths.
+         *
+         * @param remove criteria to be removed
+         * @return a ConfigFilter builder
+         */
+        Builder removeCriteria(Set<ConfigNodePath> remove);
+
+        /**
+         * Builds an immutable ConfigFilter entity.
+         *
+         * @return ConfigFilter
+         */
+        ConfigFilter build();
+    }
+
+    /**
+     * Method to list all the ConfigNodePath criteria that are in place for a ConfigFilter.
+     *
+     * @return Set of ConfigNodePath criteria for this entity
+     */
+    Set<ConfigNodePath> getCriteria();
+
+    /**
+     * Method to create a filter that include all entries rejected by the criteria.
+     *
+     * @param original filter object with a criteria set
+     * @return ConfigFilter  object with negated criteria set
+     * @throws InvalidFilterException if the received ConfigFilter object
+     * was null or if it had an empty criteria set
+     */
+    ConfigFilter negateFilter(ConfigFilter original);
+
+    /**
+     * Method to check if the ConfigFilter has an empty criteria set.
+     *
+     * @return {@code true} if criteria set is empty, {@code true} otherwise.
+     */
+    boolean isEmptyFilter();
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNode.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNode.java
new file mode 100644
index 0000000..64e6ad0
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNode.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import java.util.List;
+
+/**
+ * Abstraction of an instance in the elastic  config store.
+ */
+public interface ConfigNode<V> {
+    /**
+     * Builder for ConfigNode.
+     */
+    interface Builder<V> {
+        /**
+         * Adds the type of the instance node.
+         *
+         * @param type node type
+         * @return a ConfigNode builder
+         */
+        Builder addType(NodeType type);
+
+        /**
+         * Adds the value of the instance node.
+         *
+         * @param value at the node
+         * @return a ConfigNode builder
+         */
+        Builder addValue(Class<V> value);
+
+        /**
+         * Adds children to the children field.
+         *
+         * @param children to be added
+         * @return a ConfigNode builder
+         */
+        Builder addChildren(Class<ConfigNode> children);
+
+        /**
+         * Builds an immutable ConfigNode entity.
+         *
+         * @return ConfigNode
+         */
+        ConfigNode build();
+    }
+
+    /**
+     * Returns the type of the instance node.
+     *
+     * @return node type
+     */
+    NodeType type();
+
+    /**
+     * Returns the value of the instance node.
+     *
+     * @return value at  the node
+     */
+    Class<V> value();
+
+    /**
+     * Returns the children of the instance node.
+     *
+     * @return children of the node
+     */
+    List<ConfigNode> children();
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNodePath.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNodePath.java
new file mode 100644
index 0000000..8242383
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigNodePath.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import org.onlab.util.Identifier;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Abstraction of the key to an instance in the elastic config store.
+ * Path to each node would contain info about its hierarchy too.
+ */
+public final class ConfigNodePath extends Identifier<String> {
+
+    private final String parentKey;
+    private final String nodeKey;
+
+    /**
+     * Creates a new ConfigNodePath from parentKey and nodeKey.
+     *
+     * @param parentKey absolute path to the parent.
+     * @param nodeKey relative path to the node.
+     */
+    public ConfigNodePath(String parentKey, String nodeKey) {
+        super(checkNotNull(parentKey, "parent key is null").concat(checkNotNull(nodeKey, "node key is null")));
+        this.parentKey = parentKey;
+        this.nodeKey = nodeKey;
+    }
+
+    /**
+     * Returns the parent key.
+     *
+     * @return absolute path to the parent
+     */
+    public String parentKey() {
+        return parentKey;
+    }
+
+    /**
+     * Returns the node key.
+     *
+     * @return relative path to the node
+     */
+    public String nodeKey() {
+        return nodeKey;
+    }
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigStoreType.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigStoreType.java
new file mode 100644
index 0000000..5cee8a9
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ConfigStoreType.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+/**
+ * Designates the store type for various Proprietary Config stores.
+ */
+public enum ConfigStoreType {
+    /**
+     * Network Element Config.
+     */
+    NE_CONFIG,
+    /**
+     * Network Config.
+     */
+    NW_CONFIG,
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigEvent.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigEvent.java
new file mode 100644
index 0000000..1eb1dc3
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigEvent.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * Describes a ProprietaryConfig event.
+ */
+public class ElasticConfigEvent extends AbstractEvent<ElasticConfigEvent.Type, ConfigNodePath> {
+
+    private final ConfigNode value;
+
+    /**
+     * Type of configuration events.
+     */
+    public enum Type {
+        /**
+         * Signifies that a prop configuration instance was added.
+         */
+        NODE_ADDED,
+
+        /**
+         * Signifies that prop configuration instance was updated.
+         */
+        NODE_UPDATED,
+
+        /**
+         * Signifies that prop configuration instance was removed.
+         */
+        NODE_REMOVED,
+        /**
+         * Signifies that a prop configuration subtree was added.
+         */
+        SUBTREE_ADDED,
+
+        /**
+         * Signifies that prop configuration subtree was updated.
+         */
+        SUBTREE_UPDATED,
+
+        /**
+         * Signifies that prop configuration subtree was removed.
+         */
+        SUBTREE_REMOVED
+    }
+
+    /**
+     * Creates an event of a given type, config node value and config node path.
+     *
+     * @param type  config node type
+     * @param path  config node path
+     * @param value config node value
+     */
+    public ElasticConfigEvent(Type type, ConfigNodePath path, ConfigNode value) {
+        super(type, path);
+        this.value = value;
+    }
+
+    /**
+     * Returns the config node value.
+     *
+     * @return ConfigNode value
+     */
+    public ConfigNode value() {
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigListener.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigListener.java
new file mode 100644
index 0000000..9baa901
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2015-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.incubator.elasticcfg;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Entity capable of receiving elastic config change events.
+ */
+public interface ElasticConfigListener extends EventListener<ElasticConfigEvent> {
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigService.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigService.java
new file mode 100644
index 0000000..6597184
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigService.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import org.onosproject.event.ListenerService;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Service for storing and distributing elastic configuration data.
+ */
+public interface ElasticConfigService
+        extends ListenerService<ElasticConfigEvent, ElasticConfigListener> {
+    /**
+     * Adds a new node to the elastic config store.
+     *
+     * @param store type of store to which the application wants to add the node to.
+     * @param path  data structure with absolute path to the parent and relative
+     *              path to the node
+     * @param node  data structure with nodetype and value to be stored at the node
+     * @return future that is completed with {@code true} if the new node was successfully
+     * added. Future will be completed with {@code false} if a node already exists at
+     * the specified path. Future will be completed exceptionally with a
+     * {@code FailedException} if the parent node (for the node to create) does not exist.
+     */
+    CompletableFuture<Boolean> addNode(ConfigStoreType store,
+                                       ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Removes  a node from the elastic config store.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @return future for the previous value. Future will be completed with a
+     * {@code FailedException} if the node to be removed is either the root
+     * node or has one or more children or if the node to be removed does not exist.
+     */
+    CompletableFuture<ConfigNode> removeNode(ConfigStoreType store, ConfigNodePath path);
+
+    /**
+     * Creates/Updates  a node in the elastic config store.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param node  data structure with nodetype and new value to be stored at the node
+     * @return future for the previous value. Future will be completed with {@code null}
+     * if there was no node previously at that path.
+     * Future will be completed with a {@code FailedException}
+     * if the parent node (for the node to create/update) does not exist.
+     */
+    CompletableFuture<ConfigNode> updateNode(ConfigStoreType store,
+                                             ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Creates nodes in the elastic config store, recursively by creating
+     * all missing intermediate nodes in the path.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and relative
+     *              path to the node
+     * @param node  recursive data structure with nodetype and value to
+     *              be stored at the node
+     * @return future that is completed with {@code true} if all the new
+     * nodes were  successfully
+     * created. Future will be completed with {@code false} if any node
+     * already exists at the specified path
+     * //TODO
+     */
+    CompletableFuture<Boolean> createRecursive(ConfigStoreType store,
+                                               ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Delete nodes in the elastic config store, recursively by deleting all
+     * intermediate nodes in the path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @return future that is completed with {@code true} if all the
+     * nodes under the given path including the node at the path could
+     * be successfully deleted. Future will be completed with {@code false}
+     * if the node at the given path or any parent node
+     * did not exist //TODO
+     */
+    CompletableFuture<Boolean> deleteRecursive(ConfigStoreType store, ConfigNodePath path);
+
+    /**
+     * Creates/Updates nodes in the elastic config store, recursively by creating
+     * all missing intermediate nodes in the path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param node  recursive data structure with nodetype and value to
+     *              be stored at the node
+     * @return future that is completed with {@code true} if all the
+     * nodes under the given path
+     * including the node at the path could be successfully updated.
+     * Future will be completed with {@code false} if the node at the
+     * given path or any parent node
+     * did not exist //TODO
+     */
+    CompletableFuture<Boolean> updateRecursive(ConfigStoreType store,
+                                               ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Returns a value node or subtree under the given path.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param mode whether to retrieve the nodes recursively or not
+     * @param filter filtering conditions to be applied on the result
+     *               list of nodes.
+     * @return future that will be completed either with a value node
+     * or a recursive data structure containing the subtree;
+     * will be completed with {@code null} if
+     * after applying the filter, the result is an empty list of nodes.
+     * Future will be completed with a {@code FailedException} if path
+     * does not point to a valid node.
+     *
+     */
+   CompletableFuture<ConfigNode> getNode(ConfigStoreType store,
+                                         ConfigNodePath path, TraversalMode mode,
+                                         ConfigFilter filter);
+
+    /**
+     * Returns the number of children under the given path, excluding
+     * the node at the path.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param filter how the value nodes should be filtered
+     * @return future that will be completed with {@code Integer}, the
+     * count of the children
+     * after applying the filtering conditions as well.
+     * Future will be completed with a {@code FailedException} if path
+     * does not point to a valid node
+     */
+    CompletableFuture<Integer> getNumberOfChildren(ConfigStoreType store,
+                                                   ConfigNodePath path, ConfigFilter filter);
+
+    //TODO
+    /**
+     * Filter
+     * What should be the filtering conditions?
+     * a list of keys? node attribute/s? level1 children?
+     * Merge Trees
+     * add sub tree
+     * delete subtree
+     * update sub tree
+     * get sub tree
+     * How to handle big subtrees?
+     * how many levels? how many results to limit?
+     */
+
+    /**
+     * Registers a listener to be notified when the subtree rooted at
+     * the specified path
+     * is modified.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param listener listener to be notified
+     * @return a future that is completed when the operation completes
+     */
+    CompletableFuture<Void> addConfigListener(ConfigStoreType store,
+                                              ConfigNodePath path,
+                                              ElasticConfigListener listener);
+
+    /**
+     * Unregisters a previously added listener.
+     *
+     * @param listener listener to unregister
+     * @return a future that is completed when the operation completes
+     */
+  CompletableFuture<Void> removeConfigListener(ElasticConfigListener listener);
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStore.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStore.java
new file mode 100644
index 0000000..e5008a4
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStore.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+import org.onosproject.store.Store;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Store service for storing and distributing elastic configuration data.
+ */
+public interface ElasticConfigStore
+        extends Store<ElasticConfigEvent, ElasticConfigStoreDelegate> {
+    /**
+     * Adds a new node to the ElasticConfigStore.
+     *
+     * @param store type of store to which the application wants to add the node to.
+     * @param path  data structure with absolute path to the parent and relative
+     *              path to the node
+     * @param node  data structure with nodetype and value to be stored at the node
+     * @return future that is completed with {@code true} if the new node was successfully
+     * added. Future will be completed with {@code false} if a node already exists at
+     * the specified path. Future will be completed exceptionally with a
+     * {@code FailedException} if the parent node (for the node to create) does not exist.
+     */
+    CompletableFuture<Boolean>
+    addNode(ConfigStoreType store, ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Removes  a node from the ElasticConfigStore.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @return future for the previous value. Future will be completed with a
+     * {@code FailedException} if the node to be removed is either the root
+     * node or has one or more children or if the node to be removed does not exist.
+     */
+    CompletableFuture<ConfigNode>
+    removeNode(ConfigStoreType store, ConfigNodePath path);
+
+    /**
+     * Creates/Updates  a node in the ElasticConfigStore.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param node  data structure with nodetype and new value to be stored at the node
+     * @return future for the previous value. Future will be completed with {@code null}
+     * if there was no node previously at that path.
+     * Future will be completed with a {@code FailedException}
+     * if the parent node (for the node to create/update) does not exist.
+     */
+    CompletableFuture<ConfigNode>
+    updateNode(ConfigStoreType store, ConfigNodePath path, ConfigNode node);
+
+    /**
+     * Creates nodes in the ElasticConfigStore, recursively by creating
+     * all missing intermediate nodes in the path.
+     *
+     * @param store type of store which the application wants to access.
+     * @param path  data structure with absolute path to the parent and relative
+     *              path to the node
+     * @param node  recursive data structure with nodetype and value to
+     *              be stored at the node
+     * @return future that is completed with {@code true} if all the new
+     * nodes were  successfully
+     * created. Future will be completed with {@code false} if any node
+     * already exists at the specified path
+     * //TODO
+     */
+    CompletableFuture<Boolean>
+    createRecursive(ConfigStoreType store, ConfigNodePath path,
+                    ConfigNode node);
+
+    /**
+     * Delete nodes in the ElasticConfigStore, recursively by deleting all
+     * intermediate nodes in the path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @return future that is completed with {@code true} if all the
+     * nodes under the given path including the node at the path could
+     * be successfully deleted. Future will be completed with {@code false}
+     * if the node at the given path or any parent node
+     * did not exist //TODO
+     */
+    CompletableFuture<Boolean>
+    deleteRecursive(ConfigStoreType store, ConfigNodePath path);
+
+    /**
+     * Creates/Updates nodes in the ElasticConfigStore, recursively by creating
+     * all missing intermediate nodes in the path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param node  recursive data structure with nodetype and value to
+     *              be stored at the node
+     * @return future that is completed with {@code true} if all the
+     * nodes under the given path
+     * including the node at the path could be successfully updated.
+     * Future will be completed with {@code false} if the node at the
+     * given path or any parent node
+     * did not exist //TODO
+     */
+    CompletableFuture<Boolean>
+    updateRecursive(ConfigStoreType store, ConfigNodePath path,
+                   ConfigNode node);
+
+    /**
+     * Returns a value node or subtree under the given path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param mode wether to retrive the nodes recursivley or not
+     * @param filter filtering conditions to be applied on the result
+     *               list of nodes.
+     * @return future that will be completed either with a value node
+     * or a recursive data structure containing the subtree;
+     * will be completed with {@code null} if
+     * after applying the filter, the result is an empty list of nodes.
+     * Future will be completed with a {@code FailedException} if path
+     * does not point to a valid node.
+     *
+     */
+   CompletableFuture<ConfigNode>
+   getNode(ConfigStoreType store, ConfigNodePath path,
+           TraversalMode mode, ConfigFilter filter);
+
+    /**
+     * Returns the number of children under the given path, excluding
+     * the node at the path.
+     *
+     * @param store type of store which the appplication wants to access.
+     * @param path  data structure with absolute path to the parent and
+     *              relative path to the node
+     * @param filter how the value nodes should be filtered
+     * @return future that will be completed with {@code Integer}, the
+     * count of the children
+     * after applying the filtering conditions as well.
+     * Future will be completed with a {@code FailedException} if path
+     * does not point to a valid node
+     */
+    CompletableFuture<Integer>
+   getNumberOfChildren(ConfigStoreType store,
+                       ConfigNodePath path, ConfigFilter filter);
+
+    //TODO
+    /**
+     * Filter
+     * What should be the filtering conditions?
+     * a list of keys? node attribute/s? level1 children?
+     * Merge Trees
+     * add sub tree
+     * delete subtree
+     * update sub tree
+     * get sub tree
+     * How to handle big subtrees?
+     * how many levels? how many results to limit?
+     */
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStoreDelegate.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStoreDelegate.java
new file mode 100644
index 0000000..6d9a4b9
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/ElasticConfigStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2015-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.incubator.elasticcfg;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * Proprietary configuration store delegate abstraction.
+ */
+public interface ElasticConfigStoreDelegate extends StoreDelegate<ElasticConfigEvent> {
+}
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/FailedException.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/FailedException.java
new file mode 100644
index 0000000..b3e30d6
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/FailedException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+/**
+ * Exceptions for use by the {@code PropConfigService}.
+ */
+public class FailedException extends RuntimeException {
+
+    /**
+     * Constructs a new runtime exception with no error message.
+     */
+    public FailedException() {
+        super();
+    }
+
+    /**
+     * Constructs a new runtime exception with the given error message.
+     *
+     * @param message error message
+     */
+    public FailedException(String message) {
+        super(message);
+    }
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/InvalidFilterException.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/InvalidFilterException.java
new file mode 100644
index 0000000..a5b8149
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/InvalidFilterException.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+/**
+ * Exceptions for use by the {@code ConfigFilter}.
+ */
+public class InvalidFilterException extends RuntimeException {
+
+    /**
+     * Constructs a new runtime exception with no error message.
+     */
+    public InvalidFilterException() {
+        super();
+    }
+
+    /**
+     * Constructs a new runtime exception with the given error message.
+     *
+     * @param message error message
+     */
+    public InvalidFilterException(String message) {
+        super(message);
+    }
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/NodeType.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/NodeType.java
new file mode 100644
index 0000000..5f1b042
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/NodeType.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+/**
+ * Node Type representation for applications.
+ * Indicates the possible node types that would be communicated by/to the applications.
+ */
+public enum NodeType {
+
+    /**
+     * ROOT node of the tree.
+     */
+    ROOT,
+    /**
+     * LEAF node on the tree.
+     */
+    LEAF,
+    /**
+     * Subtree as a recursive data structure.
+     */
+    COMPOSITE,
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/TraversalMode.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/TraversalMode.java
new file mode 100644
index 0000000..bbdb2bc
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/TraversalMode.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016-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.incubator.elasticcfg;
+
+/**
+ * Traversal Modes for the PropConfig Stores.
+ */
+
+public enum TraversalMode {
+    /**
+     * Tree will be traversed recursively.
+     */
+    RECURSIVE,
+    /**
+     * Tree will NOT be traversed.
+     */
+    NON_RECURSIVE;
+}
\ No newline at end of file
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/package-info.java b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/package-info.java
new file mode 100644
index 0000000..9d849ee
--- /dev/null
+++ b/incubator/api/src/main/java/org/onosproject/incubator/elasticcfg/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015-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.
+ */
+
+/**
+ * Abstractions for interacting with the elastic configuration subsystem.
+ */
+package org.onosproject.incubator.elasticcfg;