Added handling for YANG extensions related to RFC 6536 (default-deny-write, default-deny-all) and RFC 6241 (get-filter-element-attributes) and added in Unit Tests for the new Listener classes related to extension references

Change-Id: I6501c23d340f0d6f85ecbe8790186568152d341f
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyAllExtension.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyAllExtension.java
new file mode 100644
index 0000000..2e6c58a
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyAllExtension.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Methods related to the extensions defined in ietf-netconf-acm.yang RFC 6536.
+ *
+ * RFC 6536 defines two extensions default-deny-write and default-deny-all
+ * that can be used to mark exceptions for data nodes to the standard access
+ * control exceptions.
+ * There is no attribute to this extension and so has been represented as a
+ * boolean flag
+ */
+public interface DefaultDenyAllExtension {
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    public boolean getDefaultDenyAll();
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    public void setDefaultDenyAll(boolean defaultDenyAll);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyWriteExtension.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyWriteExtension.java
new file mode 100644
index 0000000..e9bd7e7
--- /dev/null
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/DefaultDenyWriteExtension.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.yang.compiler.datamodel;
+
+/**
+ * Methods related to the extensions defined in ietf-netconf-acm.yang RFC 6536.
+ *
+ * RFC 6536 defines two extensions default-deny-write and default-deny-all
+ * that can be used to mark exceptions for data nodes to the standard access
+ * control exceptions.
+ * There is no attribute to this extension, and so has been represented as a
+ * boolean flag
+ */
+public interface DefaultDenyWriteExtension {
+    /**
+     * Returns the defaultDenyWrite.
+     * @return
+     */
+    public boolean getDefaultDenyWrite();
+
+    /**
+     * Sets the defaultDenyWrite.
+     *
+     * @param defaultDenyWrite
+     */
+    public void setDefaultDenyWrite(boolean defaultDenyWrite);
+}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
index 2278bef..bab5e89 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangContainer.java
@@ -103,9 +103,10 @@
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangIsFilterContentNodes,
-        YangConfig, SingleInstanceNodeContext, SchemaDataNode {
+        YangConfig, SingleInstanceNodeContext, SchemaDataNode,
+        DefaultDenyWriteExtension, DefaultDenyAllExtension {
 
-    private static final long serialVersionUID = 806201605L;
+    private static final long serialVersionUID = -4962764560362228905L;
 
     /**
      * If container maintains config data.
@@ -161,6 +162,16 @@
     private List<YangIfFeature> ifFeatureList;
 
     /**
+     * References the extension default-deny-write.
+     */
+    private boolean defaultDenyWrite;
+
+    /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Create a container node.
      */
     public YangContainer() {
@@ -392,6 +403,44 @@
     }
 
     /**
+     * Returns the defaultDenyWrite.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyWrite() {
+        return defaultDenyWrite;
+    }
+
+    /**
+     * Sets the defaultDenyWrite.
+     *
+     * @param defaultDenyWrite
+     */
+    @Override
+    public void setDefaultDenyWrite(boolean defaultDenyWrite) {
+        this.defaultDenyWrite = defaultDenyWrite;
+    }
+
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
+
+    /**
      * Returns the type of the data.
      *
      * @return returns CONTAINER_DATA
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
index 603db64..b45cc2e 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeaf.java
@@ -77,7 +77,7 @@
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
         YangMustHolder, YangIfFeatureHolder, YangWhenHolder, YangSchemaNode,
         YangConfig, YangUnits, YangDefault, YangMandatory, LeafSchemaContext,
-        SchemaDataNode {
+        SchemaDataNode, DefaultDenyWriteExtension, DefaultDenyAllExtension {
 
     private static final long serialVersionUID = 806201635L;
 
@@ -160,6 +160,16 @@
     private SchemaContext parentContext;
 
     /**
+     * References the extension default-deny-write.
+     */
+    private boolean defaultDenyWrite;
+
+    /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Creates a YANG leaf.
      */
     public YangLeaf() {
@@ -390,6 +400,44 @@
     }
 
     /**
+     * Returns the defaultDenyWrite.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyWrite() {
+        return defaultDenyWrite;
+    }
+
+    /**
+     * Sets the defaultDenyWrite.
+     *
+     * @param defaultDenyWrite
+     */
+    @Override
+    public void setDefaultDenyWrite(boolean defaultDenyWrite) {
+        this.defaultDenyWrite = defaultDenyWrite;
+    }
+
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
+
+    /**
      * Returns the type of the parsed data.
      *
      * @return returns LEAF_DATA
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
index 75083a4..7878e61 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangLeafList.java
@@ -73,7 +73,8 @@
         implements YangCommonInfo, Parsable, Cloneable, Serializable,
         YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
         YangConfig, YangUnits, YangMaxElementHolder, YangMinElementHolder,
-        SchemaDataNode, LeafSchemaContext {
+        SchemaDataNode, LeafSchemaContext, DefaultDenyWriteExtension,
+        DefaultDenyAllExtension {
 
     private static final long serialVersionUID = 806201637L;
 
@@ -175,6 +176,16 @@
     private SchemaContext parentContext;
 
     /**
+     * References the extension default-deny-write.
+     */
+    private boolean defaultDenyWrite;
+
+    /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Creates a YANG leaf-list.
      */
     public YangLeafList() {
@@ -656,4 +667,42 @@
     public Object fromString(String value) {
         return ObjectProvider.getObject(dataType, value, dataType.getDataType());
     }
+
+    /**
+     * Returns the defaultDenyWrite.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyWrite() {
+        return defaultDenyWrite;
+    }
+
+    /**
+     * Sets the defaultDenyWrite.
+     *
+     * @param defaultDenyWrite
+     */
+    @Override
+    public void setDefaultDenyWrite(boolean defaultDenyWrite) {
+        this.defaultDenyWrite = defaultDenyWrite;
+    }
+
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
index 37abeb2..b762699 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangList.java
@@ -90,7 +90,8 @@
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangMustHolder, YangWhenHolder, YangIfFeatureHolder, YangSchemaNode,
         YangIsFilterContentNodes, YangConfig, YangUniqueHolder,
-        YangMaxElementHolder, YangMinElementHolder, SchemaDataNode, ListSchemaContext {
+        YangMaxElementHolder, YangMinElementHolder, SchemaDataNode, ListSchemaContext,
+        DefaultDenyWriteExtension, DefaultDenyAllExtension {
 
     private static final long serialVersionUID = 806201609L;
 
@@ -231,6 +232,16 @@
     private SchemaContext parentContext;
 
     /**
+     * References the extension default-deny-write.
+     */
+    private boolean defaultDenyWrite;
+
+    /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Creates a YANG list object.
      */
     public YangList() {
@@ -883,4 +894,42 @@
             throw new IllegalArgumentException(e.getMessage());
         }
     }
+
+    /**
+     * Returns the defaultDenyWrite.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyWrite() {
+        return defaultDenyWrite;
+    }
+
+    /**
+     * Sets the defaultDenyWrite.
+     *
+     * @param defaultDenyWrite
+     */
+    @Override
+    public void setDefaultDenyWrite(boolean defaultDenyWrite) {
+        this.defaultDenyWrite = defaultDenyWrite;
+    }
+
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
index fba7fd9..3b00115 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangNotification.java
@@ -98,7 +98,7 @@
         extends YangNode
         implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector,
         YangAugmentableNode, YangIfFeatureHolder, InvalidOpTypeHolder,
-        SingleInstanceNodeContext {
+        SingleInstanceNodeContext, DefaultDenyAllExtension {
 
     private static final long serialVersionUID = 806201611L;
 
@@ -135,6 +135,11 @@
     private List<YangAugment> yangAugmentedInfo;
 
     /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Create a notification node.
      */
     public YangNotification() {
@@ -360,4 +365,23 @@
             throw new IllegalArgumentException(e.getMessage());
         }
     }
+
+    /**
+     * Returns the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
 }
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java
index 70d22c7..baa3221 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangRpc.java
@@ -81,7 +81,7 @@
         extends YangNode
         implements YangCommonInfo, Parsable,
         CollisionDetector, YangIfFeatureHolder, InvalidOpTypeHolder,
-        SingleInstanceNodeContext, SchemaDataNode {
+        SingleInstanceNodeContext, SchemaDataNode, DefaultDenyAllExtension {
 
     private static final long serialVersionUID = 806201613L;
 
@@ -106,6 +106,11 @@
     private List<YangIfFeature> ifFeatureList;
 
     /**
+     * References the extension default-deny-all.
+     */
+    private boolean defaultDenyAll;
+
+    /**
      * Creates a rpc node.
      */
     public YangRpc() {
@@ -164,6 +169,25 @@
         }
     }
 
+    /**
+     * Gets the defaultDenyAll.
+     * @return
+     */
+    @Override
+    public boolean getDefaultDenyAll() {
+        return defaultDenyAll;
+    }
+
+    /**
+     * Sets the defaultDenyAll.
+     *
+     * @param defaultDenyAll
+     */
+    @Override
+    public void setDefaultDenyAll(boolean defaultDenyAll) {
+        this.defaultDenyAll = defaultDenyAll;
+    }
+
     @Override
     public YangConstructType getYangConstructType() {
         return RPC_DATA;
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
index edb1128..d65c007 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/YangConstructType.java
@@ -400,6 +400,16 @@
     APP_EXTENDED_NAME_DATA,
 
     /**
+     * Identifies a reference to the extension default-deny-write.
+     */
+    DEFAULT_DENY_WRITE_DATA,
+
+    /**
+     * Identifies a reference to the extension default-deny-all.
+     */
+    DEFAULT_DENY_ALL_DATA,
+
+    /**
      * Identifies the YANG argument element parsed data.
      */
     ARGUMENT_DATA,
@@ -585,6 +595,10 @@
                 return "app-data-structure";
             case APP_EXTENDED_NAME_DATA:
                 return "app-extended-name";
+            case DEFAULT_DENY_WRITE_DATA:
+                return "default-deny-write";
+            case DEFAULT_DENY_ALL_DATA:
+                return "default-deny-all";
             case ARGUMENT_DATA:
                 return "argument";
             case DEVIATE_NOT_SUPPORTED:
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
index 070cd23..5055538 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
@@ -1938,5 +1938,34 @@
      *
      * @param currentContext current context in the parsed tree
      */
-    void exitRequireInstance(RequireInstanceContext currentContext);
+    void exitRequireInstance(GeneratedYangParser.RequireInstanceContext currentContext);
+
+    /**
+     * From ietf-netconf-acm.yang extension.
+     * @param currentContext
+     */
+    void enterDefaultDenyWriteStatement(
+            GeneratedYangParser.DefaultDenyWriteStatementContext currentContext);
+
+    /**
+     * From ietf-netconf-acm.yang extension.
+     * @param currentContext
+     */
+    void exitDefaultDenyWriteStatement(
+            GeneratedYangParser.DefaultDenyWriteStatementContext currentContext);
+
+    /**
+     * From ietf-netconf-acm.yang extension.
+     * @param currentContext
+     */
+    void enterDefaultDenyAllStatement(
+            GeneratedYangParser.DefaultDenyAllStatementContext currentContext);
+
+    /**
+     * From ietf-netconf-acm.yang extension.
+     * @param currentContext
+     */
+    void exitDefaultDenyAllStatement(
+            GeneratedYangParser.DefaultDenyAllStatementContext currentContext);
+
 }
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
index e6be5d4..fc1d34d 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
@@ -23,6 +23,7 @@
 import org.onosproject.yang.compiler.datamodel.utils.Parsable;
 import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
 import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangListener;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
 import org.onosproject.yang.compiler.parser.impl.listeners.AppDataStructureListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.AppExtendedNameListener;
 import org.onosproject.yang.compiler.parser.impl.listeners.ArgumentListener;
@@ -100,6 +101,8 @@
 import org.onosproject.yang.compiler.parser.impl.listeners.WhenListener;
 import org.onosproject.yang.compiler.parser.impl.parserutils.ListenerUtil;
 import org.onosproject.yang.compiler.utils.UtilConstants;
+import org.onosproject.yang.compiler.parser.impl.listeners.DefaultDenyAllExtRefListener;
+import org.onosproject.yang.compiler.parser.impl.listeners.DefaultDenyWriteExtRefListener;
 
 import java.util.Stack;
 
@@ -1847,4 +1850,30 @@
     public void exitEveryRule(ParserRuleContext parserRuleContext) {
         // do nothing.
     }
+
+    @Override
+    public void enterDefaultDenyWriteStatement(
+            GeneratedYangParser.DefaultDenyWriteStatementContext currentContext) {
+        DefaultDenyWriteExtRefListener
+            .processDefaultDenyWriteStructureEntry(this, currentContext);
+    }
+
+    @Override
+    public void exitDefaultDenyWriteStatement(
+            GeneratedYangParser.DefaultDenyWriteStatementContext currentContext) {
+        // do nothing
+    }
+
+    @Override
+    public void enterDefaultDenyAllStatement(
+            GeneratedYangParser.DefaultDenyAllStatementContext currentContext) {
+        DefaultDenyAllExtRefListener
+            .processDefaultDenyAllStructureEntry(this, currentContext);
+    }
+
+    @Override
+    public void exitDefaultDenyAllStatement(
+            GeneratedYangParser.DefaultDenyAllStatementContext currentContext) {
+        // do nothing
+    }
 }
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListener.java
new file mode 100644
index 0000000..cb7997a
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListener.java
@@ -0,0 +1,78 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEFAULT_DENY_ALL_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+
+public final class DefaultDenyAllExtRefListener {
+
+    private DefaultDenyAllExtRefListener() {
+
+    }
+
+    public static void processDefaultDenyAllStructureEntry(TreeWalkListener listener,
+            GeneratedYangParser.DefaultDenyAllStatementContext ctx) {
+        // Check for stack to be non empty.
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DENY_ALL_DATA, "", ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangContainer) {
+            YangContainer holder = (YangContainer) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else if (tmpData instanceof YangLeaf) {
+            YangLeaf holder = (YangLeaf) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else if (tmpData instanceof YangLeafList) {
+            YangLeafList holder = (YangLeafList) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else if (tmpData instanceof YangList) {
+            YangList holder = (YangList) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else if (tmpData instanceof YangNotification) {
+            YangNotification holder = (YangNotification) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else if (tmpData instanceof YangRpc) {
+            YangRpc holder = (YangRpc) tmpData;
+            holder.setDefaultDenyAll(true);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, DEFAULT_DENY_ALL_DATA, "", ENTRY));
+        }
+    }
+
+    public static void processDefaultDenyAllStructureExit(TreeWalkListener listener,
+            GeneratedYangParser.DefaultDenyAllStatementContext ctx) {
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DENY_ALL_DATA, "", EXIT);
+        // Nothing.to do
+    }
+}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListener.java
new file mode 100644
index 0000000..ea8b170
--- /dev/null
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListener.java
@@ -0,0 +1,70 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import static org.onosproject.yang.compiler.datamodel.utils.YangConstructType.DEFAULT_DENY_WRITE_DATA;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorLocation.EXIT;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yang.compiler.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
+
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.utils.Parsable;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.TreeWalkListener;
+
+public final class DefaultDenyWriteExtRefListener {
+
+    private DefaultDenyWriteExtRefListener() {
+
+    }
+
+
+    public static void processDefaultDenyWriteStructureEntry(TreeWalkListener listener,
+            GeneratedYangParser.DefaultDenyWriteStatementContext ctx) {
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DENY_WRITE_DATA, "", ENTRY);
+
+        Parsable tmpData = listener.getParsedDataStack().peek();
+        if (tmpData instanceof YangContainer) {
+            YangContainer holder = (YangContainer) tmpData;
+            holder.setDefaultDenyWrite(true);
+        } else if (tmpData instanceof YangLeaf) {
+            YangLeaf holder = (YangLeaf) tmpData;
+            holder.setDefaultDenyWrite(true);
+        } else if (tmpData instanceof YangLeafList) {
+            YangLeafList holder = (YangLeafList) tmpData;
+            holder.setDefaultDenyWrite(true);
+        } else if (tmpData instanceof YangList) {
+            YangList holder = (YangList) tmpData;
+            holder.setDefaultDenyWrite(true);
+        } else {
+            throw new ParserException(constructListenerErrorMessage(
+                    INVALID_HOLDER, DEFAULT_DENY_WRITE_DATA, "", ENTRY));
+        }
+    }
+
+    public static void processDefaultDenyWriteStructureExit(TreeWalkListener listener,
+            GeneratedYangParser.DefaultDenyWriteStatementContext ctx) {
+        checkStackIsNotEmpty(listener, MISSING_HOLDER, DEFAULT_DENY_WRITE_DATA, "", EXIT);
+        // Nothing.to do
+    }
+}
diff --git a/compiler/base/parser/src/main/resources/GeneratedYang.g4 b/compiler/base/parser/src/main/resources/GeneratedYang.g4
index 0646a60..b4a20e5 100644
--- a/compiler/base/parser/src/main/resources/GeneratedYang.g4
+++ b/compiler/base/parser/src/main/resources/GeneratedYang.g4
@@ -800,13 +800,15 @@
      *                             *((typedef-stmt /
      *                                grouping-stmt) stmtsep)
      *                             *(data-def-stmt stmtsep)
+     *                             [default-deny-write-stmt stmtsep]
+     *                             [default-deny-all-stmt stmtsep]
      *                         "}")
-     * TODO : 0..1 occurance to be checked in listener
+     * TODO : 0..1 occurrence to be checked in listener
      */
     containerStatement : CONTAINER_KEYWORD identifier
                      (STMTEND | LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | presenceStatement | configStatement
                      | statusStatement | descriptionStatement | referenceStatement | typedefStatement | groupingStatement
-                     | dataDefStatement)* RIGHT_CURLY_BRACE);
+                     | dataDefStatement | defaultDenyWriteStatement | defaultDenyAllStatement )* RIGHT_CURLY_BRACE);
 
     /**
      *  leaf-stmt           = leaf-keyword sep identifier-arg-str optsep
@@ -823,12 +825,14 @@
      *                            [status-stmt stmtsep]
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
+     *                            [default-deny-write-stmt stmtsep]
+     *                            [default-deny-all-stmt stmtsep]
      *                         "}"
-     * TODO : 0..1 occurance to be checked in listener
+     * TODO : 0..1 occurrence to be checked in listener
      */
     leafStatement : LEAF_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement | unitsStatement
               | mustStatement | defaultStatement | configStatement | mandatoryStatement | statusStatement  | descriptionStatement
