diff options
Diffstat (limited to 'deployment/aks/post-install/bootstrap')
14 files changed, 796 insertions, 0 deletions
diff --git a/deployment/aks/post-install/bootstrap/bootstrap.sh b/deployment/aks/post-install/bootstrap/bootstrap.sh new file mode 100755 index 000000000..646a502e2 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/bootstrap.sh @@ -0,0 +1,176 @@ +#!/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. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +set -x + +if [ ! -d $BUILD_DIR ]; then + mkdir -p $BUILD_DIR +fi + +# TODO +# Get these from values.yaml +export AAI_DNS_NAME=aai.onap +export AAI_PORT=8443 +export AAI_USER=AAI +export AAI_PASS=AAI +export AAI_PROTOCOL=https +export VID_DNS_NAME=vid.onap +export VID_PORT=8443 +export VID_PROTOCOL=https +export SDC_DNS_NAME=sdc-fe.onap +export SDC_PORT=9443 +export SDC_PROTOCOL=https + +DATA_FILE=$BUILD_DIR"/get_tenant_id.json" + +cat > $DATA_FILE <<EOF +{ "auth": { + "identity": { + "methods": ["password"], + "password": { + "user": { + "name": "$OPENSTACK_USER", + "domain": { "id": "default" }, + "password": "$OPENSTACK_PASS" + } + } + }, + "scope": { + "project": { + "name": "$OPENSTACK_TENANT", + "domain": { "id": "default" } + } + } + } +} +EOF + +http_code="" +COUNTER=0 + +until [ "$http_code" = "201" ] || [ $COUNTER -gt 360 ]; do +http_code=`curl -sL -w "%{http_code}" -o /dev/null -H "Content-Type: application/json" -d @"$DATA_FILE" "http://$OPENSTACK_IP/identity/v3/auth/tokens"` +echo "" +echo "http_code $http_code" +COUNTER=$((COUNTER +1)) +sleep 10 +done + +TENANT_ID=`curl -s -H "Content-Type: application/json" -d @"$DATA_FILE" "http://$OPENSTACK_IP/identity/v3/auth/tokens" | jq --raw-output '.token.project.id'` + +if [ $? -ne 0 ]; then + echo "Failure getting tenant ID from openstack, exiting..." + exit 1 +fi + +export TENANT_ID=$TENANT_ID + +URI="aai/util/echo?action=long" +http_code="" +COUNTER=0 + +until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do +echo "performing aai healthcheck..." +http_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" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Cache-Control: no-cache'` +COUNTER=$((COUNTER +1)) +sleep 10 +done + +if [ "$http_code" != "200" ]; then + echo "AAI Healthcheck unsuccessful :(" + echo "Something went wrong during the ONAP installation." + exit 1 +fi + +echo "Creating CLLI $CLLI..." +$DIR/create_clli.sh + +echo "Creating Cloud Region $CLOUD_REGION..." +$DIR/create_cloud_region.sh + +echo "Creating Cloud Region Relationship..." +$DIR/create_cloud_region_relationship.sh + +echo "Creating Cloud Customer $CUSTOMER..." +$DIR/create_customer.sh + +echo "Creating Cloud Service Type $SERVICE_TYPE..." +$DIR/create_service_type.sh + +echo "Creating Subscription..." +$DIR/create_subscription.sh + +echo "Creating Subscription Relationship..." +$DIR/create_cloud_region_subscriber_relationship.sh + +echo "Creating Availability Zone $AZ..." +$DIR/create_az.sh + + +URI="vid/healthCheck" +http_code="" +COUNTER=0 + +until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do +echo "performing vid healthcheck..." +http_code=`curl -sL -w "%{http_code}" -o /dev/null --insecure -I -X GET "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI"` +COUNTER=$((COUNTER +1)) +sleep 10 +done + +if [ "$http_code" != "200" ]; then + echo "VID Healthcheck unsuccessful :(" + echo "Something went wrong during the ONAP installation." + exit 1 +fi + +echo "Creating Owning Entity $OE..." +$DIR/create_owning_entity.sh + +echo "Creating Platform $PLATFORM..." +$DIR/create_platform.sh + +echo "Creating Project $PROJECT..." +$DIR/create_project.sh + +echo "Creating LOB $LOB..." +$DIR/create_lob.sh + +echo "Creating Cloud Site..." +$DIR/create_cloud_site.sh + +URI="sdc1/rest/healthCheck" +http_code="" +COUNTER=0 + +until [ "$http_code" = "200" ] || [ $COUNTER -gt 180 ]; do +echo "performing sdc healthcheck..." +http_code=`curl -k -sL -w "%{http_code}" -o /dev/null -I -X GET "$SDC_PROTOCOL://$SDC_DNS_NAME:$SDC_PORT/$URI"` +COUNTER=$((COUNTER +1)) +sleep 10 +done + +if [ "$http_code" != "200" ]; then + echo "SDC Healthcheck unsuccessful :(" + echo "Something went wrong during the ONAP installation." + exit 1 +fi + diff --git a/deployment/aks/post-install/bootstrap/create_az.sh b/deployment/aks/post-install/bootstrap/create_az.sh new file mode 100755 index 000000000..1e0407c12 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_az.sh @@ -0,0 +1,42 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_az.json" + +URI="aai/v15/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION/availability-zones/availability-zone/$AZ" + +cat > $DATA_FILE <<EOF +{ + "availability-zone-name": "$AZ", + "hypervisor-type": "hypervisor" +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_clli.sh b/deployment/aks/post-install/bootstrap/create_clli.sh new file mode 100755 index 000000000..dec8b8b06 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_clli.sh @@ -0,0 +1,59 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_ccli.json" + +URI="aai/v11/cloud-infrastructure/complexes/complex/$CLLI" + +# TODO +# Parameterize the rest of the values in data, like physical location + +cat > $DATA_FILE <<EOF +{ + "physical-location-id": "$CLLI", + "data-center-code": "example-data-center-code-val-6667", + "complex-name": "$CLLI", + "identity-url": "example-identity-url-val-28399", + "physical-location-type": "example-physical-location-type-val-28399", + "street1": "example-street1-val-28399", + "street2": "example-street2-val-28399", + "city": "example-city-val-28399", + "state": "example-state-val-28399", + "postal-code": "example-postal-code-val-28399", + "country": "example-country-val-28399", + "region": "example-region-val-28399", + "latitude": "1111", + "longitude": "2222", + "elevation": "example-elevation-val-28399", + "lata": "example-lata-val-28399" +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo ""
\ No newline at end of file diff --git a/deployment/aks/post-install/bootstrap/create_cloud_region.sh b/deployment/aks/post-install/bootstrap/create_cloud_region.sh new file mode 100755 index 000000000..dd83cb387 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_cloud_region.sh @@ -0,0 +1,75 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_cloudregion.json" + +URI="aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION" + +cat > $DATA_FILE <<EOF +{ + "cloud-owner": "$CLOUD_OWNER", + "cloud-region-id": "$CLOUD_REGION", + "cloud-type": "openstack", + "owner-defined-type": "t1", + "cloud-region-version": "ocata", + "cloud-zone": "z1", + "complex-name": "$CLLI", + "identity-url": "http://$OPENSTACK_IP/identity", + "sriov-automation": false, + "cloud-extra-info": "", + "tenants": { + "tenant": [ + { + "tenant-id": "$TENANT_ID", + "tenant-name": "$OPENSTACK_TENANT" + } + ] + }, + "esr-system-info-list": + { + "esr-system-info": + [ + { + "esr-system-info-id": "example-system-name-val-92940", + "service-url": "http://$OPENSTACK_IP/identity", + "user-name": "$OPENSTACK_USER", + "password": "$OPENSTACK_PASS", + "system-type": "VIM", + "ssl-cacert": "", + "ssl-insecure": true, + "cloud-domain": "Default", + "default-tenant": "$OPENSTACK_TENANT" + } + ] + } +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_cloud_region_relationship.sh b/deployment/aks/post-install/bootstrap/create_cloud_region_relationship.sh new file mode 100755 index 000000000..7acdea9d2 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_cloud_region_relationship.sh @@ -0,0 +1,46 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_cloudregionrelationship.json" + +URI="aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION/relationship-list/relationship" + +cat > $DATA_FILE <<EOF +{ + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/$CLLI", + "relationship-data": [{ + "relationship-key": "complex.physical-location-id", + "relationship-value": "$CLLI" + }] +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_cloud_region_subscriber_relationship.sh b/deployment/aks/post-install/bootstrap/create_cloud_region_subscriber_relationship.sh new file mode 100755 index 000000000..d37b5653f --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_cloud_region_subscriber_relationship.sh @@ -0,0 +1,62 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_cloudregionsubscriberrelationship.json" + +URI="aai/v11/business/customers/customer/$CUSTOMER/service-subscriptions/service-subscription/$SERVICE_TYPE/relationship-list/relationship" + +cat > $DATA_FILE <<EOF +{ + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION/tenants/tenant/$TENANT_ID", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "$CLOUD_OWNER" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "$CLOUD_REGION" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "$TENANT_ID" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "$TENANT_NAME" + } + ] +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_cloud_site.sh b/deployment/aks/post-install/bootstrap/create_cloud_site.sh new file mode 100755 index 000000000..0253b0e16 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_cloud_site.sh @@ -0,0 +1,50 @@ +#!/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. + +set -x + +pushd . + +cd /tmp + +git clone http://gerrit.onap.org/r/integration /tmp/integration-repo +git clone https://github.com/onap/oom.git /tmp/oom-repo + +cd /tmp/integration-repo/deployment/heat/onap-rke/scripts +SO_ENCRYPTION_KEY=`cat /tmp/oom-repo/kubernetes/so/resources/config/mso/encryption.key` +javac Crypto.java +SO_ENCRYPTED_KEY=`java Crypto "$OPENSTACK_PASS" "$SO_ENCRYPTION_KEY"` + +popd + +echo $SO_ENCRYPTED_KEY + +MARIADBPOD_STATUS=`kubectl -n onap get pods | grep mariadb-galera-mariadb-galera | head -1 | awk '{print $3}'` +COUNTER=0 + +until [ "$MARIADBPOD_STATUS" = "Running" ] || [ $COUNTER -gt 120 ]; do +echo "mariadb pod not ready..." +COUNTER=$((COUNTER +1)) +sleep 10 +done + +MARIADBPOD=`kubectl -n onap get pods | grep mariadb-galera-mariadb-galera | head -1 | awk '{print $1}'` + +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\");" +kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password=secretpassword --database=catalogdb --execute='$COMMAND'" + +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\");" +kubectl -n onap exec -it $MARIADBPOD -- bash -c "mysql -u root --password=secretpassword --database=catalogdb --execute='$COMMAND'" + diff --git a/deployment/aks/post-install/bootstrap/create_customer.sh b/deployment/aks/post-install/bootstrap/create_customer.sh new file mode 100755 index 000000000..0beebe97a --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_customer.sh @@ -0,0 +1,43 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_customer.json" + +URI="aai/v11/business/customers/customer/$CUSTOMER" + +cat > $DATA_FILE <<EOF +{ + "global-customer-id": "$CUSTOMER", + "subscriber-name": "$SUBSCRIBER", + "subscriber-type": "INFRA" +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_lob.sh b/deployment/aks/post-install/bootstrap/create_lob.sh new file mode 100755 index 000000000..a14367ddf --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_lob.sh @@ -0,0 +1,34 @@ +#!/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. + +set -x + +if [ -z $VID_DNS_NAME ] || [ -z $VID_PORT ]; then + echo "VID_DNS_NAME or VID_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/vid_project.json" + +URI="vid/maintenance/category_parameter/lineOfBusiness" + +cat > $DATA_FILE <<EOF +{"options":["$LOB"]} +EOF + +curl -i --insecure -X POST "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI" \ + -H 'Content-Type: application/json' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_owning_entity.sh b/deployment/aks/post-install/bootstrap/create_owning_entity.sh new file mode 100755 index 000000000..eba395591 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_owning_entity.sh @@ -0,0 +1,34 @@ +#!/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. + +set -x + +if [ -z $VID_DNS_NAME ] || [ -z $VID_PORT ]; then + echo "VID_DNS_NAME or VID_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/vid_owning_entity.json" + +URI="vid/maintenance/category_parameter/owningEntity" + +cat > $DATA_FILE <<EOF +{"options":["$OE"]} +EOF + +curl -i --insecure -X POST "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI" \ + -H 'Content-Type: application/json' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_platform.sh b/deployment/aks/post-install/bootstrap/create_platform.sh new file mode 100755 index 000000000..46dc1b4e6 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_platform.sh @@ -0,0 +1,34 @@ +#!/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. + +set -x + +if [ -z $VID_DNS_NAME ] || [ -z $VID_PORT ]; then + echo "VID_DNS_NAME or VID_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/vid_platform.json" + +URI="vid/maintenance/category_parameter/platform" + +cat > $DATA_FILE <<EOF +{"options":["$PLATFORM"]} +EOF + +curl -i --insecure -X POST "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI" \ + -H 'Content-Type: application/json' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_project.sh b/deployment/aks/post-install/bootstrap/create_project.sh new file mode 100755 index 000000000..7b455e3b0 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_project.sh @@ -0,0 +1,34 @@ +#!/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. + +set -x + +if [ -z $VID_DNS_NAME ] || [ -z $VID_PORT ]; then + echo "VID_DNS_NAME or VID_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/vid_project.json" + +URI="vid/maintenance/category_parameter/project" + +cat > $DATA_FILE <<EOF +{"options":["$PROJECT"]} +EOF + +curl -i --insecure -X POST "$VID_PROTOCOL://$VID_DNS_NAME:$VID_PORT/$URI" \ + -H 'Content-Type: application/json' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_service_type.sh b/deployment/aks/post-install/bootstrap/create_service_type.sh new file mode 100755 index 000000000..c712c53f6 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_service_type.sh @@ -0,0 +1,42 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_service_type.json" + +URI="aai/v11/service-design-and-creation/services/service/$SERVICE_TYPE" + +cat > $DATA_FILE <<EOF +{ + "service-description": "$SERVICE_TYPE", + "service-id": "$SERVICE_TYPE" +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" diff --git a/deployment/aks/post-install/bootstrap/create_subscription.sh b/deployment/aks/post-install/bootstrap/create_subscription.sh new file mode 100755 index 000000000..4bb2e6412 --- /dev/null +++ b/deployment/aks/post-install/bootstrap/create_subscription.sh @@ -0,0 +1,65 @@ +#!/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. + +set -x + +if [ -z $AAI_DNS_NAME ] || [ -z $AAI_PORT ]; then + echo "AAI_DNS_NAME or AAI_PORT not found. These should be environment variables." + exit 1 +fi + +DATA_FILE=$BUILD_DIR"/aai_subscription.json" + +URI="aai/v11/business/customers/customer/$CUSTOMER/service-subscriptions/service-subscription/$SERVICE_TYPE" + +cat > $DATA_FILE <<EOF +{ + "relationship-list": + { + "relationship": + [ + { + "related-to":"tenant", + "relationship-data": + [ + { + "relationship-key":"cloud-region.cloud-owner", + "relationship-value":"$CLOUD_OWNER" + }, + { + "relationship-key":"cloud-region.cloud-region-id", + "relationship-value":"$CLOUD_REGION" + }, + { + "relationship-key":"tenant.tenant-id", + "relationship-value":"$TENANT_ID" + } + ] + } + ] + }, + "service-type":"$SERVICE_TYPE" +} +EOF + +curl -i --insecure -u $AAI_USER:$AAI_PASS -X PUT "$AAI_PROTOCOL://$AAI_DNS_NAME:$AAI_PORT/$URI" \ + -H 'X-TransactionId: 9999' \ + -H 'X-FromAppId: jimmy-postman' \ + -H 'Real-Time: true' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Cache-Control: no-cache' \ + -d @"$DATA_FILE" +echo "" |