[ONOS-5402] Resolvable entities under union type, is added to list, after cloning.

Change-Id: Ia96959b3e65e12060926c7f15d170b5e7302fa43
diff --git a/plugin/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang b/plugin/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang
new file mode 100644
index 0000000..9fbc024
--- /dev/null
+++ b/plugin/src/test/resources/typelinkingaftercloning/identityref/IntraFileIdentityRefAfterCloning.yang
@@ -0,0 +1,74 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    identity syslog-facility {
+        description
+            "The base identity to represent syslog facilities";
+    }
+    typedef value {
+        type identityref {
+            base syslog-facility;
+        }
+    }
+
+    grouping device-common {
+        leaf facility {
+            type union {
+                type identityref {
+                    base syslog-facility;
+                }
+                type enumeration {
+                    enum "all" {
+                        description
+                            "This enum describes the case where all
+                            facilities are requested.";
+                    }
+                }
+            }
+        }
+        leaf node-id {
+            type identityref {
+                base syslog-facility;
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+        }
+        leaf-list node-ref {
+            type value;
+        }
+        container network-ref {
+            leaf-list facility {
+                type union {
+                    type identityref {
+                        base syslog-facility;
+                    }
+                    type enumeration {
+                        enum "all" {
+                            description
+                                "This enum describes the case where all
+                                facilities are requested.";
+                        }
+                    }
+                }
+            }
+            leaf-list node-ref {
+                type identityref {
+                    base syslog-facility;
+                }
+                description
+                    "Globally unique identifier for a device.";
+                config true;
+            }
+            leaf node-id {
+                type value;
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/plugin/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang b/plugin/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang
new file mode 100644
index 0000000..a73280d
--- /dev/null
+++ b/plugin/src/test/resources/typelinkingaftercloning/leafref/intrafile/IntraFileLeafrefAfterCloning.yang
@@ -0,0 +1,52 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    leaf uri {
+        type string;
+    }
+    leaf-list id {
+        type value;
+    }
+    typedef value {
+        type uint8;
+    }
+
+    grouping device-common {
+        leaf node-id {
+            type leafref {
+                path "/uri";
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+            default "open-road-m";
+        }
+        leaf-list node-ref {
+            type leafref {
+                path "/id";
+            }
+        }
+        container network-ref {
+            leaf node-id {
+                type leafref {
+                    path "/id";
+                }
+                description
+                    "Globally unique identifier for a device.";
+                config true;
+                default "open-road-m";
+            }
+            leaf-list node-ref {
+                type leafref {
+                    path "/uri";
+                }
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/plugin/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang b/plugin/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang
new file mode 100644
index 0000000..79491e1
--- /dev/null
+++ b/plugin/src/test/resources/typelinkingaftercloning/leafref/invalid/invalidleafref.yang
@@ -0,0 +1,28 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    leaf uri {
+        type string;
+    }
+
+    grouping device-common {
+        leaf node-id {
+            type union {
+                type leafref {
+                    path "/uri";
+                }
+                type string;
+            }
+            description
+                "Globally unique identifier for a device.";
+            config true;
+            default "open-road-m";
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}
diff --git a/plugin/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang b/plugin/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang
new file mode 100644
index 0000000..a69a5a1
--- /dev/null
+++ b/plugin/src/test/resources/typelinkingaftercloning/union/IntraFileUnionAfterCloning.yang
@@ -0,0 +1,81 @@
+module org-open-road-m-device {
+    namespace "http://org/openroadm/device";
+    prefix org-open-road-m-device;
+
+    identity syslog-facility {
+        description
+            "The base identity to represent syslog facilities";
+    }
+
+    identity syslog-usability {
+        description
+            "The base identity to represent syslog usabilities";
+    }
+
+    identity syslog-availability {
+        description
+            "The base identity to represent syslog availabilities";
+    }
+
+    typedef value {
+        type identityref {
+            base syslog-availability;
+        }
+    }
+
+    typedef correct {
+        type union {
+            type union {
+                type identityref {
+                    base syslog-availability;
+                }
+                type value;
+            }
+            type identityref {
+                base syslog-usability;
+            }
+        }
+    }
+
+    grouping device-common {
+        leaf facility {
+            type union {
+               type union {
+                   type union {
+                       type identityref {
+                           base syslog-usability;
+                       }
+                       type correct;
+                   }
+                   type identityref {
+                       base syslog-facility;
+                   }
+               }
+               type value;
+            }
+        }
+        container network-ref {
+            leaf-list facility {
+                type union {
+                   type union {
+                       type union {
+                           type identityref {
+                               base syslog-usability;
+                           }
+                           type correct;
+                       }
+                       type identityref {
+                           base syslog-facility;
+                       }
+                   }
+                   type value;
+                }
+            }
+        }
+    }
+
+    list node {
+        config false;
+        uses device-common;
+    }
+}