[ONOS-5135]config issue + augment flag

Change-Id: I56112023cfe64eecb16796a29ad0137952fbe49a
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java
index f3952c6..7aa4b0c 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangAugmentableNode.java
@@ -43,4 +43,18 @@
      * @return list of augment info
      */
     List<YangAugmentedInfo> getAugmentedInfoList();
+
+    /**
+     * Sets the isAugmented flag.
+     *
+     * @param isAugmented the flag value to set
+     */
+    void setIsAugmented(boolean isAugmented);
+
+    /**
+     * Returns the isAugmented flag.
+     *
+     * @return if isAugmented flag
+     */
+    boolean isAugmented();
 }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index d2a4017..69b39da 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -137,6 +137,8 @@
 
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
+    private boolean isAugmented;
+
     /**
      * Creates a choice node.
      */
@@ -420,6 +422,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
index 0efcf56..f151e1d 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangChoice.java
@@ -69,7 +69,7 @@
  */
 public class YangChoice extends YangNode
         implements YangCommonInfo, Parsable, CollisionDetector, YangAugmentableNode,
-        YangWhenHolder, YangIfFeatureHolder, YangAppErrorHolder, YangIsFilterContentNodes {
+        YangWhenHolder, YangIfFeatureHolder, YangAppErrorHolder, YangIsFilterContentNodes, YangConfig {
 
     private static final long serialVersionUID = 806201604L;
 
@@ -85,21 +85,21 @@
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "mandatory" statement, which is optional, takes as an argument the
      * string "true" or "false", and puts a constraint on valid data. If
      * "mandatory" is "true", at least one node from exactly one of the choice's
      * case branches MUST exist.
-     * <p>
+     *
      * If not specified, the default is "false".
-     * <p>
+     *
      * The behavior of the constraint depends on the type of the choice's
      * closest ancestor node in the schema tree which is not a non-presence
      * container:
-     * <p>
+     *
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     * <p>
+     *
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private String mandatory;
@@ -116,26 +116,26 @@
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "default" statement indicates if a case should be considered as the
      * default if no child nodes from any of the choice's cases exist. The
      * argument is the identifier of the "case" statement. If the "default"
      * statement is missing, there is no default case.
-     * <p>
+     *
      * The "default" statement MUST NOT be present on choices where "mandatory"
      * is true.
-     * <p>
+     *
      * The default case is only important when considering the default values of
      * nodes under the cases. The default values for nodes under the default
      * case are used if none of the nodes under any of the cases are present.
-     * <p>
+     *
      * There MUST NOT be any mandatory nodes directly under the default case.
-     * <p>
+     *
      * Default values for child nodes under a case are only used if one of the
      * nodes under that case is present, or if that case is the default case. If
      * none of the nodes under a case are present and the case is not the
      * default case, the default values of the cases' child nodes are ignored.
-     * <p>
+     *
      * the default case to be used if no case members is present.
      */
     private String defaultValueInString;
@@ -157,6 +157,8 @@
      */
     private YangAppErrorInfo yangAppErrorInfo;
 
+    private boolean isAugmented;
+
     /**
      * Create a choice node.
      */
@@ -229,6 +231,7 @@
      *
      * @return the config flag
      */
+    @Override
     public boolean isConfig() {
         return isConfig;
     }
@@ -236,10 +239,11 @@
     /**
      * Sets config flag.
      *
-     * @param isCfg the config flag
+     * @param isConfig the config flag
      */
-    public void setConfig(boolean isCfg) {
-        isConfig = isCfg;
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
     }
 
     /**
@@ -455,6 +459,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setAppErrorInfo(YangAppErrorInfo yangAppErrorInfo) {
         this.yangAppErrorInfo = yangAppErrorInfo;
     }
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangConfig.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangConfig.java
new file mode 100644
index 0000000..b64744f
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangConfig.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.yangutils.datamodel;
+
+/**
+ * Abstraction of config entity. It is used to abstract the data holders of config statement.
+ */
+public interface YangConfig {
+
+    /**
+     * Returns the config flag.
+     *
+     * @return if config flag
+     */
+    boolean isConfig();
+
+    /**
+     * Sets the config flag.
+     *
+     * @param isConfig the flag value to set
+     */
+    void setConfig(boolean isConfig);
+
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index 7707b15..736499e 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -91,14 +91,15 @@
 public class YangContainer
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
-        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes {
+        YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes,
+        YangConfig {
 
     private static final long serialVersionUID = 806201605L;
 
     /**
      * If container maintains config data.
      */
-    private Boolean isConfig;
+    private boolean isConfig;
 
     /**
      * Description of container.
@@ -128,6 +129,8 @@
 
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
+    private boolean isAugmented;
+
     /**
      * Status of the node.
      */
@@ -203,17 +206,19 @@
      *
      * @return the isConfig
      */
-    public Boolean isConfig() {
+    @Override
+    public boolean isConfig() {
         return isConfig;
     }
 
     /**
      * Sets the config flag.
      *
-     * @param isCfg the config flag
+     * @param isConfig the config flag
      */
-    public void setConfig(boolean isCfg) {
-        isConfig = isCfg;
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
     }
 
     /**
@@ -386,46 +391,10 @@
             throws DataModelException {
         List<YangLeaf> leaves = getListOfLeaf();
         List<YangLeafList> leafLists = getListOfLeafList();
-
-        setDefaultConfigValueToChild(leaves, leafLists);
         validateConfig(leaves, leafLists);
     }
 
     /**
-     * Sets the config's value to all leaf if leaf's config statement is not
-     * specified.
-     *
-     * @param leaves    list of leaf attributes of container
-     * @param leafLists list of leaf-list attributes of container
-     */
-    private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
-
-        /*
-         * If "config" is not specified, the default is the same as the parent
-         * schema node's "config" value.
-         */
-        if (leaves != null) {
-            for (YangLeaf leaf : leaves) {
-                if (leaf.isConfig() == null) {
-                    leaf.setConfig(isConfig);
-                }
-            }
-        }
-
-        /*
-         * If "config" is not specified, the default is the same as the parent
-         * schema node's "config" value.
-         */
-        if (leafLists != null) {
-            for (YangLeafList leafList : leafLists) {
-                if (leafList.isConfig() == null) {
-                    leafList.setConfig(isConfig);
-                }
-            }
-        }
-    }
-
-    /**
      * Validates config statement of container.
      *
      * @param leaves    list of leaf attributes of container
@@ -526,6 +495,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
index 4486feb..ef7206c 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangInput.java
@@ -87,6 +87,8 @@
 
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
+    private boolean isAugmented;
+
     /**
      * Create a rpc input node.
      */
@@ -216,6 +218,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index c5115ee..7feb947 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -63,7 +63,7 @@
  */
 public class YangLeaf
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
-        YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode {
+        YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode, YangConfig {
 
     private static final long serialVersionUID = 806201635L;
 
@@ -80,7 +80,7 @@
     /**
      * If the leaf is a config parameter.
      */
-    private Boolean isConfig;
+    private boolean isConfig;
 
     /**
      * description of leaf.
@@ -167,17 +167,19 @@
      *
      * @return if config flag
      */
-    public Boolean isConfig() {
+    @Override
+    public boolean isConfig() {
         return isConfig;
     }
 
     /**
      * Sets the config flag.
      *
-     * @param isCfg the flag value to set
+     * @param isConfig the flag value to set
      */
-    public void setConfig(boolean isCfg) {
-        isConfig = isCfg;
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
     }
 
     /**
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index b3d4bdd..59c0111 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -59,7 +59,7 @@
  */
 public class YangLeafList
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
-        YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode {
+        YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode, YangConfig {
 
     private static final long serialVersionUID = 806201637L;
 
@@ -76,7 +76,7 @@
     /**
      * If the leaf-list is a config parameter.
      */
-    private Boolean isConfig;
+    private boolean isConfig;
 
     /**
      * Description of leaf-list.
@@ -85,32 +85,32 @@
 
     /**
      * Reference:RFC 6020.
-     * <p>
+     *
      * The "max-elements" statement, which is optional, takes as an argument a
      * positive integer or the string "unbounded", which puts a constraint on
      * valid list entries. A valid leaf-list or list always has at most
      * max-elements entries.
-     * <p>
+     *
      * If no "max-elements" statement is present, it defaults to "unbounded".
      */
     private YangMaxElement maxElement;
 
     /**
      * Reference:RFC 6020.
-     * <p>
+     *
      * The "min-elements" statement, which is optional, takes as an argument a
      * non-negative integer that puts a constraint on valid list entries. A
      * valid leaf-list or list MUST have at least min-elements entries.
-     * <p>
+     *
      * If no "min-elements" statement is present, it defaults to zero.
-     * <p>
+     *
      * The behavior of the constraint depends on the type of the leaf-list's or
      * list's closest ancestor node in the schema tree that is not a non-
      * presence container:
-     * <p>
+     *
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     * <p>
+     *
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private YangMinElement minElements;
@@ -186,17 +186,19 @@
      *
      * @return the config flag
      */
-    public Boolean isConfig() {
+    @Override
+    public boolean isConfig() {
         return isConfig;
     }
 
     /**
      * Sets the config flag.
      *
-     * @param isCfg the config flag
+     * @param isConfig the config flag
      */
-    public void setConfig(boolean isCfg) {
-        isConfig = isCfg;
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
     }
 
     /**
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index a915226..bf3f8ea 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -73,14 +73,14 @@
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
-        YangIsFilterContentNodes {
+        YangIsFilterContentNodes, YangConfig {
 
     private static final long serialVersionUID = 806201609L;
 
     /**
      * If list maintains config data.
      */
-    private Boolean isConfig;
+    private boolean isConfig;
 
     /**
      * Description of list.
@@ -89,7 +89,7 @@
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "key" statement, which MUST be present if the list represents
      * configuration, and MAY be present otherwise, takes as an argument a
      * string that specifies a space-separated list of leaf identifiers of this
@@ -97,39 +97,39 @@
      * such leaf identifier MUST refer to a child leaf of the list. The leafs
      * can be defined directly in sub-statements to the list, or in groupings
      * used in the list.
-     * <p>
+     *
      * The combined values of all the leafs specified in the key are used to
      * uniquely identify a list entry. All key leafs MUST be given values when a
      * list entry is created. Thus, any default values in the key leafs or their
      * types are ignored. It also implies that any mandatory statement in the
      * key leafs are ignored.
-     * <p>
+     *
      * A leaf that is part of the key can be of any built-in or derived type,
      * except it MUST NOT be the built-in type "empty".
-     * <p>
+     *
      * All key leafs in a list MUST have the same value for their "config" as
      * the list itself.
-     * <p>
+     *
      * List of key leaf names.
      */
     private List<String> keyList;
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "unique" statement is used to put constraints on valid list
      * entries.  It takes as an argument a string that contains a space-
      * separated list of schema node identifiers, which MUST be given in the
      * descendant form.  Each such schema node identifier MUST refer to a leaf.
-     * <p>
+     *
      * If one of the referenced leafs represents configuration data, then
      * all of the referenced leafs MUST represent configuration data.
-     * <p>
+     *
      * The "unique" constraint specifies that the combined values of all the
      * leaf instances specified in the argument string, including leafs with
      * default values, MUST be unique within all list entry instances in
      * which all referenced leafs exist.
-     * <p>
+     *
      * List of unique leaf/leaf-list names
      */
     private List<String> uniqueList;
@@ -148,32 +148,32 @@
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "max-elements" statement, which is optional, takes as an argument a
      * positive integer or the string "unbounded", which puts a constraint on
      * valid list entries. A valid leaf-list or list always has at most
      * max-elements entries.
-     * <p>
+     *
      * If no "max-elements" statement is present, it defaults to "unbounded".
      */
     private YangMaxElement maxElements;
 
     /**
      * Reference RFC 6020.
-     * <p>
+     *
      * The "min-elements" statement, which is optional, takes as an argument a
      * non-negative integer that puts a constraint on valid list entries. A
      * valid leaf-list or list MUST have at least min-elements entries.
-     * <p>
+     *
      * If no "min-elements" statement is present, it defaults to zero.
-     * <p>
+     *
      * The behavior of the constraint depends on the type of the leaf-list's or
      * list's closest ancestor node in the schema tree that is not a non-
      * presence container:
-     * <p>
+     *
      * o If this ancestor is a case node, the constraint is enforced if any
      * other node from the case exists.
-     * <p>
+     *
      * o Otherwise, it is enforced if the ancestor node exists.
      */
     private YangMinElement minElements;
@@ -208,6 +208,8 @@
      */
     private transient YangCompilerAnnotation compilerAnnotation;
 
+    private boolean isAugmented;
+
     /**
      * Creates a YANG list object.
      */
@@ -281,17 +283,19 @@
      *
      * @return the isConfig
      */
-    public Boolean isConfig() {
+    @Override
+    public boolean isConfig() {
         return isConfig;
     }
 
     /**
      * Sets the config flag.
      *
-     * @param isCfg the config flag
+     * @param isConfig the config flag
      */
-    public void setConfig(boolean isCfg) {
-        isConfig = isCfg;
+    @Override
+    public void setConfig(boolean isConfig) {
+        this.isConfig = isConfig;
     }
 
     /**
@@ -557,7 +561,6 @@
         List<YangLeaf> leaves = getListOfLeaf();
         List<YangLeafList> leafLists = getListOfLeafList();
 
-        setDefaultConfigValueToChild(leaves, leafLists);
         validateConfig(leaves, leafLists);
 
         //A list must have atleast one key leaf if config is true
@@ -570,40 +573,6 @@
     }
 
     /**
-     * Sets the config's value to all leaf if leaf's config statement is not
-     * specified.
-     *
-     * @param leaves    list of leaf attributes of YANG list
-     * @param leafLists list of leaf-list attributes of YANG list
-     */
-    private void setDefaultConfigValueToChild(List<YangLeaf> leaves, List<YangLeafList> leafLists) {
-
-        /*
-         * If "config" is not specified, the default is the same as the parent
-         * schema node's "config" value.
-         */
-        if (leaves != null) {
-            for (YangLeaf leaf : leaves) {
-                if (leaf.isConfig() == null) {
-                    leaf.setConfig(isConfig);
-                }
-            }
-        }
-
-        /*
-         * If "config" is not specified, the default is the same as the parent
-         * schema node's "config" value.
-         */
-        if (leafLists != null) {
-            for (YangLeafList leafList : leafLists) {
-                if (leafList.isConfig() == null) {
-                    leafList.setConfig(isConfig);
-                }
-            }
-        }
-    }
-
-    /**
      * Validates config statement of YANG list.
      *
      * @param leaves    list of leaf attributes of YANG list
@@ -777,6 +746,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
index ea82cc6..4daf88b 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangNotification.java
@@ -114,6 +114,8 @@
 
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
+    private boolean isAugmented;
+
     /**
      * Create a notification node.
      */
@@ -272,6 +274,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
index 2693b1f..f0af8c2 100644
--- a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/YangOutput.java
@@ -86,6 +86,8 @@
 
     private List<YangAugmentedInfo> yangAugmentedInfo = new ArrayList<>();
 
+    private boolean isAugmented;
+
     /**
      * Create a rpc output node.
      */
@@ -215,6 +217,16 @@
     }
 
     @Override
+    public void setIsAugmented(boolean isAugmented) {
+        this.isAugmented = isAugmented;
+    }
+
+    @Override
+    public boolean isAugmented() {
+        return isAugmented;
+    }
+
+    @Override
     public void setLeafNameSpaceAndAddToParentSchemaMap() {
         // Add namespace for all leafs.
         for (YangLeaf yangLeaf : getListOfLeaf()) {
diff --git a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
index 7df0de2..f338672 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/linker/impl/YangResolutionInfoImpl.java
@@ -1222,6 +1222,7 @@
                 if (targetNode instanceof YangAugmentableNode) {
                     detectCollisionForAugmentedNode(targetNode, augment);
                     ((YangAugmentableNode) targetNode).addAugmentation(augment);
+                    ((YangAugmentableNode) targetNode).setIsAugmented(true);
                     augment.setAugmentedNode(targetNode);
                     Resolvable resolvable = (Resolvable) entityToResolve;
                     resolvable.setResolvableStatus(RESOLVED);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
index 9c5745d..4ca9c5a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
@@ -125,6 +125,34 @@
     private int groupingDepth;
 
     /**
+     * Parent depth of unsupported yang construct count for any node.
+     */
+    private int unsupportedYangConstructDepth;
+
+    /**
+     * Returns number of unsupported yang constructs parents, by a node, at any level.
+     *
+     * @return depth of unsupported yang constructs
+     */
+    public int getUnsupportedYangConstructDepth() {
+        return unsupportedYangConstructDepth;
+    }
+
+    /**
+     * Sets number of unsupported yang constructs by a node at any level.
+     */
+    private void increaseUnsupportedYangConstructDepth() {
+        unsupportedYangConstructDepth++;
+    }
+
+    /**
+     * Sets number of unsupported yang constructs by a node at any level.
+     */
+    private void decreaseUnsupportedYangConstructDepth() {
+        unsupportedYangConstructDepth--;
+    }
+
+    /**
      * Returns number of grouping parents, by a node, at any level.
      *
      * @return depth of grouping
@@ -373,7 +401,9 @@
 
     @Override
     public void enterDescriptionStatement(GeneratedYangParser.DescriptionStatementContext ctx) {
-        DescriptionListener.processDescriptionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            DescriptionListener.processDescriptionEntry(this, ctx);
+        }
     }
 
     @Override
@@ -383,7 +413,9 @@
 
     @Override
     public void enterReferenceStatement(GeneratedYangParser.ReferenceStatementContext ctx) {
-        ReferenceListener.processReferenceEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ReferenceListener.processReferenceEntry(this, ctx);
+        }
     }
 
     @Override
@@ -533,7 +565,9 @@
 
     @Override
     public void enterBaseStatement(GeneratedYangParser.BaseStatementContext ctx) {
-        BaseListener.processBaseEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BaseListener.processBaseEntry(this, ctx);
+        }
     }
 
     @Override
@@ -573,7 +607,9 @@
 
     @Override
     public void enterIfFeatureStatement(GeneratedYangParser.IfFeatureStatementContext ctx) {
-        IfFeatureListener.processIfFeatureEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IfFeatureListener.processIfFeatureEntry(this, ctx);
+        }
     }
 
     @Override
@@ -583,7 +619,9 @@
 
     @Override
     public void enterUnitsStatement(GeneratedYangParser.UnitsStatementContext ctx) {
-        UnitsListener.processUnitsEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnitsListener.processUnitsEntry(this, ctx);
+        }
     }
 
     @Override
@@ -603,12 +641,16 @@
 
     @Override
     public void enterTypeStatement(GeneratedYangParser.TypeStatementContext ctx) {
-        TypeListener.processTypeEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            TypeListener.processTypeEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitTypeStatement(GeneratedYangParser.TypeStatementContext ctx) {
-        TypeListener.processTypeExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            TypeListener.processTypeExit(this, ctx);
+        }
     }
 
     @Override
@@ -623,17 +665,23 @@
 
     @Override
     public void enterDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext ctx) {
-        Decimal64Listener.processDecimal64Entry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            Decimal64Listener.processDecimal64Entry(this, ctx);
+        }
     }
 
     @Override
     public void exitDecimal64Specification(GeneratedYangParser.Decimal64SpecificationContext ctx) {
-        Decimal64Listener.processDecimal64Exit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            Decimal64Listener.processDecimal64Exit(this, ctx);
+        }
     }
 
     @Override
     public void enterFractionDigitStatement(GeneratedYangParser.FractionDigitStatementContext ctx) {
-        FractionDigitsListener.processFractionDigitsEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            FractionDigitsListener.processFractionDigitsEntry(this, ctx);
+        }
     }
 
     @Override
@@ -653,12 +701,16 @@
 
     @Override
     public void enterRangeStatement(GeneratedYangParser.RangeStatementContext ctx) {
-        RangeRestrictionListener.processRangeRestrictionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RangeRestrictionListener.processRangeRestrictionEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitRangeStatement(GeneratedYangParser.RangeStatementContext ctx) {
-        RangeRestrictionListener.processRangeRestrictionExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RangeRestrictionListener.processRangeRestrictionExit(this, ctx);
+        }
     }
 
     @Override
@@ -683,27 +735,37 @@
 
     @Override
     public void enterLengthStatement(GeneratedYangParser.LengthStatementContext ctx) {
-        LengthRestrictionListener.processLengthRestrictionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LengthRestrictionListener.processLengthRestrictionEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitLengthStatement(GeneratedYangParser.LengthStatementContext ctx) {
-        LengthRestrictionListener.processLengthRestrictionExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LengthRestrictionListener.processLengthRestrictionExit(this, ctx);
+        }
     }
 
     @Override
     public void enterPatternStatement(GeneratedYangParser.PatternStatementContext ctx) {
-        PatternRestrictionListener.processPatternRestrictionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PatternRestrictionListener.processPatternRestrictionEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitPatternStatement(GeneratedYangParser.PatternStatementContext ctx) {
-        PatternRestrictionListener.processPatternRestrictionExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PatternRestrictionListener.processPatternRestrictionExit(this, ctx);
+        }
     }
 
     @Override
     public void enterDefaultStatement(GeneratedYangParser.DefaultStatementContext ctx) {
-        DefaultListener.processDefaultEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            DefaultListener.processDefaultEntry(this, ctx);
+        }
     }
 
     @Override
@@ -713,22 +775,30 @@
 
     @Override
     public void enterEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) {
-        EnumerationListener.processEnumerationEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumerationListener.processEnumerationEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitEnumSpecification(GeneratedYangParser.EnumSpecificationContext ctx) {
-        EnumerationListener.processEnumerationExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumerationListener.processEnumerationExit(this, ctx);
+        }
     }
 
     @Override
     public void enterEnumStatement(GeneratedYangParser.EnumStatementContext ctx) {
-        EnumListener.processEnumEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumListener.processEnumEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitEnumStatement(GeneratedYangParser.EnumStatementContext ctx) {
-        EnumListener.processEnumExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            EnumListener.processEnumExit(this, ctx);
+        }
     }
 
     @Override
@@ -743,17 +813,23 @@
 
     @Override
     public void enterLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) {
-        LeafrefListener.processLeafrefEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LeafrefListener.processLeafrefEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitLeafrefSpecification(GeneratedYangParser.LeafrefSpecificationContext ctx) {
-        LeafrefListener.processLeafrefExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            LeafrefListener.processLeafrefExit(this, ctx);
+        }
     }
 
     @Override
     public void enterPathStatement(GeneratedYangParser.PathStatementContext ctx) {
-        PathListener.processPathEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PathListener.processPathEntry(this, ctx);
+        }
     }
 
     @Override
@@ -763,7 +839,9 @@
 
     @Override
     public void enterRequireInstanceStatement(GeneratedYangParser.RequireInstanceStatementContext ctx) {
-        RequireInstanceListener.processRequireInstanceEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            RequireInstanceListener.processRequireInstanceEntry(this, ctx);
+        }
     }
 
     @Override
@@ -783,42 +861,58 @@
 
     @Override
     public void enterIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) {
-        IdentityrefListener.processIdentityrefEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IdentityrefListener.processIdentityrefEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitIdentityrefSpecification(GeneratedYangParser.IdentityrefSpecificationContext ctx) {
-        IdentityrefListener.processIdentityrefExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            IdentityrefListener.processIdentityrefExit(this, ctx);
+        }
     }
 
     @Override
     public void enterUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) {
-        UnionListener.processUnionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnionListener.processUnionEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitUnionSpecification(GeneratedYangParser.UnionSpecificationContext ctx) {
-        UnionListener.processUnionExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UnionListener.processUnionExit(this, ctx);
+        }
     }
 
     @Override
     public void enterBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) {
-        BitsListener.processBitsEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitsListener.processBitsEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitBitsSpecification(GeneratedYangParser.BitsSpecificationContext ctx) {
-        BitsListener.processBitsExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitsListener.processBitsExit(this, ctx);
+        }
     }
 
     @Override
     public void enterBitStatement(GeneratedYangParser.BitStatementContext ctx) {
-        BitListener.processBitEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitListener.processBitEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitBitStatement(GeneratedYangParser.BitStatementContext ctx) {
-        BitListener.processBitExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            BitListener.processBitExit(this, ctx);
+        }
     }
 
     @Override
@@ -833,7 +927,9 @@
 
     @Override
     public void enterPositionStatement(GeneratedYangParser.PositionStatementContext ctx) {
-        PositionListener.processPositionEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PositionListener.processPositionEntry(this, ctx);
+        }
     }
 
     @Override
@@ -843,7 +939,9 @@
 
     @Override
     public void enterStatusStatement(GeneratedYangParser.StatusStatementContext ctx) {
-        StatusListener.processStatusEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            StatusListener.processStatusEntry(this, ctx);
+        }
     }
 
     @Override
@@ -853,7 +951,9 @@
 
     @Override
     public void enterConfigStatement(GeneratedYangParser.ConfigStatementContext ctx) {
-        ConfigListener.processConfigEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ConfigListener.processConfigEntry(this, ctx);
+        }
     }
 
     @Override
@@ -863,7 +963,9 @@
 
     @Override
     public void enterMandatoryStatement(GeneratedYangParser.MandatoryStatementContext ctx) {
-        MandatoryListener.processMandatoryEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MandatoryListener.processMandatoryEntry(this, ctx);
+        }
     }
 
     @Override
@@ -873,7 +975,9 @@
 
     @Override
     public void enterPresenceStatement(GeneratedYangParser.PresenceStatementContext ctx) {
-        PresenceListener.processPresenceEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            PresenceListener.processPresenceEntry(this, ctx);
+        }
     }
 
     @Override
@@ -893,17 +997,23 @@
 
     @Override
     public void enterMustStatement(GeneratedYangParser.MustStatementContext ctx) {
-        MustListener.processMustEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MustListener.processMustEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitMustStatement(GeneratedYangParser.MustStatementContext ctx) {
-        MustListener.processMustExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MustListener.processMustExit(this, ctx);
+        }
     }
 
     @Override
     public void enterErrorMessageStatement(GeneratedYangParser.ErrorMessageStatementContext ctx) {
-        ErrorMessageListener.processErrorMessageEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ErrorMessageListener.processErrorMessageEntry(this, ctx);
+        }
     }
 
     @Override
@@ -913,7 +1023,9 @@
 
     @Override
     public void enterErrorAppTagStatement(GeneratedYangParser.ErrorAppTagStatementContext ctx) {
-        ErrorAppTagListener.processErrorAppTagMessageEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ErrorAppTagListener.processErrorAppTagMessageEntry(this, ctx);
+        }
     }
 
     @Override
@@ -923,7 +1035,9 @@
 
     @Override
     public void enterMinElementsStatement(GeneratedYangParser.MinElementsStatementContext ctx) {
-        MinElementsListener.processMinElementsEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MinElementsListener.processMinElementsEntry(this, ctx);
+        }
     }
 
     @Override
@@ -933,7 +1047,9 @@
 
     @Override
     public void enterMaxElementsStatement(GeneratedYangParser.MaxElementsStatementContext ctx) {
-        MaxElementsListener.processMaxElementsEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            MaxElementsListener.processMaxElementsEntry(this, ctx);
+        }
     }
 
     @Override
@@ -943,7 +1059,9 @@
 
     @Override
     public void enterValueStatement(GeneratedYangParser.ValueStatementContext ctx) {
-        ValueListener.processValueEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            ValueListener.processValueEntry(this, ctx);
+        }
     }
 
     @Override
@@ -1013,7 +1131,9 @@
 
     @Override
     public void enterUniqueStatement(GeneratedYangParser.UniqueStatementContext ctx) {
-        UniqueListener.processUniqueEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            UniqueListener.processUniqueEntry(this, ctx);
+        }
     }
 
     @Override
@@ -1053,12 +1173,13 @@
 
     @Override
     public void enterAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
         handleUnsupportedYangConstruct(YangConstructType.ANYXML_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT, getFileName());
     }
 
     @Override
     public void exitAnyxmlStatement(GeneratedYangParser.AnyxmlStatementContext ctx) {
-        // do nothing.
+        decreaseUnsupportedYangConstructDepth();
     }
 
     @Override
@@ -1073,12 +1194,13 @@
 
     @Override
     public void enterRefineStatement(GeneratedYangParser.RefineStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
         handleUnsupportedYangConstruct(YangConstructType.REFINE_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT, getFileName());
     }
 
     @Override
     public void exitRefineStatement(GeneratedYangParser.RefineStatementContext ctx) {
-        // do nothing.
+        decreaseUnsupportedYangConstructDepth();
     }
 
     @Override
@@ -1163,12 +1285,16 @@
 
     @Override
     public void enterWhenStatement(GeneratedYangParser.WhenStatementContext ctx) {
-        WhenListener.processWhenEntry(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            WhenListener.processWhenEntry(this, ctx);
+        }
     }
 
     @Override
     public void exitWhenStatement(GeneratedYangParser.WhenStatementContext ctx) {
-        WhenListener.processWhenExit(this, ctx);
+        if (getUnsupportedYangConstructDepth() == 0) {
+            WhenListener.processWhenExit(this, ctx);
+        }
     }
 
     @Override
@@ -1213,13 +1339,14 @@
 
     @Override
     public void enterDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) {
+        increaseUnsupportedYangConstructDepth();
         handleUnsupportedYangConstruct(YangConstructType.DEVIATION_DATA, ctx, UNSUPPORTED_YANG_CONSTRUCT,
                 getFileName());
     }
 
     @Override
     public void exitDeviationStatement(GeneratedYangParser.DeviationStatementContext ctx) {
-        // do nothing.
+        decreaseUnsupportedYangConstructDepth();
     }
 
     @Override
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java
index 1bfee32..e07dca6 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ChoiceListener.java
@@ -33,6 +33,7 @@
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
 
 import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CHOICE_DATA;
@@ -129,6 +130,15 @@
             YangChoice choiceNode = getYangChoiceNode(JAVA_GENERATION);
             choiceNode.setName(identifier);
 
+            /*
+             * If "config" is not specified, the default is the same as the parent
+             * schema node's "config" value.
+             */
+            if (ctx.configStatement().isEmpty()) {
+                boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
+                choiceNode.setConfig(parentConfig);
+            }
+
             YangNode curNode = (YangNode) curData;
             try {
                 curNode.addChild(choiceNode);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
index 6850c62..70ff42a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListener.java
@@ -22,6 +22,7 @@
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
 
 import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
@@ -111,6 +112,15 @@
         YangLeafList leafList = getYangLeafList(JAVA_GENERATION);
         leafList.setLeafName(identifier);
 
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
+            leafList.setConfig(parentConfig);
+        }
+
         Parsable tmpData = listener.getParsedDataStack().peek();
         YangLeavesHolder leavesHolder;
 
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
index ed100a0..8c66183 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/listeners/LeafListener.java
@@ -27,6 +27,7 @@
 import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
 import org.onosproject.yangutils.parser.impl.TreeWalkListener;
+import org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation;
 
 import static org.onosproject.yangutils.datamodel.utils.GeneratedLanguage.JAVA_GENERATION;
 import static org.onosproject.yangutils.datamodel.utils.YangConstructType.CONFIG_DATA;
@@ -115,6 +116,15 @@
         YangLeaf leaf = getYangLeaf(JAVA_GENERATION);
         leaf.setLeafName(identifier);
 
+        /*
+         * If "config" is not specified, the default is the same as the parent
+         * schema node's "config" value.
+         */
+        if (ctx.configStatement().isEmpty()) {
+            boolean parentConfig = ListenerValidation.getParentNodeConfig(listener);
+            leaf.setConfig(parentConfig);
+        }
+
         Parsable tmpData = listener.getParsedDataStack().peek();
         YangLeavesHolder leavesHolder;
 
diff --git a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java
index 188e24e..fa3b200 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerValidation.java
@@ -20,9 +20,14 @@
 import java.util.List;
 
 import org.antlr.v4.runtime.ParserRuleContext;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.YangCase;
+import org.onosproject.yangutils.datamodel.YangChoice;
+import org.onosproject.yangutils.datamodel.YangConfig;
+import org.onosproject.yangutils.datamodel.YangInput;
 import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangNotification;
+import org.onosproject.yangutils.datamodel.YangOutput;
+import org.onosproject.yangutils.datamodel.YangRpc;
 import org.onosproject.yangutils.datamodel.utils.Parsable;
 import org.onosproject.yangutils.datamodel.utils.YangConstructType;
 import org.onosproject.yangutils.parser.exceptions.ParserException;
@@ -102,18 +107,18 @@
      * @return true/false parent's config value
      */
     public static boolean getParentNodeConfig(TreeWalkListener listener) {
-
-        YangNode parentNode;
         Parsable curData = listener.getParsedDataStack().peek();
-        if (curData instanceof YangNode) {
-            parentNode = ((YangNode) curData).getParent();
-            if (parentNode instanceof YangContainer) {
-                return ((YangContainer) parentNode).isConfig();
-            } else if (parentNode instanceof YangList) {
-                return ((YangList) parentNode).isConfig();
-            }
+        YangNode parentNode = ((YangNode) curData).getParent();
+        if (curData instanceof YangConfig) {
+            return ((YangConfig) curData).isConfig();
+        } else if (curData instanceof YangRpc || curData instanceof YangOutput
+                || curData instanceof YangInput || curData instanceof YangNotification) {
+            return false;
+        } else if (curData instanceof YangCase && parentNode instanceof YangChoice) {
+            return ((YangChoice) parentNode).isConfig();
+        } else {
+            return true;
         }
-        return true;
     }
 
     /**
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java
index 2649d4d..ea6708b 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MustListenerTest.java
@@ -72,4 +72,13 @@
 
         assertThat(leafInfo.getListOfMust().iterator().next().getConstraint(), is("ifType != 'ethernet'"));
     }
+
+    /**
+     * Checks whether there is no parser exception when must statement is sub-statement of
+     * unsupported yang construct.
+     */
+    @Test
+    public void processUnsupportedSubStatementMust() throws IOException, ParserException {
+        YangNode node = manager.getDataModel("src/test/resources/UnsupportedYangConstructSubStatementMust.yang");
+    }
 }
\ No newline at end of file
diff --git a/plugin/src/test/resources/UnsupportedYangConstructSubStatementMust.yang b/plugin/src/test/resources/UnsupportedYangConstructSubStatementMust.yang
new file mode 100644
index 0000000..1529cfd
--- /dev/null
+++ b/plugin/src/test/resources/UnsupportedYangConstructSubStatementMust.yang
@@ -0,0 +1,17 @@
+module Test {
+    yang-version 1;
+    namespace "http://huawei.com";
+    prefix Ant;
+    list link-scope-lsa {
+        key "lsa-id adv-router";
+        description "List of OSPF link scope LSAs";
+        uses lsa {
+            refine "version/ospfv2/ospfv2" {
+                must "../../../../../../../../../../../"
+                   + "rt:type = 'ospf:ospfv2'" {
+                  description "OSPFv2 LSA.";
+                }
+            }
+        }
+    }
+}
\ No newline at end of file