stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 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 | set -x |
| 17 | |
| 18 | pushd . |
| 19 | |
| 20 | cd /tmp |
| 21 | |
| 22 | git clone http://gerrit.onap.org/r/integration /tmp/integration-repo |
| 23 | git clone https://github.com/onap/oom.git /tmp/oom-repo |
| 24 | |
| 25 | cd /tmp/integration-repo/deployment/heat/onap-rke/scripts |
| 26 | SO_ENCRYPTION_KEY=`cat /tmp/oom-repo/kubernetes/so/resources/config/mso/encryption.key` |
| 27 | javac Crypto.java |
| 28 | SO_ENCRYPTED_KEY=`java Crypto "$OPENSTACK_PASS" "$SO_ENCRYPTION_KEY"` |
| 29 | |
| 30 | popd |
| 31 | |
| 32 | echo $SO_ENCRYPTED_KEY |
| 33 | |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame^] | 34 | MARIADBPOD_STATUS=`kubectl -n onap get pods | grep mariadb-galera | head -1 | awk '{print $3}'` |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 35 | COUNTER=0 |
| 36 | |
| 37 | until [ "$MARIADBPOD_STATUS" = "Running" ] || [ $COUNTER -gt 120 ]; do |
| 38 | echo "mariadb pod not ready..." |
| 39 | COUNTER=$((COUNTER +1)) |
| 40 | sleep 10 |
| 41 | done |
| 42 | |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame^] | 43 | MARIADBPOD=`kubectl -n onap get pods | grep mariadb-galera | head -1 | awk '{print $1}'` |
| 44 | MARIADBSECRET=`kubectl -n onap get secrets | grep mariadb-galera-db-root-password | head -1 | awk '{print $1}'` |
| 45 | MARIADBPASSWORD=`kubectl -n onap get secret $MARIADBSECRET -o jsonpath="{.data.password}" | base64 -d` |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 46 | |
| 47 | COMMAND="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, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame^] | 48 | kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password='$MARIADBPASSWORD' --database=catalogdb --execute='$COMMAND'" |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 49 | |
| 50 | COMMAND="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, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame^] | 51 | kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password='$MARIADBPASSWORD' --database=catalogdb --execute='$COMMAND'" |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 52 | |