aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/aks/util/create_robot_config.sh
blob: 9c1e15e1b51764be69348609f8fba393a05473ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Copyright 2019 AT&T Intellectual Property. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

OPENSTACK_RC=$1
OPENSTACK_PARAM=$2
BUILD_DIR=$3
INTEGRATION_TEMPLATE=$4
MASTER_PASSWORD=$5

if [ "$OPENSTACK_RC" == "" ] 
       then
        echo "No OPENSTACK_RC file"
        echo "Usage: create-robot-config.sh <openstack.rc>  <openstack_env_param>"
  exit
fi 
if [ "$OPENSTACK_PARAM" == "" ] 
        then
        echo "No OPENSTACK_PARAM"
        echo "Usage: create-robot-config.sh <openstack.rc>  <openstack_env_param>"
  exit
fi

source $OPENSTACK_RC
source $OPENSTACK_PARAM

env

SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
export OS_PASSWORD_ENCRYPTED_FOR_ROBOT=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p)

#Use new encryption method
pushd .

cd $BUILD_DIR/integration/deployment/heat/onap-rke/scripts
javac Crypto.java
SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
export OS_PASSWORD_ENCRYPTED=$(java Crypto "$OS_PASSWORD" "$SO_ENCRYPTION_KEY")

cp $INTEGRATION_TEMPLATE ./integration-override.yaml
template="integration-override.yaml"
sed -ir -e "s/\${OS_PASSWORD_ENCRYPTED_FOR_ROBOT}/$OS_PASSWORD_ENCRYPTED_FOR_ROBOT/"  $template
sed -ir -e "s/\${OS_PASSWORD_ENCRYPTED}/$OS_PASSWORD_ENCRYPTED/"  $template

sed -ir -e "s/\${OS_PROJECT_ID}/$OS_PROJECT_ID/"  $template
sed -ir -e "s/\${OS_USERNAME}/$OS_USERNAME/"  $template
sed -ir -e "s/\${OS_USER_DOMAIN_NAME}/$OS_USER_DOMAIN_NAME/"  $template
sed -ir -e "s/\${OS_PROJECT_NAME}/$OS_PROJECT_NAME/"  $template
sed -ir -e "s/\${OS_USERNAME}/$OS_USERNAME/"  $template
sed -ir -e "s~\${OS_AUTH_URL}~$OS_AUTH_URL~"  $template


sed -ir -e "s/__docker_proxy__/$DOCKER_REPOSITORY/"  $template
sed -ir -e "s/__public_net_id__/$OS_PUBLIC_NETWORK_ID/"  $template
sed -ir -e "s~__oam_network_cidr__~$OS_OAM_NETWORK_CIDR~"  $template
sed -ir -e "s/__oam_network_prefix__/$OS_OAM_NETWORK_PREFIX/"  $template
sed -ir -e "s/__oam_network_id__/$OS_OAM_NETWORK_ID/"  $template
sed -ir -e "s/__oam_subnet_id__/$OS_OAM_NETWORK_SUBNET_ID/"  $template
sed -ir -e "s/__sec_group__/$OS_SEC_GROUP/"  $template

sed -ir -e "s/\${OS_UBUNTU_14_IMAGE}/$OS_UBUNTU_14_IMAGE/"  $template
sed -ir -e "s/\${OS_UBUNTU_16_IMAGE}/$OS_UBUNTU_16_IMAGE/"  $template

sed -ir -e "s/\${MASTER_PASSWORD}/$MASTER_PASSWORD/"  $template

sed -ir -e "s/__nfs_ip_addr__/$NFS_IP_ADDR/"  $template
sed -ir -e "s/__k8s_01_vm_ip__/$K8S_01_VM_IP/"  $template

cat $template
cp $template  $BUILD_DIR/$template

popd