-              | referenceStatement)* RIGHT_CURLY_BRACE;
+              | referenceStatement | defaultDenyWriteStatement | defaultDenyAllStatement )* RIGHT_CURLY_BRACE;
 
     /**
      *  leaf-list-stmt      = leaf-list-keyword sep identifier-arg-str optsep
@@ -846,12 +850,15 @@
      *                            [status-stmt stmtsep]
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
+     *                            [default-deny-write-stmt stmtsep]
+     *                            [default-deny-all-stmt stmtsep]
      *                         "}"
      * TODO : 0..1 occurance to be checked in listener
      */
     leafListStatement : LEAF_LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | typeStatement
                      | unitsStatement | mustStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement
-                     | statusStatement | descriptionStatement | referenceStatement)* RIGHT_CURLY_BRACE;
+                     | statusStatement | descriptionStatement | referenceStatement
+                     | defaultDenyWriteStatement | defaultDenyAllStatement )* RIGHT_CURLY_BRACE;
 
     /**
      *  list-stmt           = list-keyword sep identifier-arg-str optsep
@@ -869,6 +876,8 @@
      *                            [status-stmt stmtsep]
      *                            [description-stmt stmtsep]
      *                            [reference-stmt stmtsep]
+     *                            [default-deny-write-stmt stmtsep]
+     *                            [default-deny-all-stmt stmtsep]
      *                            *((typedef-stmt /
      *                               grouping-stmt) stmtsep)
      *                            1*(data-def-stmt stmtsep)
@@ -877,7 +886,8 @@
      */
     listStatement : LIST_KEYWORD identifier LEFT_CURLY_BRACE (whenStatement | ifFeatureStatement | mustStatement | keyStatement
               | uniqueStatement | configStatement | minElementsStatement | maxElementsStatement | orderedByStatement | statusStatement
-              | descriptionStatement | referenceStatement | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
+              | descriptionStatement | referenceStatement | defaultDenyWriteStatement | defaultDenyAllStatement
+              | typedefStatement | groupingStatement| dataDefStatement)* RIGHT_CURLY_BRACE;
 
     /**
      *  key-stmt            = key-keyword sep key-arg-str stmtend
@@ -1114,10 +1124,12 @@
      *                                grouping-stmt) stmtsep)
      *                             [input-stmt stmtsep]
      *                             [output-stmt stmtsep]
+     *                             [default-deny-all-stmt stmtsep]
      *                         "}")
      */
     rpcStatement : RPC_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement | statusStatement | descriptionStatement
