blob: 646a502e2d583d570553811c2b61bd460331cfbc [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
16DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
17
18set -x
19
20if [ ! -d $BUILD_DIR ]; then
21 mkdir -p $BUILD_DIR
22fi
23
24# TODO
25# Get these from values.yaml
26export AAI_DNS_NAME=aai.onap
27export AAI_PORT=8443
28export AAI_USER=AAI
29export AAI_PASS=AAI
30export AAI_PROTOCOL=https
31export VID_DNS_NAME=vid.onap
32export VID_PORT=8443
33export VID_PROTOCOL=https
34export SDC_DNS_NAME=sdc-fe.onap
35export SDC_PORT=9443
36export SDC_PROTOCOL=https
37
38DATA_FILE=$BUILD_DIR"/get_tenant_id.json"
39
40cat > $DATA_FILE <<EOF
41{ "auth": {
42 "identity": {
43 "methods": ["password"],
44 "password": {
45 "user": {
46 "name": "$OPENSTACK_USER",
47 "domain": { "id": "default" },
48 "password": "$OPENSTACK_PASS"
49 }
50 }
51 },
52 "scope": {
53 "project": {
54 "name": "$OPENSTACK_TENANT",
55 "domain": { "id": "default" }
56 }
57 }
58 }
59}
60EOF
61
62http_code=""
63COUNTER=0
64
65until [ "$http_code" = "201" ] || [ $COUNTER -gt 360 ]; do
66http_code=`curl -sL -w "%{http_code}" -o /dev/null -H "Content-Type: application/json" -d @"$DATA_FILE" "http://$OPENSTACK_IP/identity/v3/auth/tokens"`
67echo ""
68echo "http_code $http_code"
69COUNTER=$((COUNTER +1))
70sleep 10
71done
72
73TENANT_ID=`curl -s -H "Content-Type: application/json" -d @"$DATA_FILE" "http://$OPENSTACK_IP/identity/v3/auth/tokens" | jq --raw-output '.token.project.id'`
74
75if [ $? -ne 0 ]; then
76 echo "Failure getting tenant ID from openstack, exiting..."
77 exit 1
78fi
79
80export TENANT_ID=$TENANT_ID
81
82URI="aai/util/echo?action=long"
83http_code=""
84COUNTER=0
85
86until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do
87echo "performing aai healthcheck..."
88http_code=`curl -sL -w "%{http_code}" -o /dev/null -I --insecure -u $AAI_USER:$AAI_PASS -X GET "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \
89 -H 'X-TransactionId: 9999' \
90 -H 'X-FromAppId: jimmy-postman' \
91 -H 'Real-Time: true' \
92 -H 'Cache-Control: no-cache'`
93COUNTER=$((COUNTER +1))
94sleep 10
95done
96
97if [ "$http_code" != "200" ]; then
98 echo "AAI Healthcheck unsuccessful :("
99 echo "Something went wrong during the ONAP installation."
100 exit 1
101fi
102
103echo "Creating CLLI $CLLI..."
104$DIR/create_clli.sh
105
106echo "Creating Cloud Region $CLOUD_REGION..."
107$DIR/create_cloud_region.sh
108
109echo "Creating Cloud Region Relationship..."
110$DIR/create_cloud_region_relationship.sh
111
112echo "Creating Cloud Customer $CUSTOMER..."
113$DIR/create_customer.sh
114
115echo "Creating Cloud Service Type $SERVICE_TYPE..."
116$DIR/create_service_type.sh
117
118echo "Creating Subscription..."
119$DIR/create_subscription.sh
120
121echo "Creating Subscription Relationship..."
122$DIR/create_cloud_region_subscriber_relationship.sh
123
124echo "Creating Availability Zone $AZ..."
125$DIR/create_az.sh
126
127
128URI="vid/healthCheck"
129http_code=""
130COUNTER=0
131
132until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do
133echo "performing vid healthcheck..."
134http_code=`curl -sL -w "%{http_code}" -o /dev/null --insecure -I -X GET "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI"`
135COUNTER=$((COUNTER +1))
136sleep 10
137done
138
139if [ "$http_code" != "200" ]; then
140 echo "VID Healthcheck unsuccessful :("
141 echo "Something went wrong during the ONAP installation."
142 exit 1
143fi
144
145echo "Creating Owning Entity $OE..."
146$DIR/create_owning_entity.sh
147
148echo "Creating Platform $PLATFORM..."
149$DIR/create_platform.sh
150
151echo "Creating Project $PROJECT..."
152$DIR/create_project.sh
153
154echo "Creating LOB $LOB..."
155$DIR/create_lob.sh
156
157echo "Creating Cloud Site..."
158$DIR/create_cloud_site.sh
159
160URI="sdc1/rest/healthCheck"
161http_code=""
162COUNTER=0
163
164until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do
165echo "performing sdc healthcheck..."
166http_code=`curl -k -sL -w "%{http_code}" -o /dev/null -I -X GET "$SDC_PROTOCOL://$SDC_DNS_NAME:$SDC_PORT/$URI"`
167COUNTER=$((COUNTER +1))
168sleep 10
169done
170
171if [ "$http_code" != "200" ]; then
172 echo "SDC Healthcheck unsuccessful :("
173 echo "Something went wrong during the ONAP installation."
174 exit 1
175fi
176