diff options
Diffstat (limited to 'plans/usecases/pnf-sw-upgrade/so/config')
28 files changed, 1706 insertions, 0 deletions
diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-esr-system-info.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-esr-system-info.json new file mode 100755 index 00000000..1a16538b --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-esr-system-info.json @@ -0,0 +1,14 @@ +{ + "esr-system-info-id": "e6a0b318-9756-4f11-94e8-919312d6c2bd", + "system-name": "csit cloud vim", + "type": "OPENSTACK", + "vendor": "RedHat", + "version": "1", + "service-url": "https://csit.PnfSwUcloud.com:5000/v3/", + "user-name": "", + "password": "", + "system-type": "VIM", + "port": "example-port-val-93234", + "cloud-domain": "CCP_Domain_34466", + "default-tenant": "693c7729b2364a26a3ca602e6f66187d" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-region.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-region.json new file mode 100755 index 00000000..fa328408 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/cloud-region.json @@ -0,0 +1,10 @@ +{ + "cloud-owner": "CloudOwner", + "cloud-region-id": "PnfSwUCloudRegion", + "cloud-type": "openstack", + "owner-defined-type": "OwnerType", + "cloud-region-version": "1.0", + "cloud-zone": "CloudZone", + "complex-name": "clli1", + "cloud-extra-info": "" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/customer.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/customer.json new file mode 100755 index 00000000..6c53c056 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/customer.json @@ -0,0 +1,73 @@ +{ + "global-customer-id": "DemoCustomer", + "subscriber-name": "DemoCustomer", + "subscriber-type": "INFRA", + "service-subscriptions": { + "service-subscription": [ + { + "service-type": "vLB", + "relationship-list": { + "relationship": [ + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/xyzcloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "xyzcloud" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "693c7729b2364a26a3ca602e6f66187d" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "admin" + } + ] + } + ] + } + }, + { + "service-type": "vCPE", + "relationship-list": { + "relationship": [ + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/xyzcloud/tenants/tenant/693c7729b2364a26a3ca602e6f66187d", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "CloudOwner" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "xyzcloud" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "693c7729b2364a26a3ca602e6f66187d" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "admin" + } + ] + } + ] + } + } + ] + } +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-system-info.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-system-info.json new file mode 100755 index 00000000..d204a774 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-system-info.json @@ -0,0 +1,11 @@ +{ + "esr-system-info-id": "5c067098-f2e3-40f7-a7ba-155e7c61e916", + "system-name": "vnfmSimulator", + "type": "simulator", + "vendor": "EST", + "version": "V1.0", + "service-url": "https://so-vnfm-simulator:9093/vnflcm/v1", + "user-name": "", + "password": "", + "system-type": "VNFM" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-vnfm.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-vnfm.json new file mode 100755 index 00000000..4d23b439 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/esr-vnfm.json @@ -0,0 +1,5 @@ +{ + "vnfm-id": "c5e99cee-1996-4606-b697-838d51d4e1a3", + "vim-id": "PnfSwUCsitVimId", + "certificate-url": "" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/line-of-business.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/line-of-business.json new file mode 100755 index 00000000..69f872be --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/line-of-business.json @@ -0,0 +1,3 @@ +{ + "line-of-business-name": "PnfSwUCsitLineOfBusiness" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/owning-entity.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/owning-entity.json new file mode 100755 index 00000000..3bfd9cca --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/owning-entity.json @@ -0,0 +1,4 @@ +{ + "owning-entity-id": "f2e1071e-3d47-4a65-94d4-e473ec03326a", + "owning-entity-name": "OE-Demonstration" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/platform.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/platform.json new file mode 100755 index 00000000..3265a067 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/platform.json @@ -0,0 +1,3 @@ +{ + "platform-name": "PnfSwUCsitPlatform" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/pnf.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/pnf.json new file mode 100755 index 00000000..ab39d8c7 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/pnf.json @@ -0,0 +1,16 @@ +{ + "pnf-name2":"PNFDemo-pnf-name2-val-78244", + "pnf-name2-source":"PNFDemo-pnf-name2-source-val-99275", + "equip-type":"PNFDemo-equip-type-val-20348", + "equip-vendor":"PNFDemo-equip-vendor-val-52182", + "equip-model":"PNFDemo-equip-model-val-8370", + "management-option":"PNFDemo-management-option-val-72881", + "ipaddress-v4-oam":"pnfaddr", + "ipaddress-v6-oam":"0:0:0:0:0:0", + "sw-version":"pnf_sw_version-1.0.0", + "pnf-name":"PNFDemo", + "pnf-id":"PNFDemo", + "in-maint":false, + "resource-version":"1570117118905", + "selflink": "http://localhost:9993/pnf/PNFDemo" +}
\ No newline at end of file diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/project.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/project.json new file mode 100755 index 00000000..f67dbc1f --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/project.json @@ -0,0 +1,4 @@ +{ + "project-name": "PnfSwUCsitProject" +} + diff --git a/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/tenant.json b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/tenant.json new file mode 100755 index 00000000..746131a6 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/aai-simulator-populate-data/tenant.json @@ -0,0 +1,4 @@ +{ + "tenant-id": "693c7729b2364a26a3ca602e6f66187d", + "tenant-name": "admin" +} diff --git a/plans/usecases/pnf-sw-upgrade/so/config/apply-workarounds.sh b/plans/usecases/pnf-sw-upgrade/so/config/apply-workarounds.sh new file mode 100755 index 00000000..5833a9ef --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/apply-workarounds.sh @@ -0,0 +1,111 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +WORKFLOW_TABLE_NAME="workflow" +TABLE_EXISTS_QUERY="select count(*) from information_schema.tables WHERE table_schema='$CATALOG_DB' AND table_name='$WORKFLOW_TABLE_NAME';" +SLEEP_TIME=5 +FLY_WAY_MIGRATION_QUERY="SELECT COUNT(*) FROM flyway_schema_history WHERE script LIKE '%R__MacroData%' AND installed_on IS NOT NULL;" +TIME_OUT_DEFAULT_VALUE_SEC=1200 #20 mins +SCRIPT_NAME=$(basename $0) + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +wait_for_database_availability() +{ + echo "$SCRIPT_NAME $(current_timestamp): Checking for database availability" + until echo '\q' | mysql -h $DB_HOST -P $DB_PORT -uroot -p$MYSQL_ROOT_PASSWORD $CATALOG_DB; do + >&2 echo "$SCRIPT_NAME $(current_timestamp): Database is unavailable - sleeping for ${SLEEP_TIME} seconds" + isTimeOut + sleep ${SLEEP_TIME} + done + + echo "$SCRIPT_NAME $(current_timestamp): Database is available now" +} + +wait_container_to_create_table() +{ + while [ $(mysql -h $DB_HOST -P $DB_PORT -uroot -p$MYSQL_ROOT_PASSWORD $CATALOG_DB -sse "$TABLE_EXISTS_QUERY") -eq "0" ] ; do + echo "$SCRIPT_NAME $(current_timestamp): Waiting for so-catalog container to create tables - sleeping for ${SLEEP_TIME} seconds" + isTimeOut + sleep ${SLEEP_TIME} + done + sleep 5s + echo "$SCRIPT_NAME $(current_timestamp): $CATALOG_DB tables available now . . ." +} + +apply_workaround() +{ + echo "$SCRIPT_NAME $(current_timestamp): Applying workaround . . ." + + wait_for_database_availability + wait_container_to_create_table + echo "$SCRIPT_NAME $(current_timestamp): Will insert data into $CATALOG_DB" + mysql -h $DB_HOST -uroot -p$MYSQL_ROOT_PASSWORD $CATALOG_DB << EOF + BEGIN; + + insert into $WORKFLOW_TABLE_NAME(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values + ('4752c287-c5a8-40a6-8fce-077e1d54104b','PNFSoftwareUpgrade','PNFSoftwareUpgrade','PNFSoftwareUpgrade',1.0,'Pnf Workflow to upgrade software',null,'pnf','native'); + + insert into $WORKFLOW_TABLE_NAME(artifact_uuid, artifact_name, name, operation_name, version, description, body, resource_target, source) values + ('02bffbd9-6af0-4f8d-bf9b-d1dfccd28c84','PNFSWUPDownload','PNFSWUPDownload','PNFSWUPDownload',1.0,'Pnf Workflow to download software',null,'pnf','native'); + + COMMIT; +EOF + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp): Failed to execute workaround . . ." + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Finished applying workaround . . ." +} + +isTimeOut() +{ + if [ `date +%s` -gt $TIME_OUT_END_TIME_IN_SECONDS ]; then + echo "$SCRIPT_NAME $(current_timestamp): workaround script timed out . . ." + exit 1; + fi +} + +# main body +if [ -z "$TIME_OUT_IN_SECONDS"]; then + echo "$SCRIPT_NAME $(current_timestamp): TIME_OUT_IN_SECONDS attribute is empty will use default val: $TIME_OUT_DEFAULT_VALUE_SEC" + TIME_OUT_IN_SECONDS=$TIME_OUT_DEFAULT_VALUE_SEC +fi + +DIGITS_REGEX='^[0-9]+$' +if ! [[ $TIME_OUT_IN_SECONDS =~ $DIGIT_REGEX ]] ; then + echo "$SCRIPT_NAME $(current_timestamp): TIME_OUT_IN_SECONDS attribute Must be number: $TIME_OUT_IN_SECONDS, will use default val: $TIME_OUT_DEFAULT_VALUE_SEC" + TIME_OUT_IN_SECONDS=$TIME_OUT_DEFAULT_VALUE_SEC +fi + +START_TIME_IN_SECONDS=`date +%s` +TIME_OUT_END_TIME_IN_SECONDS=$(($START_TIME_IN_SECONDS+$TIME_OUT_IN_SECONDS)); +echo "$SCRIPT_NAME $(current_timestamp): Workaround script will time out at `date -d @$TIME_OUT_END_TIME_IN_SECONDS`" + +apply_workaround + diff --git a/plans/usecases/pnf-sw-upgrade/so/config/certificates/aai-certificate/aai.cert b/plans/usecases/pnf-sw-upgrade/so/config/certificates/aai-certificate/aai.cert new file mode 100755 index 00000000..9acb8bb9 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/certificates/aai-certificate/aai.cert @@ -0,0 +1,31 @@ +Bag Attributes + friendlyName: so@so.onap.org + localKeyID: 54 69 6D 65 20 31 35 36 34 30 35 32 33 31 34 37 38 34 +subject=CN = aai-simulator, emailAddress = , OU = so@so.onap.org, OU = OSAAF, O = ONAP, C = US + +issuer=C = US, O = ONAP, OU = OSAAF, CN = intermediateCA_9 + +-----BEGIN CERTIFICATE----- +MIIEBzCCAu+gAwIBAgIIdC1kel7DdnYwDQYJKoZIhvcNAQELBQAwRzELMAkGA1UE +BhMCVVMxDTALBgNVBAoMBE9OQVAxDjAMBgNVBAsMBU9TQUFGMRkwFwYDVQQDDBBp +bnRlcm1lZGlhdGVDQV85MB4XDTE5MDcyNTEwNTgzNFoXDTIwMDcyNTEwNTgzNFow +bjEWMBQGA1UEAwwNYWFpLXNpbXVsYXRvcjEPMA0GCSqGSIb3DQEJARYAMRcwFQYD +VQQLDA5zb0Bzby5vbmFwLm9yZzEOMAwGA1UECwwFT1NBQUYxDTALBgNVBAoMBE9O +QVAxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +185xCE6cmsY6XB5Dd/5GlfuWjN05KKk3akymxhbJLa9ektlusmuTPt4cnxD+e4b6 +dymqHzQ6C206TBK1jaDzcF07Ag7VTpxmlgaSukQ+aZoXfIcs80lWCLnNvC2MrOuh +9uhUILAmuddo01cIHJvti5R2g6BEirCGsVKBSwmXRotxHyzUg9IwOpeGy0G1ZDjU +OiMqY5qOonVTEz1AganctdiWK1/eZ5IBD7gQwckS5n1a6RYMVSnr1vKLoiZq76Bp +wKy3EBX16jlmQMC5Aj9/GDezJg0bPvlikL3VUsC76DRShucsxS3SzVxeAJ5nsH8S +qUElpbe3uabhFG2qKmtvdwIDAQABo4HPMIHMMAkGA1UdEwQCMAAwDgYDVR0PAQH/ +BAQDAgXgMCAGA1UdJQEB/wQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBUBgNVHSME +TTBLgBSB95lbELnIjN7zUl7qTmmgQz6s3aEwpC4wLDEOMAwGA1UECwwFT1NBQUYx +DTALBgNVBAoMBE9OQVAxCzAJBgNVBAYTAlVTggEHMB0GA1UdDgQWBBSQ54p+SID0 +2p21lUHY9YC1ZZfkZTAYBgNVHREEETAPgg1hYWktc2ltdWxhdG9yMA0GCSqGSIb3 +DQEBCwUAA4IBAQBRGK6Iyjc/0bC3+qjPuNwSlu1pUcgHtgxP/oTU5f9xMSkSjIP0 +weVnIEGOwlW8GRbDPQza14AHETTxJ17rv6p6h7l/dZZmbMPl2S+QXGptgDWR6zY7 +q5ROecGcQzgto6lTMcKgBMW+ct3Tb3khMqP6ewzGz85SY7BgyVE7HFG9M5BM3NhX +ovAcj93C24DFKLDKxHrrsVIROlFk6QW2+kb0zo1YzVc6NNJY2ViXBrM5zrG21tDj +VEv0JaHKPYhzWCb7ZcSSo/ftZ2yDsRGS8r6DK5sYCfLifloMVJhF04hOC+ZbxiiB +JgYniQPmb0Zj5BfXWovdAe/89wr5aokQ3GZL +-----END CERTIFICATE----- diff --git a/plans/usecases/pnf-sw-upgrade/so/config/distribution-test-zip/zipped_sdc_csar.tar.gz b/plans/usecases/pnf-sw-upgrade/so/config/distribution-test-zip/zipped_sdc_csar.tar.gz Binary files differnew file mode 100644 index 00000000..5af091bb --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/distribution-test-zip/zipped_sdc_csar.tar.gz diff --git a/plans/usecases/pnf-sw-upgrade/so/config/env b/plans/usecases/pnf-sw-upgrade/so/config/env new file mode 100644 index 00000000..77e3dbf2 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/env @@ -0,0 +1,6 @@ +NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 +DOCKER_ENVIRONMENT=remote +TAG=1.6.0-STAGING-latest +TIME_OUT_DEFAULT_VALUE_SEC=1200 +PROJECT_NAME=pnfSwU +DEFAULT_NETWORK_NAME=pnfswu_default diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/api-handler-infra/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/api-handler-infra/onapheat/override.yaml new file mode 100755 index 00000000..10a3ec21 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/api-handler-infra/onapheat/override.yaml @@ -0,0 +1,133 @@ +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false + +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: logs + site-name: onapheat + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + config: + path: /src/main/resources/ + infra: + default: + alacarte: + orchestrationUri: /mso/async/services/ALaCarteOrchestrator + recipeTimeout: 180 + testApi: VNF_API + service: + macro: + default: + testApi: GR_API + camundaURL: http://bpmn-infra:8081 + camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + sdc: + client: + auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862 + activate: + instanceid: test + userid: cs0008 + endpoint: http://c1.vm1.mso.simpledemo.onap.org:28090 + tenant: + isolation: + retry: + count: 3 + aai: + endpoint: https://aai-simulator:9993 + auth: 2630606608347B7124C244AB0FE34F6F + extApi: + endpoint: http://nbi.onap:8080/nbi/api/v3 + so: + operational-environment: + dmaap: + username: testuser + password: VjR5NDcxSzA= + host: http://c1.vm1.mso.simpledemo.onap.org:28090 + auth: 51EA5414022D7BE536E7516C4D1A6361416921849B72C0D6FC1C7F262FD9F2BBC2AD124190A332D9845A188AD80955567A4F975C84C221EEA8243BFD92FFE6896CDD1EA16ADD34E1E3D47D4A + publisher: + topic: com.att.ecomp.mso.operationalEnvironmentEvent + health: + auth: Basic bXNvX2FkbWlufHBhc3N3b3JkMSQ= + endpoints: + - subsystem: apih + uri: http://bpmn-infra:8081 + - subsystem: catalogdb + uri: http://catalog-db-adapter:8082 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: true + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + jersey: + type: filter + + security: + usercredentials: + - + username: sitecontrol + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SiteControl-Client + - + username: gui + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: GUI-Client + - + username: infraportal + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: InfraPortal-Client + - + username: InfraPortalClient + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: InfraPortal-Client + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +request: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb + username: requestuser + password: request123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: reqdb-pool + registerMbeans: true +org: + onap: + so: + cloud-owner: CloudOwner + adapters: + network: + encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/bpmn-infra/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/bpmn-infra/onapheat/override.yaml new file mode 100755 index 00000000..4dd959a1 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/bpmn-infra/onapheat/override.yaml @@ -0,0 +1,337 @@ +aai: + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 + dme2: + timeout: '30000' + endpoint: https://aai-simulator:9993 + workflowAaiDistributionDelay: PT30S + pnfEntryNotificationTimeout: P14D +camunda: + bpm: + admin-user: + id: admin + password: so_Admin123 + history-level: full + job-execution: + max-pool-size: 30 + core-pool-size: 3 +cds: + endpoint: blueprints-processor + port: 9111 + auth: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + timeout: 60 +entitymanager: + packagesToScan: com +pnf: + dmaap: + host: message-router + port: 3904 + protocol: http + uriPathPrefix: events + topicName: pnfReady + consumerGroup: consumerGroup + consumerId: consumerId + topicListenerDelayInSeconds: 5 +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + config: + path: /var/csar/ + correlation: + timeout: 60 + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + aai: + endpoint: https://aai-simulator:9993 + adapters: + completemsoprocess: + endpoint: http://bpmn-infra:8081/CompleteMsoProcess + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + db: + auth: 33293332AEC4930F655D8E2E8BB08937 + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/services/RequestsDbAdapter + spring: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083 + network: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/NetworkAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/networks + openecomp: + db: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/services/RequestsDbAdapter + po: + auth: 33293332AEC4930F655D8E2E8BB08937 + password: B8EBDE0311F0AF355CF3F2FD505A8CAD + sdnc: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/SDNCAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/rest/v1/sdnc + timeout: PT60M + tenant: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/TenantAdapter + vnf: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/VnfAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/volume-groups + vnf-async: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/VnfAdapterAsync + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://catalog-db-adapter:8082/ecomp/mso/catalog + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + default: + adapter: + namespace: http://org.onap.mso + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + po: + timeout: PT60M + request: + db: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://c1.vm1.mso.simpledemo.onap.org:30253 + site-name: CamundaEngine + sniro: + auth: test:testpwd + callback: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/rest/SDNCNotify + endpoint: http://replaceme:28090/optimizationInstance/V1/create + timeout: PT30M + oof: + auth: test:testpwd + callbackEndpoint: http://bpmn-infra:8081/mso/WorkflowMessage + endpoint: http://oof.api.simpledemo.openecomp.org:8698/api/oof/v1/placement + timeout: PT30M + workflow: + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + default: + aai: + version: '14' + cloud-region: + version: '14' + generic-vnf: + version: '14' + v14: + customer: + uri: /aai/v14/business/customers/customer + generic-query: + uri: /aai/v14/search/generic-query + generic-vnf: + uri: /aai/v14/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v14/network/l3-networks/l3-network + network-policy: + uri: /aai/v14/network/network-policies/network-policy + nodes-query: + uri: /aai/v14/search/nodes-query + route-table-reference: + uri: /aai/v14/network/route-table-references/route-table-reference + tenant: + uri: /aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v14/network/vces/vce + vpn-binding: + uri: /aai/v14/network/vpn-bindings/vpn-binding + sp-partner: + uri: /aai/v14/business/sp-partners/sp-partner + device: + uri: /aai/v14/network/devices/device + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.onap.aai.inventory/ + version: 14 + message: + endpoint: http://bpmn-infra:8081/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdncadapter: + callback: http://bpmn-infra:8081/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + delete: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + query: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + rollback: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + global: + dmaap: + username: testuser + password: alRyMzJ3NUNeakxl + host: http://10.42.111.36:904 + auth: A4DE725B8B0D1A745049409B16762C16BC9B48555DC157272741D616323104442B3AAC052ED17E74EECA136B89C8C6615C8CC269ED5834EC47C6BE6A75DF39C6C07B07DF064CE268BE6510F472 + publisher: + topic: replaceme +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== + host: http://sdnc:8282 + path: /restconf/operations/GENERIC-RESOURCE-API + si: + svc: + types: PORT-MIRROR,PPROBE + +so: + vnfm: + adapter: + url: https://so-vnfm-adapter:9092/so/vnfm-adapter/v1/ + auth: Basic dm5mbTpwYXNzd29yZDEk + +appc: + client: + topic: + read: + name: APPC-LCM-WRITE + timeout: 360000 + write: APPC-LCM-READ + sdnc: + read: + name: SDNC-LCM-WRITE + write: SDNC-LCM-READ + response: + timeout: 360000 + key: VIlbtVl6YLhNUrtU + secret: 64AG2hF4pYeG2pq7CT6XwUOT + service: ueb + poolMembers: ueb1.simpledemo.onap.org:3904,ueb2.simpledemo.onap.org:3904 +server: + port: 8081 + tomcat: + max-threads: 50 +spring: + datasource: + driver-class-name: org.mariadb.jdbc.Driver + url: jdbc:mariadb://mariadb:3306/camundabpmn + username: camundauser + password: camunda123 + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + security: + usercredentials: + - + username: apihBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: sdncaBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: poBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: wmaBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: sniro + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SNIRO-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR +org: + onap: + so: + cloud-owner: CloudOwner +rest: + http: + client: + configuration: + ssl: + keyStore: classpath:org.onap.so.p12 + keyStorePassword: 'RLe5ExMWW;Kd6GTSt0WQz;.Y' + trustStore: classpath:org.onap.so.trust.jks + trustStorePassword: '6V%8oSU$,%WbYp3IUe;^mWt4' diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/catalog-db-adapter/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/catalog-db-adapter/onapheat/override.yaml new file mode 100755 index 00000000..8ab96156 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/catalog-db-adapter/onapheat/override.yaml @@ -0,0 +1,69 @@ +server: + port: 8082 + tomcat: + max-threads: 50 +ssl-enable: false +mso: + logPath: logs + site-name: onapheat + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +#Actuator +management: + context-path: /manage + +flyway: + baseline-on-migrate: true + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + user: cataloguser + password: catalog123 + +cloud_config: + identity_services: + DEFAULT_KEYSTONE: + identity_url: http://192.168.35.52:5000/v2.0 + mso_id: admin + mso_pass: admin + admin_tenant: service + member_role: admin + tenant_metadata: true + identity_server_type: KEYSTONE + identity_authentication_type: USERNAME_PASSWORD + project_domain_name: service + user_domain_name: admin + cloud_sites: + RegionOne: + region_id: RegionOne + clli: RegionOne diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/request-db-adapter/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/request-db-adapter/onapheat/override.yaml new file mode 100755 index 00000000..65861167 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/request-db-adapter/onapheat/override.yaml @@ -0,0 +1,51 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck + +server: + port: 8083 + tomcat: + max-threads: 50 +ssl-enable: false +mso: + logPath: logs + site-name: localSite + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb + username: requestuser + password: request123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: reqdb-pool + registerMbeans: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +#Actuator +management: + context-path: /manage + +flyway: + baseline-on-migrate: true + url: jdbc:mariadb://mariadb:3306/requestdb + user: reqeustuser + password: request123 diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/sdc-controller/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/sdc-controller/onapheat/override.yaml new file mode 100755 index 00000000..ed8bd43f --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/sdc-controller/onapheat/override.yaml @@ -0,0 +1,81 @@ +aai: + auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586 +server: + port: 8085 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: false + + security: + usercredentials: + - + username: asdc + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: Asdc-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +request: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb + username: requestuser + password: request123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: reqdb-pool + registerMbeans: false + +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: ./logs/asdc + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + site-name: onapheat + camundaURL: http://bpmn-infra:8081/ + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + aai: + endpoint: https://aai.api.simpledemo.onap.org:8443 + asdc-connections: + asdc-controller1: + user: mso + consumerGroup: SO-OpenSource-Env11 + consumerId: SO-COpenSource-Env11 + environmentName: AUTO + asdcAddress: c2.vm1.sdc.simpledemo.onap.org:8443 + password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F + pollingInterval: 60 + pollingTimeout: 60 + relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL + useHttpsWithDmaap: false + activateServerTLSAuth: false + keyStorePassword: + keyStorePath: + watchDogTimeout: 100 + isFitlerInEmptyResources: true + messageBusAddress: vm1.mr.simpledemo.onap.org,vm1.mr.simpledemo.onap.org + asdc: + config: + activity: + endpoint: http://sdc-wfd-be:8080 + key: 566B754875657232314F5548556D3665 + components: + count: 0, + componentNames: + scheduling: + enabled: false diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-monitoring/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-monitoring/onapheat/override.yaml new file mode 100755 index 00000000..7e61c7d0 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-monitoring/onapheat/override.yaml @@ -0,0 +1,24 @@ +server: + port: 30224 + tomcat: + max-threads: 4 +ssl-enable: false +camunda: + rest: + api: + url: http://bpmn-infra:8081/sobpmnengine/engine/ + engine: default + auth: Basic YXBpaEJwbW46cGFzc3dvcmQxJA== +mso: + database: + rest: + api: + url: http://request-db-adapter:8083/infraActiveRequests/ + auth: Basic YnBlbDpwYXNzd29yZDEk +spring: + security: + usercredentials: + - + username: gui + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: GUI-Client diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-vnfm-adapter/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-vnfm-adapter/onapheat/override.yaml new file mode 100755 index 00000000..bb715126 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/so-vnfm-adapter/onapheat/override.yaml @@ -0,0 +1,30 @@ +server: + port: 9092 + tomcat: + max-threads: 4 + ssl: + key-alias: so@so.onap.org + key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L' + key-store: classpath:so-vnfm-adapter.p12 + key-store-type: PKCS12 + client-auth: need + +http: + client: + ssl: + trust-store: classpath:org.onap.so.trust.jks + trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H' +aai: + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 + version: v15 + endpoint: https://aai-simulator:9993 +mso: + key: 07a7159d3bf51a0e53be7a8f89699be7 +sdc: + username: mso + password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F + key: 566B754875657232314F5548556D3665 + endpoint: http://sdc-simulator:9991/ + toscametapath: Artifacts/Deployment/OTHER/TOSCA.meta +vnfmadapter: + endpoint: https://so-vnfm-adapter:9092 diff --git a/plans/usecases/pnf-sw-upgrade/so/config/override-files/vnfm-simulator/onapheat/override.yaml b/plans/usecases/pnf-sw-upgrade/so/config/override-files/vnfm-simulator/onapheat/override.yaml new file mode 100755 index 00000000..05cb1e56 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/override-files/vnfm-simulator/onapheat/override.yaml @@ -0,0 +1,56 @@ +spring: + h2: + console: + enabled: true + path: console + datasource: + url: jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE + username: admin + password: admin + http: + converters: + preferred-json-mapper: gson + security: + usercredentials: + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + +server: + port: 9093 + tomcat: + max-threads: 50 + ssl: + client-auth: need + key-alias: so@so.onap.org + key--store-password: '7Em3&j4.19xYiMelhD5?xbQ.' + key-store: classpath:so-vnfm-simulator.p12 + key-store-type: PKCS12 + request: + grant: + auth: twowaytls + dns: + name: so-vnfm-simulator + +vnfds: + vnfdlist: + - vnfdid: sgsn-mme_12df452s04131 + vnfclist: + - vnfcid: VNFC1 + resourceTemplateId: vnfd1_vnfc1 + vduId: vnfd1_vduForVnfc1 + type: COMPUTE + - vnfcid: VNFC2 + resourceTemplateId: vnfd1_vnfc2 + vduId: vnfd1_vduForVnfc2 + type: COMPUTE + - vnfdid: 2 + vnfclist: + - vnfcid: VNFC3 + resourceTemplateId: vnfd2_vnfc3 + vduId: vnfd2_vduForVnfc3 + type: COMPUTE + - vnfcid: VNFC4 + resourceTemplateId: vnfd2_vnfc4 + vduId: vnfd2_vduForVnfc4 + type: COMPUTE diff --git a/plans/usecases/pnf-sw-upgrade/so/config/populate-aai-simulator.sh b/plans/usecases/pnf-sw-upgrade/so/config/populate-aai-simulator.sh new file mode 100755 index 00000000..6852e3f9 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/populate-aai-simulator.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Gareth Roper (gareth.roper@est.tech) +# @auther Waqas Ikram (waqas.ikram@est.tech) + +SCRIPT_NAME=$(basename $0) +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +WAIT_FOR_SCRIPT=$SCRIPT_HOME/wait-for.sh + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +populate_aai_simulator() +{ + $WAIT_FOR_SCRIPT -t "$TIMEOUT_IN_SECONDS" -h "$AAI_SIMULATOR_HOST" -p "$AAI_SIMULATOR_PORT" + + if [ $? -eq 0 ] + then + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator is Running." + else + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator could not be found. Exiting..." + exit 1 + fi + + BASE_URL="https://$AAI_SIMULATOR_HOST:$AAI_SIMULATOR_PORT/aai/v15" + BASIC_AUTHORIZATION_HEADER="Authorization: Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==" + APPICATION_JSON="application/json" + ACCEPT_HEADER="Accept: $APPICATION_JSON" + CONTENT_TYPE_HEADER="Content-Type: $APPICATION_JSON" + CURL_COMMAND="curl -k -H $BASIC_AUTHORIZATION_HEADER -H $ACCEPT_HEADER -H $CONTENT_TYPE_HEADER" + + AAI_SIMULATOR_DATA_DIR=$SCRIPT_HOME/aai-simulator-populate-data + CUSTOMER_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/customer.json + PROJECT_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/project.json + OWNING_ENTITY_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/owning-entity.json + LINE_OF_BUSINESS_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/line-of-business.json + PLATFORM_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/platform.json + CLOUD_REGION_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/cloud-region.json + TENANT_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/tenant.json + ESR_VNFM_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/esr-vnfm.json + ESR_SYSTEM_INFO_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/esr-system-info.json + CLOUD_ESR_SYSTEM_INFO_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/cloud-esr-system-info.json + PNF_JSON_FILE=$AAI_SIMULATOR_DATA_DIR/pnf.json + STATUS_CODE_ACCEPTED="202" + + echo "$SCRIPT_NAME $(current_timestamp): checking health of AAI Simulator" + response=$(curl -k $BASE_URL/healthcheck) + + if [[ "$response" -ne "healthy" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: AAI Simulator health check failed. Response: $response" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator is healthy" + + echo "$SCRIPT_NAME $(current_timestamp): Populating AAI Simulator" + + echo "$SCRIPT_NAME $(current_timestamp): Adding Cloud-Customer Data" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/customers/customer/DemoCustomer -X PUT -d @"$CUSTOMER_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put customer data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Project" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/projects/project/PnfSwUCsitProject -X PUT -d @"$PROJECT_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put project data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Owning-Entity" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/owning-entities/owning-entity/f2e1071e-3d47-4a65-94d4-e473ec03326a -X PUT -d @$"$OWNING_ENTITY_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put owning entity data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Line Of Business" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/lines-of-business/line-of-business/PnfSwUCsitLineOfBusiness -X PUT -d @$"$LINE_OF_BUSINESS_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put line of business data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Platform" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/business/platforms/platform/PnfSwUCsitPlatform -X PUT -d @$"$PLATFORM_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put platform data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Cloud Region" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/PnfSwUCloudRegion -X PUT -d @$"$CLOUD_REGION_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put Cloud Region data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding Tenant" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/PnfSwUCloudRegion/tenants/tenant/693c7729b2364a26a3ca602e6f66187d -X PUT -d @$"$TENANT_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put Tenant data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding esr-vnfm" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/external-system/esr-vnfm-list/esr-vnfm/c5e99cee-1996-4606-b697-838d51d4e1a3 -X PUT -d @$"$ESR_VNFM_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put esr-vnfm data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding esr-system-info" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/external-system/esr-vnfm-list/esr-vnfm/c5e99cee-1996-4606-b697-838d51d4e1a3/esr-system-info-list/esr-system-info/5c067098-f2e3-40f7-a7ba-155e7c61e916 -X PUT -d @$"$ESR_SYSTEM_INFO_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put esr-system-info data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding cloud esr-system-info" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/PnfSwUCloudRegion/esr-system-info-list/esr-system-info/e6a0b318-9756-4f11-94e8-919312d6c2bd -X PUT -d @$"$CLOUD_ESR_SYSTEM_INFO_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put cloud esr-system-info data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): Adding PNF" + status_code=$(curl -k --write-out %{http_code} --silent --output /dev/null -H "$BASIC_AUTHORIZATION_HEADER" -H "$ACCEPT_HEADER" -H "$CONTENT_TYPE_HEADER" $BASE_URL/network/pnfs/pnf/PNFDemo -X PUT -d @$"$PNF_JSON_FILE") + + if [[ "$status_code" -ne "$STATUS_CODE_ACCEPTED" ]] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to put PNF data in AAI Simulator. Status code received: $status_code" + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): AAI Simulator Populated Successfully" +} + +# main body +populate_aai_simulator diff --git a/plans/usecases/pnf-sw-upgrade/so/config/wait-for-aai-config-job.sh b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-aai-config-job.sh new file mode 100755 index 00000000..58a07811 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-aai-config-job.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SLEEP_TIME=5 +SUCCESSFUL_TEXT="AAI Simulator Populated Successfully" +FAILURE_TEXT="ERROR:" +TIME_OUT_TEXT="Time out" +CONTAINER_NAME=$(docker ps -aqf "name=populate-aai-config" --format "{{.Names}}") +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_NAME=$(basename $0) + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# main body +if [ -z $TIME_OUT_DEFAULT_VALUE_SEC ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: Undefined value for TIME_OUT_DEFAULT_VALUE_SEC attribute" + exit 1 +fi + +if [ -z $CONTAINER_NAME ]; then + echo "$SCRIPT_NAME $(current_timestamp): Unable to find docker container id " + exit 1 +fi + +START_TIME_IN_SECONDS=`date +%s` +TIME_OUT_END_TIME_IN_SECONDS=$(($START_TIME_IN_SECONDS+$TIME_OUT_DEFAULT_VALUE_SEC)); + + +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME script Start Time `date -d @$START_TIME_IN_SECONDS`" +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME will time out at `date -d @$TIME_OUT_END_TIME_IN_SECONDS`" + +while [ `date +%s` -lt "$TIME_OUT_END_TIME_IN_SECONDS" ]; do + echo "$(current_timestamp): Waiting for $CONTAINER_NAME to finish ..." + + result=$(docker logs $CONTAINER_NAME 2>&1 | grep -E "$SUCCESSFUL_TEXT|$FAILURE_TEXT|$TIME_OUT_TEXT") + if [ ! -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): Found result: $result" + break; + fi + echo "$(current_timestamp): Sleeping for ${SLEEP_TIME} seconds" + sleep ${SLEEP_TIME} +done + +if [ -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: failed to populate AAI Simulator . . . " + echo "-------------- $CONTAINER_NAME logs -------------" + docker logs $CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +if echo "$result" | grep -E "$FAILURE_TEXT|$TIME_OUT_TEXT"; then + echo "$SCRIPT_NAME $(current_timestamp): populate-aai-simulator.sh failed" + echo "-------------- $CONTAINER_NAME logs -------------" + docker logs $CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +echo "$SCRIPT_NAME $(current_timestamp): Successfully populated AAI Simulator . . ." +exit 0 diff --git a/plans/usecases/pnf-sw-upgrade/so/config/wait-for-container.sh b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-container.sh new file mode 100755 index 00000000..35ee2641 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-container.sh @@ -0,0 +1,153 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_NAME=$(basename $0) +WAIT_FOR_SCRIPT=$SCRIPT_HOME/wait-for.sh + +# Process the arguments passed to the script +usage() +{ + _msg_="$@" + cat<<-EOF + Command Arguments: + + -c, --container-name + Mandatory argument. container name + + -n, --network-name + Mandatory argument. network name + + -t, --timeout + Mandatory argument. time out value in seconds (must be number) + + --help + Optional argument. Display this usage. + +EOF + exit 1 +} + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# Called when script is executed with invalid arguments +invalid_arguments() +{ + echo "Missing or invalid option(s):" + echo "$@" + echo "Try --help for more information" + exit 1 +} + +process_arguments() +{ + SHORT_ARGS="c:n:t:" + LONG_ARGS="help,container-name:,network-name:,timeout:" + + args=$(getopt -o $SHORT_ARGS -l $LONG_ARGS -n "$0" -- "$@" 2>&1 ) + [[ $? -ne 0 ]] && invalid_arguments $( echo " $args"| head -1 ) + [[ $# -eq 0 ]] && invalid_arguments "No options provided" + + eval set -- "$args" + cmd_arg="$0" + + while true; do + case "$1" in + -c|--container-name) + NAME=$2 + shift 2 ;; + -n|--network-name) + NETWORK_NAME=$2 + shift 2 ;; + -t|--timeout) + TIME_OUT=$2 + shift 2 ;; + --help) + usage + exit 0 + ;; + --) + shift + break ;; + *) + echo BAD ARGUMENTS # perhaps error + break ;; + esac + done + + if [ -z "$NAME" ]; then + echo "$SCRIPT_NAME $(current_timestamp): error: Container name must not be empty! $NAME" >&2; exit 1 + fi + + if [ -z "$NETWORK_NAME" ]; then + echo "$SCRIPT_NAME $(current_timestamp): error: network name must not be empty! $NETWORK_NAME" >&2; exit 1 + fi + + regex='^[0-9]+$' + if ! [[ $TIME_OUT =~ $regex ]] ; then + echo "$SCRIPT_NAME $(current_timestamp): error: TIME_OUT must be number $TIME_OUT" >&2; exit 1 + fi + + CONTAINER_NAME=$(docker ps -aqf "name=$NAME" --format "{{.Names}}") + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find container using $NAME" + exit 1 + fi + + result=$(docker inspect --format '{{.State.Running}}' $CONTAINER_NAME) + + if [ $result != "true" ] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: $CONTAINER_NAME container is not running" + exit 1 + fi + + HOST_IP=$(docker inspect --format '{{ index .NetworkSettings.Networks "'$NETWORK_NAME'" "IPAddress"}}' $CONTAINER_NAME) + + if [ $? -ne 0 ] || [ -z $HOST_IP ] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find HOST IP using network name: $NETWORK_NAME and container name: $CONTAINER_NAME" + exit 1 + fi + + PORT=$(docker port $CONTAINER_NAME | cut -c1-$(docker port $CONTAINER_NAME | grep -aob '/' | grep -oE '[0-9]+')) + + if [ $? -ne 0 ] || [ -z $PORT ] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find PORT using project name: $PROJECT_NAME and container name: $CONTAINER_NAME" + exit 1 + fi + + $WAIT_FOR_SCRIPT -t "$TIME_OUT" -h "$HOST_IP" -p "$PORT" + + if [ $? -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: wait-for.sh failed ..." + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): finished successfully" +} + +# main body +process_arguments $@ diff --git a/plans/usecases/pnf-sw-upgrade/so/config/wait-for-workaround-job.sh b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-workaround-job.sh new file mode 100755 index 00000000..035c5e26 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/wait-for-workaround-job.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SLEEP_TIME=5 +WORKAROUND_SUCCESSFUL_TEXT="Finished applying workaround" +WORKAROUND_FAILURE_TEXT="Failed to execute workaround" +WORKAROUND_TIME_OUT_TEXT="workaround script timed out" +WORKAROUND_CONTAINER_NAME=$(docker ps -aqf "name=workaround-config" --format "{{.Names}}") +SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +SCRIPT_NAME=$(basename $0) + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# main body +if [ -z $TIME_OUT_DEFAULT_VALUE_SEC ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: Undefined value for TIME_OUT_DEFAULT_VALUE_SEC attribute" + exit 1 +fi + +if [ -z $WORKAROUND_CONTAINER_NAME ]; then + echo "$SCRIPT_NAME $(current_timestamp): Unable to find docker container id " + exit 1 +fi + +START_TIME_IN_SECONDS=`date +%s` +TIME_OUT_END_TIME_IN_SECONDS=$(($START_TIME_IN_SECONDS+$TIME_OUT_DEFAULT_VALUE_SEC)); + + +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME script Start Time `date -d @$START_TIME_IN_SECONDS`" +echo echo "$SCRIPT_NAME $(current_timestamp): $SCRIPT_NAME will time out at `date -d @$TIME_OUT_END_TIME_IN_SECONDS`" + +while [ `date +%s` -lt "$TIME_OUT_END_TIME_IN_SECONDS" ]; do + echo "$(current_timestamp): Waiting for $WORKAROUND_CONTAINER_NAME to finish ..." + + result=$(docker logs $WORKAROUND_CONTAINER_NAME 2>&1 | grep -E "$WORKAROUND_SUCCESSFUL_TEXT|$WORKAROUND_FAILURE_TEXT|$WORKAROUND_TIME_OUT_TEXT") + if [ ! -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): Found result: $result" + break; + fi + echo "$(current_timestamp): Sleeping for ${SLEEP_TIME} seconds" + sleep ${SLEEP_TIME} +done + +if [ -z "$result" ]; then + echo "$SCRIPT_NAME $(current_timestamp): ERROR: failed to apply workaround . . . " + echo "-------------- $WORKAROUND_CONTAINER_NAME logs -------------" + docker logs $WORKAROUND_CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +if echo "$result" | grep -E "$WORKAROUND_FAILURE_TEXT|$WORKAROUND_TIME_OUT_TEXT"; then + echo "$SCRIPT_NAME $(current_timestamp): Work around script failed" + echo "-------------- $WORKAROUND_CONTAINER_NAME logs -------------" + docker logs $WORKAROUND_CONTAINER_NAME + echo "------------------------------------------------------------" + exit 1 +fi + +echo "$SCRIPT_NAME $(current_timestamp): Successfully applied workaround configuration . . ." +exit 0 diff --git a/plans/usecases/pnf-sw-upgrade/so/config/wait-for.sh b/plans/usecases/pnf-sw-upgrade/so/config/wait-for.sh new file mode 100755 index 00000000..53581b39 --- /dev/null +++ b/plans/usecases/pnf-sw-upgrade/so/config/wait-for.sh @@ -0,0 +1,138 @@ +#!/bin/bash +# +# ============LICENSE_START======================================================= +# Copyright (C) 2019 Nordix Foundation. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# + +# @author Waqas Ikram (waqas.ikram@est.tech) + +SCRIPT_NAME=$(basename $0) + +# Process the arguments passed to the script +usage() +{ + _msg_="$@" + cat<<-EOF + Command Arguments: + + -t, --timeout + Mandatory argument. time out value in seconds (must be number) + + -h --host + Mandatory argument. Host name or IP + + -p, --port + Mandatory argument. Port of the host + + --help + Optional argument. Display this usage. + +EOF + exit 1 +} + +current_timestamp() +{ + date +"%Y-%m-%d %H:%M:%S" +} + +# Called when script is executed with invalid arguments +invalid_arguments() +{ + echo "Missing or invalid option(s):" + echo "$@" + echo "Try --help for more information" + exit 1 +} + +process_arguments() +{ + SHORT_ARGS="t:h:p:" + LONG_ARGS="help,timeout:,host:,port:" + + args=$(getopt -o $SHORT_ARGS -l $LONG_ARGS -n "$0" -- "$@" 2>&1 ) + [[ $? -ne 0 ]] && invalid_arguments $( echo " $args"| head -1 ) + [[ $# -eq 0 ]] && invalid_arguments "No options provided" + + eval set -- "$args" + cmd_arg="$0" + + while true; do + case "$1" in + -t|--timeout) + TIME_OUT=$2 + shift 2 ;; + -h|--host) + HOST=$2 + shift 2 ;; + -p|--port) + PORT=$2 + shift 2 ;; + --help) + usage + exit 0 + ;; + --) + shift + break ;; + *) + echo BAD ARGUMENTS # perhaps error + break ;; + esac + done + + regex='^[0-9]+$' + if ! [[ $TIME_OUT =~ $regex ]] ; then + echo "$SCRIPT_NAME $(current_timestamp): error: TIME_OUT must be number $TIME_OUT" >&2; exit 1 + fi + + if [ -z "$HOST" ]; then + echo "$SCRIPT_NAME $(current_timestamp): error: HOST must not be empty! $HOST" >&2; exit 1 + fi + + if ! [[ $PORT =~ $regex ]]; then + echo "$SCRIPT_NAME $(current_timestamp): error: PORT must be number! $PORT" >&2; exit 1 + fi + + SLEEP_TIME=5 + START_TIME_IN_SECONDS=`date +%s` + TIME_OUT_END_TIME_IN_SECONDS=$(($START_TIME_IN_SECONDS+$TIME_OUT)); + + while [ `date +%s` -lt "$TIME_OUT_END_TIME_IN_SECONDS" ]; do + echo "$(current_timestamp): Waiting for $HOST:$PORT to startup ..." + + nc -z "$HOST" "$PORT" > /dev/null 2>&1 + result=$? + if [ $result -eq 0 ] ; then + echo "$SCRIPT_NAME $(current_timestamp): $HOST:$PORT is up and running" + break; + fi + echo "$SCRIPT_NAME $(current_timestamp): Sleeping for ${SLEEP_TIME} seconds" + sleep ${SLEEP_TIME} + done + + if [ $result -ne 0 ]; then + echo "$SCRIPT_NAME $(current_timestamp): Time out: could not get any response from $HOST:$PORT . . ." + exit 1 + fi + + echo "$SCRIPT_NAME $(current_timestamp): finished successfully" +} + +# main body +process_arguments $@ |