-                | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement)* RIGHT_CURLY_BRACE);
+                | referenceStatement | typedefStatement | groupingStatement | inputStatement | outputStatement
+                | defaultDenyAllStatement)* RIGHT_CURLY_BRACE);
 
     /**
      * input-stmt          = input-keyword optsep
@@ -1151,6 +1163,7 @@
      *                             [status-stmt stmtsep]
      *                             [description-stmt stmtsep]
      *                             [reference-stmt stmtsep]
+     *                             [default-deny-all-stmt stmtsep]
      *                             *((typedef-stmt /
      *                                grouping-stmt) stmtsep)
      *                             *(data-def-stmt stmtsep)
@@ -1158,7 +1171,8 @@
      * TODO : 0..1 occurance to be checked in listener
      */
      notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | LEFT_CURLY_BRACE (ifFeatureStatement
-                           | statusStatement | descriptionStatement | referenceStatement | typedefStatement
+                           | statusStatement | descriptionStatement | referenceStatement
+                           | typedefStatement | defaultDenyAllStatement
                            | groupingStatement | dataDefStatement)* RIGHT_CURLY_BRACE);
 
     /**
@@ -1275,6 +1289,18 @@
      */
     appExtendedStatement : APP_EXTENDED extendedName STMTEND;
 
