devstack: check latest revision of ODL snapshot
Get latest revision number from given ODL major.minor snapshot version by checking ODL nexus maven meta data. Thus we don't have to maintain ODL latest snapshot versions. Change-Id: I9fac8ff319c9ec47acf06ce3c520c4388b042ef7
This commit is contained in:

committed by
Isaku Yamahata

parent
602abab37c
commit
9699022080
@@ -2,12 +2,15 @@
|
||||
#
|
||||
# functions - OpenDaylight driver utility functions
|
||||
|
||||
# Get build information
|
||||
function odl_update_maven_metadata_xml {
|
||||
function _odl_nexus_path {
|
||||
local ODL_URL_PREFIX=$1
|
||||
echo "${NEXUSPATH:-${ODL_URL_PREFIX}/${ODL_URL_SNAPSHOT_REPOSITORY_PATH}/org/opendaylight/integration/distribution-karaf}"
|
||||
}
|
||||
|
||||
function _wget {
|
||||
local MAVENMETAFILE=$1
|
||||
local NEXUSPATH=$2
|
||||
local BUNDLEVERSION=$3
|
||||
local OFFLINE=$4
|
||||
local URL=$2
|
||||
local $OFFLINE=$3
|
||||
|
||||
if [[ "$OFFLINE" == "True" ]]; then
|
||||
return
|
||||
@@ -17,7 +20,48 @@ function odl_update_maven_metadata_xml {
|
||||
rm -f $MAVENMETAFILE
|
||||
|
||||
# Acquire the timestamp information from maven-metadata.xml
|
||||
wget -O $MAVENMETAFILE ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
|
||||
wget -O $MAVENMETAFILE $URL
|
||||
}
|
||||
|
||||
function _xpath {
|
||||
local XPATH=$1
|
||||
local MAVENMETAFILE=$2
|
||||
local result=""
|
||||
if is_ubuntu; then
|
||||
install_package libxml-xpath-perl >/dev/null
|
||||
result=`xpath -e "$XPATH" $MAVENMETAFILE 2>/dev/null`
|
||||
elif is_fedora; then
|
||||
yum_install perl-XML-XPath >/dev/null
|
||||
result=`xpath -e "$XPATH" $MAVENMETAFILE 2>/dev/null`
|
||||
else
|
||||
yum_install perl-XML-XPath >/dev/null
|
||||
result=`xpath $MAVENMETAFILE "$XPATH" 2>/dev/null`
|
||||
fi
|
||||
echo $result
|
||||
}
|
||||
|
||||
# get snapshot version <major>.<minor> -> <maor>.<minor>.<reivision>
|
||||
function odl_snapshot_full_version {
|
||||
local ODL_DIR=$1
|
||||
local ODL_URL_PREFIX=$2
|
||||
local MAJOR_MINOR=$1
|
||||
local OFFLINE=$4
|
||||
|
||||
local MAVENMETAFILE=$ODL_DIR/maven-metadata-snapshot.xml
|
||||
local NEXUSPATH=$(_odl_nexus_path $ODL_URL_PREFIX)
|
||||
_wget $MAVENMETAFILE ${NEXUSPATH}/maven-metadata.xml $OFFLINE
|
||||
if [[ ! -r $MAVENMETAFILE ]]; then
|
||||
echo "$MAVENMETAFILE doesn't exist. Please try with OFFLINE=False and check internet connection to $NEXUSPATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$MAJOR_MINOR" == "latest" ]]; then
|
||||
local ODL_FULL_VERSION=$(_xpath "//latest/text()" $MAVENMETAFILE)
|
||||
else
|
||||
local ODL_FULL_VERSION=$(_xpath "//version[starts-with(text(), '$MAOR_MINOR')][last()]/text()" $MAVENMETAFILE)
|
||||
fi
|
||||
ODL_FULL_VERSION=${ODL_FULL_VERSION/-SNAPSHOT/}
|
||||
echo $ODL_FULL_VERSION
|
||||
}
|
||||
|
||||
function _odl_export_snapshot_url_pkg {
|
||||
@@ -28,20 +72,12 @@ function _odl_export_snapshot_url_pkg {
|
||||
local BUNDLE_TIMESTAMP=$5
|
||||
|
||||
local MAVENMETAFILE=$ODL_DIR/maven-metadata.xml
|
||||
local NEXUSPATH="${NEXUSPATH:-${ODL_URL_PREFIX}/${ODL_URL_SNAPSHOT_REPOSITORY_PATH}/org/opendaylight/integration/distribution-karaf}"
|
||||
local NEXUSPATH=$(_odl_nexus_path $ODL_URL_PREFIX)
|
||||
|
||||
if [ "$BUNDLE_TIMESTAMP" == "latest" ]; then
|
||||
odl_update_maven_metadata_xml $MAVENMETAFILE $NEXUSPATH $BUNDLEVERSION $OFFLINE
|
||||
if is_ubuntu; then
|
||||
install_package libxml-xpath-perl
|
||||
BUNDLE_TIMESTAMP=`xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" $MAVENMETAFILE 2>/dev/null`
|
||||
elif is_fedora; then
|
||||
yum_install perl-XML-XPath
|
||||
BUNDLE_TIMESTAMP=`xpath -e "//snapshotVersion[extension='zip'][1]/value/text()" $MAVENMETAFILE 2>/dev/null`
|
||||
else
|
||||
yum_install perl-XML-XPath
|
||||
BUNDLE_TIMESTAMP=`xpath $MAVENMETAFILE "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
|
||||
fi
|
||||
# Get build information
|
||||
_wget $MAVENMETAFILE ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml $OFFLINE
|
||||
BUNDLE_TIMESTAMP=$(_xpath "//snapshotVersion[extension='zip'][1]/value/text()" $MAVENMETAFILE)
|
||||
fi
|
||||
|
||||
export ODL_URL=${NEXUSPATH}/${BUNDLEVERSION}
|
||||
|
0
devstack/odl-releases/boron-snapshot-0.5
Normal file
0
devstack/odl-releases/boron-snapshot-0.5
Normal file
0
devstack/odl-releases/carbon-snapshot-0.6
Normal file
0
devstack/odl-releases/carbon-snapshot-0.6
Normal file
@@ -1,7 +1,28 @@
|
||||
_XTRACE_ODL_RELEASE_COMMON=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
_odl_release=$1
|
||||
if [[ "$_odl_release" =~ -snapshot- ]]; then
|
||||
if [[ "$_odl_release" =~ -snapshot ]]; then
|
||||
# <release name>-snapshot-<N>.<N>.<N> -> <N>.<N>.<N>-SNAPSHOT
|
||||
_odl_bundleversion_default=${_odl_release/[[:alpha:]]*-snapshot-/}-SNAPSHOT
|
||||
_odl_version=${_odl_release/[[:alpha:]]*-snapshot-/}
|
||||
if [[ "$_odl_release" == "latest-snapshot" ]]; then
|
||||
# get latest revision of snapshot
|
||||
_odl_version=$(odl_snapshot_full_version $ODL_DIR $ODL_URL_PREFIX "latest" $OFFLINE)
|
||||
# update ODL_RELEASE to prevent odl_snapshot_full_version from being called
|
||||
# every time networking-odl/devstack/plugin.sh is called by devstack
|
||||
# latest-snapshot -> latest-snapshot-<N>.<N>.<N>
|
||||
ODL_RELEASE=${ODL_RELEASE}-${_odl_version}
|
||||
elif [[ "${_odl_version}" =~ ^[[:digit:]]\.[[:digit:]]$ ]]; then
|
||||
# get latest revision of given major.minor
|
||||
# <major>.<minor> -> <major>.<minor>.<revision>
|
||||
_odl_version=$(odl_snapshot_full_version $ODL_DIR $ODL_URL_PREFIX $_odl_version $OFFLINE)
|
||||
# update ODL_RELEASE to prevent odl_snapshot_full_version from being called
|
||||
# every time networking-odl/devstack/plugin.sh is called by devstack
|
||||
# <release name>-snapshot-<N>.<N> -> <release name>-snapshot-<N>.<N>.<N>
|
||||
_odl_revision=${_odl_version/[[:digit:]]\.[[:digit:]]\./}
|
||||
ODL_RELEASE=${ODL_RELEASE}.${_odl_revision}
|
||||
fi
|
||||
_odl_bundleversion_default=${_odl_version}-SNAPSHOT
|
||||
export ODL_BUNDLEVERSION=${ODL_BUNDLEVERSION:-${_odl_bundleversion_default}}
|
||||
export ODL_SNAPSHOT_VERSION=${ODL_SNAPSHOT_VERSION:-latest}
|
||||
else
|
||||
@@ -48,3 +69,5 @@ export ODL_NETVIRT_KARAF_FEATURE=${ODL_NETVIRT_KARAF_FEATURE:-$ODL_NETVIRT_KARAF
|
||||
|
||||
# The url that this version of ODL netvirt can use to know ODL is fully up
|
||||
export ODL_BOOT_WAIT_URL=${ODL_BOOT_WAIT_URL:-restconf/operational/network-topology:network-topology/topology/netvirt:1}
|
||||
|
||||
$_XTRACE_ODL_RELEASE_COMMON
|
||||
|
0
devstack/odl-releases/latest-snapshot
Normal file
0
devstack/odl-releases/latest-snapshot
Normal file
@@ -7,11 +7,14 @@ GATE_DEST=$BASE/new
|
||||
DEVSTACK_PATH=$GATE_DEST/devstack
|
||||
|
||||
case "$ODL_RELEASE_BASE" in
|
||||
latest-snapshot)
|
||||
ODL_RELEASE=latest-snapshot
|
||||
;;
|
||||
carbon-snapshot)
|
||||
ODL_RELEASE=carbon-snapshot-0.6.0
|
||||
ODL_RELEASE=carbon-snapshot-0.6
|
||||
;;
|
||||
boron-snapshot)
|
||||
ODL_RELEASE=boron-snapshot-0.5.3
|
||||
ODL_RELEASE=boron-snapshot-0.5
|
||||
;;
|
||||
beryllium-snapshot)
|
||||
ODL_RELEASE=beryllium-snapshot-0.4.5
|
||||
|
@@ -3,7 +3,10 @@
|
||||
|
||||
# What release to use. Choices are:
|
||||
#
|
||||
# latest-snapshot (master latest snapshot)
|
||||
# carbon-snapshot-0.6 (master latest carbon snapshot)
|
||||
# carbon-snapshot-0.6.0 (master)
|
||||
# boron-snapshot-0.5 (stable/boron latest boron snapshot)
|
||||
# boron-snapshot-0.5.3 (stable/boron)
|
||||
# boron-0.5.2-SR2
|
||||
# boron-0.5.1-SR1
|
||||
@@ -20,7 +23,7 @@
|
||||
# lithium-0.3.1-SR1 (SR1)
|
||||
# helium-0.2.3-SR3
|
||||
|
||||
ODL_RELEASE=${ODL_RELEASE:-carbon-snapshot-0.6.0}
|
||||
ODL_RELEASE=${ODL_RELEASE:-latest-snapshot}
|
||||
|
||||
# The IP address of ODL. Set this in local.conf.
|
||||
ODL_MGR_IP=${ODL_MGR_IP:-$SERVICE_HOST}
|
||||
|
Reference in New Issue
Block a user