| #!/bin/bash |
| |
| set -o xtrace |
| |
| source /var/onap/functions |
| source /var/onap/asserts |
| |
| src_folder=$git_src_folder/openecomp/sdnc |
| sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam") |
| |
| # clone_all_sdnc_repos() - Function that clones SDNC source repo. |
| function clone_all_sdnc_repos { |
| for dirc in ${sdnc_repos[@]}; do |
| clone_repo sdnc/$dirc $src_folder/$dirc |
| done |
| } |
| |
| # compile_all_sdnc_repos() - Function that compiles SDNC source repo. |
| function compile_all_sdnc_repos { |
| for dirc in ${sdnc_repos[@]}; do |
| if [[ "$dirc" == "core" ]]; then |
| compile_src $src_folder/core/rootpom |
| fi |
| compile_src $src_folder/$dirc |
| done |
| } |
| |
| # _build_sdnc_images() - Builds SDNC images from source code |
| function _build_sdnc_images { |
| local folder=$1 |
| |
| build_docker_image $folder/installation/ubuntu |
| asserts_image openecomp/ubuntu-sdnc-image |
| |
| build_docker_image $folder/installation/sdnc |
| asserts_image openecomp/sdnc-image |
| |
| build_docker_image $folder/installation/admportal |
| asserts_image openecomp/admportal-sdnc-image |
| |
| build_docker_image $folder/installation/dgbuilder |
| asserts_image openecomp/dgbuilder-sdnc-image |
| } |
| |
| # get_sdnc_images() - Build or retrieve necessary images |
| function get_sdnc_images { |
| if [[ "$build_image" == "True" ]]; then |
| # The OAM code depends on all the SDNC repos which should be downloaded and compiled first |
| if [[ "$compile_repo" == "False" ]]; then |
| compile_all_sdnc_repos |
| fi |
| _build_sdnc_images $src_folder/oam |
| else |
| pull_openecomp_image sdnc-image openecomp/sdnc-image:latest |
| pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest |
| pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| fi |
| } |
| |
| # install_sdnc() - Download and install SDNC services from source code |
| function install_sdnc { |
| install_package unzip |
| clone_repo sdnc/oam $src_folder/oam |
| pushd $src_folder/oam/installation/src/main/yaml |
| install_docker_compose |
| /opt/docker/docker-compose up -d |
| popd |
| } |
| |
| # init_sdnc() - Function that initialize SDNC services |
| function init_sdnc { |
| start_ODL |
| clone_all_sdnc_repos |
| if [[ "$compile_repo" == "True" ]]; then |
| compile_all_sdnc_repos |
| fi |
| get_sdnc_images |
| install_sdnc |
| } |