[ONOS-4694] YANG management system outline and YMSM/YDT interfaces

Change-Id: I050ed98ba18edc2c2cea2abafeee6d8c9061b579
diff --git a/apps/yms/BUCK b/apps/yms/BUCK
new file mode 100644
index 0000000..163d67e
--- /dev/null
+++ b/apps/yms/BUCK
@@ -0,0 +1,11 @@
+BUNDLES = [
+  '//apps/yms/api:onos-apps-yms-api',
+  '//apps/yms/app:onos-apps-yms-app',
+]
+
+onos_app(
+  title = 'YANG Management System App',
+  category = 'Utility',
+  url = 'http://onosproject.org',
+  included_bundles = BUNDLES,
+)
diff --git a/apps/yms/api/BUCK b/apps/yms/api/BUCK
new file mode 100644
index 0000000..013d7cc
--- /dev/null
+++ b/apps/yms/api/BUCK
@@ -0,0 +1,7 @@
+COMPILE_DEPS = [
+  '//lib:CORE_DEPS',
+]
+
+osgi_jar_with_tests(
+  deps = COMPILE_DEPS,
+)
diff --git a/apps/yms/api/pom.xml b/apps/yms/api/pom.xml
new file mode 100644
index 0000000..32fd818
--- /dev/null
+++ b/apps/yms/api/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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>
+
+    <parent>
+        <artifactId>onos-yms</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.7.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-app-yms-api</artifactId>
+    <packaging>bundle</packaging>
+
+    <url>http://onosproject.org</url>
+
+    <description>YANG Management System API</description>
+
+</project>
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/package-info.java b/apps/yms/api/src/main/java/org/onosproject/yms/package-info.java
new file mode 100644
index 0000000..1a6e8fa
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/package-info.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides interfaces to YANG management system. YANG management system
+ * is a core of YANG in ONOS.
+ *
+ * In NBI, it acts as a broker in between the protocol and application,
+ * here there is a separate protocol implementation, which does the conversion
+ * of protocol representation to abstract data tree. The protocol
+ * implementation takes care of the protocol specific actions for
+ * e.g. RESTCONF handling the entity-tag / timestamp related operations.
+ *
+ * In SBI, driver or provider uses YANG codec handler as a utility to translate
+ * the request information in java(YANG utils generated) to protocol specific
+ * format and vice versa.
+ */
+package org.onosproject.yms;
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java
new file mode 100644
index 0000000..f2433fa
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java
@@ -0,0 +1,35 @@
+/*
+ * 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.yms.ych;
+
+/**
+ * Abstraction of an entity which provides interfaces to YANG codec handler.
+ *
+ * In SBI, the provider or driver uses YANG management system as a CODEC
+ * utility. These providers/drivers use the YANG codec utility to register
+ * the device schema. YANG utils is used to generate the java files
+ * corresponding to the device schema. Provider or driver use these classes
+ * to seamlessly manage the device as java objects. While sending the request
+ * to device, drivers use the utility to translate the objects to protocol
+ * specific data representation and then send to the device.
+ * Protocol or driver use the same instance of the codec utility across multiple
+ * translation request.
+ * Protocol or driver should not use the same instance of utility concurrently.
+ */
+public interface YangCodecHandler {
+    //TODO
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/package-info.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/package-info.java
new file mode 100644
index 0000000..8e74d10
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/package-info.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/**
+ * In SBI, the provider or driver uses YANG management system as a CODEC
+ * utility. These providers/drivers use the YANG codec utility to register
+ * the device schema. YANG utils is used to generate the java files
+ * corresponding to the device schema. Provider or driver use these classes
+ * to seamlessly manage the device as java objects. While sending the request
+ * to device, drivers use the utility to translate the objects to protocol
+ * specific data representation and then send to the device.
+ * Protocol or driver use the same instance of the codec utility across multiple
+ * translation request.
+ * Protocol or driver should not use the same instance of utility concurrently.
+ */
+package org.onosproject.yms.ych;
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/Ydt.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/Ydt.java
new file mode 100644
index 0000000..72790e2
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/Ydt.java
@@ -0,0 +1,45 @@
+/*
+ * 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.yms.ydt;
+
+import org.onosproject.yms.ymsm.YmsOperationType;
+
+/**
+ * Abstraction of an entity which represent YANG data tree. This is used
+ * for exchanging information between YANG management system and NBI protocol.
+ */
+public interface Ydt {
+
+    /**
+     * Returns the root context information available in YDT node. This root
+     * node is a logical container of a protocol which holds the complete data
+     * tree. After building YANG data tree, root node can be obtained from this.
+     *
+     * @return root YDT context which is logical container of a protocol which
+     * is holder of the complete tree
+     */
+    YdtContext getRootNode();
+
+    /**
+     * Returns YANG management system operation type. It represents type of
+     * root level operation for the request. This is used by protocols to
+     * specify the root level operation associated with the request.
+     *
+     * @return YANG management system operation type
+     */
+    YmsOperationType getYmsOperationType();
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtBuilder.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtBuilder.java
new file mode 100644
index 0000000..b31ce04
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtBuilder.java
@@ -0,0 +1,218 @@
+/*
+ * 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.yms.ydt;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Abstraction of an entity which provides interfaces to build and obtain YANG
+ * data tree which is data (sub)instance representation, abstract of protocol.
+ *
+ * NBI protocols need to translate the protocol operation request, into a
+ * protocol independent abstract tree called the YANG data tree (YDT). In order
+ * to enable the protocol in building these abstract data tree, YANG
+ * management system provides a utility called the YANG data tree builder.
+ */
+public interface YdtBuilder
+        extends Ydt {
+
+    /**
+     * Sets root node tag attributes. This is used by protocol
+     * to specify tag attributes associated with root resource.
+     *
+     * @param attributeTag map of root tags attribute values indexed by root
+     *                     tag name.
+     */
+    void setRootTagAttributeMap(Map<String, String> attributeTag);
+
+    /**
+     * Returns map of tag attribute list associated with root resource.
+     *
+     * @return linked hash map of tag name with value
+     */
+    Map<String, String> getRootTagAttributeMap();
+
+    /**
+     * Adds a last child to YANG data tree, this method is to be used by
+     * protocols which are unaware of the nature (single/multiple) of node and
+     * also unaware of the operation type at every node(Example: RESTCONF).
+     *
+     * Add child is used to add module/sub-module nodes also. Request may
+     * contain revision number corresponding to Module/sub-module in that
+     * case YMS expect revision number to be appended to module/sub-module
+     * name in the below mentioned format.
+     * module-or-submodule-name ['@' date-arg]
+     * date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
+     * Example: testModule@2016-10-27.
+     *
+     * If the revision date is not specified YMS first search for
+     * registered module/sub-module without revision date, if still can't obtain
+     * then uses registered module/sub-module with latest revision date.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     */
+    void addChild(String name, String namespace);
+
+    /**
+     * Adds a last child to YANG data tree, this method is to be used by
+     * protocols which are aware of the nature (single/multiple) of node.
+     *
+     * Add child is used to add module/sub-module nodes also. Request may
+     * contain revision number corresponding to Module/sub-module in that
+     * case YMS expect revision number to be appended to module/sub-module
+     * name in the below mentioned format.
+     * module-or-submodule-name ['@' date-arg]
+     * date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
+     * Example: testModule@2016-10-27.
+     *
+     * If the revision date is not specified YMS first search for
+     * registered module/sub-module without revision date, if still can't obtain
+     * then uses registered module/sub-module with latest revision date.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     * @param ydtType   type of YDT node to be added
+     */
+    void addChild(String name, String namespace, YdtType ydtType);
+
+    /**
+     * Adds a last child to YANG data tree, this method is to be used by
+     * protocols which are unaware of the nature (single/multiple) of node.
+     * This is an overloaded method with operation type. This method can
+     * optionally
+     * be used when protocol doesn't want to specify operation type by
+     * keeping it null.
+     *
+     * Add child is used to add module/sub-module nodes also. Request may
+     * contain revision number corresponding to Module/sub-module in that
+     * case YMS expect revision number to be appended to module/sub-module
+     * name in the below mentioned format.
+     * module-or-submodule-name ['@' date-arg]
+     * date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
+     * Example: testModule@2016-10-27.
+     *
+     * If the revision date is not specified YMS first search for
+     * registered module/sub-module without revision date, if still can't obtain
+     * then uses registered module/sub-module with latest revision date.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     * @param opType    type of requested operation over a node
+     */
+    void addChild(String name, String namespace,
+                  YdtContextOperationType opType);
+
+    /**
+     * Adds a last child to YANG data tree, this method is to be used by
+     * protocols which are aware of the nature (single/multiple) of node.
+     * This is an overloaded method with operation type. This method can
+     * optionally
+     * be used when protocol doesn't want to specify operation type by
+     * keeping it null.
+     *
+     * Add child is used to add module/sub-module nodes also. Request may
+     * contain revision number corresponding to Module/sub-module in that
+     * case YMS expect revision number to be appended to module/sub-module
+     * name in the below mentioned format.
+     * module-or-submodule-name ['@' date-arg]
+     * date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
+     * Example: testModule@2016-10-27.
+     *
+     * If the revision date is not specified YMS first search for
+     * registered module/sub-module without revision date, if still can't obtain
+     * then uses registered module/sub-module with latest revision date.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     * @param ydtType   type of YDT node to be added
+     * @param opType    type of requested operation over a node
+     */
+    void addChild(String name, String namespace, YdtType ydtType,
+                  YdtContextOperationType opType);
+
+
+    /**
+     * Adds a last leaf with value to YANG data tree. Protocols unaware of
+     * nature
+     * of leaf (single/multiple) will use it to add both single instance and
+     * multi instance node. Protocols aware of nature of node will use it for
+     * single instance value node addition.
+     * Value of leaf can be null which indicates selection node in get
+     * operation.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     * @param value     value of the child
+     */
+    void addLeaf(String name, String namespace, String value);
+
+    /**
+     * Adds a last leaf with list of values to YANG data tree. This method is
+     * used by protocols which knows the nature (single/multiple) of node for
+     * multi instance node addition.
+     * Value of leaf can be null which indicates selection node in get
+     * operation.
+     *
+     * @param name      name of child to be added
+     * @param namespace namespace of child to be added, if it's null, parent's
+     *                  namespace will be applied to child
+     * @param valueSet  list of value of the child
+     */
+    void addLeaf(String name, String namespace, Set<String> valueSet);
+
+    /**
+     * Adds YANG list's keys value in the order defined in list's key statement.
+     * All the keys must be present any missing key or invalid key will result
+     * in exception.
+     *
+     * @param keysValueList values of the keys in URI in the same order
+     *                      as defined in YANG file
+     */
+    void addKeyLeafs(List<String> keysValueList);
+
+    /**
+     * Traverses up in YANG data tree to the parent node, it is to be used when
+     * protocol is using context type "current" and wanted to traverse up the
+     * tree.
+     */
+    void traverseToParent();
+
+    /**
+     * Returns the current context information available in YDT node.
+     *
+     * @return current YDT context
+     */
+    YdtContext getCurNode();
+
+    /**
+     * Sets default operation type. This operation type is taken if operation
+     * type is not explicitly specified in request. If default operation type
+     * is not set, merge will be taken as default operation type.
+     *
+     * @param ydtContextOperationType default edit operation type
+     */
+    void setDefaultEditOperationType(
+            YdtContextOperationType ydtContextOperationType);
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContext.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContext.java
new file mode 100644
index 0000000..8d8152b
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContext.java
@@ -0,0 +1,124 @@
+/*
+ * 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.yms.ydt;
+
+import java.util.Set;
+
+/**
+ * Abstraction of an entity which represents YANG data tree context
+ * information. This context information will be used protocol to obtain
+ * the information associated with YDT node. This is used when protocol is
+ * walking the data tree in both visitor and listener mechanism.
+ */
+public interface YdtContext {
+
+    /**
+     * Returns the node name.
+     *
+     * @return node name
+     */
+    String getName();
+
+    /**
+     * Returns the node namespace.
+     *
+     * @return node  namespace
+     */
+    String getNamespace();
+
+    /**
+     * Returns the YDT node extended context information corresponding to YDT
+     * node.
+     *
+     * @param <T> specifies YMS operation specific extended information
+     *            associated with YDT context. It will be
+     *            YdtContextOperationType in case extended information type
+     *            is EDIT_REQUEST and will be YdtContextResponseInfo in case
+     *            extended information type is RESPONSE.
+     * @return YdtContextOperationType  YDT node operation type
+     */
+    <T> T getYdtContextExtendedInfo();
+
+    /**
+     * Returns YANG data tree extended information type. This is used to
+     * identify the type of extended information applicable for YDT node.
+     *
+     * @return type of extended information
+     */
+    YdtExtendedInfoType getYdtExtendedInfoType();
+
+    /**
+     * Returns the type of YDT entity. This type will be used by protocols to
+     * identify the nature of node and can implement it accordingly.
+     *
+     * @return YDT entity type
+     */
+    YdtType getYdtType();
+
+    /**
+     * Returns the context of parent node.
+     *
+     * @return context of parent node
+     */
+    YdtContext getParent();
+
+    /**
+     * Returns the context of first child.
+     *
+     * @return context of first child
+     */
+    YdtContext getFirstChild();
+
+    /**
+     * Returns the context of last child.
+     *
+     * @return context of last child
+     */
+    YdtContext getLastChild();
+
+    /**
+     * Returns the context of next sibling.
+     *
+     * @return context of next sibling
+     */
+    YdtContext getNextSibling();
+
+    /**
+     * Returns the context of previous sibling.
+     *
+     * @return context of previous sibling
+     */
+    YdtContext getPreviousSibling();
+
+    /**
+     * Returns value of node, this is only valid for single instance leaf
+     * node, to obtain the nature of the node protocols need to use
+     * getYdtType().
+     *
+     * @return value of node
+     */
+    String getValue();
+
+    /**
+     * Returns set of values of a node, this is only valid for multi instance
+     * leaf node, to obtain the nature of the node protocols need to use
+     * getYdtType().
+     *
+     * @return value of YDT leaf
+     */
+    Set<String> getValueSet();
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextOperationType.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextOperationType.java
new file mode 100644
index 0000000..4e2c686
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextOperationType.java
@@ -0,0 +1,123 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Represents type of YANG data tree node operation.
+ *
+ * This is used by protocols to specify edit operation associate with the node.
+ * YMS data validation and data handling will vary based on the edit operation
+ * type, for an instance, default leafs if not present in data should be added
+ * if edit operation type is create and shouldn't be added if operation type is
+ * delete.
+ * Edit operation type is mapped to "operation type" of YANG utils generated
+ * classes by YMS.
+ *
+ * In case of SBI driver/provider creates JAVA object (of YANG utils generated
+ * classes) and specifies the edit operation type in "operation type" field.
+ * YMS map this operation type to "edit operation type" of YDT, which will be
+ * further encoded in corresponding data format.
+ *
+ * This is only applicable if YANG root level interaction type is EDIT_CONFIG.
+ * If edit operation type is not specified when root interaction type is
+ * EDIT_CONFIG then default operation type will be selected.
+ * By default "default operation type" is "merge" unless explicitly specified
+ * by protocol.
+ */
+
+/*
+ * Edit operation type mapping with RESTCONF and NETCONF as example:
+ * +----------+----------------------------+------------+
+ * | RESTCONF | NETCONF                    | EditOpType |
+ * +----------+----------------------------+------------+
+ * | OPTIONS  | none                       | NA         |
+ * | HEAD     | none                       | NA         |
+ * | GET      | <get-config>, <get>        | NA         |
+ * | POST     | (operation="create")       | CREATE     |
+ * | PUT      | (operation="replace")      | REPLACE    |
+ * | PATCH    | (operation="merge")        | MERGE      |
+ * | DELETE   | (operation="delete")       | DELETE     |
+ * | none     | (operation="remove")       | REMOVE     |
+ * +----------+----------------------------+------------+
+ * Note: Additionally RESTCONF must use API resource to figure out whether
+ * request contains data resource or it's for data model specific operation.
+ *     +--rw restconf
+ *       +--rw data
+ *       +--rw operations
+ * Edit operation type is only applicable for data resource.
+ *
+ * Additionally protocols has to use operation type NONE to specify the URI
+ * path.
+ */
+public enum YdtContextOperationType {
+
+    /**
+     * Type of YANG data tree action for below action:
+     * The configuration data identified by the element
+     * containing this attribute is added to the configuration if
+     * and only if the configuration data does not already exist in
+     * the configuration datastore.  If the configuration data
+     * exists, an error is returned.
+     */
+    CREATE,
+
+    /**
+     * Type of YANG data tree action for below action:
+     * The configuration data identified by the element
+     * containing this attribute is deleted from the configuration
+     * if and only if the configuration data currently exists in
+     * the configuration datastore.  If the configuration data does
+     * not exist, an error is returned".
+     */
+    DELETE,
+
+    /**
+     * Type of YANG data tree action for below action:
+     * The configuration data identified by the element
+     * containing this attribute is merged with the configuration
+     * at the corresponding level in the configuration datastore.
+     */
+    MERGE,
+
+    /**
+     * Type of YANG data tree action for below action:
+     * The configuration data identified by the element
+     * containing this attribute replaces any related configuration
+     * in the configuration datastore. If no such configuration
+     * data exists in the configuration datastore, it is created.
+     */
+    REPLACE,
+
+    /**
+     * Type of YANG data tree action for below action:
+     * The configuration data identified by the element
+     * containing this attribute is deleted from the configuration
+     * if the configuration data currently exists in the
+     * configuration datastore.  If the configuration data does not
+     * exist, the "remove" operation is silently ignored by the
+     * server.
+     */
+    REMOVE,
+
+    /**
+     * The node is used as a containment node to reach the child node,
+     * There is no change in the data store for the values of this node in the
+     * edit request.
+     */
+    NONE
+}
+
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextResponseInfo.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextResponseInfo.java
new file mode 100644
index 0000000..279d33e
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtContextResponseInfo.java
@@ -0,0 +1,26 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Represents YANG context response information. It contains YDT node specific
+ * information for operation response like error information, particular node
+ * operation result etc.
+ */
+public interface YdtContextResponseInfo {
+    //TODO
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtExtendedInfoType.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtExtendedInfoType.java
new file mode 100644
index 0000000..2b75db0
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtExtendedInfoType.java
@@ -0,0 +1,37 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Represents type of YANG data tree node operation.
+ */
+public enum YdtExtendedInfoType {
+
+    /**
+     * It specifies operation type edit request for YDT node. It is used to
+     * identify the YMS operation specific extended information associated
+     * with YDT context.
+     */
+    EDIT_REQUEST,
+
+    /**
+     * It specifies operation type RESPONSE for YDT node. It is used to
+     * identify the YMS operation specific extended information associated
+     * with YDT context.
+     */
+    RESPONSE
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtListener.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtListener.java
new file mode 100644
index 0000000..dbe4de3
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtListener.java
@@ -0,0 +1,50 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Abstraction of an entity which provide call back methods which are called
+ * by YDT walker while walking the YANG data tree.
+ *
+ * In a response to execute operation YMS returns the YMS operation results
+ * with root YDT node. Now, protocols needs to walk through the YDT node and
+ * constructs the corresponding data format string. Protocol can opt to use
+ * listener or visitor based walking mechanism.
+ *
+ * This interface needs to be implemented by protocol implementing listener's
+ * based call backs while YDT walk.
+ */
+public interface YdtListener {
+
+    /**
+     * YANG data tree node's entry, it will be called during a node entry.
+     * All the related information about the node can be obtain from the YDT
+     * context.
+     *
+     * @param ydtContext YANG data tree context
+     */
+    void enterYdtNode(YdtContext ydtContext);
+
+    /**
+     * YANG data tree node's exit, it will be called during a node exit.
+     * All the related information about the node can be obtain from the YDT
+     * context.
+     *
+     * @param ydtContext YANG data tree context
+     */
+    void exitYdtNode(YdtContext ydtContext);
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtResponse.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtResponse.java
new file mode 100644
index 0000000..08d4aeb
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtResponse.java
@@ -0,0 +1,37 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Represents YANG management system results. Protocols sends request to
+ * YANG management system for execution. YMS returns response in form of
+ * YANG data tree response
+ */
+public interface YdtResponse extends Ydt {
+
+    /**
+     * Returns YANG management system operation result. This status of the
+     * operation execution is returned
+     *
+     * @return YMS operation result
+     */
+    YmsOperationExecutionStatus getYmsOperationResult();
+
+    /*
+     * TODO: Applications layer error reporting to protocols.
+     */
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtType.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtType.java
new file mode 100644
index 0000000..01f6509
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtType.java
@@ -0,0 +1,51 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Represents type of node in YANG data tree. Protocols based on input data
+ * format provide this information to YMS during YDT building. YMS use this
+ * information to carry out the validation against the schema information
+ * obtained as a part of application registration. Also as a part of response
+ * YMS encode this information in YDT node, protocol may use this information
+ * while construction the data format string.
+ *
+ * Protocols unaware of node type like NETCONF, may opt not to provide this
+ * information.
+ */
+public enum YdtType {
+
+    /**
+     * Single instance node.
+     */
+    SINGLE_INSTANCE_NODE,
+
+    /**
+     * Multi instance node.
+     */
+    MULTI_INSTANCE_NODE,
+
+    /**
+     * Single instance leaf node.
+     */
+    SINGLE_INSTANCE_LEAF_VALUE_NODE,
+
+    /**
+     * Multi instance leaf node.
+     */
+    MULTI_INSTANCE_LEAF_VALUE_NODE
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtWalker.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtWalker.java
new file mode 100644
index 0000000..569ae05
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YdtWalker.java
@@ -0,0 +1,45 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Abstraction of an entity which provides interfaces for YDT walk.
+ *
+ * When YANG management system gets data from application to be returned
+ * to protocol for any protocol operation or as a part of notification, YANG
+ * management system encodes this data in a YANG data tree and sends the same
+ * to protocol.
+ * Protocols can use the YANG data tree walker utility to have their
+ * callbacks to be invoked as per the YANG data tree walking.
+ * By this way protocols can encode the data from abstract YANG data tree
+ * into a protocol specific representation.
+ *
+ * YDT walker provides entry and exit callbacks for each node in YANG data
+ * tree.
+ */
+public interface YdtWalker {
+
+    /**
+     * Walks the YANG data tree. Protocols implements YDT listener service
+     * and walks YDT tree with input as implemented object. YDT walker provides
+     * call backs to implemented methods.
+     *
+     * @param ydtListener YDT listener implemented by the protocol
+     * @param rootNode    root node of YDT
+     */
+    void walk(YdtListener ydtListener, YdtContext rootNode);
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YmsOperationExecutionStatus.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YmsOperationExecutionStatus.java
new file mode 100644
index 0000000..3ac63ee
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/YmsOperationExecutionStatus.java
@@ -0,0 +1,34 @@
+/*
+ * 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.yms.ydt;
+
+/**
+ * Abstraction of an entity which represents YANG management system operation
+ * result. Once the protocol translates the request information into a abstract
+ * YANG data tree, it uses YANG management system as a broker to get the
+ * operation executed in ONOS. Protocols uses a request Yang management
+ * system to delegate the operation request.
+ *
+ * YANG management system is responsible to split the protocol operation
+ * across application(s) which needs to participate, and collate the
+ * response(s) from application(s) and return an effective result of the
+ * operation request. The result of the operation request is returned in
+ * YMS operation result.
+ */
+public interface YmsOperationExecutionStatus {
+    // TODO
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ydt/package-info.java b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/package-info.java
new file mode 100644
index 0000000..fb5a29f
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ydt/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides interfaces to build and obtain YANG data tree which is data
+ * (sub)instance representation, abstract of protocol.
+ *
+ * NBI protocol implementation takes care of the protocol specific
+ * operations. They are abstracted from the intricacies of understanding
+ * the application identification or handling the interaction with
+ * applications.
+ *
+ * NBI protocols need to handle the encoding and decoding of data to the
+ * protocol specific format. They are unaware of the YANG of applications,
+ * i.e. protocols are unaware of the data structure / organization in
+ * applications.
+ *
+ * They need to translate the protocol operation request, into a protocol
+ * independent abstract tree called the YANG data tree (YDT). In order to
+ * enable the protocol in building these abstract data tree, YANG
+ * management system provides a utility called the YANG data tree builder.
+ *
+ * Using the YANG data tree utility API's protocols are expected to walk
+ * the data received in request and pass the information during the walk.
+ * YANG data tree builder, identifies the application which supports the
+ * request and validates it against the schema defined in YANG, and
+ * constructs the abstract YANG data tree.
+ */
+package org.onosproject.yms.ydt;
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsOperationType.java b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsOperationType.java
new file mode 100644
index 0000000..45958de
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsOperationType.java
@@ -0,0 +1,84 @@
+/*
+ * 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.yms.ymsm;
+
+/**
+ * Represents type of root level operation for the request.
+ *
+ * This is used by protocols to specify the root level operation associated
+ * with the request. YMS data validation and data handling will vary based
+ * on the edit operation type, for an instance YANG specified "mandatory"
+ * leafs needn't be present for QUERY_CONFIG and QUERY, but they may be
+ * mandatory to be present in request for EDIT_CONFIG type. The validation
+ * and handling is further dependent on edit operation type.
+ *
+ * In SBI, driver/provider must provide this information to YMS which needs
+ * to encode this information in corresponding data format.
+ *
+ * YmsOperationType MUST be specified by protocol.
+ */
+
+/*
+ * Yang interaction type with RESTCONF and NETCONF as example:
+ * +--------------+-------------------+-------------+
+ * | RESTCONF     | NETCONF           | EditOpType  |
+ * +--------------+-------------------+-------------+
+ * | OPTIONS      | NA                | NA          |
+ * | HEAD         | NA                | NA          |
+ * | GET          | <get>             | QUERY       |
+ * | none         | <get-config>      | QUERY_CONFIG|
+ * | POST (data)  | <edit-config>     | EDIT_CONFIG |
+ * | PUT          | <edit-config>     | EDIT_CONFIG |
+ * | PATCH        | <edit-config>     | EDIT_CONFIG |
+ * | DELETE       | <edit-config>     | EDIT_CONFIG |
+ * | POST (op)    | <rpc>             | RPC         |
+ * +--------------+-------------------+-------------+
+ *
+ * Note: Additionally RESTCONF must use API resource to figure out whether
+ * request contains data resource or it's for data model specific operation.
+ * +--rw restconf
+ * +--rw data
+ * +--rw operations
+ */
+public enum YmsOperationType {
+    /**
+     * The YANG based request is to edit a config node / subtree in the data
+     * store.
+     */
+    EDIT_CONFIG,
+
+    /**
+     * The YANG based request is to query a config node / subtree in the data
+     * store.
+     */
+    QUERY_CONFIG,
+
+    /**
+     * The YANG based request is to query a node / subtree in the data store.
+     */
+    QUERY,
+
+    /**
+     * The YANG based request is to execute an RPC defined in YANG.
+     */
+    RPC,
+
+    /**
+     * The YANG based request is to execute an RPC defined in YANG.
+     */
+    NOTIFICATION
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsService.java b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsService.java
new file mode 100644
index 0000000..0c9d5f3
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/YmsService.java
@@ -0,0 +1,308 @@
+/*
+ * 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.yms.ymsm;
+
+import java.util.List;
+
+import org.onosproject.yms.ych.YangCodecHandler;
+import org.onosproject.yms.ydt.YdtBuilder;
+import org.onosproject.yms.ydt.YdtResponse;
+import org.onosproject.yms.ydt.YdtWalker;
+import org.onosproject.yms.ynh.YangNotificationService;
+
+/**
+ * Abstraction of an entity which provides interfaces to YANG management
+ * system. YMS is a core of YANG in ONOS.
+ *
+ * In NBI, it acts as a broker in between the protocol and application,
+ * here there is a separate protocol implementation, which does the conversion
+ * of protocol representation to abstract data tree. The protocol
+ * implementation takes care of the protocol specific actions for
+ * e.g. RESTCONF handling the entity-tag / timestamp related operations.
+ *
+ * In SBI, driver or provider uses YANG codec handler as a utility to translate
+ * the request information in java(YANG utils generated) to protocol specific
+ * format and vice versa.
+ */
+public interface YmsService {
+
+    /**
+     * Returns YANG data tree builder.
+     *
+     * NBI protocol implementation takes care of the protocol specific
+     * operations. They are abstracted from the intricacies of understanding
+     * the application identification or handling the interaction with
+     * applications.
+     *
+     * NBI protocols need to handle the encoding and decoding of data to the
+     * protocol specific format. They are unaware of the YANG of applications,
+     * i.e. protocols are unaware of the data structure / organization in
+     * applications.
+     *
+     * They need to translate the protocol operation request, into a protocol
+     * independent abstract tree called the YANG data tree (YDT). In order to
+     * enable the protocol in building these abstract data tree, YANG
+     * management system provides a utility called the YANG data tree builder.
+     *
+     * Using the YANG data tree utility API's protocols are expected to walk
+     * the data received in request and pass the information during the walk.
+     * YANG data tree builder, identifies the application which supports the
+     * request and validates it against the schema defined in YANG, and
+     * constructs the abstract YANG data tree.
+     *
+     * Interaction type is a MANDATORY parameter which is used by YANG
+     * management system to perform the required operation in ONOS.
+     *
+     * NOTE: Same YDT builder instance cannot be reused across different
+     * operation request. A new instance needs to be used for every operation.
+     *
+     * Returns YANG data tree builder logical root container node.
+     * Protocol use this to logical root container to hold schema specific data
+     * that spans across different modules schema.
+     *
+     * @param logicalRootName name of a protocol specific logical container
+     *                        node to group data across multiple applications.
+     *                        This is only a logical container to group more
+     *                        than one application's root node. It is not
+     *                        validated against any YANG definition
+     * @param rootNamespace   namespace of logical root container, if any,
+     *                        otherwise it can be sent as null
+     * @param operationType   maps the request type to a corresponding
+     *                        operation request type to YANG management system
+     * @return YANG data tree builder, using which the abstract tree can be
+     * built corresponding to the data exchanged between protocol and YANG
+     * management system.
+     */
+    YdtBuilder getYdtBuilder(String logicalRootName, String rootNamespace,
+                             YmsOperationType operationType);
+
+    /**
+     * Returns YANG data tree builder attached with a given schema registry.
+     *
+     * YMS provides a framework where-in protocols can register their protocol
+     * data format specific CODECS with YMS. These registered CODEC will be
+     * used by YMS to perform translations from data format to YDT and YDT to
+     * data format. YMS may intend to use these CODECS both for NBI and SBI.
+     *
+     * To perform decode i.e. generate YDT for given data format string, these
+     * CODECS implementation needs to call the API's of YDT. YDT referred the
+     * registered schema information while building tree. In case of NBI their
+     * is a single schema registry, but for SBI schema registry is per
+     * driver/provider.
+     *
+     * Now this schema registry information is provided to protocols
+     * CODECS while invoking "decodeProtocolDataToYdt" and
+     * "decodeCompositeProtocolDataToYdt", protocol CODECS  needs to provide
+     * the schema registry while getting instance of YDT builder.
+     * The schemaRegistry may be null when the YMS is performing decode for NBI
+     * protocols.
+     *
+     * Validations for NBI and SBI will vary, schemaRegistry value will also
+     * indicate the usage scenario and will be used by YdtBuilder to carry out
+     * necessary validations.
+     *
+     * This is an overloaded method to YdtBuilder which MUST be used by the
+     * overridden protocols CODECS.
+     *
+     * @param logicalRootName      name of a protocol specific logical container
+     *                             node to group data across multiple
+     *                             applications.
+     *                             This is only a logical container to group
+     *                             more
+     *                             than one application's root node. It is not
+     *                             validated against any YANG definition
+     * @param rootNamespace        namespace of logical root container, if any,
+     *                             otherwise it can be sent as null
+     * @param operationType        maps the request type to a corresponding
+     *                             operation request type to YANG management
+     *                             system
+     * @param schemaRegistryForYdt schema registry for Ydt, protocol CODECS get
+     *                             this value from YMS in
+     *                             "decodeProtocolDataToYdt" and
+     *                             "decodeCompositeProtocolDataToYdt" and
+     *                             provide it while obtaining YdtBuilder
+     * @return YANG data tree builder, using which the abstract tree can be
+     * built corresponding to the data exchanged between protocol and YANG
+     * management system.
+     */
+    YdtBuilder getYdtBuilder(String logicalRootName, String rootNamespace,
+                             YmsOperationType operationType,
+                             Object schemaRegistryForYdt);
+
+    /**
+     * Returns YANG data tree walker.
+     *
+     * YANG management system gets data from application to be returned
+     * in protocol operation or to notify to protocol(s) clients, YANG
+     * management system encodes the data in a YANG data tree and informs the
+     * protocol.
+     * Protocols can use the YANG data tree walker utility to have their
+     * callbacks to be invoked as per the YANG data tree walking.
+     * By this way protocols can encode the data from abstract YANG data tree
+     * into a protocol specific representation.
+     *
+     * @return YANG data tree walker utility
+     */
+    YdtWalker getYdtWalker();
+
+    /**
+     * Once the NBI protocol translates the request information into an abstract
+     * YANG data tree, it uses YANG management system as a broker to get the
+     * operation executed in ONOS.
+     *
+     * YANG management system is responsible to split the protocol operation
+     * across application(s) which needs to participate, and collate the
+     * response(s) from application(s) and return an effective result of the
+     * operation request.
+     *
+     * YMS identifies the type of operation to be performed using the
+     * operation type in YANG builder data tree and process the corresponding
+     * operation request on the applicable application(s).
+     * The response information maintained in response YANG data tree and
+     * given to NBI protocol's to encode it using a YANG data tree walker.
+     *
+     * Depending on the operation type set in the YANG builder tree, the
+     * application(s) get / set / operation interface is invoked.
+     * These interface are part to the YANG modelled service interface.
+     *
+     * @param operationRequest operation request that was constructed
+     *                         by NBI protocol using YANG data tree
+     *                         builder. This operation request contains
+     *                         operation request that needs to be
+     *                         executed on the applicable application(s)
+     * @return returns the result of the operation execution.
+     * Depending on the operation type, the YANG response data tree can have
+     * the following information.
+     *
+     * In case of EDIT_CONFIG operation, it will have the status of the
+     * operation execution. If there is any applications schema specific
+     * error, then the schema error information will be encoded in the
+     * corresponding context node. In case the edit operation is successful
+     * there is no YANG response data tree created, hence getRootNode will
+     * return null.
+     *
+     * In case of query operation, it will have the status of the operation
+     * execution. If there is any application schema specific error, then
+     * schema error information will be encoded in the corresponding YANG
+     * context. In case the query operation is successful, YANG data tree
+     * contains the application data that matched the filter in the
+     * operation request. NBI protocol to use a Yang data tree walker to
+     * construct the protocol specific reply.
+     *
+     * In case of RPC operation, it will have the status of the operation
+     * execution. If there is any application schema specific error, then
+     * schema error information will be encoded in the corresponding YANG
+     * context. In case the RPC operation is successful, and the RPC
+     * does not have any RPC reply in YANG, then the YANG data tree will
+     * be null.
+     * In case the RPC has a RPC reply in YANG, then the YANG data tree
+     * will contain the application's RPC reply schema specific .
+     * NBI protocol to use a Yang data tree walker to construct the
+     * protocol specific reply.
+     */
+    YdtResponse executeOperation(YdtBuilder operationRequest);
+
+    // TODO execute operation which directly take data format string as input.
+
+    /**
+     * Returns YANG notification service.
+     *
+     * NBI Protocols which can support notification delivery for application(s)
+     * needs to add themselves as a listeners with YANG notification service.
+     * Also protocols can use YANG notification service to check if a received
+     * notification should be filtered against any of their protocol specific
+     * filtering mechanism.
+     *
+     * @return YANG notification service instance
+     */
+    YangNotificationService getYangNotificationService();
+
+    /**
+     * Registers service with YANG management system.
+     *
+     * Applications model their exposed interface in YANG, and register with
+     * YANG management system, so that it can be configured / managed by the
+     * set of protocols supported in ONOS.
+     *
+     * ONOS YANG tools generate the applications service interface
+     * corresponding to the application's interface designed in YANG.
+     *
+     * The Application which implements this service registers the generated
+     * service with YANG management system. The generated service interfaces
+     * have all the information modeled by applications in YANG.
+     *
+     * Registers application's YANG model with YANG management system. This
+     * is used by applications/core to register their service with YMS.
+     *
+     * @param appManager           application manager instance which is
+     *                             implementing the service defined in YANG.
+     * @param yangService          service interface generated by ONOS YANG
+     *                             tools corresponding to the interface modeled
+     *                             in YANG.
+     * @param supportedFeatureList mentions the list of YANG features supported
+     *                             by the application implementation.
+     *                             If it is null, then the application
+     *                             implementation supports all the features
+     *                             defined in the registered YANG module.
+     */
+    void registerService(Object appManager, Class<?> yangService,
+                         List<String> supportedFeatureList);
+
+    /**
+     * Unregisters service which is registered in YANG management system.
+     *
+     * Applications model their exposed interface in YANG, and register with
+     * YANG management system, so that it can be configured / managed by the
+     * set of protocols supported in ONOS.
+     *
+     * ONOS YANG tools generate the applications service interface
+     * corresponding to the application's interface designed in YANG.
+     *
+     * The Application which implements this service registers the generated
+     * service with YANG management system. The generated service interfaces
+     * have all the information modeled by applications in YANG.
+     *
+     * Registers application's YANG model with YANG management system. This
+     * is used by applications/core to register their service with YMS.
+     *
+     * @param appManager  application manager instance which is implementing
+     *                    the service defined in YANG.
+     * @param yangService service interface generated by ONOS YANG tools
+     *                    corresponding to the interface modeled in YANG.
+     */
+    void unRegisterService(Object appManager, Class<?> yangService);
+
+    /**
+     * Returns YANG codec handler utility.
+     *
+     * In SBI, the provider or driver uses YANG management system as a CODEC
+     * utility. These providers/drivers use the YANG codec utility to register
+     * the device schema. YANG utils is used to generate the java files
+     * corresponding to the device schema. Provider or driver use these classes
+     * to seamlessly manage the device as java objects. While sending the
+     * request to device, drivers use the utility to translate the objects to
+     * protocol specific data representation and then send to the device.
+     * Protocol or driver use the same instance of the codec utility across
+     * multiple translation request. Protocol or driver should not use the same
+     * instance of utility concurrently.
+     *
+     * @return YANG codec utility
+     */
+    YangCodecHandler getYangCodecHandler();
+
+    // TODO exceptions handling and sending.
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/package-info.java b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/package-info.java
new file mode 100644
index 0000000..d6bbc6e
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ymsm/package-info.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides interfaces to YANG application management system manager. YMSM is
+ * manager of the YANG Core.
+ *
+ * In NBI, it acts as a broker in between the protocol and application,
+ * here there is a separate protocol implementation, which does the conversion
+ * of protocol representation to abstract data tree. The protocol
+ * implementation takes care of the protocol specific actions for
+ * e.g. RESTCONF handling the entity-tag / timestamp related operations.
+ *
+ * In SBI, driver or provider uses YANG codec handler as a utility to translate
+ * the request information in java(YANG utils generated) to protocol specific
+ * format and vice versa.
+ */
+package org.onosproject.yms.ymsm;
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ynh/YangNotificationService.java b/apps/yms/api/src/main/java/org/onosproject/yms/ynh/YangNotificationService.java
new file mode 100644
index 0000000..1beb498
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ynh/YangNotificationService.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.yms.ynh;
+
+/**
+ * Abstraction of an entity which provides interfaces to YANG notification
+ * service. YNH handles notification from the application/core and provide
+ * it to the protocols.
+ * <p>
+ * NBI Protocols which can support notification delivery for application(s)
+ * needs to add themselves as a listeners with YANG notification service.
+ * Protocols can use YANG notification service to check if a received
+ * notification should be filtered against any of their protocol specific
+ * filtering mechanism.
+ */
+public interface YangNotificationService {
+    //TODO
+}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ynh/package-info.java b/apps/yms/api/src/main/java/org/onosproject/yms/ynh/package-info.java
new file mode 100644
index 0000000..4c62822
--- /dev/null
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ynh/package-info.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+/**
+ * Provides interfaces to YANG notification handler. YNH handles notification
+ * from the application and provide it to the protocols.
+ */
+
+/**
+ * Provides interfaces to YANG notification service.
+ *
+ * NBI Protocols which can support notification delivery for application(s)
+ * needs to add themselves as a listeners with YANG notification service.
+ * Protocols can use YANG notification service to check if a received
+ * notification should be filtered against any of their protocol specific
+ * filtering mechanism.
+ */
+package org.onosproject.yms.ynh;
diff --git a/apps/yms/app/BUCK b/apps/yms/app/BUCK
new file mode 100644
index 0000000..8da70d1
--- /dev/null
+++ b/apps/yms/app/BUCK
@@ -0,0 +1,8 @@
+COMPILE_DEPS = [
+  '//lib:CORE_DEPS',
+  '//apps/yms/api:onos-apps-yms-api',
+]
+
+osgi_jar_with_tests(
+  deps = COMPILE_DEPS,
+)
diff --git a/apps/yms/app/app.xml b/apps/yms/app/app.xml
new file mode 100644
index 0000000..6749a2a
--- /dev/null
+++ b/apps/yms/app/app.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<app name="org.onosproject.yms" origin="ON.Lab" version="${project.version}"
+     category="Utility" url="http://onosproject.org" title="YMS App"
+     featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
+     features="${project.artifactId}">
+    <description>${project.description}</description>
+    <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
+    <artifact>mvn:${project.groupId}/onos-app-yms-api/${project.version}</artifact>
+</app>
diff --git a/apps/yms/app/features.xml b/apps/yms/app/features.xml
new file mode 100644
index 0000000..4daf677
--- /dev/null
+++ b/apps/yms/app/features.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+  ~ 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.
+  -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+    <feature name="${project.artifactId}" version="${project.version}"
+             description="${project.description}">
+        <feature>onos-api</feature>
+        <bundle>mvn:${project.groupId}/onos-app-yms-api/${project.version}</bundle>
+        <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+    </feature>
+</features>
diff --git a/apps/yms/app/pom.xml b/apps/yms/app/pom.xml
new file mode 100644
index 0000000..ea9a64d
--- /dev/null
+++ b/apps/yms/app/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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>
+
+    <parent>
+        <artifactId>onos-yms</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.7.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-app-yms</artifactId>
+    <packaging>bundle</packaging>
+
+    <url>http://onosproject.org</url>
+
+    <description>YANG management system application</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-app-yms-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onlab-junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-api</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/apps/yms/pom.xml b/apps/yms/pom.xml
new file mode 100644
index 0000000..1b9ba48
--- /dev/null
+++ b/apps/yms/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.onosproject</groupId>
+        <artifactId>onos-apps</artifactId>
+        <version>1.7.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>onos-yms</artifactId>
+    <packaging>pom</packaging>
+
+    <description>ONOS YANG management system</description>
+
+    <modules>
+        <module>api</module>
+        <module>app</module>
+    </modules>
+
+</project>