--- /dev/null
+#!/bin/bash
+
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+##
+
+# author: Alfonso Tierno
+
+# It uses following env, if not provided filling by default
+[ -z "$GIT_OVIM_URL" ] && GIT_OVIM_URL=https://osm.etsi.org/gerrit/osm/openvim.git
+[ -z "$DEVELOP" ] && DEVELOP=""
+# folder where RO is installed
+[ -z "$BASEFOLDER" ] && HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]})) && BASEFOLDER=$(dirname $HERE)
+[ -z "$SUDO_USER" ] && SUDO_USER="$USER"
+[ -z "$NO_PACKAGES" ] && NO_PACKAGES=""
+[ -z "$_DISTRO" ] && _DISTRO="Ubuntu"
+
+
+su $SUDO_USER -c "git -C '${BASEFOLDER}' clone ${GIT_OVIM_URL} lib-openvim" ||
+ ! echo "Error cannot clone from '${GIT_OVIM_URL}'" >&2 || exit 1
+if [[ -n $COMMIT_ID ]] ; then
+ echo -e "Installing lib-osm-openvim from refspec: $COMMIT_ID"
+ su $SUDO_USER -c "git -C '${BASEFOLDER}/lib-openvim' checkout $COMMIT_ID" ||
+ ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OVIM_URL}'" >&2 || exit 1
+elif [[ -z $DEVELOP ]]; then
+ LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/lib-openvim" tag -l "v[0-9]*" | sort -V | tail -n1`
+ echo -e "Installing lib-osm-openvim from refspec: tags/${LATEST_STABLE_TAG}"
+ su $SUDO_USER -c "git -C '${BASEFOLDER}/lib-openvim' checkout tags/${LATEST_STABLE_TAG}" ||
+ ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OVIM_URL}'" >&2 || exit 1
+else
+ echo -e "Installing lib-osm-openvim from refspec: master"
+fi
+
+make -C "${BASEFOLDER}/lib-openvim" prepare_lite
+export LANG="en_US.UTF-8"
+pip2 install -e "${BASEFOLDER}/lib-openvim/build"
}
GIT_URL=https://osm.etsi.org/gerrit/osm/RO.git
-GIT_OVIM_URL=https://osm.etsi.org/gerrit/osm/openvim.git
-GIT_OSMIM_URL=https://osm.etsi.org/gerrit/osm/IM.git
+export GIT_OVIM_URL=https://osm.etsi.org/gerrit/osm/openvim.git
+export GIT_OSMIM_URL=https://osm.etsi.org/gerrit/osm/IM.git
DBUSER="root"
DBPASSWD=""
DBPASSWD_PARAM=""
;;
-)
[ "${OPTARG}" == "help" ] && usage && exit 0
- [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
+ [ "${OPTARG}" == "develop" ] && export DEVELOP="y" && continue
[ "${OPTARG}" == "forcedb" ] && DB_FORCE_UPDATE="${DB_FORCE_UPDATE}--forcedb" && continue
[ "${OPTARG}" == "updatedb" ] && DB_FORCE_UPDATE="${DB_FORCE_UPDATE}--updatedb" && continue
[ "${OPTARG}" == "force" ] && FORCE="y" && continue
echo "Cancelled" && exit 1
fi
+export _DISTRO="$_DISTRO"
#check if installed as a service
INSTALL_AS_A_SERVICE=""
[[ "$_DISTRO" == "Ubuntu" ]] && [[ ${_RELEASE%%.*} == 16 ]] && [[ -z $DEVELOP ]] && INSTALL_AS_A_SERVICE="y"
# Next operations require knowing BASEFOLDER
if [[ -z "$NOCLONE" ]]; then
if [[ -n "$INSTALL_AS_A_SERVICE" ]] ; then
- BASEFOLDER=__openmano__${RANDOM}
+ export BASEFOLDER=__openmano__${RANDOM}
else
- BASEFOLDER="${PWD}/openmano"
+ export BASEFOLDER="${PWD}/openmano"
fi
[[ -n "$FORCE" ]] && rm -rf $BASEFOLDER #make idempotent
else
HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
- BASEFOLDER=$(dirname $HERE)
+ export BASEFOLDER=$(dirname $HERE)
fi
if [[ -z "$NO_PACKAGES" ]]
"#################################################################\n"\
"##### INSTALLING OSM-IM LIBRARY #####\n"\
"#################################################################"
-su $SUDO_USER -c "git -C ${BASEFOLDER} clone ${GIT_OSMIM_URL} IM" ||
- ! echo "Error cannot clone from '${GIT_OSMIM_URL}'" >&2 || exit 1
-if [[ -n $COMMIT_ID ]] ; then
- echo -e "Installing osm-IM from refspec: $COMMIT_ID"
- su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout $COMMIT_ID" ||
- ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OSMIM_URL}'" >&2 || exit 1
-elif [[ -z $DEVELOP ]]; then
- LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/IM" tag -l "v[0-9]*" | sort -V | tail -n1`
- echo -e "Installing osm-IM from refspec: tags/${LATEST_STABLE_TAG}"
- su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout tags/${LATEST_STABLE_TAG}" ||
- ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OSMIM_URL}'" >&2 || exit 1
-else
- echo -e "Installing osm-IM from refspec: master"
-fi
-
-# Install debian dependencies before setup.py
-if [[ -z "$NO_PACKAGES" ]]
-then
- [ "$_DISTRO" == "Ubuntu" ] && install_packages "tox debhelper python-bitarray python-lxml python-six"
- # TODO check packages for CentOS and RedHat
- [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "tox debhelper python-bitarray python-lxml python-six"
- pip2 install --upgrade stdeb pyangbind || exit 1
-fi
-su $SUDO_USER -c "make -C ${BASEFOLDER}/IM all"
-dpkg -i ${BASEFOLDER}/IM/deb_dist/python-osm-im*.deb ${BASEFOLDER}/IM/pyangbind/deb_dist/*.deb \
- ${BASEFOLDER}/IM/pyang/deb_dist/*.deb
-rm -rf "${BASEFOLDER}/IM"
-OSM_IM_PATH=`python -c 'import osm_im; print osm_im.__path__[0]'` ||
- ! echo "ERROR installing python-osm-im library!!!" >&2 || exit 1
-
+ ${BASEFOLDER}/scripts/install-osm-im.sh
+ OSM_IM_PATH=`python -c 'import osm_im; print osm_im.__path__[0]'` ||
+ ! echo "ERROR installing python-osm-im library!!!" >&2 || exit 1
echo -e "\n"\
"#################################################################\n"\
"##### INSTALLING OVIM LIBRARY #####\n"\
"#################################################################"
-su $SUDO_USER -c "git -C ${BASEFOLDER} clone ${GIT_OVIM_URL} openvim" ||
- ! echo "Error cannot clone from '${GIT_OVIM_URL}'" || exit 1
-if [[ -n $COMMIT_ID ]] ; then
- echo -e "Installing lib_osm_openvim from refspec: $COMMIT_ID"
- su $SUDO_USER -c "git -C ${BASEFOLDER}/openvim checkout $COMMIT_ID" ||
- ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OVIM_URL}'" || exit 1
-elif [[ -z $DEVELOP ]]; then
- LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/openvim" tag -l "v[0-9]*" | sort -V | tail -n1`
- echo -e "Installing lib_osm_openvim from refspec: tags/${LATEST_STABLE_TAG}"
- su $SUDO_USER -c "git -C ${BASEFOLDER}/openvim checkout tags/${LATEST_STABLE_TAG}" ||
- ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OVIM_URL}'" || exit 1
-else
- echo -e "Installing lib_osm_openvim from refspec: master"
-fi
-
-# Install debian dependencies before setup.py
-if [[ -z "$NO_PACKAGES" ]]
-then
- [ "$_DISTRO" == "Ubuntu" ] && install_packages \
- "libmysqlclient-dev python-cffi python-packaging python-pkgconfig python-pycparser libssl-dev libffi-dev"
- # TODO check if that is the name in CentOS and RedHat
- [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages \
- "libmysqlclient-dev python-cffi python-packaging python-pkgconfig python-pycparser libssl-dev libffi-dev"
- pip2 install --upgrade stdeb setuptools-version-command || exit 1
-fi
-su $SUDO_USER -c "make -C ${BASEFOLDER}/openvim lite"
-dpkg -i ${BASEFOLDER}/openvim/.build/python-lib-osm-openvim*.deb
-rm -rf "${BASEFOLDER}/openvim"
-OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` ||
- ! echo "ERROR installing python-lib-osm-openvim library!!!" >&2 || exit 1
+ ${BASEFOLDER}/scripts/install-lib-osm-openvim.sh
+ OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` ||
+ ! echo "ERROR installing python-lib-osm-openvim library!!!" >&2 || exit 1
if [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ]
then
--- /dev/null
+#!/bin/bash
+
+##
+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+##
+
+# author: Alfonso Tierno
+
+# It uses following env, if not provided filling by default
+[ -z "$GIT_OSMIM_URL" ] && GIT_OSMIM_URL=https://osm.etsi.org/gerrit/osm/IM.git
+[ -z "$DEVELOP" ] && DEVELOP=""
+# folder where RO is installed
+[ -z "$BASEFOLDER" ] && HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]})) && BASEFOLDER=$(dirname $HERE)
+[ -z "$SUDO_USER" ] && SUDO_USER="$USER"
+[ -z "$NO_PACKAGES" ] && NO_PACKAGES=""
+[ -z "$_DISTRO" ] && _DISTRO="Ubuntu"
+
+
+su $SUDO_USER -c "git -C ${BASEFOLDER} clone ${GIT_OSMIM_URL} IM" ||
+ ! echo "Error cannot clone from '${GIT_OSMIM_URL}'" >&2 || exit 1
+if [[ -n $COMMIT_ID ]] ; then
+ echo -e "Installing osm-IM from refspec: $COMMIT_ID"
+ su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout $COMMIT_ID" ||
+ ! echo "Error cannot checkout '$COMMIT_ID' from '${GIT_OSMIM_URL}'" >&2 || exit 1
+elif [[ -z $DEVELOP ]]; then
+ LATEST_STABLE_TAG=`git -C "${BASEFOLDER}/IM" tag -l "v[0-9]*" | sort -V | tail -n1`
+ echo -e "Installing osm-IM from refspec: tags/${LATEST_STABLE_TAG}"
+ su $SUDO_USER -c "git -C ${BASEFOLDER}/IM checkout tags/${LATEST_STABLE_TAG}" ||
+ ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '${GIT_OSMIM_URL}'" >&2 || exit 1
+else
+ echo -e "Installing osm-IM from refspec: master"
+fi
+
+# Install debian dependencies before setup.py
+if [[ -z "$NO_PACKAGES" ]]
+then
+ # apt-get update
+ # apt-get install -y git python-pip
+ # pip2 install pip==9.0.3
+ pip2 install pyangbind || exit 1
+fi
+
+PYBINDPLUGIN=$(python2 -c 'import pyangbind; import os; print "%s/plugin" % os.path.dirname(pyangbind.__file__)')
+su $SUDO_USER -c 'mkdir -p "'${BASEFOLDER}/IM/osm_im'"'
+su $SUDO_USER -c 'touch "'${BASEFOLDER}/IM/osm_im/__init__.py'"'
+# wget -q https://raw.githubusercontent.com/RIFTIO/RIFT.ware/RIFT.ware-4.4.1/modules/core/util/yangtools/yang/rw-pb-ext.yang -O "${BASEFOLDER}/IM/models/yang/rw-pb-ext.yang"
+for target in vnfd nsd ; do
+ pyang -Werror --path "${BASEFOLDER}/IM/models/yang" --plugindir "${PYBINDPLUGIN}" -f pybind \
+ -o "${BASEFOLDER}/IM/osm_im/${target}.py" "${BASEFOLDER}/IM/models/yang/${target}.yang"
+done
+
+pip2 install -e "${BASEFOLDER}/IM" || ! echo "ERROR installing python-osm-im library!!!" >&2 || exit 1
\ No newline at end of file