blob: 0cffbf0d4e0c360cf99eda2b930a751c727963e0 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
5source /var/onap/functions
6
7# install_mso() - Installation of mso images
8function install_mso {
9 local src_folder=/opt/mso
10 if [[ "$build_image" == "True" ]]; then
11 clone_repo mso $src_folder
12 export GIT_NO_PROJECT=/opt/
13 build_docker_image $src_folder/packages/docker
14 fi
15}
16
17# install_mso_docker_config() - Download and install MSO Docker configuration project
18function install_mso_docker_config {
19 local src_folder=/opt/mso/docker-config
20 clone_repo mso/docker-config $src_folder
21 MSO_ENCRYPTION_KEY=$(cat /opt/mso/docker-config/encryption.key)
22 echo -n "$openstack_api_key" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
23
24 # Deployments in OpenStack require a keystone file
25 if [ -e /opt/config/keystone.txt ]; then
26 KEYSTONE_URL=$(cat /opt/config/keystone.txt)
27 DCP_CLLI="DEFAULT_KEYSTONE"
28 AUTH_TYPE="USERNAME_PASSWORD"
29 else
30 KEYSTONE_URL="https://identity.api.rackspacecloud.com/v2.0"
31 DCP_CLLI="RAX_KEYSTONE"
32 AUTH_TYPE="RACKSPACE_APIKEY"
33 fi
34
35 # Update the MSO configuration file.
36 read -d '' MSO_CONFIG_UPDATES <<-EOF
37{
38"default_attributes":
39 {
40 "asdc-connections":
41 {
42 "asdc-controller1":
43 {
44 "environmentName": "$dmaap_topic"
45 }
46 },
47 "mso-po-adapter-config":
48 {
49 "identity_services":
50 [
51 {
52 "dcp_clli": "$DCP_CLLI",
53 "identity_url": "$KEYSTONE_URL",
54 "mso_id": "$openstack_username",
55 "mso_pass": "$openstack_password",
56 "admin_tenant": "service",
57 "member_role": "admin",
58 "tenant_metadata": "true",
59 "identity_server_type": "KEYSTONE",
60 "identity_authentication_type": "$AUTH_TYPE"
61 }
62 ]
63 }
64 }
65}
66EOF
67 export MSO_CONFIG_UPDATES
68 export MSO_DOCKER_IMAGE_VERSION=$docker_version
69
70 # Deploy the environment
71 pushd $src_folder
72 chmod +x deploy.sh
73 is_package_installed docker-ce || install_docker
74 install_docker_compose
75 # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
76 ./deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
77 popd
78}
79
80# init_mso() - Function that initialize MSO services
81function init_mso {
82 install_mso
83 install_mso_docker_config
84}