+    /**
+     *   default-deny-write-stmt = prefix:default-deny-write ";"
+     *   From ietf-netconf-acm.yang RFC 6536
+     */
+    defaultDenyWriteStatement : DEFAULT_DENY_WRITE STMTEND;
+
+    /**
+     *   default-deny-all-stmt = prefix:default-deny-all ";"
+     *   From ietf-netconf-acm.yang RFC 6536
+     */
+    defaultDenyAllStatement : DEFAULT_DENY_ALL STMTEND;
+
     string : STRING (PLUS STRING)*
            | IDENTIFIER
            | INTEGER
@@ -1346,4 +1372,4 @@
                   | FALSE_KEYWORD | MAX_KEYWORD | MIN_KEYWORD | NOT_SUPPORTED_KEYWORD | OBSOLETE_KEYWORD
                   | REPLACE_KEYWORD | SYSTEM_KEYWORD | TRUE_KEYWORD | UNBOUNDED_KEYWORD | USER_KEYWORD
                   | COMPILER_ANNOTATION_KEYWORD | APP_DATA_STRUCTURE_KEYWORD | DATA_STRUCTURE_KEYWORD
-                  | APP_EXTENDED_KEYWORD;
+                  | APP_EXTENDED_KEYWORD | DEFAULT_DENY_WRITE_KEYWORD | DEFAULT_DENY_ALL_KEYWORD;
diff --git a/compiler/base/parser/src/main/resources/YangLexer.g4 b/compiler/base/parser/src/main/resources/YangLexer.g4
index 45189f7..cd942a0 100644
--- a/compiler/base/parser/src/main/resources/YangLexer.g4
+++ b/compiler/base/parser/src/main/resources/YangLexer.g4
@@ -113,6 +113,11 @@
     DATA_STRUCTURE_KEY : IDENTIFIER COLON KEY_KEYWORD;
     APP_EXTENDED_KEYWORD : 'app-extended-name';
     APP_EXTENDED : IDENTIFIER COLON APP_EXTENDED_KEYWORD;
