From: Jack Lucas Date: Mon, 3 Feb 2020 23:21:29 +0000 (-0500) Subject: Move k8s-bootstrap container to blueprints repo X-Git-Tag: 1.9.0^0 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F101079%2F2;p=dcaegen2%2Fplatform%2Fblueprints.git Move k8s-bootstrap container to blueprints repo Cleanup of unnecessary input templates and other files Use non-templatized blueprints instead of blueprint templates Copy blueprints from blueprints/ directory into image Move reference_templates to top-level directory Issue-ID: DCAEGEN2-2041 Signed-off-by: Jack Lucas Change-Id: Ib846a96a4995eb97383f63ff764705e6277a24b0 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa7a830 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.project +Dockerfile +.vscode +bootstrap-container.code-workspace +target \ No newline at end of file diff --git a/Dockerfile-template b/Dockerfile-template new file mode 100644 index 0000000..8c2e084 --- /dev/null +++ b/Dockerfile-template @@ -0,0 +1,63 @@ +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# Copyright (c) 2018-2020 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. +# ============LICENSE_END========================================================= + +FROM centos:7.4.1708 +LABEL maintainer="maintainer" + +ENV DCAE_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }} +ENV CCSDK_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }} +ENV BP_REPO {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases }} + +# Install gcc +RUN yum install -y gcc python-devel + +# Install Consul +RUN yum install -y unzip \ + && mkdir -p /opt/consul/bin \ + && mkdir -p /opt/consul/data \ + && mkdir -p /opt/consul/config \ + && curl -Ssf https://releases.hashicorp.com/consul/1.2.1/consul_1.2.1_linux_amd64.zip > /tmp/consul.zip \ + && unzip -pj /tmp/consul.zip > /opt/consul/bin/consul \ + && chmod +x /opt/consul/bin/consul +COPY config/00-consul.json /opt/consul/config/ + +# Install jq +RUN curl -Ssf -L "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64" > /bin/jq \ +&& chmod +x /bin/jq + +# Install pip and Cloudify CLI (stay at version 4.2 because of changes in higher versions) +RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \ + && python get-pip.py \ + && rm get-pip.py \ + && pip install cloudify==4.2 + +# Copy scripts +RUN mkdir scripts +COPY scripts/ /scripts + +# Get plugins from raw repos +RUN scripts/load-plugins.sh ${DCAE_REPO} ${CCSDK_REPO} \ + && rm scripts/load-plugins.sh \ +# Make sure scripts are executable + && chmod +x /scripts/*.sh + +# Load blueprints and input templates +COPY blueprints/ /blueprints + +# Set up runtime script +ENTRYPOINT exec "/scripts/bootstrap.sh" diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d3a870 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# DCAE Blueprints and Bootstrap Container +This repository holds the source code needed to build the +Docker image for the DCAE bootstrap container. The bootstrap +container runs at DCAE deployment time (via a Helm chart) and +does initial setup of the DCAE environment. This includes +deploying several service components using Cloudify Manager. + +This repository also holds Cloudify blueprints for service components. +The Docker build process copies these blueprints into the Docker image +for the bootstrap container. + +_Note: Prior to the Frankfurt release (R6), this repository held blueprint templates +for components deployed using Cloudify Manager. The build process for this +repository expanded the templates and pushed them to the Nexus raw +repository. The DCAE bootstrap container was hosted in the `dcaegen2.deployments` repository. The Docker build process for the bootstrap containter image pulled the blueprints it needed from the Nexus raw repository._ + +## DCAE Bootstrap Container +This container is responsible for loading plugins and wagons onto the +DCAE Cloudify Manager instance and for launching DCAE components. + +The Docker image build process loads plugins and blueprints into the +image's file system. The plugins are pulled from the Nexus raw repository. The +blueprints are copied from the `blueprints` directory in this repository. At run time, the main script in the container +(`bootstrap.sh`) uploads the plugins to Cloudify Manager, then installs +components using the blueprints. + +The container expects to be started with two environment variables: + - `CMADDR` -- the address of the target Cloudify Manager + - `CMPASS` -- the password for Cloudify Manager + +The container expects input files to use when deploying the blueprints. +It expects to find them in /inputs. The normal method for launching +the container is via a Helm Chart launched by OOM. That chart creates +a Kubernetes ConfigMap containing the input files. The ConfigMap is +mounted as a volume at /inputs. + diff --git a/blueprints/k8s-helm-override.yaml-template b/blueprints/k8s-helm-override.yaml similarity index 96% rename from blueprints/k8s-helm-override.yaml-template rename to blueprints/k8s-helm-override.yaml index dc53dde..639d2a0 100644 --- a/blueprints/k8s-helm-override.yaml-template +++ b/blueprints/k8s-helm-override.yaml @@ -18,7 +18,7 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/helm/4.0.0/helm-type.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/helm/4.0.0/helm-type.yaml" inputs: tiller-server-ip: diff --git a/blueprints/k8s-helm.yaml-template b/blueprints/k8s-helm.yaml similarity index 94% rename from blueprints/k8s-helm.yaml-template rename to blueprints/k8s-helm.yaml index 958f0e6..4aed5ba 100644 --- a/blueprints/k8s-helm.yaml-template +++ b/blueprints/k8s-helm.yaml @@ -18,7 +18,7 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/helm/4.0.0/helm-type.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/helm/4.0.0/helm-type.yaml" inputs: tiller-server-ip: diff --git a/blueprints/k8s-holmes-engine.yaml-template b/blueprints/k8s-holmes-engine.yaml similarity index 87% rename from blueprints/k8s-holmes-engine.yaml-template rename to blueprints/k8s-holmes-engine.yaml index f14dea2..707d2ed 100644 --- a/blueprints/k8s-holmes-engine.yaml-template +++ b/blueprints/k8s-holmes-engine.yaml @@ -20,9 +20,9 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml" -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml" -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/pgaas/1.1.0/pgaas_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/pgaas/1.1.0/pgaas_types.yaml" inputs: dcae_CL_publish_url: type: string @@ -45,7 +45,7 @@ inputs: default: holmes he_image: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/holmes/engine-management:v1.0.0" + default: "nexus3.onap.org:10001/onap/holmes/engine-management:v1.0.0" node_templates: pgaasvm: diff --git a/blueprints/k8s-holmes-rules.yaml-template b/blueprints/k8s-holmes-rules.yaml similarity index 93% rename from blueprints/k8s-holmes-rules.yaml-template rename to blueprints/k8s-holmes-rules.yaml index 1cff89f..269692a 100644 --- a/blueprints/k8s-holmes-rules.yaml-template +++ b/blueprints/k8s-holmes-rules.yaml @@ -20,9 +20,9 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml" -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml" -- "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/pgaas/1.1.0/pgaas_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml" +- "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/pgaas/1.1.0/pgaas_types.yaml" inputs: msb_hostname: type: string @@ -37,7 +37,7 @@ inputs: default: holmes hr_image: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/holmes/rule-management:v1.0.0" + default: "nexus3.onap.org:10001/onap/holmes/rule-management:v1.0.0" node_templates: pgaasvm: type: dcae.nodes.pgaas.database diff --git a/blueprints/k8s-hv-ves.yaml-template b/blueprints/k8s-hv-ves.yaml similarity index 94% rename from blueprints/k8s-hv-ves.yaml-template rename to blueprints/k8s-hv-ves.yaml index c66a606..3723200 100644 --- a/blueprints/k8s-hv-ves.yaml-template +++ b/blueprints/k8s-hv-ves.yaml @@ -21,12 +21,12 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml inputs: tag_version: type: string - default: '{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:1.3.0' + default: 'nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.hv-ves.hv-collector-main:1.3.0' hv_ves_name: type: string default: 'dcae-hv-ves-collector' diff --git a/blueprints/k8s-pgaas-initdb.yaml-template b/blueprints/k8s-pgaas-initdb.yaml similarity index 85% rename from blueprints/k8s-pgaas-initdb.yaml-template rename to blueprints/k8s-pgaas-initdb.yaml index 2022300..4cdf5ae 100644 --- a/blueprints/k8s-pgaas-initdb.yaml-template +++ b/blueprints/k8s-pgaas-initdb.yaml @@ -30,9 +30,9 @@ description: |- imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/relationshipplugin/1.1.0/relationshipplugin_types.yaml" - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/sshkeyshare/sshkey_types.yaml" - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/pgaas/1.1.0/pgaas_types.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/relationshipplugin/1.1.0/relationshipplugin_types.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/sshkeyshare/sshkey_types.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/type_files/pgaas/1.1.0/pgaas_types.yaml" inputs: blueprint_version: diff --git a/blueprints/k8s-prh.yaml-template b/blueprints/k8s-prh.yaml similarity index 96% rename from blueprints/k8s-prh.yaml-template rename to blueprints/k8s-prh.yaml index 3d3107c..4486412 100644 --- a/blueprints/k8s-prh.yaml-template +++ b/blueprints/k8s-prh.yaml @@ -21,7 +21,7 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml inputs: pnfUrl: @@ -63,7 +63,7 @@ inputs: default: "admin" tag_version: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/org.onap.dcaegen2.services.prh.prh-app-server:1.4.0" + default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh.prh-app-server:1.4.0" replicas: type: integer description: number of instances diff --git a/blueprints/k8s-snmptrap.yaml-template b/blueprints/k8s-snmptrap.yaml similarity index 93% rename from blueprints/k8s-snmptrap.yaml-template rename to blueprints/k8s-snmptrap.yaml index bf83a27..e1d50c7 100644 --- a/blueprints/k8s-snmptrap.yaml-template +++ b/blueprints/k8s-snmptrap.yaml @@ -21,11 +21,11 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml inputs: tag_version: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/org.onap.dcaegen2.collectors.snmptrap:1.4.0" + default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.snmptrap:1.4.0" cache: type: string default: diff --git a/blueprints/k8s-tca-clampnode.yaml-template b/blueprints/k8s-tca-clampnode.yaml similarity index 96% rename from blueprints/k8s-tca-clampnode.yaml-template rename to blueprints/k8s-tca-clampnode.yaml index d43d017..56dbc2c 100644 --- a/blueprints/k8s-tca-clampnode.yaml-template +++ b/blueprints/k8s-tca-clampnode.yaml @@ -23,8 +23,8 @@ description: > imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml" - - "{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml" + - "https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml" inputs: aaiEnrichmentHost: type: string diff --git a/blueprints/k8s-tca-policynode.yaml-template b/blueprints/k8s-tca-policynode.yaml similarity index 95% rename from blueprints/k8s-tca-policynode.yaml-template rename to blueprints/k8s-tca-policynode.yaml index c24dfed..2dec8c0 100644 --- a/blueprints/k8s-tca-policynode.yaml-template +++ b/blueprints/k8s-tca-policynode.yaml @@ -23,8 +23,8 @@ description: > imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml inputs: aaiEnrichmentHost: type: string @@ -49,7 +49,7 @@ inputs: default: dcae-redis.onap.svc.cluster.local:6379 tag_version: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0" + default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.0.0" consul_host: type: string default: consul-server.onap.svc.cluster.local diff --git a/blueprints/k8s-tca.yaml-template b/blueprints/k8s-tca.yaml similarity index 97% rename from blueprints/k8s-tca.yaml-template rename to blueprints/k8s-tca.yaml index 78c3f03..f006531 100644 --- a/blueprints/k8s-tca.yaml-template +++ b/blueprints/k8s-tca.yaml @@ -23,7 +23,7 @@ description: > imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml inputs: aaiEnrichmentHost: type: string @@ -48,7 +48,7 @@ inputs: default: dcae-redis.onap.svc.cluster.local:6379 tag_version: type: string - default: "{{ ONAPTEMPLATE_DOCKERREGURL_org_onap_dcaegen2_releases }}/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.2.2" + default: "nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.2.2" consul_host: type: string default: consul-server.onap.svc.cluster.local diff --git a/blueprints/k8s-ves.yaml-template b/blueprints/k8s-ves.yaml similarity index 97% rename from blueprints/k8s-ves.yaml-template rename to blueprints/k8s-ves.yaml index bb372a9..7a45a5c 100644 --- a/blueprints/k8s-ves.yaml-template +++ b/blueprints/k8s-ves.yaml @@ -21,7 +21,7 @@ tosca_definitions_version: cloudify_dsl_1_3 imports: - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/k8splugin/1.7.2/k8splugin_types.yaml + - https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml inputs: ves_other_publish_url: diff --git a/blueprints/pom.xml b/blueprints/pom.xml deleted file mode 100644 index 9b886ea..0000000 --- a/blueprints/pom.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - 4.0.0 - - org.onap.dcaegen2.platform - blueprints - 1.2.0-SNAPSHOT - - org.onap.dcaegen2.platform.blueprints - blueprints - blueprints - 1.0.0-SNAPSHOT - http://maven.apache.org - - - UTF-8 - true - . - - - - - py - Python - **/*.py - - - - - ${project.artifactId}-${project.version} - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - clean phase script - clean - - exec - - - - ${project.artifactId} - clean - - - - - generate-sources script - generate-sources - - exec - - - - ${project.artifactId} - generate-sources - - - - - compile script - compile - - exec - - - - ${project.artifactId} - compile - - - - - package script - package - - exec - - - - ${project.artifactId} - package - - - - - test script - test - - exec - - - - ${project.artifactId} - test - - - - - install script - install - - exec - - - - ${project.artifactId} - install - - - - - deploy script - deploy - - exec - - - - ${project.artifactId} - deploy - - - - - - - - diff --git a/check-blueprint-vs-input/bin/check-blueprint-vs-input b/check-blueprint-vs-input/bin/check-blueprint-vs-input deleted file mode 100755 index c6b271b..0000000 --- a/check-blueprint-vs-input/bin/check-blueprint-vs-input +++ /dev/null @@ -1,262 +0,0 @@ -#!/usr/bin/env python3 -# -*- indent-tabs-mode: nil -*- -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this code 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. - -from __future__ import print_function - -""" - - NAME - check-blueprint-vs-input - given a blueprint and inputs file pair, validate them against each other - - USAGE - check-blueprint-vs-input [-v] [-t] -b BLUEPRINT [-B exclusion-list] -i INPUTS [-B exclusion-list] - - DESCRIPTION -""" -description = """ - Validate a blueprint and inputs file against each other. This looks for the inputs: node of the blueprint - file, the inputs used by {get_input} within the blueprint, and the values found in the inputs file. The - files may be in either YAML or JSON formats. The names default to blueprint.yaml and inputs.yaml. If - a blueprint inputs name has a default value, it is not considered an error if it is not in the inputs file. - - If using a template inputs file, add the -t/--template option. This will look for the inputs under - an "inputs:" node instead of at the top level. - - If there are blueprint nodes or inputs nodes that should not be considered an error, specify them - using the -B/--blueprint-exclusion-list and -I/inputs-exclusion-list parameters. - - "check-blueprint-vs-input --help" will list all of the available options. -""" - -import sys, argparse, json, yaml -from yaml.composer import Composer -from yaml.constructor import Constructor -from yaml.constructor import SafeConstructor -from yaml.constructor import ScalarNode - -def main(): - DEF_BLUEPRINT_NAME = "blueprint.yaml" - DEF_INPUTS_NAME = "inputs.yaml" - parser = argparse.ArgumentParser(description=description) - parser.add_argument("-b", "--blueprint", type=str, help="Path to blueprint file, defaults to '%s'" % DEF_BLUEPRINT_NAME, - default=DEF_BLUEPRINT_NAME) - parser.add_argument("-i", "--inputs", type=str, help="Port to listen on, defaults to '%s'" % DEF_INPUTS_NAME, - default=DEF_INPUTS_NAME) - parser.add_argument("-B", "--blueprint-exclusion-list", type=str, help="Comma-separated list of names not to warn about not being in the blueprint file", default="") - parser.add_argument("-I", "--inputs-exclusion-list", type=str, help="Comma-separated list of names not to warn about not being in the inputs file", default="") - parser.add_argument("-t", "--inputs-template", help="Treat inputs file as coming from template area", action="store_true") - parser.add_argument("-v", "--verbose", help="Verbose, may be specified multiple times", action="count", default=0) - args = parser.parse_args() - - blueprintExclusionList = args.blueprint_exclusion_list.split(",") - if args.verbose: print("blueprintExclusionList=%s" % blueprintExclusionList) - - inputsExclusionList = args.inputs_exclusion_list.split(",") - if args.verbose: print("inputsExclusionList=%s" % inputsExclusionList) - - def loadYaml(filename, where): - """ - Load a YAML file - - Line number manipulation is inspired by: - https://stackoverflow.com/questions/13319067/parsing-yaml-return-with-line-number - - The YAML loader parses the file first into a set of nodes. Capture the - line numbers and column numbers during that parsing pass. - The YAML object is then created from those objects. - """ - - def compose_node(parent, index): - lineno = loader.line # the line number where the previous token has ended (plus empty lines) - # column = loader.column - node = Composer.compose_node(loader, parent, index) - node.__lineno__ = lineno + 1 - # node.__column__ = column + 1 - return node - - def construct_scalar(node): - where[node.value] = str(node.__lineno__) # + ":" + str(node.__column__) - return SafeConstructor.construct_scalar(loader, node) - - def construct_mapping(node, deep=False): - mapping = SafeConstructor.construct_mapping(loader, node, deep=deep) - mapping['__lineno__'] = str(node.__lineno__) # + ":" + str(node.__column__) - return mapping - - yread = None - try: - with open(filename, "r") as fd: - yread = fd.read() - except: - type, value, traceback = sys.exc_info() - sys.exit(value) - - loader = yaml.SafeLoader(yread) - loader.compose_node = compose_node - loader.construct_mapping = construct_mapping - loader.construct_scalar = construct_scalar - data = loader.get_single_data() - if args.verbose > 2: - print("================ %s ================" % filename) - yaml.dump(data, sys.stdout) - print("================================") - return data - - blueprint = loadYaml(args.blueprint, {}) - inputsWhere = { } - inputs = loadYaml(args.inputs, inputsWhere) - - # if inputs file is empty, provide an empty dictionary - if inputs is None: inputs = { } - - # blueprint file has inputs under the inputs: node - blueprintInputs = blueprint['inputs'] - - # inputs file normally has inputs at the top level, - # but templated inputs files have themunder the inputs: node - if args.inputs_template: inputs = inputs['inputs'] - - - exitval = 0 - - def check_blueprint_inputs(blueprintInputs, inputs, inputsExclusionList): - """ - check the blueprint inputs against the inputs file - """ - foundone = False - for input in blueprintInputs: - if input == '__lineno__': continue - if args.verbose: print("blueprint input=%s\n%s" % (input, blueprintInputs[input])) - if input in inputs: - if args.verbose: print("\tIS in inputs file") - else: - # print("blueprintInputs.get(input)=%s and blueprintInputs[input].get('default')=%s" % (blueprintInputs.get(input), blueprintInputs[input].get('default'))) - if blueprintInputs.get(input) and blueprintInputs[input].get('default'): - if args.verbose: print("\tHAS a default value") - elif input not in inputsExclusionList: - print("<<<<<<<<<<<<<<<< %s (blueprint line %s) not in inputs file" % (input, blueprintInputs[input].get('__lineno__'))) - foundone = True - else: - if args.verbose: print("<<<<<<<<<<<<<<<< %s not in inputs file, but being ignored" % input) - return foundone - - # check the blueprint inputs: against the inputs file - if args.verbose: print("================ check the blueprint inputs: against the inputs file") - foundone = check_blueprint_inputs(blueprintInputs, inputs, inputsExclusionList) - if foundone: print("") - if foundone: exitval = 1 - - def prettyprint(msg,j): - print(msg) - json.dump(j, sys.stdout, indent=4, sort_keys=True) - print("") - - def check_get_inputs(blueprint, blueprintInputs, inputs, inputsExclusionList): - """ - check the blueprint get_input values against the inputs file - """ - - def findInputs(d, where): - if args.verbose > 2: print("check_get_inputs(): d=%s" % d) - ret = [ ] - if isinstance(d, dict): - if args.verbose: print("type(d) is dict") - for key,val in d.items(): - linecol = d.get('__lineno__') - if args.verbose: print("looking at d[key=%s], line=%s" % (key, linecol)) - if key == '__lineno__': continue - if key == "get_input": - if args.verbose: print("found get_input, adding '%s'" % val) - ret += [ val ] - if not where.get(val): where[val] = str(linecol) - else: where[val] += "," + str(linecol) - return ret - else: - if args.verbose: print("going recursive on '%s'" % val) - ret += findInputs(val, where) - elif isinstance(d, list): - if args.verbose: print("type(d) is list") - for val in d: - if args.verbose: print("going recursive on '%s'" % val) - ret += findInputs(val, where) - else: - if args.verbose: print("type(d) is scalar: %s" % d) - return ret - - foundone = False - where = {} - inputList = findInputs(blueprint, where) - if args.verbose: - print("done looking for get_input, found:\n%s" % inputList) - prettyprint("where=",where) - alreadySeen = { } - for input in inputList: - if input not in alreadySeen: - alreadySeen[input] = True - if args.verbose: print("checking input %s" % input) - if input in inputs: - if args.verbose: print("\tIS in input file") - else: - if blueprintInputs.get(input) and blueprintInputs[input].get('default'): - if args.verbose: print("\tHAS a default value") - elif input not in inputsExclusionList: - line = where[input] - s = "s" if line.find(",") >= 0 else "" - print(":::::::::::::::: get_input: {0} is NOT in input file (blueprint line{1} {2})".format(input, s, line)) - foundone = True - else: - if args.verbose: - line = where[input] - s = "s" if line.find(",") >= 0 else "" - print(":::::::::::::::: get_input: %s is NOT in input file (blueprint line{1} {2}), but being ignored" % (input, s, line)) - - return foundone - - - - # check the blueprint's get_input calls against the inputs file - if args.verbose: print("================ check the blueprint's get_input calls against the inputs file ================") - foundone = check_get_inputs(blueprint, blueprintInputs, inputs, inputsExclusionList) - if foundone: print("") - if foundone: exitval = 1 - - def check_inputs(blueprintInputs, inputs, blueprintExclusionList): - """ - check the inputs file against the blueprints inputs list - """ - foundone = False - # prettyprint("inputs=", inputs) - for key,val in inputs.items(): - if key == '__lineno__': continue - if args.verbose: print("inputs key=%s" % key) - # print("inputs key=%s, line=%s, val=%s" % (key,inputsWhere[key],val)) # DELETE - if key in blueprintInputs: - if args.verbose: print("\tIS in blueprint") - else: - if key not in blueprintExclusionList: - print(">>>>>>>>>>>>>>>> %s is in inputs file (around line %s) but not in blueprint file" % (key, inputsWhere[key])) - foundone = True - else: - if args.verbose: print(">>>>>>>>>>>>>>>> %s is in inputs file (around line %s), but not in blueprint file and being ignored" % (key, inputsWhere[key])) - return foundone - - # check the inputs file against the blueprints input: section - if args.verbose: print("================ check the inputs file against the blueprints input: section ================") - foundone = check_inputs(blueprintInputs, inputs, blueprintExclusionList) - if foundone: exitval = 1 - sys.exit(exitval) - -if __name__ == "__main__": - main() diff --git a/check-blueprint-vs-input/lib/sample-inputs.yaml b/check-blueprint-vs-input/lib/sample-inputs.yaml deleted file mode 100644 index a56652b..0000000 --- a/check-blueprint-vs-input/lib/sample-inputs.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -centos7image_id: 'some-value-in-guid-format' -ubuntu1604image_id: 'another-value-in-guid-format' -flavor_id: '4' -security_group: '55a11193-6559-4f6c-b2d2-0119a9817062' -public_net: 'admin_floating_228_net' -private_net: 'onap-f-net' -openstack: - username: 'MY_LOGIN' - password: 'MY_PASSWORD' - tenant_name: 'TENANT_NAME' - auth_url: 'KEYSTONE_AUTH_URL' - region: 'RegionOne' -keypair: 'KEYNME' -key_filename: '/opt/dcae/key' -location_prefix: 'onapr1' -location_domain: 'onapdevlab.onap.org' -codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content' -codesource_version: 'org.onap.dcaegen2.deployments/releases/scripts' diff --git a/check-blueprint-vs-input/man/check-blueprint-vs-input.1 b/check-blueprint-vs-input/man/check-blueprint-vs-input.1 deleted file mode 100644 index 247fbc6..0000000 --- a/check-blueprint-vs-input/man/check-blueprint-vs-input.1 +++ /dev/null @@ -1,50 +0,0 @@ -check-blueprint-vs-input(1UTIL) ONAP check-blueprint-vs-input(1UTIL) - - - -NNAAMMEE - check-blueprint-vs-input - -SSYYNNOOPPSSIISS - check-blueprint-vs-input [-h] [-b BLUEPRINT] [-i INPUTS] - [-B BLUEPRINT_EXCLUSION_LIST] - [-I INPUTS_EXCLUSION_LIST] [-t] [-v] - -DDEESSCCRRIIPPTTIIOONN - Validate a blueprint and inputs file against each other. This looks for - the inputs: node of the blueprint file, the inputs used by {get_input} - within the blueprint, and the values found in the inputs file. The - files may be in either YAML or JSON formats. The names default to blue‐ - print.yaml and inputs.yaml. If a blueprint inputs name has a default - value, it is not considered an error if it is not in the inputs file. - If using a template inputs file, add the -t/--template option. This - will look for the inputs under an "inputs:" node instead of at the top - level. If there are blueprint nodes or inputs nodes that should not be - considered an error, specify them using the -B/--blueprint- exclusion- - list and -I/inputs-exclusion-list parameters. "check-blueprint-vs- - input --help" will list all of the available options. - - OOPPTTIIOONNSS - -h, --help show this help message and exit - - -b BLUEPRINT, --blueprint BLUEPRINT Path to blueprint file, defaults to - 'blueprint.yaml' - - -i INPUTS, --inputs INPUTS Port to listen on, defaults to 'inputs.yaml' - - -B BLUEPRINT_EXCLUSION_LIST, --blueprint-exclusion-list BLUE‐ - PRINT_EXCLUSION_LIST Comma-separated list of names - not to warn about not - being in the blueprint file - - -I INPUTS_EXCLUSION_LIST, --inputs-exclusion-list INPUTS_EXCLUSION_LIST - Comma-separated list of names not to warn about not - being in the inputs file - - -t, --inputs-template Treat inputs file as coming from template area - - -v, --verbose Verbose, may be specified multiple times - - - -ONAP {{DATE}} check-blueprint-vs-input(1UTIL) diff --git a/check-blueprint-vs-input/man/check-blueprint-vs-input.man b/check-blueprint-vs-input/man/check-blueprint-vs-input.man deleted file mode 100644 index 017d529..0000000 --- a/check-blueprint-vs-input/man/check-blueprint-vs-input.man +++ /dev/null @@ -1,55 +0,0 @@ -'\" Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -'\" -'\" Licensed under the Apache License, Version 2.0 (the "License"); -'\" you may not use this code 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. -.TH check-blueprint-vs-input 1UTIL {{DATE}} ONAP ONAP -.SH NAME -check-blueprint-vs-input -.SH SYNOPSIS -check-blueprint-vs-input [-h] [-b BLUEPRINT] [-i INPUTS] - [-B BLUEPRINT_EXCLUSION_LIST] - [-I INPUTS_EXCLUSION_LIST] [-t] [-v] -.SH DESCRIPTION -Validate a blueprint and inputs file against each other. This looks for the -inputs: node of the blueprint file, the inputs used by {get_input} within the -blueprint, and the values found in the inputs file. The files may be in either -YAML or JSON formats. The names default to blueprint.yaml and inputs.yaml. If -a blueprint inputs name has a default value, it is not considered an error if -it is not in the inputs file. If using a template inputs file, add the --t/--template option. This will look for the inputs under an "inputs:" node -instead of at the top level. If there are blueprint nodes or inputs nodes that -should not be considered an error, specify them using the -B/--blueprint- -exclusion-list and -I/inputs-exclusion-list parameters. "check-blueprint-vs- -input --help" will list all of the available options. -.SS OPTIONS -.HP 20 --h, --help -show this help message and exit -.HP 20 --b BLUEPRINT, --blueprint BLUEPRINT -Path to blueprint file, defaults to 'blueprint.yaml' -.HP 20 --i INPUTS, --inputs INPUTS -Port to listen on, defaults to 'inputs.yaml' -.HP 20 --B BLUEPRINT_EXCLUSION_LIST, --blueprint-exclusion-list BLUEPRINT_EXCLUSION_LIST -Comma-separated list of names not to warn about not - being in the blueprint file -.HP 20 --I INPUTS_EXCLUSION_LIST, --inputs-exclusion-list INPUTS_EXCLUSION_LIST -Comma-separated list of names not to warn about not - being in the inputs file -.HP 20 --t, --inputs-template -Treat inputs file as coming from template area -.HP 20 --v, --verbose -Verbose, may be specified multiple times diff --git a/check-blueprint-vs-input/pom.xml b/check-blueprint-vs-input/pom.xml deleted file mode 100644 index 14b4d50..0000000 --- a/check-blueprint-vs-input/pom.xml +++ /dev/null @@ -1,250 +0,0 @@ - - - - 4.0.0 - - org.onap.dcaegen2.platform.blueprints - blueprints - 1.2.0-SNAPSHOT - - org.onap.dcaegen2.plaform.blueprints - check-blueprint-vs-input - dcaegen2-plaform-blueprints-check-blueprint-vs-input - 1.0.0-SNAPSHOT - http://maven.apache.org - - - UTF-8 - true - . - - - - - py - Python - **/*.py - - - - - ${project.artifactId}-${project.version} - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - - true - - - - org.apache.maven.plugins - maven-deploy-plugin - - 2.8 - - true - - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.6 - - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - true - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - default-jar - - - - - - - org.apache.maven.plugins - maven-install-plugin - 2.4 - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12.4 - - true - - - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - clean phase script - clean - - exec - - - - ${project.artifactId} - clean - - - - - generate-sources script - generate-sources - - exec - - - - ${project.artifactId} - generate-sources - - - - - compile script - compile - - exec - - - - ${project.artifactId} - compile - - - - - package script - package - - exec - - - - ${project.artifactId} - package - - - - - test script - test - - exec - - - - ${project.artifactId} - test - - - - - install script - install - - exec - - - - ${project.artifactId} - install - - - - - deploy script - deploy - - exec - - - - ${project.artifactId} - deploy - bin/check-blueprint-vs-input - man/check-blueprint-vs-input.1 - - - - - - - - diff --git a/config/00-consul.json b/config/00-consul.json new file mode 100644 index 0000000..a7d6ff4 --- /dev/null +++ b/config/00-consul.json @@ -0,0 +1,9 @@ +{ + "datacenter": "dc1", + "data_dir": "/opt/consul", + "log_level": "INFO", + "server": false, + "retry_join": ["consul"], + "node_name": "dcae-bootstrap", + "disable_update_check": true + } \ No newline at end of file diff --git a/input-templates/cdapinputs.yaml b/input-templates/cdapinputs.yaml deleted file mode 100644 index 879b59c..0000000 --- a/input-templates/cdapinputs.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -ubuntu1604image_id: '{{ ubuntu_1604_image }}' -centos7image_id: '{{ centos_7_image }}' -flavor_id: '{{ flavor_id_cdap }}' -security_group: '{{ security_group }}' -public_net: '{{ public_net_id }}' -private_net: '{{ openstack_private_network_name }}' -openstack: - username: '{{ openstack_user }}' - password: '{{ openstack_password }}' - tenant_name: '{{ tenant_name }}' - auth_url: '{{ keystone_url }}' - region: '{{ openstack_region }}' -keypair: '{{ key_name }}' -key_filename: '/opt/dcae/key' -location_prefix: 'dcae' -location_domain: '{{ dcae_zone }}.{{ dcae_domain }}' -codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content' -codesource_version: 'org.onap.dcaegen2.deployments/releases' diff --git a/input-templates/datafile-collector-input.yaml b/input-templates/datafile-collector-input.yaml deleted file mode 100644 index 242eba2..0000000 --- a/input-templates/datafile-collector-input.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= - -#dmaap_host: '{{ dmaap_host }}' -#dmaap_port: '{{ dmaap_port }}' -#dmaap_user: '{{ dmaap_user }}' -#dmaap_passwd: '{{ dmaap_passwd }}' -#tag_version: '{{ tag_version }}' -#replicas: '{{ replicas }}' \ No newline at end of file diff --git a/input-templates/dhinputs.yaml b/input-templates/dhinputs.yaml deleted file mode 100644 index 9014ac6..0000000 --- a/input-templates/dhinputs.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -application_config: - cloudify: - protocol: "http" - inventory: - protocol: "http" diff --git a/input-templates/he-ip.yaml b/input-templates/he-ip.yaml deleted file mode 100644 index 284aa2d..0000000 --- a/input-templates/he-ip.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -{ - "dh_location_id": "{{ dcae_zone }}", - "docker_host_override": "component_dockerhost", - "msb_hostname": "{{ openo_ip_addr }}", - "dcae_CL_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.DCAE_CL_OUTPUT", - "ves_fault_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_FAULT_OUTPUT", - "location_domain" : "{{ dcae_zone }}.{{ dcae_domain }}", - "location_prefix" : "dcae", - "pgaas_cluster_name" : "pgvm", - "database_name":"holmes" -} diff --git a/input-templates/heartbeat-input.json b/input-templates/heartbeat-input.json deleted file mode 100644 index eaf13a3..0000000 --- a/input-templates/heartbeat-input.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dh_location_id": "{{ dcae_zone }}", - "docker_host_override": "component_dockerhost", - "dcae_CL_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.DCAE_CL_OUTPUT/", - "ves_heartbeat_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_HEARTBEAT_OUTPUT/", - "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.heartbeat:2.0" -} diff --git a/input-templates/hr-ip.yaml b/input-templates/hr-ip.yaml deleted file mode 100644 index 10c65e0..0000000 --- a/input-templates/hr-ip.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -{ - "dh_location_id": "{{ dcae_zone }}", - "docker_host_override": "component_dockerhost", - "msb_hostname": "{{ openo_ip_addr }}", - "location_domain" : "{{ dcae_zone }}.{{ dcae_domain }}", - "location_prefix" : "dcae", - "pgaas_cluster_name" : "pgvm", - "database_name":"holmes" -} diff --git a/input-templates/inputs.yaml b/input-templates/inputs.yaml deleted file mode 100644 index b87a760..0000000 --- a/input-templates/inputs.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -ubuntu1604image_id: '{{ ubuntu_1604_image }}' -centos7image_id: '{{ centos_7_image }}' -flavor_id: '{{ flavor_id }}' -security_group: '{{ security_group }}' -public_net: '{{ public_net_id }}' -private_net: '{{ openstack_private_network_name }}' -openstack: - username: '{{ openstack_user }}' - password: '{{ openstack_password }}' - tenant_name: '{{ tenant_name }}' - auth_url: '{{ keystone_url }}' - region: '{{ openstack_region }}' -keypair: '{{ key_name }}' -key_filename: '/opt/dcae/key' -location_prefix: 'dcae' -location_domain: '{{ dcae_zone }}.{{ dcae_domain }}' -codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content' -codesource_version: 'org.onap.dcaegen2.deployments/releases' diff --git a/input-templates/invinputs.yaml b/input-templates/invinputs.yaml deleted file mode 100644 index 9701b9b..0000000 --- a/input-templates/invinputs.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -docker_host_override: "platform_dockerhost" -asdc_address: '{{ sdc_ip_addr }}:8443' -asdc_uri: 'https://{{ sdc_ip_addr }}:8443' -asdc_user: "dcae" -asdc_password: !!str Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -asdc_environment_name: "AUTO" -postgres_user_inventory: "postgres" -postgres_password_inventory: "onap123" -service_change_handler_image: "{{ nexus_docker_repo }}/onap/org.onap.dcaegen2.platform.servicechange-handler:v1.0.0" -inventory_image: "{{ nexus_docker_repo }}/onap/org.onap.dcaegen2.platform.inventory-api:v1.2.0" diff --git a/input-templates/phinputs.yaml b/input-templates/phinputs.yaml deleted file mode 100644 index bbdab63..0000000 --- a/input-templates/phinputs.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. - -application_config: - policy_handler : - # parallelize the getConfig queries to policy-engine on each policy-update notification - thread_pool_size : 4 - - # parallelize requests to policy-engine and keep them alive - pool_connections : 20 - - # retry to getConfig from policy-engine on policy-update notification - policy_retry_count : 5 - policy_retry_sleep : 5 - - # mode of operation for the policy-handler - # either active or passive - # in passive mode the policy-hanlder will not listen to - # and will not bring the policy-updates from policy-engine - mode_of_operation : "active" - - # config of automatic catch_up for resiliency - catch_up : - # interval in seconds on how often to call automatic catch_up - # example: 1200 is 20*60 seconds that is 20 minutes - interval : 1200 - - # config of periodic reconfigure-rediscover for adaptability - reconfigure: - # interval in seconds on how often to call automatic reconfigure - # example: 600 is 10*60 seconds that is 10 minutes - interval : 600 - - # policy-engine config - # These are the url of and the auth for the external system, namely the policy-engine (PDP). - # We obtain that info manually from PDP folks at the moment. - # In long run we should figure out a way of bringing that info into consul record - # related to policy-engine itself. - policy_engine : - url : "http://{{ policy_ip_addr }}:8081" - path_decision : "/decision/v1" - path_notifications : "/pdp/notifications" - path_api : "/pdp/api/" - headers : - Accept : "application/json" - "Content-Type" : "application/json" - ClientAuth : "cHl0aG9uOnRlc3Q=" - Authorization : "Basic dGVzdHBkcDphbHBoYTEyMw==" - Environment : "TEST" - target_entity : "policy_engine" - # optional tls_ca_mode specifies where to find the cacert.pem for tls - # can be one of these: - # "cert_directory" - use the cacert.pem stored locally in cert_directory. - # this is the default if cacert.pem file is found - # - # "os_ca_bundle" - use the public ca_bundle provided by linux system. - # this is the default if cacert.pem file not found - # - # "do_not_verify" - special hack to turn off the verification by cacert and hostname - tls_ca_mode : "cert_directory" - # optional tls_wss_ca_mode specifies the same for the tls based web-socket - tls_wss_ca_mode : "cert_directory" - # optional timeout_in_secs specifies the timeout for the http requests - timeout_in_secs: 60 - # optional ws_ping_interval_in_secs specifies the ping interval for the web-socket connection - ws_ping_interval_in_secs: 30 - # deploy_handler config - # changed from string "deployment_handler" in 2.3.1 to structure in 2.4.0 - deploy_handler : - # name of deployment-handler service used by policy-handler for logging - target_entity : "deployment_handler" - # url of the deployment-handler service for policy-handler to direct the policy-updates to - # - expecting dns to resolve the hostname deployment-handler to ip address - url : "http://deployment-handler:8188" - # limit the size of a single data segment for policy-update messages - # from policy-handler to deployment-handler in megabytes - max_msg_length_mb : 5 - query : - # optionally specify the tenant name for the cloudify under deployment-handler - # if not specified the "default_tenant" is used by the deployment-handler - cfy_tenant_name : "default_tenant" - # optional tls_ca_mode specifies where to find the cacert.pem or skip tls verification - # can be one of these: - # "cert_directory" - use the cacert.pem stored locally in cert_directory. - # this is the default if cacert.pem file is found - # - # "os_ca_bundle" - use the public ca_bundle provided by linux system. - # this is the default if cacert.pem file not found - # - # "do_not_verify" - special hack to turn off the verification by cacert and hostname - tls_ca_mode : "cert_directory" - # optional timeout_in_secs specifies the timeout for the http requests - timeout_in_secs: 60 diff --git a/input-templates/pom.xml b/input-templates/pom.xml deleted file mode 100644 index c0d7a75..0000000 --- a/input-templates/pom.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - 4.0.0 - - org.onap.dcaegen2.platform - blueprints - 1.2.0-SNAPSHOT - - org.onap.dcaegen2.platform.blueprints - input-templates - dcaegen2-platform-blueprints-input-templates - 1.0.0-SNAPSHOT - http://maven.apache.org - - - UTF-8 - true - . - - - - - py - Python - **/*.py - - - - - ${project.artifactId}-${project.version} - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - clean phase script - clean - - exec - - - - ${project.artifactId} - clean - - - - - generate-sources script - generate-sources - - exec - - - - ${project.artifactId} - generate-sources - - - - - compile script - compile - - exec - - - - ${project.artifactId} - compile - - - - - package script - package - - exec - - - - ${project.artifactId} - package - - - - - test script - test - - exec - - - - ${project.artifactId} - test - - - - - install script - install - - exec - - - - ${project.artifactId} - install - - - - - deploy script - deploy - - exec - - - - ${project.artifactId} - deploy - - - - - - - - diff --git a/input-templates/prh-input.json b/input-templates/prh-input.json deleted file mode 100644 index 5dab4f5..0000000 --- a/input-templates/prh-input.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dh_location_id": "{{ dcae_zone }}", - "docker_host_override": "component_dockerhost", - "prh_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.unauthenticated.PNF_READY/", - "prh_subscribe_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.VES_PNFREG_OUTPUT/", - "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.prh:1.2.2" -} diff --git a/input-templates/prh-input.yaml b/input-templates/prh-input.yaml deleted file mode 100644 index 6b54630..0000000 --- a/input-templates/prh-input.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= - -#aaiEnrichmentHost: '{{ aaiEnrichmentHost }}' -#aaiEnrichmentPort: '{{ aaiEnrichmentPort }}' -#aaiEnrichmentUser: '{{ aaiEnrichmentUser }}' -#aaiEnrichmentPasswd: '{{ aaiEnrichmentPasswd }}' -#dmaap_host: '{{ dmaap_host }}' -#dmaap_port: '{{ dmaap_port }}' -#dmaap_user: '{{ dmaap_user }}' -#dmaap_passwd: '{{ dmaap_passwd }}' -#tag_version: '{{ tag_version }}' -#replicas: '{{ replicas }}' \ No newline at end of file diff --git a/input-templates/snmptrap-input.json b/input-templates/snmptrap-input.json deleted file mode 100644 index b3be3df..0000000 --- a/input-templates/snmptrap-input.json +++ /dev/null @@ -1,7 +0,0 @@ - -{ - "dh_location_id": "{{ dcae_zone }}", - "docker_host_override": "component_dockerhost", - "snmp_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.ONAP-COLLECTOR-SNMPTRAP/", - "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.snmptrap:1.3" -} diff --git a/input-templates/tcadocker-input.json b/input-templates/tcadocker-input.json deleted file mode 100644 index 56a1681..0000000 --- a/input-templates/tcadocker-input.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "aaiEnrichmentHost": "{{ aai1_ip_addr }}", - "enableAAIEnrichment": true, - "subscriberHostName": "{{ mr_ip_addr }}", - "publisherHostName": "{{ mr_ip_addr }}", - "dh_location_id": "{{ dcae_zone }}", - "dh_override": "component_dockerhost", - "redisHosts": "{{ redis_ip_port_addr }}", - "enableRedisCaching": true, - "tag_version": "nexus3.onap.org:10001/onap/tca-cdap-container:1.0" -} diff --git a/input-templates/tcainputs.yaml b/input-templates/tcainputs.yaml deleted file mode 100644 index a4d3828..0000000 --- a/input-templates/tcainputs.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -aaiEnrichmentHost: '{{ aai1_ip_addr }}' -enableAAIEnrichment: true -subscriberHostName: '{{ mr_ip_addr }}' -publisherHostName: '{{ mr_ip_addr }}' diff --git a/input-templates/vesinput.yaml b/input-templates/vesinput.yaml deleted file mode 100644 index 8ddfb2c..0000000 --- a/input-templates/vesinput.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# ================================================================================ -# Copyright (c) 2017-2018 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. -# ============LICENSE_END========================================================= -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -{ - "dh_location_id": "{{ dcae_zone }}", - "dh_override": "component_dockerhost", - "ves_other_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_OTHER_OUTPUT/", - "ves_heartbeat_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_HEARTBEAT_OUTPUT/", - "ves_fault_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_FAULT_OUTPUT/", - "ves_measurement_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.SEC_MEASUREMENT_OUTPUT/", - "ves_pnfRegistration_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.VES_PNFREG_OUTPUT/", - "ves_notification_publish_url": "http://{{ mr_ip_addr }}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" -} diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index 892ea23..2f43cff 100755 --- a/mvn-phase-script.sh +++ b/mvn-phase-script.sh @@ -1,7 +1,7 @@ #!/bin/bash # ================================================================================ -# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2017-2020 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. @@ -60,7 +60,7 @@ if [ -z "$SETTINGS_FILE" ]; then echo "SETTINGS_FILE environment variable not set. Cannot proceed" exit fi - + # mvn phase in life cycle @@ -122,12 +122,7 @@ install) echo "==> install phase script" ;; deploy) - echo "==> deploy phase script" - if [ -z "$MVN_PROJECT_MODULEID" ]; then - upload_files_of_extension yaml - else - upload_files_of_extension yaml "$MVN_PROJECT_MODULEID" - fi + build_and_push_docker ;; *) echo "==> unprocessed phase" diff --git a/pom.xml b/pom.xml index c0caee5..9f97f47 100644 --- a/pom.xml +++ b/pom.xml @@ -25,16 +25,12 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. oparent 1.2.0 - org.onap.dcaegen2.platform - blueprints - dcaegen2-platform-blueprints - 1.2.0-SNAPSHOT + org.onap.dcaegen2.deployments + k8s-bootstrap-container + dcaegen2-deployments-k8s-bootstrap-container + 1.9.0-SNAPSHOT http://maven.apache.org pom - - blueprints - input-templates - https://nexus.onap.org @@ -92,7 +88,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. - org.apache.maven.plugins @@ -123,7 +119,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. - org.apache.maven.plugins @@ -173,5 +169,106 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + clean phase script + clean + + exec + + + + ${project.artifactId} + clean + + + + + generate-sources script + generate-sources + + exec + + + + ${project.artifactId} + generate-sources + + + + + compile script + compile + + exec + + + + ${project.artifactId} + compile + + + + + package script + package + + exec + + + + ${project.artifactId} + package + + + + + test script + test + + exec + + + + ${project.artifactId} + test + + + + + install script + install + + exec + + + + ${project.artifactId} + install + + + + + deploy script + deploy + + exec + + + + ${project.artifactId} + deploy + + + + + + diff --git a/blueprints/reference_templates/DeploymentHandler-README.md b/reference_templates/DeploymentHandler-README.md similarity index 100% rename from blueprints/reference_templates/DeploymentHandler-README.md rename to reference_templates/DeploymentHandler-README.md diff --git a/blueprints/reference_templates/DeploymentHandler.yaml-template b/reference_templates/DeploymentHandler.yaml-template similarity index 100% rename from blueprints/reference_templates/DeploymentHandler.yaml-template rename to reference_templates/DeploymentHandler.yaml-template diff --git a/blueprints/reference_templates/DockerBP.yaml-template b/reference_templates/DockerBP.yaml-template similarity index 100% rename from blueprints/reference_templates/DockerBP.yaml-template rename to reference_templates/DockerBP.yaml-template diff --git a/blueprints/reference_templates/README.txt b/reference_templates/README.txt similarity index 100% rename from blueprints/reference_templates/README.txt rename to reference_templates/README.txt diff --git a/blueprints/reference_templates/cdap-sdk.yaml-template b/reference_templates/cdap-sdk.yaml-template similarity index 100% rename from blueprints/reference_templates/cdap-sdk.yaml-template rename to reference_templates/cdap-sdk.yaml-template diff --git a/blueprints/reference_templates/cdap_broker.yaml-template b/reference_templates/cdap_broker.yaml-template similarity index 100% rename from blueprints/reference_templates/cdap_broker.yaml-template rename to reference_templates/cdap_broker.yaml-template diff --git a/blueprints/reference_templates/cdapbp7.yaml-template b/reference_templates/cdapbp7.yaml-template similarity index 100% rename from blueprints/reference_templates/cdapbp7.yaml-template rename to reference_templates/cdapbp7.yaml-template diff --git a/blueprints/reference_templates/centos_vm.yaml-template b/reference_templates/centos_vm.yaml-template similarity index 100% rename from blueprints/reference_templates/centos_vm.yaml-template rename to reference_templates/centos_vm.yaml-template diff --git a/blueprints/reference_templates/config_binding_service.yaml-template b/reference_templates/config_binding_service.yaml-template similarity index 100% rename from blueprints/reference_templates/config_binding_service.yaml-template rename to reference_templates/config_binding_service.yaml-template diff --git a/blueprints/reference_templates/consul_cluster.yaml-template b/reference_templates/consul_cluster.yaml-template similarity index 100% rename from blueprints/reference_templates/consul_cluster.yaml-template rename to reference_templates/consul_cluster.yaml-template diff --git a/blueprints/reference_templates/heartbeat-service.yaml-template b/reference_templates/heartbeat-service.yaml-template similarity index 100% rename from blueprints/reference_templates/heartbeat-service.yaml-template rename to reference_templates/heartbeat-service.yaml-template diff --git a/blueprints/reference_templates/holmes-engine.yaml-template b/reference_templates/holmes-engine.yaml-template similarity index 100% rename from blueprints/reference_templates/holmes-engine.yaml-template rename to reference_templates/holmes-engine.yaml-template diff --git a/blueprints/reference_templates/holmes-rules.yaml-template b/reference_templates/holmes-rules.yaml-template similarity index 100% rename from blueprints/reference_templates/holmes-rules.yaml-template rename to reference_templates/holmes-rules.yaml-template diff --git a/blueprints/reference_templates/inventory.yaml-template b/reference_templates/inventory.yaml-template similarity index 100% rename from blueprints/reference_templates/inventory.yaml-template rename to reference_templates/inventory.yaml-template diff --git a/blueprints/reference_templates/k8s-dashboard.yaml-template b/reference_templates/k8s-dashboard.yaml-template similarity index 100% rename from blueprints/reference_templates/k8s-dashboard.yaml-template rename to reference_templates/k8s-dashboard.yaml-template diff --git a/blueprints/reference_templates/k8s-datafile-collector.yaml-template b/reference_templates/k8s-datafile-collector.yaml-template similarity index 100% rename from blueprints/reference_templates/k8s-datafile-collector.yaml-template rename to reference_templates/k8s-datafile-collector.yaml-template diff --git a/blueprints/reference_templates/k8s-pgaas-database.yaml-template b/reference_templates/k8s-pgaas-database.yaml-template similarity index 100% rename from blueprints/reference_templates/k8s-pgaas-database.yaml-template rename to reference_templates/k8s-pgaas-database.yaml-template diff --git a/blueprints/reference_templates/k8s-pgaas-getdbinfo.yaml-template b/reference_templates/k8s-pgaas-getdbinfo.yaml-template similarity index 100% rename from blueprints/reference_templates/k8s-pgaas-getdbinfo.yaml-template rename to reference_templates/k8s-pgaas-getdbinfo.yaml-template diff --git a/blueprints/reference_templates/pgaas-cluster.yaml-template b/reference_templates/pgaas-cluster.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas-cluster.yaml-template rename to reference_templates/pgaas-cluster.yaml-template diff --git a/blueprints/reference_templates/pgaas-database.yaml-template b/reference_templates/pgaas-database.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas-database.yaml-template rename to reference_templates/pgaas-database.yaml-template diff --git a/blueprints/reference_templates/pgaas-disk.yaml-template b/reference_templates/pgaas-disk.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas-disk.yaml-template rename to reference_templates/pgaas-disk.yaml-template diff --git a/blueprints/reference_templates/pgaas-getdbinfo.yaml-template b/reference_templates/pgaas-getdbinfo.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas-getdbinfo.yaml-template rename to reference_templates/pgaas-getdbinfo.yaml-template diff --git a/blueprints/reference_templates/pgaas-onevm.yaml-template b/reference_templates/pgaas-onevm.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas-onevm.yaml-template rename to reference_templates/pgaas-onevm.yaml-template diff --git a/blueprints/reference_templates/pgaas.yaml-template b/reference_templates/pgaas.yaml-template similarity index 100% rename from blueprints/reference_templates/pgaas.yaml-template rename to reference_templates/pgaas.yaml-template diff --git a/blueprints/reference_templates/policy_handler.yaml-template b/reference_templates/policy_handler.yaml-template similarity index 100% rename from blueprints/reference_templates/policy_handler.yaml-template rename to reference_templates/policy_handler.yaml-template diff --git a/blueprints/reference_templates/prh-service.yaml-template b/reference_templates/prh-service.yaml-template similarity index 100% rename from blueprints/reference_templates/prh-service.yaml-template rename to reference_templates/prh-service.yaml-template diff --git a/blueprints/reference_templates/snmptrap-collector.yaml-template b/reference_templates/snmptrap-collector.yaml-template similarity index 100% rename from blueprints/reference_templates/snmptrap-collector.yaml-template rename to reference_templates/snmptrap-collector.yaml-template diff --git a/blueprints/reference_templates/tca.yaml-template b/reference_templates/tca.yaml-template similarity index 100% rename from blueprints/reference_templates/tca.yaml-template rename to reference_templates/tca.yaml-template diff --git a/blueprints/reference_templates/tcadocker-service.yaml-template b/reference_templates/tcadocker-service.yaml-template similarity index 100% rename from blueprints/reference_templates/tcadocker-service.yaml-template rename to reference_templates/tcadocker-service.yaml-template diff --git a/blueprints/reference_templates/test_dr_mr.yaml-template b/reference_templates/test_dr_mr.yaml-template similarity index 100% rename from blueprints/reference_templates/test_dr_mr.yaml-template rename to reference_templates/test_dr_mr.yaml-template diff --git a/blueprints/reference_templates/test_dr_pubsub.yaml-template b/reference_templates/test_dr_pubsub.yaml-template similarity index 100% rename from blueprints/reference_templates/test_dr_pubsub.yaml-template rename to reference_templates/test_dr_pubsub.yaml-template diff --git a/blueprints/reference_templates/test_mr_multipub.yaml-template b/reference_templates/test_mr_multipub.yaml-template similarity index 100% rename from blueprints/reference_templates/test_mr_multipub.yaml-template rename to reference_templates/test_mr_multipub.yaml-template diff --git a/blueprints/reference_templates/test_mr_multisub.yaml-template b/reference_templates/test_mr_multisub.yaml-template similarity index 100% rename from blueprints/reference_templates/test_mr_multisub.yaml-template rename to reference_templates/test_mr_multisub.yaml-template diff --git a/blueprints/reference_templates/test_mr_pubsub.yaml-template b/reference_templates/test_mr_pubsub.yaml-template similarity index 100% rename from blueprints/reference_templates/test_mr_pubsub.yaml-template rename to reference_templates/test_mr_pubsub.yaml-template diff --git a/blueprints/reference_templates/test_mr_pubsub_extra.yaml-template b/reference_templates/test_mr_pubsub_extra.yaml-template similarity index 100% rename from blueprints/reference_templates/test_mr_pubsub_extra.yaml-template rename to reference_templates/test_mr_pubsub_extra.yaml-template diff --git a/blueprints/reference_templates/ves.yaml-template b/reference_templates/ves.yaml-template similarity index 100% rename from blueprints/reference_templates/ves.yaml-template rename to reference_templates/ves.yaml-template diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100755 index 0000000..e47ccd6 --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,233 @@ +#!/bin/bash +# ================================================================================ +# Copyright (c) 2018-2020 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. +# ============LICENSE_END========================================================= + +# Install DCAE via Cloudify Manager +# Expects: +# CM address (IP or DNS) in CMADDR environment variable +# CM password in CMPASS environment variable (assumes user is "admin") +# ONAP common Kubernetes namespace in ONAP_NAMESPACE environment variable +# If DCAE components are deployed in a separate Kubernetes namespace, that namespace in DCAE_NAMESPACE variable. +# Consul address with port in CONSUL variable +# Plugin wagon files in /wagons +# Blueprints for components to be installed in /blueprints +# Input files for components to be installed in /inputs +# Configuration JSON files that need to be loaded into Consul in /dcae-configs +# Consul is installed in /opt/consul/bin/consul, with base config in /opt/consul/config/00consul.json +# Optionally, allows: +# CM protocol in CMPROTO environment variable (defaults to HTTP) +# CM port in CMPORT environment variable (defaults to 80) +# If CMPROTO is set to "https", bootstrap will use HTTPS to communicate with CM. Otherwise, +# it will use HTTP. +# If CMPROTO is set to "https", the script assumes the CA cert needed to verify the cert +# presented by CM is mounted at /certs/cacert.pem. + +# Set defaults for CM protocol and port +CMPROTO=${CMPROTO:-http} +CMPORT=${CMPORT:-80} + +# Set up additional parameters for using HTTPS +CFYTLS="" +CURLTLS="" +if [ $CMPROTO = "https" ] +then + CFYTLS="--rest-certificate /certs/cacert.pem --ssl" + CURLTLS="--cacert /certs/cacert.pem" +fi + +### FUNCTION DEFINITIONS ### + +# keep_running: Keep running after bootstrap finishes or after error +keep_running() { + echo $1 + sleep infinity & + wait +} + +# cm_hasany: Query Cloudify Manager and return 0 (true) if there are any entities matching the query +# Used to see if something is already present on CM +# $1 -- query fragment, for instance "plugins?archive_name=xyz.wgn" to get +# the number of plugins that came from the archive file "xyz.wgn" +function cm_hasany { + # We use _include=id to limit the amount of data the CM sends back + # We rely on the "metadata.pagination.total" field in the response + # for the total number of matching entities + COUNT=$(curl -Ss -H "Tenant: default_tenant" --user admin:${CMPASS} ${CURLTLS} "${CMPROTO}://${CMADDR}:${CMPORT}/api/v3.1/$1&_include=id" \ + | /bin/jq .metadata.pagination.total) + if (( $COUNT > 0 )) + then + return 0 + else + return 1 + fi +} + +# deploy: Deploy components if they're not already deployed +# $1 -- name (for bp and deployment) +# $2 -- blueprint file name +# $3 -- inputs file name (optional) +function deploy { + # Don't crash the script on error + set +e + + # Upload blueprint if it's not already there + if cm_hasany "blueprints?id=$1" + then + echo blueprint $1 is already installed on ${CMADDR} + else + cfy blueprints upload -b $1 /blueprints/$2 + fi + + # Create deployment if it doesn't already exist + if cm_hasany "deployments?id=$1" + then + echo deployment $1 has already been created on ${CMADDR} + else + INPUTS= + if [ -n "$3" ] + then + INPUTS="-i/inputs/$3" + fi + cfy deployments create -b $1 ${INPUTS} $1 + fi + + # Run the install workflow if it hasn't been run already + # We don't have a completely certain way of determining this. + # We check to see if the deployment has any node instances + # that are in the 'uninitialized' or 'deleted' states. (Note that + # the & in the query acts as a logical OR for the multiple state values.) + # We'll try to install when a deployment has node instances in those states + if cm_hasany "node-instances?deployment_id=$1&state=uninitialized&state=deleted" + then + cfy executions start -d $1 install + else + echo deployment $1 appears to have had an install workflow executed already or is not ready for an install + fi +} + +# Install plugin if it's not already installed +# $1 -- path to wagon file for plugin +function install_plugin { + ARCHIVE=$(basename $1) + # See if it's already installed + if cm_hasany "plugins?archive_name=$ARCHIVE" + then + echo plugin $1 already installed on ${CMADDR} + else + cfy plugin upload $1 + fi +} + +### END FUNCTION DEFINTIONS ### + +set -x + +# Make sure we keep the container alive after an error +trap keep_running ERR + +set -e + +# Consul service registration data +CBS_REG='{"ID": "dcae-cbs0", "Name": "config_binding_service", "Address": "config-binding-service", "Port": 10000}' +CBS_REG1='{"ID": "dcae-cbs1", "Name": "config-binding-service", "Address": "config-binding-service", "Port": 10000}' + +# Set up profile to access Cloudify Manager +cfy profiles use -u admin -t default_tenant -p "${CMPASS}" ${CFYTLS} "${CMADDR}" + +# Output status, for debugging purposes +cfy status + +# Check Consul readiness +# The readiness container waits for a "consul-server" container to be ready, +# but this isn't always enough. We need the Consul API to be up and for +# the cluster to be formed, otherwise our Consul accesses might fail. +# (Note in ONAP R2, we never saw a problem, but occasionally in R3 we +# have seen Consul not be fully ready, so we add these checks, originally +# used in the R1 HEAT-based deployment.) +# Wait for Consul API to come up +until curl http://${CONSUL}/v1/agent/services +do + echo Waiting for Consul API + sleep 60 +done +# Wait for a leader to be elected +until [[ "$(curl -Ss http://{$CONSUL}/v1/status/leader)" != '""' ]] +do + echo Waiting for leader + sleep 30 +done + +# Load configurations into Consul KV store +for config in /dcae-configs/*.json +do + # The basename of the file is the Consul key + key=$(basename ${config} .json) + # Strip out comments, empty lines + egrep -v "^#|^$" ${config} > /tmp/dcae-upload + curl -v -X PUT -H "Content-Type: application/json" --data-binary @/tmp/dcae-upload ${CONSUL}/v1/kv/${key} +done + +# Put service registrations into the local Consul configuration directory +for sr in CBS_REG CBS_REG1 +do + echo '{"service" : ' ${!sr} ' }'> /opt/consul/config/${sr}.json +done + +# Start the local consul agent instance +/opt/consul/bin/consul agent --config-dir /opt/consul/config 2>&1 | tee /opt/consul/consul.log & + +# Store the CM password into a Cloudify secret +cfy secret create -s ${CMPASS} cmpass + +# Load plugins onto CM +for wagon in /wagons/*.wgn +do + install_plugin ${wagon} +done + +# In some oversubscribed cloud environments, we have +# observed that even though the plugin installations appear +# to have completed, there are background installation tasks +# that might still be running. So we check for running system workflows +while cm_hasany "executions?is_system_workflow=true&status=pending&status=started&status=queued&status=scheduled" +do + echo "Waiting for running system workflows to complete" + sleep 15 +done + +# After this point, failures should not stop the script or block later commands +trap - ERR +set +e + +# Initialize the DCAE postgres instance +deploy pgaas_initdb k8s-pgaas-initdb.yaml k8s-pgaas-initdb-inputs.yaml + +# Deploy service components +# tca, ves, prh, hv-ves, datafile-collector can be deployed simultaneously +deploy tca k8s-tca.yaml k8s-tca-inputs.yaml & +deploy ves k8s-ves.yaml k8s-ves-inputs.yaml & +deploy prh k8s-prh.yaml k8s-prh-inputs.yaml & +deploy hv-ves k8s-hv-ves.yaml k8s-hv_ves-inputs.yaml & +# holmes_rules must be deployed before holmes_engine, but holmes_rules can go in parallel with other service components +deploy holmes_rules k8s-holmes-rules.yaml k8s-holmes_rules-inputs.yaml +deploy holmes_engine k8s-holmes-engine.yaml k8s-holmes_engine-inputs.yaml + +# Display deployments, for debugging purposes +cfy deployments list + +# Continue running +keep_running "Finished bootstrap steps." +echo "Exiting!" diff --git a/scripts/load-plugins.sh b/scripts/load-plugins.sh new file mode 100755 index 0000000..c67258e --- /dev/null +++ b/scripts/load-plugins.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# org.onap.dcae +# ================================================================================ +# Copyright (c) 2018-2020 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. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. + +# Pull plugin archives from repos +# $1 is the DCAE repo URL +# $2 is the CCSDK repo URL +# (This script runs at Docker image build time) +# +set -x +set -e +DEST=wagons + +# For DCAE, starting in R5, we pull down wagons directly +DCAEPLUGINFILES=\ +"\ +k8splugin/1.7.2/k8splugin-1.7.2-py27-none-linux_x86_64.wgn +relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn +clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn +dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn \ +" + +# For CCSDK, we pull down the wagon files directly +CCSDKPLUGINFILES=\ +"\ +plugins/pgaas-1.1.0-py27-none-any.wgn +plugins/dmaap-1.3.5-py27-none-any.wgn +plugins/sshkeyshare-1.0.0-py27-none-any.wgn +plugins/helm-4.0.0-py27-none-linux_x86_64.wgn +" + +# Copy a set of wagons from a repo +# $1 -- repo baseURL +# $2 -- list of paths to wagons in the repo +function get_wagons { + for wagon in $2 + do + target=$(basename ${wagon}) + curl -Ssf $1/${wagon} > ${DEST}/${target} + done +} + +mkdir ${DEST} +get_wagons $1 "${DCAEPLUGINFILES}" +get_wagons $2 "${CCSDKPLUGINFILES}" diff --git a/input-templates/cdap-sdk-inputs.yaml b/scripts/uninstall.sh old mode 100644 new mode 100755 similarity index 54% rename from input-templates/cdap-sdk-inputs.yaml rename to scripts/uninstall.sh index e55c796..71f8161 --- a/input-templates/cdap-sdk-inputs.yaml +++ b/scripts/uninstall.sh @@ -1,3 +1,4 @@ +#!/bin/bash # ================================================================================ # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ @@ -13,10 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============LICENSE_END========================================================= + +# Clean up DCAE during ONAP uninstall + +set -x +set +e + +# Leave the Consul cluster +/opt/consul/bin/consul leave + +# Uninstall components managed by Cloudify +# Get the list of deployment ids known to Cloudify via curl to Cloudify API. +# The output of the curl is JSON that looks like {"items" :[{"id": "config_binding_service"}, ...], "metadata" :{...}} # -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -{ - "dh_location_id": "{{ dcae_zone }}", - "dh_override": "component_dockerhost", - "cdap_cluster_name": "cdap" -} +# jq gives us the just the deployment ids (e.g., "config_binding_service"), one per line +# +# xargs -I lets us run the cfy uninstall command once for each deployment id extracted by jq + +curl -Ss --user admin:$CMPASS -H "Tenant: default_tenant" "$CMADDR/api/v3.1/deployments?_include=id" \ +| /bin/jq .items[].id \ +| xargs -I % sh -c 'cfy uninstall %'