Change to use LCM git project at LWB
[osm/devops.git] / installers / full_install_osm.sh
index 7cdf8bc..659c32d 100755 (executable)
@@ -32,7 +32,7 @@ function usage(){
     echo -e "     -l <lxd_repo>:  use specified repository url for lxd images"
     echo -e "     -p <path>:      use specified repository path for lxd images"
     echo -e "     --lightweight:  install lightweight build of OSM (default installation)"
-    echo -e "     --soui:         install classic build of OSM (based on LXD containers, with SO and UI)"
+    echo -e "     --soui:         install classic build of OSM (Rel THREE v3.1, based on LXD containers, with SO and UI)"
     echo -e "     --vimemu:       additionally fetch, build, and deploy the VIM emulator as a docker container"
     echo -e "     --develop:      (deprecated, use '-b master') install OSM from source code using the master branch"
 #    echo -e "     --reconfigure:  reconfigure the modules (DO NOT change NAT rules)"
@@ -312,7 +312,9 @@ function configure_SOUI(){
 
     echo -e "       Configuring SO"
     sudo route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP
+    sudo ip route add 10.44.127.0/24 via $VCA_CONTAINER_IP
     sudo sed -i "$ i route add -host $JUJU_CONTROLLER_IP gw $VCA_CONTAINER_IP" /etc/rc.local
+    sudo sed -i "$ i ip route add 10.44.127.0/24 via $VCA_CONTAINER_IP" /etc/rc.local
     # make journaling persistent
     lxc exec SO-ub -- mkdir -p /var/log/journal
     lxc exec SO-ub -- systemd-tmpfiles --create --prefix /var/log/journal
@@ -552,11 +554,12 @@ function generate_docker_images() {
     docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t osm/nbi || ! echo "cannot build NBI docker image" >&2
     git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
     docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/docker/Dockerfile-local -t osm/ro || ! echo "cannot build RO docker image" >&2
-    docker build ${LWTEMPDIR}/RO/lcm -t osm/lcm || ! echo "cannot build LCM docker image" >&2
-    git -C ${LWTEMPDIR} clone https://github.com/superfluidity/osm-light-ui.git
-    docker build ${LWTEMPDIR}/osm-light-ui -t osm/light-ui -f ${LWTEMPDIR}/osm-light-ui/code/docker/Dockerfile
-#    git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
-#    docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile
+    git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LCM
+    docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t osm/lcm || ! echo "cannot build LCM docker image" >&2
+#    git -C ${LWTEMPDIR} clone https://github.com/superfluidity/osm-light-ui.git
+#    docker build ${LWTEMPDIR}/osm-light-ui -t osm/light-ui -f ${LWTEMPDIR}/osm-light-ui/code/docker/Dockerfile
+    git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
+    docker build ${LWTEMPDIR}/LW-UI -t osm/light-ui -f ${LWTEMPDIR}/LW-UI/Dockerfile
 EONG
     echo "Finished generation of docker images"
 }
@@ -613,32 +616,38 @@ function install_lightweight() {
     generate_docker_images
     generate_docker_env_files
     deploy_lightweight
+    [ -n "$INSTALL_VIMEMU" ] && install_vimemu
     install_osmclient
     return 0
 }
 
 function install_vimemu() {
-    # install Docker
-    install_docker_ce
+    echo "\nInstalling vim-emu"
+    EMUTEMPDIR="$(mktemp -d -q --tmpdir "installosmvimemu.XXXXXX")"
+    trap 'rm -rf "${EMUTEMPDIR}"' EXIT
     # clone vim-emu repository (attention: branch is currently master only)
     echo "Cloning vim-emu repository ..."
-    git clone https://osm.etsi.org/gerrit/osm/vim-emu.git
+    git clone https://osm.etsi.org/gerrit/osm/vim-emu.git $EMUTEMPDIR
     # build vim-emu docker
     echo "Building vim-emu Docker container..."
-    sudo docker build -t vim-emu-img -f vim-emu/Dockerfile vim-emu/
+    sudo docker build -t vim-emu-img -f $EMUTEMPDIR/Dockerfile $EMUTEMPDIR/
     # start vim-emu container as daemon
     echo "Starting vim-emu Docker container 'vim-emu' ..."
-    sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
+    if [ -n "$INSTALL_LIGHTWEIGHT" ]; then
+        # in lightweight mode, the emulator needs to be attached to netOSM
+        sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
+    else
+        # classic build mode
+        sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py
+    fi
     echo "Waiting for 'vim-emu' container to start ..."
     sleep 5
     export VIMEMU_HOSTNAME=$(sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' vim-emu)
     echo "vim-emu running at ${VIMEMU_HOSTNAME} ..."
-    echo -e "You might be interested in adding the following OSM client env variables to your .bashrc file:"
-    echo "     export OSM_HOSTNAME=${OSM_HOSTNAME}"
-    echo "     export OSM_RO_HOSTNAME=${OSM_RO_HOSTNAME}"
-    echo -e "You might be interested in adding the following vim-emu env variables to your .bashrc file:"
+    # print vim-emu connection info
+    echo -e "\nYou might be interested in adding the following vim-emu env variables to your .bashrc file:"
     echo "     export VIMEMU_HOSTNAME=${VIMEMU_HOSTNAME}"
-    echo -e "\nTo add the emulated VIM to OSM you should do:"
+    echo -e "To add the emulated VIM to OSM you should do:"
     echo "     osm vim-create --name emu-vim1 --user username --password password --auth_url http://${VIMEMU_HOSTNAME}:6001/v2.0 --tenant tenantName --account_type openstack"
 }
 
@@ -742,7 +751,7 @@ while getopts ":hy-:b:r:k:u:R:l:p:D:" o; do
             [ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue
             [ "${OPTARG}" == "lxdimages" ] && INSTALL_FROM_LXDIMAGES="y" && continue
             [ "${OPTARG}" == "lightweight" ] && INSTALL_LIGHTWEIGHT="y" && continue
-            [ "${OPTARG}" == "soui" ] && INSTALL_LIGHTWEIGHT="" && && continue
+            [ "${OPTARG}" == "soui" ] && INSTALL_LIGHTWEIGHT="" && RELEASE="-R ReleaseTHREE" && REPOSITORY="-r stable" && continue
             [ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue
             [ "${OPTARG}" == "noconfigure" ] && NOCONFIGURE="y" && continue
             [ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
@@ -884,10 +893,7 @@ fi
 [ -z "$NOCONFIGURE" ] && install_osmclient
 
 #Install vim-emu (optional)
-if [ -n "$INSTALL_VIMEMU" ]; then
-    echo -e "\nInstalling vim-emu ..."
-    install_vimemu
-fi
+[ -n "$INSTALL_VIMEMU" ] && install_docker_ce && install_vimemu
 
 wget -q -O- https://osm-download.etsi.org/ftp/osm-4.0-four/README2.txt &> /dev/null
 track end