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