blob: daa4dc21dac14b1774fb484e26be3c79984b36f3 [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
16set -x
17
18pushd .
19
20cd /tmp
21
22git clone http://gerrit.onap.org/r/integration /tmp/integration-repo
23git clone https://github.com/onap/oom.git /tmp/oom-repo
24
25cd /tmp/integration-repo/deployment/heat/onap-rke/scripts
26SO_ENCRYPTION_KEY=`cat /tmp/oom-repo/kubernetes/so/resources/config/mso/encryption.key`
27javac Crypto.java
28SO_ENCRYPTED_KEY=`java Crypto "$OPENSTACK_PASS" "$SO_ENCRYPTION_KEY"`
29
30popd
31
32echo $SO_ENCRYPTED_KEY
33
stark, stevend5d74c72020-04-21 15:28:13 -070034MARIADBPOD_STATUS=`kubectl -n onap get pods | grep mariadb-galera | head -1 | awk '{print $3}'`
stark, steven6754bc12019-09-19 15:43:00 -070035COUNTER=0
36
37until [ "$MARIADBPOD_STATUS" = "Running" ] || [ $COUNTER -gt 120 ]; do
38echo "mariadb pod not ready..."
39COUNTER=$((COUNTER +1))
40sleep 10
41done
42
stark, stevend5d74c72020-04-21 15:28:13 -070043MARIADBPOD=`kubectl -n onap get pods | grep mariadb-galera | head -1 | awk '{print $1}'`
44MARIADBSECRET=`kubectl -n onap get secrets | grep mariadb-galera-db-root-password | head -1 | awk '{print $1}'`
45MARIADBPASSWORD=`kubectl -n onap get secret $MARIADBSECRET -o jsonpath="{.data.password}" | base64 -d`
stark, steven6754bc12019-09-19 15:43:00 -070046
47COMMAND="INSERT INTO identity_services (id, identity_url, mso_id, mso_pass, admin_tenant, member_role, tenant_metadata, identity_server_type, identity_authentication_type, project_domain_name, user_domain_name) VALUES (\"$OS_ID\", \"http://$OPENSTACK_IP/identity/v3\", \"$OPENSTACK_USER\", \"$SO_ENCRYPTED_KEY\", \"$OPENSTACK_TENANT\", \"$OS_TENANT_ROLE\", 0, \"$OS_KEYSTONE\", \"USERNAME_PASSWORD\", \"default\", \"default\");"
stark, stevend5d74c72020-04-21 15:28:13 -070048kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password='$MARIADBPASSWORD' --database=catalogdb --execute='$COMMAND'"
stark, steven6754bc12019-09-19 15:43:00 -070049
50COMMAND="INSERT INTO cloud_sites (id, region_id, identity_service_id, cloud_version, clli) VALUES (\"$CLOUD_REGION\", \"$OPENSTACK_REGION\", \"$OS_ID\", \"2.5\", \"$CLOUD_REGION\");"
stark, stevend5d74c72020-04-21 15:28:13 -070051kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password='$MARIADBPASSWORD' --database=catalogdb --execute='$COMMAND'"
stark, steven6754bc12019-09-19 15:43:00 -070052