[ONOS-4063 to 68] Intra YANG file Linking Implementation and Intra YANG file Linking Framework

Change-Id: I06e602c351ab54178bf90b8676af71a70e42371f
diff --git a/utils/yangutils/src/test/resources/DerivedTypeStatement.yang b/utils/yangutils/src/test/resources/DerivedTypeStatement.yang
index c678822..952b7d4 100644
--- a/utils/yangutils/src/test/resources/DerivedTypeStatement.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/GroupingAttributes.yang b/utils/yangutils/src/test/resources/GroupingAttributes.yang
index 7eb3880..977adc5 100644
--- a/utils/yangutils/src/test/resources/GroupingAttributes.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/GroupingInContainer.yang b/utils/yangutils/src/test/resources/GroupingInContainer.yang
index be9e7e8..7c51913 100644
--- a/utils/yangutils/src/test/resources/GroupingInContainer.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/GroupingInList.yang b/utils/yangutils/src/test/resources/GroupingInList.yang
index 2cdf7d1..a8fad09 100644
--- a/utils/yangutils/src/test/resources/GroupingInList.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/GroupingInModule.yang b/utils/yangutils/src/test/resources/GroupingInModule.yang
index d0a31c1..7d513a4 100644
--- a/utils/yangutils/src/test/resources/GroupingInModule.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang b/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtMiddleLevelAfterParentHolder.yang
new file mode 100644
index 0000000..c372bfa
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang b/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtRootIsAfterContainerHavingType.yang
new file mode 100644
index 0000000..052cb7e
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang b/utils/yangutils/src/test/resources/SelfFileLinkingTypedefAtRootTypeTwoLevelInHierarchy.yang
new file mode 100644
index 0000000..2b4a1e8
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingTypedefNotFound.yang b/utils/yangutils/src/test/resources/SelfFileLinkingTypedefNotFound.yang
new file mode 100644
index 0000000..9248598
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang b/utils/yangutils/src/test/resources/SelfFileLinkingWithHierarchicalTypeFailureScenario.yang
new file mode 100644
index 0000000..71d1947
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang b/utils/yangutils/src/test/resources/SelfFileLinkingWithTypdefHierarchicalRefUnresolved.yang
new file mode 100644
index 0000000..35c28b6
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang b/utils/yangutils/src/test/resources/SelfFileLinkingWithTypdefHierarchicalReference.yang
new file mode 100644
index 0000000..958dc23
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang b/utils/yangutils/src/test/resources/SelfFileLinkingWithTypeWithSelfAndExternalPrefixMix.yang
new file mode 100644
index 0000000..038c7de
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang b/utils/yangutils/src/test/resources/SelfFileLinkingWithTypeWithSelfModulePrefix.yang
new file mode 100644
index 0000000..4f292b8
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang b/utils/yangutils/src/test/resources/SelfResolutionWhenTypeAndTypedefAtRootLevel.yang
new file mode 100644
index 0000000..b6b08a7
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang b/utils/yangutils/src/test/resources/SelfResolutionWhenTypeReferredTypedefNotDefined.yang
new file mode 100644
index 0000000..499e10d
--- /dev/null
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/UsesInList.yang b/utils/yangutils/src/test/resources/UsesInList.yang
index 6443cfa..c4fd47d 100644
--- a/utils/yangutils/src/test/resources/UsesInList.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/ValidNotificationStatement.yang b/utils/yangutils/src/test/resources/ValidNotificationStatement.yang
index b96fc54..d588bb9 100644
--- a/utils/yangutils/src/test/resources/ValidNotificationStatement.yang
+++ b/utils/yangutils/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/utils/yangutils/src/test/resources/processTypeDef.yang b/utils/yangutils/src/test/resources/processTypeDef.yang
new file mode 100644
index 0000000..2875752
--- /dev/null
+++ b/utils/yangutils/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;
+    }
+}