avoid hardcoded values
[demo.git] / boot / robot_vm_init.sh
1 #!/bin/bash
2
3 NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
4 NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
5 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
6 NEXUS_REPO=$(cat /opt/config/nexus_repo.txt)
7 DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
8 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
9
10 #
11 # Deploy latest robot configuration 
12 #
13 cd /opt/testsuite/properties
14 git pull
15 cp integration_* /opt/eteshare/config
16 cp vm_config2robot.sh /opt/eteshare/config
17 cp ete.sh /opt
18 cp demo.sh /opt
19
20 if [[ $CLOUD_ENV != "rackspace" ]]
21 then
22         sed -i "s/10.0.1.1/"$(cat /opt/config/aai1_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
23         sed -i "s/10.0.2.1/"$(cat /opt/config/appc_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
24         sed -i "s/10.0.4.1/"$(cat /opt/config/dcae_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
25         sed -i "s/10.0.5.1/"$(cat /opt/config/mso_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
26         sed -i "s/10.0.11.1/"$(cat /opt/config/mr_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
27         sed -i "s/10.0.6.1/"$(cat /opt/config/policy_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
28         sed -i "s/10.0.9.1/"$(cat /opt/config/portal_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
29         sed -i "s/10.0.3.1/"$(cat /opt/config/sdc_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
30         sed -i "s/10.0.7.1/"$(cat /opt/config/sdnc_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
31         sed -i "s/10.0.8.1/"$(cat /opt/config/vid_ip_addr.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
32         sed -i "s/https:\/\/identity.api.rackspacecloud.com/"$(cat /opt/config/keystone.txt)"/g" /opt/eteshare/config/integration_robot_properties.py
33 fi
34
35 chmod +x /opt/ete.sh
36 chmod +x /opt/demo.sh
37
38 /bin/bash /opt/eteshare/config/vm_config2robot.sh
39
40 docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
41 docker pull $NEXUS_DOCKER_REPO/openecomp/testsuite:$DOCKER_IMAGE_VERSION
42 docker rm -f openecompete_container
43 docker run -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $NEXUS_DOCKER_REPO/openecomp/testsuite:$DOCKER_IMAGE_VERSION