blob: dea67b8583b08da283a25499982e5426f314c00e [file] [log] [blame]
stark, steven6754bc12019-09-19 15:43:00 -07001#!/bin/bash
2# Copyright 2019 AT&T Intellectual Property. All rights reserved.
3#
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
16OPENSTACK_RC=$1
17OPENSTACK_PARAM=$2
18BUILD_DIR=$3
19INTEGRATION_TEMPLATE=$4
20
21if [ "$OPENSTACK_RC" == "" ]
22 then
23 echo "No OPENSTACK_RC file"
24 echo "Usage: create-robot-config.sh <openstack.rc> <openstack_env_param>"
25 exit
26fi
27if [ "$OPENSTACK_PARAM" == "" ]
28 then
29 echo "No OPENSTACK_PARAM"
30 echo "Usage: create-robot-config.sh <openstack.rc> <openstack_env_param>"
31 exit
32fi
33
34source $OPENSTACK_RC
35source $OPENSTACK_PARAM
36
37env
38
39SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
40export OS_PASSWORD_ENCRYPTED_FOR_ROBOT=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p)
41
42#Use new encryption method
43pushd .
44
45cd $BUILD_DIR/integration/deployment/heat/onap-rke/scripts
46javac Crypto.java
47SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
48export OS_PASSWORD_ENCRYPTED=$(java Crypto "$OS_PASSWORD" "$SO_ENCRYPTION_KEY")
49
50cp $INTEGRATION_TEMPLATE ./integration-override.yaml
51template="integration-override.yaml"
52sed -ir -e "s/\${OS_PASSWORD_ENCRYPTED_FOR_ROBOT}/$OS_PASSWORD_ENCRYPTED_FOR_ROBOT/" $template
53sed -ir -e "s/\${OS_PASSWORD_ENCRYPTED}/$OS_PASSWORD_ENCRYPTED/" $template
54
55sed -ir -e "s/\${OS_PROJECT_ID}/$OS_PROJECT_ID/" $template
56sed -ir -e "s/\${OS_USERNAME}/$OS_USERNAME/" $template
57sed -ir -e "s/\${OS_USER_DOMAIN_NAME}/$OS_USER_DOMAIN_NAME/" $template
58sed -ir -e "s/\${OS_PROJECT_NAME}/$OS_PROJECT_NAME/" $template
59sed -ir -e "s/\${OS_USERNAME}/$OS_USERNAME/" $template
60sed -ir -e "s~\${OS_AUTH_URL}~$OS_AUTH_URL~" $template
61
62
63sed -ir -e "s/__docker_proxy__/$DOCKER_REPOSITORY/" $template
64sed -ir -e "s/__public_net_id__/$OS_PUBLIC_NETWORK_ID/" $template
65sed -ir -e "s~__oam_network_cidr__~$OS_OAM_NETWORK_CIDR~" $template
66sed -ir -e "s/__oam_network_prefix__/$OS_OAM_NETWORK_PREFIX/" $template
67sed -ir -e "s/__oam_network_id__/$OS_OAM_NETWORK_ID/" $template
68sed -ir -e "s/__oam_subnet_id__/$OS_OAM_NETWORK_SUBNET_ID/" $template
69sed -ir -e "s/__sec_group__/$OS_SEC_GROUP/" $template
70
71sed -ir -e "s/\${OS_UBUNTU_14_IMAGE}/$OS_UBUNTU_14_IMAGE/" $template
72sed -ir -e "s/\${OS_UBUNTU_16_IMAGE}/$OS_UBUNTU_16_IMAGE/" $template
73
74sed -ir -e "s/__nfs_ip_addr__/$NFS_IP_ADDR/" $template
75sed -ir -e "s/__k8s_01_vm_ip__/$K8S_01_VM_IP/" $template
76
77cat $template
78cp $template $BUILD_DIR/$template
79
80popd