From 28331958d3436204abdc9a0f834faf43bfb82238 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 25 May 2016 20:23:42 +0200 Subject: [PATCH] Bug 4296: Add config subsystem file with versions This requires https://git.opendaylight.org/gerrit/39427 This adds new module "version" containing the new config file, so far with distribution version and odlparent version. It is installed as feature odl-distribution-version. Also a separate features-distribution module is added, its repo added to features-indes and feature to features-test. It uses "config-parent" to publish the config file together with Yang model for its data. Binding-aware Java code is generated as well, but it is not used for anything yet. In the future, it may be used together with additional Java code to write version data to datastore. Change-Id: I41fe1b26c5c9873877f76de4f4e943d53be5feb0 Signed-off-by: Vratko Polak --- features-distribution/pom.xml | 141 ++++++++++++++++++ .../src/main/resources/features.xml | 20 +++ features-index/pom.xml | 10 +- .../src/main/resources/features.xml | 1 + features-test/src/main/resources/features.xml | 1 + pom.xml | 7 +- version/pom.xml | 41 +++++ version/src/main/config/default-config.xml | 30 ++++ .../version/rev160316/OdlVersionModule.java | 28 ++++ .../main/yang/odl-distribution-version.yang | 30 ++++ 10 files changed, 304 insertions(+), 5 deletions(-) create mode 100644 features-distribution/pom.xml create mode 100644 features-distribution/src/main/resources/features.xml create mode 100644 version/pom.xml create mode 100644 version/src/main/config/default-config.xml create mode 100644 version/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/integration/distribution/version/rev160316/OdlVersionModule.java create mode 100644 version/src/main/yang/odl-distribution-version.yang diff --git a/features-distribution/pom.xml b/features-distribution/pom.xml new file mode 100644 index 00000000..7364d944 --- /dev/null +++ b/features-distribution/pom.xml @@ -0,0 +1,141 @@ + + + + + 4.0.0 + + org.opendaylight.integration + root + 0.5.0-SNAPSHOT + ../ + + features-distribution + jar + + features.xml + + + + + ${project.groupId} + version + ${project.version} + + + ${project.groupId} + version + ${project.version} + xml + config + + + + org.opendaylight.controller + features-config-persister + ${feature.controller.config.version} + features + xml + + + + org.opendaylight.odlparent + features-test + ${feature.odlparent.version} + + + junit + junit-dep + test + + + + org.opendaylight.controller + opendaylight-karaf-empty + ${feature.odlparent.version} + zip + + + + + + src/main/resources + true + + + + + org.apache.karaf.tooling + karaf-maven-plugin + true + + + features-create-kar + + features-create-kar + + + ${project.build.directory}/classes/${features.file} + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + filter + generate-resources + + resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/classes/${features.file} + xml + features + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.opendaylight.controller + opendaylight-karaf-empty + ${feature.odlparent.version} + + + org.opendaylight.odlparent:features-test + + + + + + diff --git a/features-distribution/src/main/resources/features.xml b/features-distribution/src/main/resources/features.xml new file mode 100644 index 00000000..a1a5fcb1 --- /dev/null +++ b/features-distribution/src/main/resources/features.xml @@ -0,0 +1,20 @@ + + + + + mvn:org.opendaylight.controller/features-config-persister/${feature.controller.config.version}/xml/features + + + odl-config-startup + mvn:org.opendaylight.integration/version/${project.version} + mvn:org.opendaylight.integration/version/${project.version}/xml/config + + diff --git a/features-index/pom.xml b/features-index/pom.xml index 04813b89..4ad4f2e9 100644 --- a/features-index/pom.xml +++ b/features-index/pom.xml @@ -22,7 +22,15 @@ features.xml - + + + ${project.groupId} + features-distribution + ${project.version} + features + xml + + org.opendaylight.aaa features-aaa-api diff --git a/features-index/src/main/resources/features.xml b/features-index/src/main/resources/features.xml index 159d6354..80d13153 100644 --- a/features-index/src/main/resources/features.xml +++ b/features-index/src/main/resources/features.xml @@ -57,6 +57,7 @@ mvn:org.opendaylight.faas/features-faas/${feature.faas.version}/xml/features mvn:org.opendaylight.genius/genius-features/${feature.genius.version}/xml/features mvn:org.opendaylight.groupbasedpolicy/features-groupbasedpolicy/${feature.groupbasedpolicy.version}/xml/features + mvn:org.opendaylight.integration/features-distribution/${project.version}/xml/features mvn:org.opendaylight.iotdm/onem2m-features/${feature.iotdm.version}/xml/features mvn:org.opendaylight.l2switch/features-l2switch/${feature.l2switch.version}/xml/features mvn:org.opendaylight.lacp/features-lacp/${feature.lacp.version}/xml/features diff --git a/features-test/src/main/resources/features.xml b/features-test/src/main/resources/features.xml index 186386ce..19864c56 100644 --- a/features-test/src/main/resources/features.xml +++ b/features-test/src/main/resources/features.xml @@ -82,6 +82,7 @@ odl-circuitsw-switch-rest odl-circuitsw-switch-ui odl-dlux-core + odl-distribution-version odl-lispflowmapping-msmr odl-lispflowmapping-neutron odl-lispflowmapping-ui diff --git a/pom.xml b/pom.xml index 84b589c6..fbb5d9ed 100644 --- a/pom.xml +++ b/pom.xml @@ -24,15 +24,12 @@ 0.3.0-SNAPSHOT 0.4.0-SNAPSHOT 0.3.0-SNAPSHOT - - 1.2.0-SNAPSHOT 0.6.0-SNAPSHOT 0.3.0-SNAPSHOT 0.2.0-SNAPSHOT 1.1.0-SNAPSHOT + 0.5.0-SNAPSHOT 1.7.0-SNAPSHOT 0.4.0-SNAPSHOT 1.1.0-SNAPSHOT @@ -82,8 +79,10 @@ distribution-karaf + features-distribution features-index features-test + version diff --git a/version/pom.xml b/version/pom.xml new file mode 100644 index 00000000..19f23962 --- /dev/null +++ b/version/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.opendaylight.controller + config-parent + 0.5.0-SNAPSHOT + + + org.opendaylight.integration + version + 0.5.0-SNAPSHOT + bundle + + + 1.7.0-SNAPSHOT + + + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.groupId}.${project.artifactId} + + ${project.build.directory}/META-INF + + + + + + + + scm:git:ssh://git.opendaylight.org:29418/integration/distribution.git + scm:git:ssh://git.opendaylight.org:29418/integration/distribution.git + HEAD + https://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=tree;f=config;hb=HEAD + + diff --git a/version/src/main/config/default-config.xml b/version/src/main/config/default-config.xml new file mode 100644 index 00000000..12918dcf --- /dev/null +++ b/version/src/main/config/default-config.xml @@ -0,0 +1,30 @@ + + + + + + urn:opendaylight:params:xml:ns:yang:integration:distribution:version?module=odl-distribution-version&revision=2016-03-16 + + + + + + prefix:odl-version + odl-distribution-version + ${project.version} + + + prefix:odl-version + odl-odlparent-version + ${feature.odlparent.version} + + + + + diff --git a/version/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/integration/distribution/version/rev160316/OdlVersionModule.java b/version/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/integration/distribution/version/rev160316/OdlVersionModule.java new file mode 100644 index 00000000..362cb1a5 --- /dev/null +++ b/version/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/integration/distribution/version/rev160316/OdlVersionModule.java @@ -0,0 +1,28 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.integration.distribution.version.rev160316; +public class OdlVersionModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.integration.distribution.version.rev160316.AbstractOdlVersionModule { + public OdlVersionModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public OdlVersionModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.integration.distribution.version.rev160316.OdlVersionModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + return new java.io.Closeable() { + // TODO: Perhaps write something to datastore in constructor? + + @Override + public void close() { + } + + }; + } + +} diff --git a/version/src/main/yang/odl-distribution-version.yang b/version/src/main/yang/odl-distribution-version.yang new file mode 100644 index 00000000..d65604c9 --- /dev/null +++ b/version/src/main/yang/odl-distribution-version.yang @@ -0,0 +1,30 @@ +module odl-distribution-version { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:integration:distribution:version"; + prefix "odl-version"; + + import config { prefix config; revision-date 2013-04-05; } + + description + "Piece of ODL configuration holding version strings for ODL components."; + + revision "2016-03-16" { + description + "Initial revision"; + } + + identity odl-version { + base config:module-type; + } + + augment "/config:modules/config:module/config:configuration" { + case odl-version { + when "/config:modules/config:module/config:type = 'odl-version'"; + leaf version { + description "Short string with version of component corresponding to module name."; + type string; + mandatory true; + } + } + } +} -- 2.36.6