Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | source /var/onap/functions |
| 6 | source /var/onap/asserts |
| 7 | |
| 8 | src_folder=$git_src_folder/openecomp/sdnc |
| 9 | sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam") |
| 10 | |
| 11 | # clone_all_sdnc_repos() - Function that clones SDNC source repo. |
| 12 | function clone_all_sdnc_repos { |
| 13 | for dirc in ${sdnc_repos[@]}; do |
| 14 | clone_repo sdnc/$dirc $src_folder/$dirc |
| 15 | done |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 16 | } |
| 17 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 18 | # compile_all_sdnc_repos() - Function that compiles SDNC source repo. |
| 19 | function compile_all_sdnc_repos { |
| 20 | for dirc in ${sdnc_repos[@]}; do |
| 21 | if [[ "$dirc" == "core" ]]; then |
| 22 | compile_src $src_folder/core/rootpom |
| 23 | fi |
| 24 | compile_src $src_folder/$dirc |
| 25 | done |
| 26 | } |
| 27 | |
| 28 | # _build_sdnc_images() - Builds SDNC images from source code |
| 29 | function _build_sdnc_images { |
| 30 | local folder=$1 |
| 31 | |
| 32 | build_docker_image $folder/installation/ubuntu |
| 33 | asserts_image openecomp/ubuntu-sdnc-image |
| 34 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 35 | build_docker_image $folder/installation/sdnc |
| 36 | asserts_image openecomp/sdnc-image |
| 37 | |
| 38 | build_docker_image $folder/installation/admportal |
| 39 | asserts_image openecomp/admportal-sdnc-image |
| 40 | |
| 41 | build_docker_image $folder/installation/dgbuilder |
| 42 | asserts_image openecomp/dgbuilder-sdnc-image |
| 43 | } |
| 44 | |
| 45 | # get_sdnc_images() - Build or retrieve necessary images |
| 46 | function get_sdnc_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 47 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 48 | # The OAM code depends on all the SDNC repos which should be downloaded and compiled first |
| 49 | if [[ "$compile_repo" == "False" ]]; then |
| 50 | compile_all_sdnc_repos |
| 51 | fi |
| 52 | _build_sdnc_images $src_folder/oam |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 53 | else |
| 54 | pull_openecomp_image sdnc-image openecomp/sdnc-image:latest |
| 55 | pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest |
| 56 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 57 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | # install_sdnc() - Download and install SDNC services from source code |
| 61 | function install_sdnc { |
| 62 | install_package unzip |
| 63 | clone_repo sdnc/oam $src_folder/oam |
| 64 | pushd $src_folder/oam/installation/src/main/yaml |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 65 | install_docker_compose |
| 66 | /opt/docker/docker-compose up -d |
| 67 | popd |
| 68 | } |
| 69 | |
| 70 | # init_sdnc() - Function that initialize SDNC services |
| 71 | function init_sdnc { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 72 | start_ODL |
| 73 | clone_all_sdnc_repos |
| 74 | if [[ "$compile_repo" == "True" ]]; then |
| 75 | compile_all_sdnc_repos |
| 76 | fi |
| 77 | get_sdnc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 78 | install_sdnc |
| 79 | } |