Non-intrusive option to select one of the 3 virtualization technologies supported...
authorMadhu Venugopal <mavenugo@gmail.com>
Thu, 12 Dec 2013 01:27:53 +0000 (17:27 -0800)
committerMadhu Venugopal <mavenugo@gmail.com>
Thu, 12 Dec 2013 02:43:16 +0000 (18:43 -0800)
The basic idea is to make use of the Apache Felix FileInstall to filter out the excluded technology.
In order to avoid introducing multiple config files and keep the changes contained in the Integration branch & Virtualization edition,
we decided to play with a maven assembly plugin option which essentially provides a way to wrap the root run.sh with a virtualization
edition's run.sh.

1. The root run.sh from the base edition is renamed to run.base.sh
2. Introduced a new run.sh (in assemble/resources folder - Note I didnt add it in main/resources to avoid conflicts)
   which is essentially a wrapper for run.base.sh.
3. Maven Assembly plugin takes care of the rest with the <file> and <fileSet> changes.

Change-Id: I76554e60fd3360f6ceea2fec06c98897cac4b99b
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
distributions/virtualization/src/assemble/bin.xml
distributions/virtualization/src/assemble/resources/run.sh [new file with mode: 0755]

index 5c377d165935dedd3389a5ce68e1b6ccbace8fa9..542708bf14879ad42f5b05b231a4fc3f0f209a00 100644 (file)
     <fileSet>
       <directory>${project.build.directory}/generated-resources</directory>
       <outputDirectory>/</outputDirectory>
+      <excludes>
+          <exclude>opendaylight/run.sh</exclude>
+      </excludes>
     </fileSet>
   </fileSets>
+  <files>
+    <file>
+      <source>${project.build.directory}/generated-resources/opendaylight/run.sh</source>
+      <outputDirectory>/opendaylight/</outputDirectory>
+      <destName>run.base.sh</destName>
+      <fileMode>0755</fileMode>
+    </file>
+    <file>
+      <source>${basedir}/src/assemble/resources/run.sh</source>
+      <outputDirectory>/opendaylight/</outputDirectory>
+      <fileMode>0755</fileMode>
+    </file>
+  </files>
   <dependencySets>
     <dependencySet>
       <outputDirectory>opendaylight/plugins</outputDirectory>
diff --git a/distributions/virtualization/src/assemble/resources/run.sh b/distributions/virtualization/src/assemble/resources/run.sh
new file mode 100755 (executable)
index 0000000..af97531
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+function usage {
+    echo "Please select one of the 3 supported Virtualization technology : \"run.sh -virt [ovsdb | opendove | vtn]\""
+    exit 1
+}
+while true ; do
+    case "$1" in
+        -virt) shift; virt="$1"; shift ;;
+        "") break ;;
+        *) shift ;;
+    esac
+done
+
+# Virtualization edition select
+if [ "${virt}" == "" ]; then
+    usage
+else
+    if [ "${virt}" == "ovsdb" ]; then
+        ODL_VIRT_FILTER="opendove|vtn"
+    elif [ "${virt}" == "opendove" ]; then
+        ODL_VIRT_FILTER="ovsdb|vtn"
+    elif [ "${virt}" == "vtn" ]; then
+        ODL_VIRT_FILTER="opendove|ovsdb"
+    else
+        usage
+    fi
+fi
+
+./run.base.sh -Dfelix.fileinstall.filter="^(?!org.opendaylight.(${ODL_VIRT_FILTER})).*" "$@"