Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2018 Intel Corporation, Inc |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | cd ${SCRIPTS} |
| 17 | |
| 18 | source common_functions.sh |
| 19 | |
Gary Wu | 13111e9 | 2018-09-27 11:31:33 -0700 | [diff] [blame^] | 20 | generic_sim_path=${WORKSPACE}/scripts/multicloud-ocata/generic_sim |
| 21 | multicloud_provision_path=${WORKSPACE}/tests/multicloud-ocata/provision |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 22 | # start generic simulator for openstack mock and AAI mock |
| 23 | if [[ -z $(docker images -q generic_sim) ]]; then |
| 24 | pushd $generic_sim_path |
| 25 | docker build -t generic_sim . |
| 26 | popd |
| 27 | fi |
| 28 | |
| 29 | function start_simulator () |
| 30 | { |
| 31 | local service_name=$1 |
| 32 | local service_port=$2 |
| 33 | |
| 34 | ./run-instance.sh generic_sim $service_name "-v ${multicloud_provision_path}/${service_name}/:/tmp/generic_sim/ -v ${generic_sim_path}/${service_name}/:/etc/generic_sim/ -p $service_port:8080" |
| 35 | wait_for_service_init localhost:$service_port |
| 36 | bypass_ip_adress $service_name |
| 37 | } |
| 38 | |
| 39 | start_simulator nova 8774 |
| 40 | start_simulator glance 9292 |
| 41 | start_simulator cinder 8776 |
| 42 | start_simulator keystone 5000 |
| 43 | start_simulator aai 8443 |
| 44 | |
| 45 | # start multicloud-ocata |
| 46 | ./run-instance.sh nexus3.onap.org:10001/onap/multicloud/openstack/openstack-ocata multicloud-ocata "-t -e AAI_SERVICE_URL=http://aai:8080/aai -e no_proxy=$no_proxy -p 9006:9006" |
| 47 | SERVICE_IP=$(./get-instance-ip.sh multicloud-ocata) |
| 48 | SERVICE_PORT=9006 |
| 49 | |
| 50 | docker network create hpa-net |
| 51 | for container in aai keystone glance cinder nova multicloud-ocata; do |
| 52 | docker network connect hpa-net $container |
| 53 | done |
| 54 | |
| 55 | bypass_ip_adress $SERVICE_IP |
| 56 | wait_for_service_init ${SERVICE_IP}:${SERVICE_PORT} |
| 57 | |
| 58 | # Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 59 | ROBOT_VARIABLES+="-v SERVICE_IP:${SERVICE_IP} " |
| 60 | ROBOT_VARIABLES+="-v SERVICE_PORT:${SERVICE_PORT} " |