[ONOS-6941] addition of derived identities search
Change-Id: Ibefb62de9c00fdc57cf67d6433b850ddecccfb7a
diff --git a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java
index 97e2a86..01a47f9 100644
--- a/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java
+++ b/compiler/plugin/maven/src/test/java/org/onosproject/yang/compiler/plugin/maven/AugmentTranslatorTest.java
@@ -193,6 +193,38 @@
}
/**
+ * Checks the derived identities with referred base types in inter modules.
+ *
+ * @throws IOException if any error occurs during IO on files
+ * @throws ParserException if any error occurs during parsing
+ * @throws MojoExecutionException if any mojo operation fails
+ */
+ @Test
+ public void processIdentityRefTranslator() throws IOException,
+ ParserException,
+ MojoExecutionException {
+
+ deleteDirectory(DIR);
+ String searchDir = "src/test/resources/DerivedIdentity";
+
+ Set<Path> paths = new HashSet<>();
+ for (String file : getYangFiles(searchDir)) {
+ paths.add(Paths.get(file));
+ }
+
+ utilManager.createYangFileInfoSet(paths);
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangPluginConfig yangPluginConfig = new YangPluginConfig();
+ yangPluginConfig.setCodeGenDir(DIR);
+ utilManager.translateToJava(yangPluginConfig);
+ YangPluginConfig.compileCode(COMP);
+ deleteDirectory(DIR);
+ }
+
+ /**
* Checks collision detection of an augment linked to a target having
* same node in the same level.
*
diff --git a/compiler/plugin/maven/src/test/resources/DerivedIdentity/DerivedIdentities.yang b/compiler/plugin/maven/src/test/resources/DerivedIdentity/DerivedIdentities.yang
new file mode 100644
index 0000000..379f832
--- /dev/null
+++ b/compiler/plugin/maven/src/test/resources/DerivedIdentity/DerivedIdentities.yang
@@ -0,0 +1,31 @@
+module IdentityTypedef {
+ yang-version 1;
+ namespace http://huawei.com;
+ prefix IdentityTypedef;
+
+ identity ref-address-family {
+
+ }
+
+ identity ipv4-address-family {
+ base ref-address-family;
+ }
+
+ identity ipv6-address-family {
+ base ref-address-family;
+ }
+
+ leaf tunnel {
+ type type15;
+ }
+
+ leaf-list network-ref {
+ type type15;
+ }
+
+ typedef type15 {
+ type identityref {
+ base ref-address-family;
+ }
+ }
+}
\ No newline at end of file