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