[UCA-10] Fix issue with MTU size in dockers
[demo.git] / boot / mso_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 DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt)
7 OPENSTACK_USERNAME=$(cat /opt/config/openstack_username.txt)
8 OPENSTACK_APIKEY=$(cat /opt/config/api_key.txt)
9 export MSO_DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
10 export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
11
12 # Deployments in OpenStack require a keystone file
13 if [ -e /opt/config/keystone.txt ]
14 then
15         KEYSTONE_URL=$(cat /opt/config/keystone.txt)
16         DCP_CLLI="DEFAULT_KEYSTONE"
17         AUTH_TYPE="USERNAME_PASSWORD"
18 else
19         KEYSTONE_URL="https://identity.api.rackspacecloud.com/v2.0"
20         DCP_CLLI="RAX_KEYSTONE"
21         AUTH_TYPE="RACKSPACE_APIKEY"
22 fi
23
24 # Update the MSO configuration file.
25 read -d '' MSO_CONFIG_UPDATES <<-EOF
26 {
27 "default_attributes":
28   {
29     "asdc-connections":
30       {
31             "asdc-controller1":
32             {
33                 "environmentName": "$DMAAP_TOPIC"
34             }
35       },
36       "mso-po-adapter-config": 
37           {
38             "identity_services": 
39                 [
40                     {"dcp_clli": "$DCP_CLLI", 
41                      "identity_url": "$KEYSTONE_URL",
42                      "mso_id": "$OPENSTACK_USERNAME", 
43                      "mso_pass": "$OPENSTACK_APIKEY", 
44                      "admin_tenant": "service", 
45                      "member_role": "admin", 
46                      "tenant_metadata": "true",
47                      "identity_server_type": "KEYSTONE", 
48                      "identity_authentication_type": "$AUTH_TYPE"
49                         
50                     }
51                 ]
52           }
53   }
54 }
55 EOF
56 export MSO_CONFIG_UPDATES
57
58
59 # Deploy the environment
60 cd /opt/test_lab
61 git pull
62 chmod +x deploy.sh
63 #This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
64 ./deploy.sh $NEXUS_DOCKER_REPO $NEXUS_USERNAME $NEXUS_PASSWD $NEXUS_DOCKER_REPO $NEXUS_USERNAME $NEXUS_PASSWD