Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
Victor Morales | 0f94b4a | 2017-09-01 18:42:40 -0500 | [diff] [blame^] | 5 | source /var/onap/functions |
| 6 | |
| 7 | robot_src_folder=$git_src_folder/testsuite |
| 8 | robot_repos=("heatbridge" "properties" "python-testing-utils") |
| 9 | |
| 10 | # clone_robot_repos() - Function that clones Robot source repo. |
| 11 | function clone_robot_repos { |
| 12 | clone_repo testsuite $robot_src_folder |
| 13 | |
| 14 | for dirc in ${robot_repos[@]}; do |
| 15 | clone_repo testsuite/$dirc $robot_src_folder/$dirc |
| 16 | done |
| 17 | } |
| 18 | |
| 19 | # compile_robot_repos() - Function that compile Robot source repo. |
| 20 | function compile_robot_repos { |
| 21 | install_python_package tox |
| 22 | compile_src $robot_src_folder |
| 23 | |
| 24 | for dirc in ${robot_repos[@]}; do |
| 25 | compile_src $robot_src_folder/$dirc |
| 26 | done |
| 27 | } |
| 28 | |
| 29 | # _setup_ete_folder() - Create and copy ete folder structure |
| 30 | function _setup_ete_folder { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 31 | mkdir -p /opt/eteshare/config |
| 32 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 33 | cp $src_folder/integration_* /opt/eteshare/config |
| 34 | cp $src_folder/vm_config2robot.sh /opt/eteshare/config |
| 35 | cp $src_folder/ete.sh /opt |
| 36 | cp $src_folderdemo.sh /opt |
| 37 | |
| 38 | chmod +x /opt/ete.sh |
| 39 | chmod +x /opt/demo.sh |
| 40 | } |
| 41 | |
Victor Morales | 0f94b4a | 2017-09-01 18:42:40 -0500 | [diff] [blame^] | 42 | # get_robot_images() - Pull or build the Robot Docker images |
| 43 | function get_robot_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 44 | pull_openecomp_image testsuite |
Victor Morales | 0f94b4a | 2017-09-01 18:42:40 -0500 | [diff] [blame^] | 45 | } |
| 46 | |
| 47 | # install_robot() - Run Robot services |
| 48 | function install_robot { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 49 | docker rm -f openecompete_container |
| 50 | docker run -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $nexus_docker_repo/openecomp/testsuite:$docker_version |
| 51 | } |
| 52 | |
| 53 | # init_robot() - Function that initialize Robot services |
| 54 | function init_robot { |
Victor Morales | 0f94b4a | 2017-09-01 18:42:40 -0500 | [diff] [blame^] | 55 | if [[ "$clone_repo" == "True" ]]; then |
| 56 | clone_robot_repos |
| 57 | _setup_ete_folder |
| 58 | if [[ "$compile_repo" == "True" ]]; then |
| 59 | compile_robot_repos |
| 60 | fi |
| 61 | fi |
| 62 | get_robot_images |
| 63 | install_robot |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 64 | } |