echo -e "Install OSM from source code"
echo -e " OPTIONS"
echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules"
- echo -e " --develop: install OSM from source code using the master branch"
+ echo -e " -b <branch>: install OSM from source code using a specific branch (master, v1.0, ...)"
+ echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch"
echo -e " --nat: install only NAT rules"
echo -e " -h / --help: print this help"
}
echo -e " Configuring RO"
lxc exec RO -- sed -i -e "s/^\#\?log_socket_host:.*/log_socket_host: $SO_CONTAINER_IP/g" /opt/openmano/openmanod.cfg
lxc exec RO -- service openmano restart
- time=0; step=1; timelength=10; while [ $time -le $timelength ]; do sleep $step; echo -n "."; time=$((time+step)); done; echo
+ time=0; step=2; timelength=20; while [ $time -le $timelength ]; do sleep $step; echo -n "."; time=$((time+step)); done; echo
+ lxc exec RO -- openmano tenant-delete -f osm >/dev/null
RO_TENANT_ID=`lxc exec RO -- openmano tenant-create osm |awk '{print $1}'`
echo -e " Configuring VCA"
echo -e " Configuring SO"
sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP
- lxc exec SO-ub -- nohup sudo -b -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode
- time=0; step=20; timelength=200; while [ $time -le $timelength ]; do sleep $step; echo -n "."; time=$((time+step)); done; echo
+ lxc exec SO-ub -- nohup sudo -b -H /usr/rift/rift-shell -r -i /usr/rift -a /usr/rift/.artifacts -- ./demos/launchpad.py --use-xml-mode &
+ time=0; step=30; timelength=300; while [ $time -le $timelength ]; do sleep $step; echo -n "."; time=$((time+step)); done; echo
curl -k --request POST \
--url https://$SO_CONTAINER_IP:8008/api/config/config-agent \
}
+function install_lxd() {
+ lxd init --auto
+ lxd waitready
+ systemctl stop lxd-bridge
+ systemctl --system daemon-reload
+ systemctl enable lxd-bridge
+ systemctl start lxd-bridge
+}
+
+
UNINSTALL=""
DEVELOP=""
NAT=""
RECONFIGURE=""
TEST_INSTALLER=""
-while getopts ":h-:" o; do
+LXD=""
+SHOWOPTS=""
+COMMIT_ID=""
+while getopts ":h-:b:" o; do
case "${o}" in
h)
usage && exit 0
;;
+ b)
+ COMMIT_ID=${OPTARG}
+ ;;
-)
[ "${OPTARG}" == "help" ] && usage && exit 0
[ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
[ "${OPTARG}" == "nat" ] && NAT="y" && continue
[ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
[ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue
+ [ "${OPTARG}" == "lxd" ] && LXD="y" && continue
+ [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
echo -e "Invalid option: '--$OPTARG'\n" >&2
usage && exit 1
;;
esac
done
+[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
+[ -z "$COMMIT_ID" ] && COMMIT_ID="tags/v1.0.3"
+
+if [ -n "$SHOWOPTS" ]; then
+ echo "UNINSTALL=$UNINSTALL"
+ echo "DEVELOP=$DEVELOP"
+ echo "NAT=$NAT"
+ echo "RECONFIGURE=$RECONFIGURE"
+ echo "TEST_INSTALLER=$TEST_INSTALLER"
+ echo "LXD=$LXD"
+ echo "Commit: $COMMIT_ID"
+ exit 0
+fi
+
if [ -n "$TEST_INSTALLER" ]; then
echo -e "\nUsing local devops repo for OSM installation"
TEMPDIR="$(dirname $(realpath $(dirname $0)))"
echo -e "\nCloning devops repo temporarily"
git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
RC_CLONE=$?
- DEVOPS_COMMITID="tags/v1.0.1"
+ DEVOPS_COMMITID="tags/v1.0.3"
git -C $TEMPDIR checkout $DEVOPS_COMMITID
fi
OSM_DEVOPS=$TEMPDIR
OSM_JENKINS="$TEMPDIR/jenkins"
. $OSM_JENKINS/common/all_funcs
-[ -n "$UNINSTALL" ] && uninstall && exit 0
-[ -n "$NAT" ] && nat && exit 0
-[ -n "$RECONFIGURE" ] && configure && exit 0
+[ -n "$UNINSTALL" ] && uninstall && echo -e "\nDONE" && exit 0
+[ -n "$NAT" ] && nat && echo -e "\nDONE" && exit 0
+[ -n "$RECONFIGURE" ] && configure && echo -e "\nDONE" && exit 0
#Installation starts here
wget -q -O- https://osm-download.etsi.org/ftp/osm-1.0-one/README.txt &> /dev/null
+[ -n "$LXD" ] && echo -e "\nConfiguring lxd" && install_lxd
+
echo -e "\nChecking required packages: wget, curl, tar"
dpkg -l wget curl tar &>/dev/null || ! echo -e " One or several packages are not installed.\nInstalling required packages\n Root privileges are required" || sudo apt install -y wget curl tar
echo -e "\nCreating the containers and building ..."
-COMMIT_ID="tags/v1.0.1"
-[ -n "$DEVELOP" ] && COMMIT_ID="master"
$OSM_DEVOPS/jenkins/host/start_build RO checkout $COMMIT_ID
$OSM_DEVOPS/jenkins/host/start_build VCA
$OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID