From: Yaroslav Lastivka Date: Thu, 19 Jan 2023 11:55:38 +0000 (+0200) Subject: Fix odl-yanglib feature usage X-Git-Tag: v5.0.2~3 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=11ced7438f39559415565864c085fc0ec4422f4d;p=netconf.git Fix odl-yanglib feature usage The problem is that Initialization stops working correctly and expect non-empty YanglibConfig provided by blueprint. Were set default cache-folder to cache/schema, binding-addr to localhost and binding-port port 8181 by creating new config file. JIRA: NETCONF-909 Change-Id: I76455310d014a5ad87051cb0ac749f5ce9f010c1 Signed-off-by: Yaroslav Lastivka Signed-off-by: Robert Varga --- diff --git a/artifacts/pom.xml b/artifacts/pom.xml index a7d3cbe22f..59f623eb08 100644 --- a/artifacts/pom.xml +++ b/artifacts/pom.xml @@ -236,6 +236,13 @@ yanglib ${project.version} + + org.opendaylight.netconf + yanglib + ${project.version} + config + xml + org.opendaylight.netconf diff --git a/features/yanglib/odl-yanglib/pom.xml b/features/yanglib/odl-yanglib/pom.xml index fa50dffbe7..f03474368e 100644 --- a/features/yanglib/odl-yanglib/pom.xml +++ b/features/yanglib/odl-yanglib/pom.xml @@ -25,6 +25,12 @@ org.opendaylight.netconf yanglib + + org.opendaylight.netconf + yanglib + xml + config + org.opendaylight.netconf odl-restconf diff --git a/features/yanglib/odl-yanglib/src/main/feature/feature.xml b/features/yanglib/odl-yanglib/src/main/feature/feature.xml index fddef45d58..246b91782a 100644 --- a/features/yanglib/odl-yanglib/src/main/feature/feature.xml +++ b/features/yanglib/odl-yanglib/src/main/feature/feature.xml @@ -10,5 +10,8 @@ odl-karaf-feat-jetty odl-mdsal-model-rfc8525 + + mvn:org.opendaylight.netconf/yanglib/${project.version}/xml/config + diff --git a/netconf/yanglib/pom.xml b/netconf/yanglib/pom.xml index 88df6d8076..a9cc3a1c81 100644 --- a/netconf/yanglib/pom.xml +++ b/netconf/yanglib/pom.xml @@ -32,6 +32,28 @@ + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/initial/yanglib-config.xml + xml + config + + + + + + diff --git a/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java b/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java index 5235d7df51..68f9b2d4c3 100644 --- a/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java +++ b/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java @@ -88,7 +88,12 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener, Yan } final File cacheFolderFile = new File(yanglibConfig.getCacheFolder()); - checkArgument(cacheFolderFile.exists(), "cache-folder %s does not exist", cacheFolderFile); + if (cacheFolderFile.exists()) { + LOG.info("cache-folder {} already exists", cacheFolderFile); + } else { + checkArgument(cacheFolderFile.mkdirs(), "cache-folder %s cannot be created", cacheFolderFile); + LOG.info("cache-folder {} was created", cacheFolderFile); + } checkArgument(cacheFolderFile.isDirectory(), "cache-folder %s is not a directory", cacheFolderFile); final FilesystemSchemaSourceCache cache = diff --git a/netconf/yanglib/src/main/resources/OSGI-INF/blueprint/yanglib.xml b/netconf/yanglib/src/main/resources/OSGI-INF/blueprint/yanglib.xml index be4b5cf3ed..9fe5243513 100644 --- a/netconf/yanglib/src/main/resources/OSGI-INF/blueprint/yanglib.xml +++ b/netconf/yanglib/src/main/resources/OSGI-INF/blueprint/yanglib.xml @@ -10,7 +10,7 @@ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true"> - diff --git a/netconf/yanglib/src/main/resources/initial/yanglib-config.xml b/netconf/yanglib/src/main/resources/initial/yanglib-config.xml new file mode 100644 index 0000000000..fd1ab99e87 --- /dev/null +++ b/netconf/yanglib/src/main/resources/initial/yanglib-config.xml @@ -0,0 +1,6 @@ + + + cache/schema + localhost + 8181 + \ No newline at end of file