+    //From ietf-netconf-acm.yang RFC 6536
+    DEFAULT_DENY_WRITE_KEYWORD : 'default-deny-write';
+    DEFAULT_DENY_WRITE : IDENTIFIER COLON DEFAULT_DENY_WRITE_KEYWORD;
+    DEFAULT_DENY_ALL_KEYWORD : 'default-deny-all';
+    DEFAULT_DENY_ALL : IDENTIFIER COLON DEFAULT_DENY_ALL_KEYWORD;
 
     // Lexer tokens to be skipped
     COMMENT
@@ -147,4 +152,4 @@
     fragment ALPHA      : [A-Za-z];
     fragment DIGIT      : [0-9];
     fragment URN        : [u][r][n];
-    fragment HTTP       : [h][t][t][p];
\ No newline at end of file
+    fragment HTTP       : [h][t][t][p];
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListenerTest.java
new file mode 100644
index 0000000..2bce360
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyAllExtRefListenerTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangExtension;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.datamodel.YangNotification;
+import org.onosproject.yang.compiler.datamodel.YangRpc;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+/**
+ * Test cases for testing default-deny-all extension reference listener.
+ */
+public class DefaultDenyAllExtRefListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks extension reference statement as sub-statement of module.
+     */
+    @Test
+    public void processDefaultDenyAllExtensionRefStatement() throws IOException, ParserException {
+
+        YangNode node = manager
+                .getDataModel("src/test/resources/DefaultDenyAllExtensionRefTest.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("default-deny-all-extension-ref-test"));
+
+        YangExtension extension = yangNode.getExtensionList().iterator().next();
+        assertThat(extension.getName(), is("default-deny-all"));
+        assertThat(extension.getDescription(), is("\"Used to indicate that the data model node\n       "
+                + "controls a very sensitive security system parameter.\""));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("test"));
+        assertNotNull(yangContainer.getDefaultDenyAll());
+
+        assertEquals(2, yangContainer.getListOfLeaf().size());
+        YangLeaf leaf1 = yangContainer.getListOfLeaf().get(0);
+        assertThat(leaf1.getName(), is("test1"));
+        assertFalse(leaf1.getDefaultDenyAll());
+
+        YangLeaf leaf2 = yangContainer.getListOfLeaf().get(1);
+        assertThat(leaf2.getName(), is("test2"));
+        assertTrue(leaf2.getDefaultDenyAll());
+
+        assertEquals(1, yangContainer.getListOfLeafList().size());
+        YangLeafList leaffList3 = yangContainer.getListOfLeafList().get(0);
+        assertThat(leaffList3.getName(), is("test3"));
+        assertTrue(leaffList3.getDefaultDenyAll());
+
+        YangList list4 = (YangList) yangContainer.getChild();
+        assertThat(list4.getName(), is("test4"));
+        assertTrue(list4.getDefaultDenyAll());
+
+        YangRpc testrpc = (YangRpc) yangContainer.getNextSibling();
+        assertThat(testrpc.getName(), is("testrpc"));
+        assertTrue(testrpc.getDefaultDenyAll());
+
+        YangNotification testNotification =
+                            (YangNotification) testrpc.getNextSibling();
+        assertThat(testNotification.getName(), is("testnotif"));
+        assertTrue(testNotification.getDefaultDenyAll());
+    }
+}
diff --git a/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListenerTest.java b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListenerTest.java
new file mode 100644
index 0000000..c4f38a5
--- /dev/null
+++ b/compiler/base/parser/src/test/java/org/onosproject/yang/compiler/parser/impl/listeners/DefaultDenyWriteExtRefListenerTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.yang.compiler.parser.impl.listeners;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.onosproject.yang.compiler.datamodel.YangContainer;
+import org.onosproject.yang.compiler.datamodel.YangExtension;
+import org.onosproject.yang.compiler.datamodel.YangLeaf;
+import org.onosproject.yang.compiler.datamodel.YangLeafList;
+import org.onosproject.yang.compiler.datamodel.YangList;
+import org.onosproject.yang.compiler.datamodel.YangModule;
+import org.onosproject.yang.compiler.datamodel.YangNode;
+import org.onosproject.yang.compiler.datamodel.YangNodeType;
+import org.onosproject.yang.compiler.parser.exceptions.ParserException;
+import org.onosproject.yang.compiler.parser.impl.YangUtilsParserManager;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test cases for testing default-deny-write extension reference listener.
+ */
+public class DefaultDenyWriteExtRefListenerTest {
+
+    private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+    /**
+     * Checks extension reference statement as sub-statement of module.
+     */
+    @Test
+    public void processDefaultDenyWriteExtensionRefStatement() throws IOException, ParserException {
+
+        YangNode node = manager.getDataModel("src/test/resources/DefaultDenyWriteExtensionRefTest.yang");
+
+        assertThat((node instanceof YangModule), is(true));
+
+        // Check whether the node type is set properly to module.
+        assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+        YangModule yangNode = (YangModule) node;
+        assertThat(yangNode.getName(), is("default-deny-write-extension-ref-test"));
+
+        YangExtension extension = yangNode.getExtensionList().iterator().next();
+        assertThat(extension.getName(), is("default-deny-write"));
+        assertThat(extension.getDescription(),
+                is("\"Used to indicate that the data model node\n       "
+                        + "represents a sensitive security system parameter.\""));
+
+        YangContainer yangContainer = (YangContainer) yangNode.getChild();
+        assertThat(yangContainer.getName(), is("test"));
+        assertNotNull(yangContainer.getDefaultDenyWrite());
+
+        assertEquals(2, yangContainer.getListOfLeaf().size());
+        YangLeaf leaf1 = yangContainer.getListOfLeaf().get(0);
+        assertThat(leaf1.getName(), is("test1"));
+        assertFalse(leaf1.getDefaultDenyWrite());
+
+        YangLeaf leaf2 = yangContainer.getListOfLeaf().get(1);
+        assertThat(leaf2.getName(), is("test2"));
+        assertTrue(leaf2.getDefaultDenyWrite());
+
+        assertEquals(1, yangContainer.getListOfLeafList().size());
+        YangLeafList leaffList3 = yangContainer.getListOfLeafList().get(0);
+        assertThat(leaffList3.getName(), is("test3"));
+        assertTrue(leaffList3.getDefaultDenyAll());
+
+        YangList list4 = (YangList) yangContainer.getChild();
+        assertThat(list4.getName(), is("test4"));
+        assertTrue(list4.getDefaultDenyAll());
+    }
+}
+
diff --git a/compiler/base/parser/src/test/resources/DefaultDenyAllExtensionRefTest.yang b/compiler/base/parser/src/test/resources/DefaultDenyAllExtensionRefTest.yang
new file mode 100644
index 0000000..0583666
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DefaultDenyAllExtensionRefTest.yang
@@ -0,0 +1,82 @@
+module default-deny-all-extension-ref-test {
+  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";
+  prefix "nacm";
+
+  description
+  "This version of this YANG module is part of RFC 6536; see
+   the RFC itself for full legal notices.";
+
+  revision 2016-12-08 {
+    description
+      "Initial revision.";
+  }
+
+  extension default-deny-all {
+    description
+      "Used to indicate that the data model node
+       controls a very sensitive security system parameter.";
+  }
+
+
+  container test {
+    nacm:default-deny-all;
+
+    leaf test1 {
+      type string {
+        length 1..6;
+      }
+      description "A leaf without an extension";
+    }
+
+    leaf test2 {
+      nacm:default-deny-all;
+      type string {
+        length 1..6;
+      }
+      description "A leaf with an extension";
+    }
+
+    leaf-list test3 {
+      nacm:default-deny-all;
+      type string {
+        length 1..6;
+      }
+      description "A leaf-list with an extension";
+    }
+
+    list test4 {
+      key test4a;
+      nacm:default-deny-all;
+      description "A list with the extension";
+
+      leaf test4a {
+        type uint8;
+        description "Key leaf in the list";
+      }
+
+      leaf test4b {
+        type string {
+          length 1..6;
+        }
+        description "Another leaf in the list";
+      }
+    }
+  }
+
+  rpc testrpc {
+    nacm:default-deny-all;
+    description "An rpc with default-deny-all";
+  }
+
+  notification testnotif {
+    nacm:default-deny-all;
+    description "An rpc with default-deny-all";
+
+    leaf test4b {
+      type string {
+        length 1..6;
+      }
+      description "Another leaf in the list";
+    }
+  }
+}
\ No newline at end of file
diff --git a/compiler/base/parser/src/test/resources/DefaultDenyWriteExtensionRefTest.yang b/compiler/base/parser/src/test/resources/DefaultDenyWriteExtensionRefTest.yang
new file mode 100644
index 0000000..711d663
--- /dev/null
+++ b/compiler/base/parser/src/test/resources/DefaultDenyWriteExtensionRefTest.yang
@@ -0,0 +1,64 @@
+module default-deny-write-extension-ref-test {
+  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";
+  prefix "nacm";
+
+  description
+  "This version of this YANG module is part of RFC 6536; see
+   the RFC itself for full legal notices.";
+
+  revision 2016-12-08 {
+    description
+      "Initial revision.";
+  }
+
+  extension default-deny-write {
+    description
+      "Used to indicate that the data model node
+       represents a sensitive security system parameter.";
+  }
+
+
+  container test {
+    nacm:default-deny-write;
+    leaf test1 {
+      type string {
+        length 1..6;
+      }
+      description "A leaf without an extension";
+    }
+
+    leaf test2 {
+      nacm:default-deny-write;
+      type string {
+        length 1..6;
+      }
+      description "A leaf with an extension";
+    }
+
+    leaf-list test3 {
+      nacm:default-deny-all;
+      type string {
+        length 1..6;
+      }
+      description "A leaf-list with an extension";
+    }
+
+    list test4 {
+      key test4a;
+      nacm:default-deny-all;
+      description "A list with the extension";
+
+      leaf test4a {
+        type uint8;
+        description "Key leaf in the list";
+      }
+
+      leaf test4b {
+        type string {
+          length 1..6;
+        }
+        description "Another leaf in the list";
+      }
+    }
+  }
+}
\ No newline at end of file