Bug 4296: Add config subsystem file with versions 10/37210/7
authorVratko Polak <vrpolak@cisco.com>
Wed, 25 May 2016 18:23:42 +0000 (20:23 +0200)
committerLuis Gomez <ecelgp@gmail.com>
Thu, 2 Jun 2016 16:48:31 +0000 (16:48 +0000)
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 <vrpolak@cisco.com>
features-distribution/pom.xml [new file with mode: 0644]
features-distribution/src/main/resources/features.xml [new file with mode: 0644]
features-index/pom.xml
features-index/src/main/resources/features.xml
features-test/src/main/resources/features.xml
pom.xml
version/pom.xml [new file with mode: 0644]
version/src/main/config/default-config.xml [new file with mode: 0644]
version/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/integration/distribution/version/rev160316/OdlVersionModule.java [new file with mode: 0644]
version/src/main/yang/odl-distribution-version.yang [new file with mode: 0644]

diff --git a/features-distribution/pom.xml b/features-distribution/pom.xml
new file mode 100644 (file)
index 0000000..7364d94
--- /dev/null
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+      <groupId>org.opendaylight.integration</groupId>
+      <artifactId>root</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <relativePath>../</relativePath>
+   </parent>
+   <artifactId>features-distribution</artifactId>
+   <packaging>jar</packaging>
+   <properties>
+      <features.file>features.xml</features.file>
+   </properties>
+   <dependencies>
+    <!-- version module -->
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>version</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>version</artifactId>
+      <version>${project.version}</version>
+      <type>xml</type>
+      <classifier>config</classifier>
+    </dependency>
+    <!-- dependencies on feature repos -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>features-config-persister</artifactId>
+      <version>${feature.controller.config.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
+    <!-- test to validate features.xml -->
+    <dependency>
+      <groupId>org.opendaylight.odlparent</groupId>
+      <artifactId>features-test</artifactId>
+      <version>${feature.odlparent.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit-dep</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <!-- dependency for opendaylight-karaf-empty for use by testing -->
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>opendaylight-karaf-empty</artifactId>
+      <version>${feature.odlparent.version}</version>
+      <type>zip</type>
+    </dependency>
+   </dependencies>
+   <build>
+      <resources>
+         <resource>
+            <directory>src/main/resources</directory>
+            <filtering>true</filtering>
+         </resource>
+      </resources>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.karaf.tooling</groupId>
+            <artifactId>karaf-maven-plugin</artifactId>
+            <extensions>true</extensions>
+            <executions>
+               <execution>
+                  <id>features-create-kar</id>
+                  <goals>
+                     <goal>features-create-kar</goal>
+                  </goals>
+                  <configuration>
+                     <featuresFile>${project.build.directory}/classes/${features.file}</featuresFile>
+                  </configuration>
+               </execution>
+            </executions>
+        <!-- There is no useful configuration for the kar mojo. The features-generate-descriptor mojo configuration may be useful -->
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-resources-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>filter</id>
+                  <phase>generate-resources</phase>
+                  <goals>
+                     <goal>resources</goal>
+                  </goals>
+               </execution>
+            </executions>
+         </plugin>
+         <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>attach-artifacts</id>
+                  <phase>package</phase>
+                  <goals>
+                     <goal>attach-artifact</goal>
+                  </goals>
+                  <configuration>
+                     <artifacts>
+                        <artifact>
+                           <file>${project.build.directory}/classes/${features.file}</file>
+                           <type>xml</type>
+                           <classifier>features</classifier>
+                        </artifact>
+                     </artifacts>
+                  </configuration>
+               </execution>
+            </executions>
+         </plugin>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <systemPropertyVariables>
+                <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+                <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+                <karaf.distro.version>${feature.odlparent.version}</karaf.distro.version>
+              </systemPropertyVariables>
+              <dependenciesToScan>
+               <dependency>org.opendaylight.odlparent:features-test</dependency>
+              </dependenciesToScan>
+            </configuration>
+          </plugin>
+      </plugins>
+   </build>
+</project>
diff --git a/features-distribution/src/main/resources/features.xml b/features-distribution/src/main/resources/features.xml
new file mode 100644 (file)
index 0000000..a1a5fcb
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<features name="odl-distribution-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+    <repository>mvn:org.opendaylight.controller/features-config-persister/${feature.controller.config.version}/xml/features</repository>
+
+    <feature name='odl-distribution-version' version='${project.version}'>
+        <feature>odl-config-startup</feature>
+        <bundle>mvn:org.opendaylight.integration/version/${project.version}</bundle>
+        <configfile finalname="etc/opendaylight/karaf/odl-version.xml">mvn:org.opendaylight.integration/version/${project.version}/xml/config</configfile>
+    </feature>
+</features>
index 04813b892b95849fbe1807c788091ea55c291839..4ad4f2e925880dd586ea1c8cf85cf2182c712867 100644 (file)
       <features.file>features.xml</features.file>
    </properties>
    <dependencies>
-    <!-- dependencies on feature repos -->
+    <!-- feature repository dependencies from this project -->
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>features-distribution</artifactId>
+      <version>${project.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
+    <!-- feature repository dependencies from other ODL projects -->
     <dependency>
       <groupId>org.opendaylight.aaa</groupId>
       <artifactId>features-aaa-api</artifactId>
index 159d6354a06788b08258ff9a240af9b9b5639465..80d13153465e64c5d71b98f338dd6384c3f8d023 100644 (file)
@@ -57,6 +57,7 @@
     <repository>mvn:org.opendaylight.faas/features-faas/${feature.faas.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.genius/genius-features/${feature.genius.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.groupbasedpolicy/features-groupbasedpolicy/${feature.groupbasedpolicy.version}/xml/features</repository>
+    <repository>mvn:org.opendaylight.integration/features-distribution/${project.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.iotdm/onem2m-features/${feature.iotdm.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.l2switch/features-l2switch/${feature.l2switch.version}/xml/features</repository>
     <repository>mvn:org.opendaylight.lacp/features-lacp/${feature.lacp.version}/xml/features</repository>
index 186386cec1f95030d3d399cae04fcd29020612b7..19864c56efcfd58967451f7efd330940f4f561ae 100644 (file)
@@ -82,6 +82,7 @@
         <feature version='${feature.circuitsw.version}'>odl-circuitsw-switch-rest</feature>
         <feature version='${feature.circuitsw.version}'>odl-circuitsw-switch-ui</feature>
         <feature version='${feature.dlux.version}'>odl-dlux-core</feature>
+        <feature version='${project.version}'>odl-distribution-version</feature>
         <feature version='${feature.lispflowmapping.version}'>odl-lispflowmapping-msmr</feature>
         <feature version='${feature.lispflowmapping.version}'>odl-lispflowmapping-neutron</feature>
         <feature version='${feature.lispflowmapping.version}'>odl-lispflowmapping-ui</feature>
diff --git a/pom.xml b/pom.xml
index 84b589c6f9e6daaadd51fb26535d6920a6c9f820..fbb5d9ed3d8af92ed455dc5c1d903793c4191f41 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <didm.version>0.3.0-SNAPSHOT</didm.version>
     <feature.aaa.version>0.4.0-SNAPSHOT</feature.aaa.version>
     <feature.alto.version>0.3.0-SNAPSHOT</feature.alto.version>
-    <!-- Remove Armoury from Beryllium release as per as committers consent:
-    https://lists.opendaylight.org/pipermail/armoury-dev/2016-January/000081.html.
-    Need to be uncommented once in Boron -->
-    <!-- <feature.armoury.version>1.1.0-SNAPSHOT</feature.armoury.version> -->
     <feature.benchmark.version>1.2.0-SNAPSHOT</feature.benchmark.version>
     <feature.bgpcep.version>0.6.0-SNAPSHOT</feature.bgpcep.version>
     <feature.capwap.version>0.3.0-SNAPSHOT</feature.capwap.version>
     <feature.centinel.version>0.2.0-SNAPSHOT</feature.centinel.version>
     <feature.circuitsw.version>1.1.0-SNAPSHOT</feature.circuitsw.version>
+    <feature.controller.config.version>0.5.0-SNAPSHOT</feature.controller.config.version>
     <feature.controller.extras.version>1.7.0-SNAPSHOT</feature.controller.extras.version>
     <feature.dlux.version>0.4.0-SNAPSHOT</feature.dlux.version>
     <feature.faas.version>1.1.0-SNAPSHOT</feature.faas.version>
 
   <modules>
     <module>distribution-karaf</module>
+    <module>features-distribution</module>
     <module>features-index</module>
     <module>features-test</module>
+    <module>version</module>
   </modules>
 
   <build>
diff --git a/version/pom.xml b/version/pom.xml
new file mode 100644 (file)
index 0000000..19f2396
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>config-parent</artifactId>
+    <version>0.5.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+  <groupId>org.opendaylight.integration</groupId>
+  <artifactId>version</artifactId>
+  <version>0.5.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <!-- Is there a way to inherit/include properties from a file bumped autimatically? -->
+  <properties>
+    <feature.odlparent.version>1.7.0-SNAPSHOT</feature.odlparent.version>
+  </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
+          </instructions>
+          <manifestLocation>${project.build.directory}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+  </dependencies>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/integration/distribution.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/integration/distribution.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=tree;f=config;hb=HEAD</url>
+  </scm>
+</project>
diff --git a/version/src/main/config/default-config.xml b/version/src/main/config/default-config.xml
new file mode 100644 (file)
index 0000000..12918dc
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+  <required-capabilities>
+    <capability>urn:opendaylight:params:xml:ns:yang:integration:distribution:version?module=odl-distribution-version&amp;revision=2016-03-16</capability>
+  </required-capabilities>
+  <configuration>
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+        <module>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:integration:distribution:version">prefix:odl-version</type>
+          <name>odl-distribution-version</name>
+          <version>${project.version}</version>
+        </module>
+        <module>
+          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:integration:distribution:version">prefix:odl-version</type>
+          <name>odl-odlparent-version</name>
+          <version>${feature.odlparent.version}</version>
+        </module>
+      </modules>
+    </data>
+  </configuration>
+</snapshot>
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 (file)
index 0000000..362cb1a
--- /dev/null
@@ -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 (file)
index 0000000..d65604c
--- /dev/null
@@ -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;
+            }
+        }
+    }
+}