[ONOS-4063 to 68] Intra YANG file Linking Implementation and Intra YANG file Linking Framework
Change-Id: I06e602c351ab54178bf90b8676af71a70e42371f
diff --git a/src/test/java/org/onosproject/yangutils/linker/IntraFileTypeLinkingTest.java b/src/test/java/org/onosproject/yangutils/linker/IntraFileTypeLinkingTest.java
new file mode 100644
index 0000000..67fcf07
--- /dev/null
+++ b/src/test/java/org/onosproject/yangutils/linker/IntraFileTypeLinkingTest.java
@@ -0,0 +1,420 @@
+/*
+ * Copyright 2016 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.linker;
+
+import java.io.IOException;
+import java.util.ListIterator;
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.ResolvableStatus;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
+import org.onosproject.yangutils.datamodel.YangDerivedInfo;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangNodeType;
+import org.onosproject.yangutils.datamodel.YangTypeDef;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for testing "type" intra file linking.
+ */
+public class IntraFileTypeLinkingTest {
+
+ private final YangUtilsParserManager manager = new YangUtilsParserManager();
+
+ /**
+ * Checks self resolution when typedef and leaf using type are siblings.
+ */
+ @Test
+ public void processSelfResolutionWhenTypeAndTypedefAtRootLevel() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when typedef and leaf using type are at different
+ * level where typedef is at the root.
+ */
+ @Test
+ public void processSelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when typedef and leaf using type are at different
+ * level where typedef is at the root and defined after parent holder
+ * of type.
+ */
+ @Test
+ public void processSelfFileLinkingTypedefAtRootIsAfterContainerHavingType() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild().getNextSibling()));
+
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when typedef and leaf using type are at different
+ * level where typedef is at the level of root+1 and defined after parent
+ * holder of type.
+ */
+ @Test
+ public void processSelfFileLinkingTypedefAtMiddleLevelAfterParentHolder() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when typedef hierarchical references are present.
+ */
+ @Test
+ public void processSelfFileLinkingWithTypdefHierarchicalReference() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangList.getChild()));
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+
+ YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+ assertThat(((YangDerivedInfo<?>) typeDef1.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+ assertThat((typeDef1.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+
+ YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+ assertThat(((YangDerivedInfo<?>) typeDef2.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+ assertThat((typeDef2.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when typedef hierarchical references are present
+ * with last type is unresolved.
+ */
+ @Test
+ public void processSelfFileLinkingWithTypdefHierarchicalRefUnresolved() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangList.getChild()));
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.PARTIALLY_RESOLVED));
+
+ YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+ assertThat(((YangDerivedInfo<?>) typeDef1.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+ assertThat((typeDef1.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.PARTIALLY_RESOLVED));
+
+ YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+ assertThat(((YangDerivedInfo<?>) typeDef2.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+ assertThat((typeDef2.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.PARTIALLY_RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when type uses prefix of self module.
+ */
+ @Test
+ public void processSelfFileLinkingWithTypeWithSelfModulePrefix() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangList.getChild()));
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+
+ YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+ assertThat(((YangDerivedInfo<?>) typeDef1.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangContainer.getChild().getNextSibling()));
+ assertThat((typeDef1.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+
+ YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+ assertThat(((YangDerivedInfo<?>) typeDef2.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+ assertThat((typeDef2.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Checks self resolution when some type uses prefix of self module
+ * some uses external prefix.
+ */
+ @Test
+ public void processSelfFileLinkingWithTypeWithSelfAndExternalPrefixMix() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang");
+
+ // Check whether the data model tree returned is of type module.
+ assertThat((node instanceof YangModule), is(true));
+
+ // Check whether the node type is set properly to module.
+ assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
+
+ // Check whether the module name is set correctly.
+ YangModule yangNode = (YangModule) node;
+ assertThat(yangNode.getName(), is("Test"));
+
+ YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling();
+
+ YangList yangList = (YangList) yangContainer.getChild();
+
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
+
+ assertThat(leafInfo.getLeafName(), is("invalid-interval"));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("FirstClass"));
+ assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
+
+ assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) yangList.getChild()));
+ assertThat((leafInfo.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.PARTIALLY_RESOLVED));
+
+ YangTypeDef typeDef1 = (YangTypeDef) yangList.getChild();
+
+ YangTypeDef typeDef2 = (YangTypeDef) yangContainer.getChild().getNextSibling();
+
+ assertThat(((YangDerivedInfo<?>) typeDef2.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(),
+ is((YangTypeDef) node.getChild()));
+ assertThat((typeDef2.getDataType().getResolvableStatus()),
+ is(ResolvableStatus.RESOLVED));
+ }
+
+ /**
+ * Check self resolution when type referred typedef is not available in
+ * file.
+ */
+ @Test(expected = ParserException.class)
+ public void processSelfResolutionWhenTypeReferredTypedefNotDefined() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang");
+ }
+
+ /**
+ * Checks self resolution when typedef and leaf using type are at different
+ * level where typedef is is not an ancestor of type.
+ */
+ @Test(expected = ParserException.class)
+ public void processSelfFileLinkingTypedefNotFound() throws IOException, ParserException {
+
+ YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingTypedefNotFound.yang");
+ }
+
+ /**
+ * Checks hierarchical self resolution with self resolution failure scenario.
+ */
+ @Test(expected = ParserException.class)
+ public void processSelfFileLinkingWithHierarchicalTypeFailureScenario() throws IOException, ParserException {
+
+ YangNode node =
+ manager.getDataModel("src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang");
+ }
+}
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
index 7e693d5..cd94ec6 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -170,7 +169,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -206,7 +205,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
index b34209e..6013261 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
@@ -193,7 +193,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
index f3042bb..83bc719 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -178,7 +177,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -215,7 +214,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
index b150f81..6e1d651 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -68,7 +67,7 @@
YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafListInfo.getUnits(), is("\"seconds\""));
assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -163,7 +162,7 @@
YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafListInfo.getUnits(), is("\"seconds\""));
assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -200,7 +199,7 @@
YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafListInfo.getUnits(), is("\"seconds\""));
assertThat(leafListInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
index da9bb35..a5863d6 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
@@ -68,7 +68,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -162,7 +162,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -225,7 +225,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
index 86d1a0b..bee66aa 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
@@ -162,7 +162,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getStatus(), is(YangStatusType.CURRENT));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java
index b6a57d9..5a86d33 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/NotificationListenerTest.java
@@ -16,20 +16,18 @@
package org.onosproject.yangutils.parser.impl.listeners;
-import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-import org.onosproject.yangutils.parser.exceptions.ParserException;
-import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-
import java.io.IOException;
import java.util.ListIterator;
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangNodeType;
+import org.onosproject.yangutils.datamodel.YangNotification;
+import org.onosproject.yangutils.datamodel.YangStatusType;
+import org.onosproject.yangutils.datamodel.YangTypeDef;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
@@ -63,8 +61,6 @@
YangTypeDef typeDef = (YangTypeDef) yangNotification.getChild();
assertThat(typeDef.getName(), is("my-type"));
assertThat(typeDef.getStatus(), is(YangStatusType.DEPRECATED));
- assertThat(typeDef.getDerivedType().getDataTypeExtendedInfo()
- .getBaseType().getDataType(), is(YangDataTypes.INT32));
ListIterator<YangLeaf> leafIterator = yangNotification.getListOfLeaf().listIterator();
YangLeaf leafInfo = leafIterator.next();
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
index c398569..a0bcd1c 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -177,7 +176,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -214,7 +213,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
index 984b0f2..ed76c6d 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -187,7 +186,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
@@ -224,7 +223,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
index a1146aa..d263bb0 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
@@ -2,7 +2,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Test;
import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
@@ -45,7 +44,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"hello\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("hello"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.DERIVED));
}
@@ -71,7 +70,7 @@
YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
}
@@ -97,7 +96,7 @@
YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafListInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafListInfo.getDataType().getDataType(), is(YangDataTypes.UINT16));
}
}
\ No newline at end of file
diff --git a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
index dc5ff59..516848c 100644
--- a/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
+++ b/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.util.ListIterator;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -117,7 +116,7 @@
// Check whether leaf properties is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
- assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
+ assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16"));
assertThat(leafInfo.getUnits(), is("\"seconds\""));
assertThat(leafInfo.getDescription(), is("\"Interval before a route is declared invalid\""));
assertThat(leafInfo.isConfig(), is(true));
diff --git a/src/test/resources/DerivedTypeStatement.yang b/src/test/resources/DerivedTypeStatement.yang
index c678822..952b7d4 100644
--- a/src/test/resources/DerivedTypeStatement.yang
+++ b/src/test/resources/DerivedTypeStatement.yang
@@ -3,6 +3,6 @@
namespace http://huawei.com;
prefix Ant;
leaf invalid-interval {
- type "hello";
+ type P:hello;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/GroupingAttributes.yang b/src/test/resources/GroupingAttributes.yang
index 7eb3880..977adc5 100644
--- a/src/test/resources/GroupingAttributes.yang
+++ b/src/test/resources/GroupingAttributes.yang
@@ -5,17 +5,17 @@
list valid {
key address;
leaf address {
- type ip;
+ type P:ip;
}
grouping endpoint {
description "grouping under test";
status current;
reference "RFC 6020";
leaf address {
- type ip-address;
+ type P:ip-address;
}
leaf port {
- type port-number;
+ type P:port-number;
}
}
}
diff --git a/src/test/resources/GroupingInContainer.yang b/src/test/resources/GroupingInContainer.yang
index be9e7e8..7c51913 100644
--- a/src/test/resources/GroupingInContainer.yang
+++ b/src/test/resources/GroupingInContainer.yang
@@ -5,10 +5,10 @@
container valid {
grouping endpoint {
leaf address {
- type ip-address;
+ type P:ip-address;
}
leaf port {
- type port-number;
+ type P:port-number;
}
}
}
diff --git a/src/test/resources/GroupingInList.yang b/src/test/resources/GroupingInList.yang
index 2cdf7d1..a8fad09 100644
--- a/src/test/resources/GroupingInList.yang
+++ b/src/test/resources/GroupingInList.yang
@@ -5,14 +5,14 @@
list valid {
key address;
leaf address {
- type ip;
+ type P:ip;
}
grouping endpoint {
leaf address {
- type ip-address;
+ type P:ip-address;
}
leaf port {
- type port-number;
+ type P:port-number;
}
}
}
diff --git a/src/test/resources/GroupingInModule.yang b/src/test/resources/GroupingInModule.yang
index d0a31c1..7d513a4 100644
--- a/src/test/resources/GroupingInModule.yang
+++ b/src/test/resources/GroupingInModule.yang
@@ -4,10 +4,10 @@
prefix Ant;
grouping endpoint {
leaf address {
- type ip-address;
+ type P:ip-address;
}
leaf port {
- type port-number;
+ type P:port-number;
}
}
}
diff --git a/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang b/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
new file mode 100644
index 0000000..c372bfa
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type hello;
+ }
+ }
+ typedef hello {
+ type String;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang b/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
new file mode 100644
index 0000000..052cb7e
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type hello;
+ }
+ }
+ }
+ typedef hello {
+ type String;
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang b/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
new file mode 100644
index 0000000..2b4a1e8
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
@@ -0,0 +1,16 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef hello {
+ type String;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type hello;
+ }
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingTypedefNotFound.yang b/src/test/resources/SelfFileLinkingTypedefNotFound.yang
new file mode 100644
index 0000000..9248598
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingTypedefNotFound.yang
@@ -0,0 +1,18 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type hello;
+ }
+ }
+ }
+ container isis {
+ typedef hello {
+ type String;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang b/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
new file mode 100644
index 0000000..71d1947
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef Percentage {
+ type INT;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type Ant:FirstClass;
+ }
+ typedef FirstClass {
+ type Ant:PassingClass;
+ }
+ }
+ typedef PassingClass {
+ type Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang b/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
new file mode 100644
index 0000000..35c28b6
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef Percentage {
+ type P:Per;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type FirstClass;
+ }
+ typedef FirstClass {
+ type PassingClass;
+ }
+ }
+ typedef PassingClass {
+ type Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang b/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
new file mode 100644
index 0000000..958dc23
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef Percentage {
+ type int32;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type FirstClass;
+ }
+ typedef FirstClass {
+ type PassingClass;
+ }
+ }
+ typedef PassingClass {
+ type Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang b/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
new file mode 100644
index 0000000..038c7de
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef Percentage {
+ type int32;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type Ant:FirstClass;
+ }
+ typedef FirstClass {
+ type P:PassingClass;
+ }
+ }
+ typedef PassingClass {
+ type Ant:Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang b/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
new file mode 100644
index 0000000..4f292b8
--- /dev/null
+++ b/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
@@ -0,0 +1,22 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef Percentage {
+ type int32;
+ }
+ container ospf {
+ list valid {
+ key "invalid-interval";
+ leaf invalid-interval {
+ type Ant:FirstClass;
+ }
+ typedef FirstClass {
+ type PassingClass;
+ }
+ }
+ typedef PassingClass {
+ type Ant:Percentage;
+ }
+ }
+}
diff --git a/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang b/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
new file mode 100644
index 0000000..b6b08a7
--- /dev/null
+++ b/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hello {
+ type String;
+ }
+}
diff --git a/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang b/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
new file mode 100644
index 0000000..499e10d
--- /dev/null
+++ b/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ leaf invalid-interval {
+ type hello;
+ }
+ typedef hi {
+ type String;
+ }
+}
diff --git a/src/test/resources/UsesInList.yang b/src/test/resources/UsesInList.yang
index 6443cfa..c4fd47d 100644
--- a/src/test/resources/UsesInList.yang
+++ b/src/test/resources/UsesInList.yang
@@ -5,7 +5,7 @@
list valid {
key address;
leaf address {
- type ip;
+ type P:ip;
}
uses endpoint {
description "grouping under test";
diff --git a/src/test/resources/ValidNotificationStatement.yang b/src/test/resources/ValidNotificationStatement.yang
index b96fc54..d588bb9 100644
--- a/src/test/resources/ValidNotificationStatement.yang
+++ b/src/test/resources/ValidNotificationStatement.yang
@@ -16,10 +16,10 @@
}
}
leaf if-admin-status {
- type admin-status;
+ type P:admin-status;
}
leaf if-oper-status {
- type oper-status;
+ type P:oper-status;
}
}
}
diff --git a/src/test/resources/processTypeDef.yang b/src/test/resources/processTypeDef.yang
new file mode 100644
index 0000000..2875752
--- /dev/null
+++ b/src/test/resources/processTypeDef.yang
@@ -0,0 +1,11 @@
+module Test {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix Ant;
+ typedef hello {
+ type String;
+ }
+ leaf invalid-interval {
+ type hello;
+ }
+}