diff options
88 files changed, 12299 insertions, 0 deletions
diff --git a/mod2/helm-generator/.gitignore b/mod2/helm-generator/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/mod2/helm-generator/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/mod2/helm-generator/Changelog.md b/mod2/helm-generator/Changelog.md new file mode 100644 index 0000000..d38f0b4 --- /dev/null +++ b/mod2/helm-generator/Changelog.md @@ -0,0 +1,11 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [1.0.0] + +* Helm chart generator seed code introduction
\ No newline at end of file diff --git a/mod2/helm-generator/README.md b/mod2/helm-generator/README.md new file mode 100644 index 0000000..6304ebb --- /dev/null +++ b/mod2/helm-generator/README.md @@ -0,0 +1,20 @@ +## Instructions for running helm chart generator +version: 1.0.0-SNAPSHOT + +1. Must have helm installed. + +2. Run `mvn clean package` to build and package the code. + +3. Run main class `HelmChartGeneratorApplication` with parameters added to configuration properties, set in the following order: + 1. Spec file location + 2. Chart directory location + 3. Output directory location + 4. Component spec schema (Optional) + 5. --distribute flag (Optional) + 6. --help (to see usage) + + Arguments expected as: `<somePath/spec.json> <somePath/chartDirectory> <somePath/outputDirectory> <somepath/specSchema.json> --distribute` + + Test files currently included in project: + - Spec file: `helm-chart-generator\src\test\input\specs\ves.json` + - Charts Directory: `helm-chart-generator\src\test\input\blueprint`
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/pom.xml b/mod2/helm-generator/helmchartgenerator-cli/pom.xml new file mode 100644 index 0000000..3c6de24 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.dcaegen2.platform</groupId> + <artifactId>helmchartgenerator</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <artifactId>helmchartgenerator-cli</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>helmchartgenerator-cli</name> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>org.onap.dcaegen2.platform</groupId> + <artifactId>helmchartgenerator-core</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplication.java b/mod2/helm-generator/helmchartgenerator-cli/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplication.java new file mode 100644 index 0000000..617947f --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplication.java @@ -0,0 +1,97 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import lombok.extern.slf4j.Slf4j; +import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ChartBuilder; +import org.onap.dcaegen2.platform.helmchartgenerator.distribution.ChartDistributor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.core.io.ClassPathResource; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Main class to run the application. + * @author Dhrumin Desai + */ +@SpringBootApplication +@Slf4j +public class HelmChartGeneratorApplication implements CommandLineRunner { + + @Autowired + private final ChartBuilder builder; + + @Autowired + private final ChartDistributor distributor; + + public HelmChartGeneratorApplication(ChartBuilder builder, ChartDistributor distributor) { + this.builder = builder; + this.distributor = distributor; + } + + public static void main(String[] args) { + SpringApplication.run(HelmChartGeneratorApplication.class, args); + } + + @Override + public void run(String... args) throws Exception { + List<String> argList = new ArrayList<>(Arrays.asList(args)); + boolean isDistribute = false; + if(argList.contains("--help") || argList.size() < 3){ + printUsage(); + return; + } + if(argList.contains("--distribute")){ + isDistribute = true; + argList.remove("--distribute"); + } + + log.info("STARTED HELM GENERATION:"); + final File chartPackage = builder.build(argList.get(0), argList.get(1), argList.get(2), + getSpecSchemaLocation(argList)); + if(isDistribute) { + log.info("Distributing.."); + distributor.distribute(chartPackage); + } + } + + private String getSpecSchemaLocation(List<String> argList) { + String specSchemaLocation; + try { + specSchemaLocation = argList.get(3); + } + catch (Exception e) { + specSchemaLocation = ""; + } + return specSchemaLocation; + } + + private void printUsage() throws IOException { + InputStream inputStream = new ClassPathResource("Usage.txt").getInputStream(); + log.info(new String(inputStream.readAllBytes())); + } +} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/main/resources/Usage.txt b/mod2/helm-generator/helmchartgenerator-cli/src/main/resources/Usage.txt new file mode 100644 index 0000000..7aaec03 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/main/resources/Usage.txt @@ -0,0 +1,32 @@ + +Helm Chart Generator: + +- generate a helm chart from the base helm template and parsed component spec file. +- distribute a helm chart to Chartmuseum + +Environment variables: + +| Name | Description | +|------------------------------------|-----------------------------------------------------------------------------------| +| $CHARTMUSEUM_BASEURL | set a Chartmuseum base url for chart distribution. | +| $CHARTMUSEUM_AUTH_BASIC_USERNAME | set a Chartmuseum username for the basic auth. | +| $CHARTMUSEUM_AUTH_BASIC_PASSWORD | set a Chartmuseum password for the basic auth. | + +Requirements: + +- Helm Chart Generator uses 'helm' command installed on the host machine, so 'helm' command must be installed. +- For the distribution, $CHARTMUSEUM_BASEURL, $CHARTMUSEUM_AUTH_BASIC_USERNAME and $CHARTMUSEUM_AUTH_BASIC_PASSWORD + must be set. + +Usage: + helmchartgenerator-<jar-version>.jar <args> (with JAR) + OR + HelmChartGeneratorApplication.java <args> (with the main class) + + - Arguments must be passed in the numeric order mentioned below. +Arguments: + 1. Spec file location (Required) + 2. Chart directory location (helm template location) (Required) + 3. Output directory location (Required) + 4. Component spec schema (Optional) (Note: Default componentSpec schema will be used if not passed.) + 5. --distribute flag (Optional) diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/addons/templates/certificates.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/addons/templates/certificates.yaml new file mode 100644 index 0000000..a871343 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/addons/templates/certificates.yaml @@ -0,0 +1,21 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ if and .Values.certDirectory .Values.global.cmpv2Enabled .Values.global.CMPv2CertManagerIntegration }} +{{ include "certManagerCertificate.certificate" . }} +{{ end }} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/Chart.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/Chart.yaml new file mode 100644 index 0000000..239978f --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/Chart.yaml @@ -0,0 +1,39 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 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========================================================= + +apiVersion: v2 +appVersion: "Honolulu" +description: TBD +name: TBD +version: TBD + +dependencies: + - name: common + version: ~8.x-0 + repository: '@local' + - name: repositoryGenerator + version: ~8.x-0 + repository: '@local' + - name: readinessCheck + version: ~8.x-0 + repository: '@local' + - name: dcaegen2-services-common + version: ~8.x-0 + repository: '@local' + - name: postgres + version: ~8.x-0 + repository: '@local' + condition: postgres.enabled diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/configmap.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/configmap.yaml new file mode 100644 index 0000000..eaa7f34 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/configmap.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "dcaegen2-services-common.configMap" . }} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/deployment.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/deployment.yaml new file mode 100644 index 0000000..6d554d3 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/deployment.yaml @@ -0,0 +1,18 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} +{{ include "dcaegen2-services-common.microserviceDeployment" . }}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/secret.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/secret.yaml new file mode 100644 index 0000000..2162630 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/secret.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "common.secretFast" . }} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/service.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/service.yaml new file mode 100644 index 0000000..115398a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/templates/service.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "common.service" . }} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/values.yaml b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/values.yaml new file mode 100644 index 0000000..e83afd3 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/blueprint/base/values.yaml @@ -0,0 +1,96 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 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========================================================= + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + nodePortPrefixExt: 304 + +################################################################# +# Filebeat configuration defaults. +################################################################# +filebeatConfig: + logstashServiceName: log-ls + logstashPort: 5044 + +################################################################# +# initContainer images. +################################################################# +tlsImage: onap/org.onap.dcaegen2.deployments.tls-init-container:2.1.0 +consulLoaderImage: onap/org.onap.dcaegen2.deployments.consul-loader-container:1.1.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +image: TBD #DONE +pullPolicy: Always + +#policy sync image +dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1 + +#postgres enable/disable +postgres: + enabled: false + +# log directory where logging sidecar should look for log files +# if absent, no sidecar will be deployed +#logDirectory: TBD #/opt/app/VESCollector/logs #DONE + +# directory where TLS certs should be stored +# if absent, no certs will be retrieved and stored +#certDirectory: TBD #/opt/app/dcae-certificate #DONE + +# TLS role -- set to true if microservice acts as server +# If true, an init container will retrieve a server cert +# and key from AAF and mount them in certDirectory. +#tlsServer: TBD #DONE + +# dependencies +readinessCheck: + wait_for: + - dcae-config-binding-service + - aaf-cm + +# probe configuration #NEED DISCUSSION +readiness: + initialDelaySeconds: TBD + periodSeconds: TBD + path: TBD + scheme: TBD + port: TBD + +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 2 + memory: 2Gi + requests: + cpu: 1 + memory: 1Gi + large: + limits: + cpu: 4 + memory: 4Gi + requests: + cpu: 2 + memory: 2Gi + unlimited: {} diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoHelm.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoHelm.json new file mode 100644 index 0000000..f5e27f6 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoHelm.json @@ -0,0 +1,419 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "healthcheck": { + "type": "http", + "interval": 15, + "timeout": 1, + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoServices.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoServices.json new file mode 100644 index 0000000..eb5010a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecNoServices.json @@ -0,0 +1,432 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + } + }, + "healthcheck": { + "type": "http", + "interval": 15, + "timeout": 1, + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecSchema.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecSchema.json new file mode 100644 index 0000000..c15abde --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/invalidSpecSchema.json @@ -0,0 +1,382 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/schemas/component-spec-schema.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/schemas/component-spec-schema.json new file mode 100644 index 0000000..9b7fe77 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/schemas/component-spec-schema.json @@ -0,0 +1,1158 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Component specification schema", + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "version": { + "$ref": "#/definitions/version" + }, + "description": { + "type": "string" + }, + "component_type": { + "type": "string", + "enum": [ + "docker", + "cdap" + ] + }, + "name": { + "$ref": "#/definitions/name" + } + }, + "required": [ + "version", + "name", + "description", + "component_type" + ] + }, + "streams": { + "type": "object", + "properties": { + "publishes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/publisher_http" + }, + { + "$ref": "#/definitions/publisher_message_router" + }, + { + "$ref": "#/definitions/publisher_data_router" + }, + { + "$ref": "#/definitions/publisher_kafka" + } + ] + } + }, + "subscribes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/subscriber_http" + }, + { + "$ref": "#/definitions/subscriber_message_router" + }, + { + "$ref": "#/definitions/subscriber_data_router" + }, + { + "$ref": "#/definitions/subscriber_kafka" + } + ] + } + } + }, + "required": [ + "publishes", + "subscribes" + ] + }, + "services": { + "type": "object", + "properties": { + "calls": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/caller" + } + }, + "provides": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/provider" + } + } + }, + "required": [ + "calls", + "provides" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/definitions/docker-parameters" + }, + { + "$ref": "#/definitions/cdap-parameters" + } + ] + }, + "auxilary": { + "oneOf": [ + { + "$ref": "#/definitions/auxilary_cdap" + }, + { + "$ref": "#/definitions/auxilary_docker" + } + ] + }, + "artifacts": { + "type": "array", + "description": "List of component artifacts", + "items": { + "$ref": "#/definitions/artifact" + } + }, + "policy_info": { + "type": "object", + "properties": { + "policy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "node_label": { + "type": "string" + }, + "policy_id": { + "type": "string" + }, + "policy_model_id": { + "type": "string" + } + }, + "required": [ + "node_label", + "policy_model_id" + ] + } + } + }, + "additionalProperties": false + } + }, + "required": [ + "self", + "streams", + "services", + "parameters", + "auxilary", + "artifacts" + ], + "additionalProperties": false, + "definitions": { + "cdap-parameters": { + "description": "There are three seperate ways to pass parameters to CDAP: app config, app preferences, program preferences. These are all treated as optional.", + "type": "object", + "properties": { + "program_preferences": { + "description": "A list of {program_id, program_type, program_preference} objects where program_preference is an object passed into program_id of type program_type", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/program_preference" + } + }, + "app_preferences": { + "description": "Parameters Passed down to the CDAP preference API", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "app_config": { + "description": "Parameters Passed down to the CDAP App Config", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + } + }, + "program_preference": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/program_type" + }, + "program_id": { + "type": "string" + }, + "program_pref": { + "description": "Parameters that the CDAP developer wants pushed to this program's preferences API. Optional", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + }, + "required": [ + "program_type", + "program_id", + "program_pref" + ] + }, + "program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "docker-parameters": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/parameter-list" + }, + { + "$ref": "#/definitions/parameter-other" + } + ] + }, + "parameter-list": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "Only valid type is list, the entry_schema is required - which contains the type of the list element. All properties set for the parameter apply to all elements in the list at this time", + "type": "string", + "enum": [ + "list" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional property used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is list. This is the only type it is currently supported for.", + "type": "object", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/list-parameter" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable by DevOps in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "policy_editable", + "sourced_at_deployment", + "entry_schema" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "parameter-other": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "description": "An optional property used to define policy_editable parameters as lists or maps", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "sourced_at_deployment", + "policy_editable" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "list-parameter": { + "type": "object", + "properties": { + "type": { + "description": "The required data type for each parameter in the list.", + "type": "string", + "enum": [ + "string", + "number" + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "policy_schema_parameter": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime", + "list", + "map" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional key that is used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is either list or map. If the type is list and the entry type is a simple type (string, number, boolean, datetime), follow with a simple string to describe the entry type. If the type is list and the entry type is a map, follow with an array to describe the keys for the entry map. If the type is list and the entry type is also list, this is not currently supported here. If the type is map, then follow with an array to describe the keys for this map. ", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "type" + ], + "additionalProperties": false + }, + "parameter-constraints": { + "type": "object", + "additionalProperties": false, + "properties": { + "equal": { + "description": "Constrains a property or parameter to a value equal to (‘=’) the value declared." + }, + "greater_than": { + "description": "Constrains a property or parameter to a value greater than (‘>’) the value declared.", + "type": "number" + }, + "greater_or_equal": { + "description": "Constrains a property or parameter to a value greater than or equal to (‘>=’) the value declared.", + "type": "number" + }, + "less_than": { + "description": "Constrains a property or parameter to a value less than (‘<’) the value declared.", + "type": "number" + }, + "less_or_equal": { + "description": "Constrains a property or parameter to a value less than or equal to (‘<=’) the value declared.", + "type": "number" + }, + "valid_values": { + "description": "Constrains a property or parameter to a value that is in the list of declared values.", + "type": "array" + }, + "length": { + "description": "Constrains the property or parameter to a value of a given length.", + "type": "number" + }, + "min_length": { + "description": "Constrains the property or parameter to a value to a minimum length.", + "type": "number" + }, + "max_length": { + "description": "Constrains the property or parameter to a value to a maximum length.", + "type": "number" + } + } + }, + "stream_message_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "message router", + "message_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "stream_kafka": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "kafka" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "publisher_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "subscriber_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "route", + "type" + ] + }, + "subscriber_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "subscriber_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + }, + "config_key": { + "description": "Data router subscribers require config info to setup their endpoints to handle requests. For example, needs username and password", + "type": "string" + } + }, + "required": [ + "format", + "version", + "route", + "type", + "config_key" + ] + }, + "subscriber_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "provider": { + "oneOf": [ + { + "$ref": "#/definitions/docker-provider" + }, + { + "$ref": "#/definitions/cdap-provider" + } + ] + }, + "cdap-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "service_name": { + "type": "string" + }, + "service_endpoint": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "service_name", + "service_endpoint", + "verb" + ] + }, + "docker-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "route": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "route" + ] + }, + "caller": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "config_key": { + "type": "string" + } + }, + "required": [ + "request", + "response", + "config_key" + ] + }, + "formatPair": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + } + } + }, + "name": { + "type": "string" + }, + "version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "artifact": { + "type": "object", + "description": "Component artifact object", + "properties": { + "uri": { + "type": "string", + "description": "Uri to artifact" + }, + "type": { + "type": "string", + "enum": [ + "jar", + "docker image" + ] + } + }, + "required": [ + "uri", + "type" + ] + }, + "auxilary_cdap": { + "title": "cdap component specification schema", + "type": "object", + "properties": { + "streamname": { + "type": "string" + }, + "artifact_name": { + "type": "string" + }, + "artifact_version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "namespace": { + "type": "string", + "description": "optional" + }, + "programs": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/cdap_program" + } + } + }, + "required": [ + "streamname", + "programs", + "artifact_name", + "artifact_version" + ] + }, + "cdap_program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "cdap_program": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/cdap_program_type" + }, + "program_id": { + "type": "string" + } + }, + "required": [ + "program_type", + "program_id" + ] + }, + "auxilary_docker": { + "title": "Docker component specification schema", + "type": "object", + "properties": { + "helm": { + "type": "object", + "properties": { + "applicationEnv": { + "type": "object" + }, + "service": { + "description": "Mapping for kubernetes services", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "NodePort", + "Cluster" + ] + }, + "name": { + "type": "string" + }, + "ports": { + "type": "array", + "items": { + "type": "object" + } + } + }, + "required": [ + "type", + "name", + "ports" + ] + } + }, + "required": [ + "service" + ] + }, + "healthcheck": { + "description": "Define the health check that Consul should perfom for this component", + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/docker_healthcheck_http" + }, + { + "$ref": "#/definitions/docker_healthcheck_script" + } + ] + }, + "ports": { + "description": "Port mapping to be used for Docker containers. Each entry is of the format <container port>:<host port>.", + "type": "array", + "items": { + "type": "string" + } + }, + "log_info": { + "description": "Component specific details for logging", + "type": "object", + "properties": { + "log_directory": { + "description": "The path in the container where the component writes its logs. If the component is following the EELF requirements, this would be the directory where the four EELF files are being written. (Other logs can be placed in the directory--if their names in '.log', they'll also be sent into ELK.)", + "type": "string" + }, + "alternate_fb_path": { + "description": "By default, the log volume is mounted at /var/log/onap/<component_type> in the sidecar container's file system. 'alternate_fb_path' allows overriding the default. Will affect how the log data can be found in the ELK system.", + "type": "string" + } + }, + "additionalProperties": false + }, + "tls_info": { + "description": "Component information to use tls certificates", + "type": "object", + "properties": { + "cert_directory": { + "description": "The path in the container where the component certificates will be placed by the init container", + "type": "string" + }, + "use_tls": { + "description": "Boolean flag to determine if the application is using tls certificates", + "type": "boolean" + }, + "use_external_tls": { + "description": "Boolean flag to determine if the application is using tls certificates for external communication", + "type": "boolean" + } + }, + "required": [ + "cert_directory", + "use_tls" + ], + "additionalProperties": false + }, + "databases": { + "description": "The databases the application is connecting to using the pgaas", + "type": "object", + "additionalProperties": { + "type": "string", + "enum": [ + "postgres" + ] + } + }, + "policy": { + "properties": { + "trigger_type": { + "description": "Only value of docker is supported at this time.", + "type": "string", + "enum": [ + "docker" + ] + }, + "script_path": { + "description": "Script command that will be executed for policy reconfiguration", + "type": "string" + } + }, + "required": [ + "trigger_type", + "script_path" + ], + "additionalProperties": false + }, + "volumes": { + "description": "Volume mapping to be used for Docker containers. Each entry is of the format below", + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/host_path_volume" + }, + { + "$ref": "#/definitions/config_map_volume" + } + ] + } + } + }, + "required": [ + "healthcheck" + ], + "additionalProperties": false + }, + "host_path_volume": { + "type": "object", + "properties": { + "host": { + "type": "object", + "path": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "host", + "container" + ] + }, + "config_map_volume": { + "type": "object", + "properties": { + "config_volume": { + "type": "object", + "name": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "config_volume", + "container" + ] + }, + "docker_healthcheck_http": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "http", + "https", + "HTTP", + "HTTPS" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "endpoint": { + "description": "Relative endpoint used by Consul to check health by making periodic HTTP GET calls", + "type": "string" + }, + "port": { + "description": "Port mapping for readiness section", + "type": "integer" + }, + "initialDelaySeconds": { + "description": "Initial delay in seconds for readiness section", + "type": "integer" + } + }, + "required": [ + "type", + "endpoint" + ] + }, + "docker_healthcheck_script": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "script", + "docker" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "script": { + "description": "Script command that will be executed by Consul to check health", + "type": "string" + } + }, + "required": [ + "type", + "script" + ] + } + } +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/ves.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/ves.json new file mode 100644 index 0000000..3829a1a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/ves.json @@ -0,0 +1,455 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + }, + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + }, + { + "name": "metrics", + "port": 4444, + "internal_only": true + } + ] + } + }, + "healthcheck": { + "type": "http", + "interval": "15s", + "timeout": "1s", + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + }, + "databases": { + + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vesWithDb.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vesWithDb.json new file mode 100644 index 0000000..207be6d --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vesWithDb.json @@ -0,0 +1,452 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + }, + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + }, + { + "name": "metrics", + "port": 4444, + "internal_only": true + } + ] + } + }, + "healthcheck": { + "type": "http", + "interval": "15s", + "timeout": "1s", + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vescollector-componentspec-v3-helm.json b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vescollector-componentspec-v3-helm.json new file mode 100644 index 0000000..30b05e5 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/input/specs/vescollector-componentspec-v3-helm.json @@ -0,0 +1,475 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + }, + "ves-measurement": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT" + }, + "type": "message_router" + }, + "ves-notification": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT" + }, + "type": "message_router" + }, + "ves-pnfRegistration": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_PNFREG_OUTPUT" + }, + "type": "message_router" + }, + "ves-heartbeat": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_HEARTBEAT_OUTPUT" + }, + "type": "message_router" + }, + "ves-other": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_OTHER_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-fault-supervision": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-provisioning": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-heartbeat": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-performance-assurance": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + } + ] + } + }, + "healthcheck": { + "type": "HTTP", + "interval": "15s", + "timeout": "1s", + "port": 8080, + "endpoint": "/healthcheck" + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls":true, + "use_external_tls": false + } + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +} + diff --git a/mod2/helm-generator/helmchartgenerator-cli/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplicationTests.java b/mod2/helm-generator/helmchartgenerator-cli/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplicationTests.java new file mode 100644 index 0000000..20b2c17 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-cli/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/HelmChartGeneratorApplicationTests.java @@ -0,0 +1,36 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.DisabledIf; + +/** + * Disabling the test as it is using 'helm' command from the local environment. + */ +@DisabledIf("true") +@SpringBootTest(args = {"src/test/input/specs/ves.json", "src/test/input/blueprint", "src/test/output/charts"}) +class HelmChartGeneratorApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/mod2/helm-generator/helmchartgenerator-core/pom.xml b/mod2/helm-generator/helmchartgenerator-core/pom.xml new file mode 100644 index 0000000..be8e39b --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/pom.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.dcaegen2.platform</groupId> + <artifactId>helmchartgenerator</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <artifactId>helmchartgenerator-core</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>helmchartgenerator-core</name> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java new file mode 100644 index 0000000..83c67b1 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/Utils.java @@ -0,0 +1,105 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Map; + +/** + * An utility class for various file related tasks. + * @author Dhrumin Desai + */ +@Slf4j +public class Utils { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private Utils() {} + + public static <T> T deserializeJsonFileToModel(String filePath, Class<T> modelClass) { + return deserializeJsonFileToModel(new File(filePath), modelClass); + } + + /** + * maps json file to a model class + * @param file Json file which holds the data + * @param modelClass target model class for mapping + * @return mapped model instance + */ + public static <T> T deserializeJsonFileToModel(File file, Class<T> modelClass) { + try { + return MAPPER.readValue(file, modelClass); + } catch (IOException e) { + log.error(e.getMessage()); + throw new RuntimeException("Error occurred while converting file to the given model class"); + } + } + + /** + * copies dir/file to a temp location on OS + * @param srcLocation + * @return + */ + public static File cloneFileToTempLocation(String srcLocation) { + File cloneLocation = null; + try { + Path tempRootDir = Files.createTempDirectory("chart"); + cloneLocation = new File(tempRootDir.toString()); + log.info("cloning dir/file at : " + tempRootDir); + FileUtils.copyDirectory(new File(srcLocation), cloneLocation); + } catch (IOException e) { + log.error(e.getMessage()); + throw new RuntimeException("Error occured while cloning file to temp location."); + } + return cloneLocation; + } + + /** + * deletes dir / file from temp location of OS + * @param dir dir to be deleted + */ + public static void deleteTempFileLocation(File dir) { + try { + FileUtils.deleteDirectory(dir); + } catch (IOException e) { + log.warn("Could not delete dir/file: " + dir.getAbsolutePath()); + } + } + + /** + * puts value into a map if only exists + * @param map a map + * @param key a key + * @param value a value + */ + public static void putIfNotNull(Map<String, Object> map, String key, Object value){ + if(value != null){ + map.put(key, value); + } + } + +} + diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java new file mode 100644 index 0000000..ac73544 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartBuilder.java @@ -0,0 +1,68 @@ + +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import lombok.extern.slf4j.Slf4j; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ChartTemplateStructureValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; + +/** + * ChartBuilder is a main class responsible to generate a helm chart. + * @author Dhrumin Desai + */ +@Component +@Slf4j +public class ChartBuilder { + + @Autowired + private ComponentSpecParser specParser; + + @Autowired + private ChartGenerator chartGenerator; + + /** + * constructor of ChartBuilder + * @param specParser implementation of ComponentSpecParser + * @param chartGenerator implementation of ChartGenerator + */ + public ChartBuilder(ComponentSpecParser specParser, ChartGenerator chartGenerator) { + this.specParser = specParser; + this.chartGenerator = chartGenerator; + } + + /** + * this method validates the inputs and generate a helm chart. + * @param specFileLocation location of the application specification json file + * @param chartTemplateLocation location of the base helm chart template + * @param outputLocation location to store the helm chart + * @param specSchemaLocation location of the specification json schema file to validate the application spec + * @return generated helm chart tgz file + * @throws Exception + */ + public File build(String specFileLocation, String chartTemplateLocation, String outputLocation, String specSchemaLocation ) throws Exception { + ChartTemplateStructureValidator.validateChartTemplateStructure(chartTemplateLocation); + ChartInfo chartInfo = specParser.extractChartInfo(specFileLocation, chartTemplateLocation, specSchemaLocation); + return chartGenerator.generate(chartTemplateLocation, chartInfo, outputLocation); + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java new file mode 100644 index 0000000..b9980d7 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ChartGenerator.java @@ -0,0 +1,73 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; + +import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.cloneFileToTempLocation; +import static org.onap.dcaegen2.platform.helmchartgenerator.Utils.deleteTempFileLocation; + +/** + * ChartGenerator interacts with HelmClient and generates a packaged helm chart + * @author Dhrumin Desai + */ +@Component +@Slf4j +public class ChartGenerator { + + @Setter + @Autowired + private HelmClient helmClient; + + @Setter + @Autowired + private KeyValueMerger merger; + + /** + * Constructor for ChartGenerator + * @param helmClient HelmClient implementation + * @param merger KeyValueMerger implementation + */ + public ChartGenerator(HelmClient helmClient, KeyValueMerger merger) { + this.helmClient = helmClient; + this.merger = merger; + } + + /** + * Merges the key-values from the helm base template and parsed spec file and generates a new packaged helm chart + * @param chartBlueprintLocation location of the base helm chart template + * @param chartInfo chartInfo object with key-values parsed from the specfile. + * @param outputLocation location to store the helm chart + * @return generated helm chart tgz file + */ + public File generate(String chartBlueprintLocation, ChartInfo chartInfo, String outputLocation) { + File newChartDir = cloneFileToTempLocation(chartBlueprintLocation + "/base"); + merger.mergeValuesToChart(chartInfo, newChartDir); + helmClient.lint(newChartDir); + final File chartLocation = helmClient.packageChart(newChartDir, outputLocation); + deleteTempFileLocation(newChartDir); + return chartLocation; + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java new file mode 100644 index 0000000..942e5ae --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/ComponentSpecParser.java @@ -0,0 +1,331 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import org.jetbrains.annotations.NotNull; +import org.onap.dcaegen2.platform.helmchartgenerator.Utils; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.Metadata; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base.ComponentSpec; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Artifacts; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.HealthCheck; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Parameters; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Policy; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.PolicyInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Self; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Service; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.TlsInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Volumes; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ComponentSpecValidator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * ComponentSpecParser reads a componentspec file and collects useful data for helm chart generation. + * @author Dhrumin Desai + */ +@Component +public class ComponentSpecParser { + + @Autowired + private ComponentSpecValidator specValidator; + + /** + * Constructor for ComponentSpecParser + * @param specValidator ComponentSpecValidator implementation + */ + public ComponentSpecParser(ComponentSpecValidator specValidator) { + this.specValidator = specValidator; + } + + /** + * + * @param specFileLocation location of the application specification json file + * @param chartTemplateLocation location of the base helm chart template + * @param specSchemaLocation location of the specification json schema file to validate the application spec + * @return ChartInfo object populated with key-values + * @throws Exception + */ + public ChartInfo extractChartInfo(String specFileLocation, String chartTemplateLocation, String specSchemaLocation) throws Exception { + specValidator.validateSpecFile(specFileLocation, specSchemaLocation); + ComponentSpec cs = Utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class); + ChartInfo chartInfo = new ChartInfo(); + chartInfo.setMetadata(extractMetadata(cs.getSelf())); + chartInfo.setValues(extractValues(cs, chartTemplateLocation)); + return chartInfo; + } + + private Map<String, Object> extractValues(ComponentSpec cs, String chartTemplateLocation) { + Map<String, Object> outerValues = new LinkedHashMap<>(); + if(cs.getAuxilary() != null && cs.getAuxilary().getTlsInfo() != null){ + Utils.putIfNotNull(outerValues,"certDirectory", cs.getAuxilary().getTlsInfo().getCertDirectory()); + Utils.putIfNotNull(outerValues, "tlsServer", cs.getAuxilary().getTlsInfo().getUseTls()); + } + if(cs.getAuxilary() != null && cs.getAuxilary().getLogInfo() != null) { + Utils.putIfNotNull(outerValues,"logDirectory", cs.getAuxilary().getLogInfo().get("log_directory")); + } + if(imageUriExistsForFirstArtifact(cs)){ + Utils.putIfNotNull(outerValues,"image", cs.getArtifacts()[0].getUri()); + } + populateApplicationConfigSection(outerValues, cs); + populateReadinessSection(outerValues, cs); + populateApplicationEnvSection(outerValues, cs); + populateServiceSection(outerValues, cs); + populateCertificatesSection(outerValues, cs, chartTemplateLocation); + populatePoliciesSection(outerValues, cs); + populateExternalVolumesSection(outerValues, cs); + populatePostgresSection(outerValues, cs); + populateSecretsSection(outerValues, cs); + return outerValues; + } + + private boolean imageUriExistsForFirstArtifact(ComponentSpec cs) { + final Artifacts[] artifacts = cs.getArtifacts(); + return artifacts != null && artifacts.length > 0 && artifacts[0].getUri() != null; + } + + private void populateApplicationConfigSection(Map<String, Object> outerValues, ComponentSpec cs) { + Map<String, Object> applicationConfig = new LinkedHashMap<>(); + Parameters[] parameters = cs.getParameters(); + for(Parameters param : parameters){ + applicationConfig.put(param.getName(), param.getValue()); + } + Utils.putIfNotNull(outerValues,"applicationConfig", applicationConfig); + } + + private void populateReadinessSection(Map<String, Object> outerValues, ComponentSpec cs) { + + if (!healthCheckExists(cs)) return; + + Map<String, Object> readiness = new LinkedHashMap<>(); + final HealthCheck healthcheck = cs.getAuxilary().getHealthcheck(); + Utils.putIfNotNull(readiness, "initialDelaySeconds", healthcheck.getInitialDelaySeconds()); + + if(healthcheck.getInterval() != null) { + readiness.put("periodSeconds", getSeconds(healthcheck.getInterval(), "interval")); + } + if(healthcheck.getTimeout() != null) { + readiness.put("timeoutSeconds", getSeconds(healthcheck.getTimeout(), "timeout")); + } + + readiness.put("path", healthcheck.getEndpoint()); + readiness.put("scheme", healthcheck.getType()); + readiness.put("port", healthcheck.getPort()); + + outerValues.put("readiness", readiness); + } + + private int getSeconds(String value, String field) { + int seconds = 0; + try { + seconds = Integer.parseInt(value.replaceAll("[^\\d.]", "")); + } + catch (NumberFormatException e){ + throw new RuntimeException(String.format("%s with %s is not given in a correct format", field, value)); + } + return seconds; + } + + private boolean healthCheckExists(ComponentSpec cs) { + return cs.getAuxilary() != null && + cs.getAuxilary().getHealthcheck() != null; + } + + private void populateApplicationEnvSection(Map<String, Object> outerValues, ComponentSpec cs){ + if(applicationEnvExists(cs)) { + Object applicationEnv = cs.getAuxilary().getHelm().getApplicationEnv(); + Utils.putIfNotNull(outerValues,"applicationEnv", applicationEnv); + } + } + + private boolean applicationEnvExists(ComponentSpec cs) { + return cs.getAuxilary() != null && + cs.getAuxilary().getHelm() != null && + cs.getAuxilary().getHelm().getApplicationEnv() != null; + } + + private void populateServiceSection(Map<String, Object> outerValues, ComponentSpec cs) { + if (!serviceExists(cs)) return; + + Map<String, Object> service = new LinkedHashMap<>(); + final Service serviceFromSpec = cs.getAuxilary().getHelm().getService(); + + if(serviceFromSpec.getPorts() != null){ + List<Object> ports = mapServicePorts(serviceFromSpec.getPorts()); + service.put("ports", ports); + Utils.putIfNotNull(service, "type", serviceFromSpec.getType()); + } + Utils.putIfNotNull(service,"name", serviceFromSpec.getName()); + Utils.putIfNotNull(service,"has_internal_only_ports", serviceFromSpec.getHasInternalOnlyPorts()); + outerValues.put("service", service); + } + + private boolean serviceExists(ComponentSpec cs) { + return cs.getAuxilary() != null && + cs.getAuxilary().getHelm() != null && + cs.getAuxilary().getHelm().getService() != null; + } + + private List<Object> mapServicePorts(Object[] ports) { + List<Object> portsList = new ArrayList<>(); + Collections.addAll(portsList, ports); + return portsList; + } + + private void populatePoliciesSection(Map<String, Object> outerValues, ComponentSpec cs) { + Map<String, Object> policies = new LinkedHashMap<>(); + final PolicyInfo policyInfo = cs.getPolicyInfo(); + if(policyInfo != null && policyInfo.getPolicy() != null) { + List<String> policyList = new ArrayList<>(); + for (Policy policyItem : policyInfo.getPolicy()) { + policyList.add('"' + policyItem.getPolicyID() + '"'); + } + policies.put("policyRelease", "onap"); + policies.put("duration", 300); + policies.put("policyID", "'" + policyList.toString() + "'\n"); + outerValues.put("policies", policies); + } + } + + private void populateCertificatesSection(Map<String, Object> outerValues, ComponentSpec cs, String chartTemplateLocation) { + Map<String, Object> certificate = new LinkedHashMap<>(); + Map<String, Object> keystore = new LinkedHashMap<>(); + Map<String, Object> passwordsSecretRef = new LinkedHashMap<>(); + TlsInfo tlsInfo = cs.getAuxilary().getTlsInfo(); + String componentName = getComponentNameWithOmitFirstWord(cs); + if(externalTlsExists(tlsInfo)) { + String mountPath = tlsInfo.getCertDirectory(); + if(tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls()) { + checkCertificateYamlExists(chartTemplateLocation); + mountPath += "external"; + } + passwordsSecretRef.put("name", componentName + "-cmpv2-keystore-password"); + passwordsSecretRef.put("key", "password"); + passwordsSecretRef.put("create", true); + keystore.put("outputType", List.of("jks")); + keystore.put("passwordSecretRef", passwordsSecretRef); + certificate.put("mountPath", mountPath); + Utils.putIfNotNull(certificate,"commonName", cs.getSelf().getName()); + Utils.putIfNotNull(certificate,"dnsNames", List.of(cs.getSelf().getName())); + certificate.put("keystore", keystore); + outerValues.put("certificates", List.of(certificate)); + } + } + + private String getComponentNameWithOmitFirstWord(ComponentSpec cs) { + return cs.getSelf().getName().substring(cs.getSelf().getName().indexOf("-") + 1); + } + + private boolean externalTlsExists(TlsInfo tlsInfo) { + return tlsInfo != null && tlsInfo.getUseExternalTls() != null && tlsInfo.getUseExternalTls().equals(true); + } + + private void checkCertificateYamlExists(String chartTemplateLocation) { + Path certificateYaml = Paths.get(chartTemplateLocation, "addons/templates/certificates.yaml"); + if(!Files.exists(certificateYaml)) { + throw new RuntimeException("certificates.yaml not found under templates directory in addons"); + } + } + + private void populateExternalVolumesSection(Map<String, Object> outerValues, ComponentSpec cs) { + if(cs.getAuxilary().getVolumes() != null) { + List<Object> externalVolumes = new ArrayList<>(); + Volumes[] volumes = cs.getAuxilary().getVolumes(); + for (Volumes volume : volumes) { + if(volume.getHost() == null) { + Map<String, Object> tempVolume = new LinkedHashMap<>(); + tempVolume.put("name", volume.getConfigVolume().getName()); + tempVolume.put("type", "configMap"); + tempVolume.put("mountPath", volume.getContainer().getBind()); + tempVolume.put("optional", true); + externalVolumes.add(tempVolume); + } + } + if(!externalVolumes.isEmpty()) { + outerValues.put("externalVolumes", externalVolumes); + } + } + } + + private void populatePostgresSection(Map<String, Object> outerValues, ComponentSpec cs) { + if(cs.getAuxilary().getDatabases() != null) { + String componentFullName = cs.getSelf().getName(); + String component = getComponentNameWithOmitFirstWord(cs); + Map<String, Object> postgres = new LinkedHashMap<>(); + Map<String, Object> service = new LinkedHashMap<>(); + Map<String, Object> container = new LinkedHashMap<>(); + Map<String, Object> name = new LinkedHashMap<>(); + Map<String, Object> persistence = new LinkedHashMap<>(); + Map<String, Object> config = new LinkedHashMap<>(); + service.put("name", componentFullName + "-postgres"); + service.put("name2", componentFullName + "-pg-primary"); + service.put("name3", componentFullName + "-pg-replica"); + name.put("primary", componentFullName + "-pg-primary"); + name.put("replica", componentFullName + "-pg-replica"); + container.put("name", name); + persistence.put("mountSubPath", componentFullName + "/data"); + persistence.put("mountInitPath", componentFullName); + config.put("pgUserName", component); + config.put("pgDatabase", component); + config.put("pgUserExternalSecret", "{{ include \"common.release\" . }}-" + component + "-pg-user-creds"); + + postgres.put("enabled", true); + postgres.put("nameOverride", componentFullName + "-postgres"); + postgres.put("service", service); + postgres.put("container", container); + postgres.put("persistence", persistence); + postgres.put("config", config); + outerValues.put("postgres", postgres); + } + } + + private void populateSecretsSection(Map<String, Object> outerValues, ComponentSpec cs) { + if(cs.getAuxilary().getDatabases() != null) { + String component = getComponentNameWithOmitFirstWord(cs); + List<Object> secrets = new ArrayList<>(); + Map<String, Object> secret = new LinkedHashMap<>(); + secret.put("uid", "pg-user-creds"); + secret.put("name", "{{ include \"common.release\" . }}-" + component + "-pg-user-creds"); + secret.put("type", "basicAuth"); + secret.put("externalSecret", "{{ ternary \"\" (tpl (default \"\" .Values.postgres.config.pgUserExternalSecret) .) (hasSuffix \"" + component + "-pg-user-creds\" .Values.postgres.config.pgUserExternalSecret) }}"); + secret.put("login", "{{ .Values.postgres.config.pgUserName }}"); + secret.put("password", "{{ .Values.postgres.config.pgUserPassword }}"); + secret.put("passwordPolicy", "generate"); + secrets.add(secret); + outerValues.put("secrets", secrets); + } + } + + private Metadata extractMetadata(Self self) { + Metadata metadata = new Metadata(); + metadata.setName(self.getName()); + metadata.setDescription(self.getDescription()); + metadata.setVersion(self.getVersion()); + return metadata; + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java new file mode 100644 index 0000000..bcfe731 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClient.java @@ -0,0 +1,31 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import java.io.File; + +/** + * An Interface for HelmClient to perform helm operations + * @author Dhrumin Desai + */ +public interface HelmClient { + void lint(File chartLocation); + + File packageChart(File chartLocation, String outputLocation); +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java new file mode 100644 index 0000000..098ddda --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/HelmClientImpl.java @@ -0,0 +1,119 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +/** + * HelmClient implementation which uses helm command installed in the runtime environment. + * @author Dhrumin Desai + */ +@Component +@Slf4j +public class HelmClientImpl implements HelmClient { + + /** + * performs <code>helm lint</code> operation + * @param chartLocation helm chart location + */ + @Override + public void lint(File chartLocation) { + ProcessBuilder builder = new ProcessBuilder(); + builder.command("helm", "lint", chartLocation.getAbsolutePath()); + runProcess(builder, "lint"); + } + + /** + * performs <code>helm package</code> operation + * @param chartLocation helm chart location + * @param outputLocation location to store the generated helm package + * @return generated helm tgz file + */ + @Override + public File packageChart(File chartLocation, String outputLocation) { + ProcessBuilder builder = new ProcessBuilder(); + builder.directory(new File(System.getProperty("user.dir"))); + builder.command("helm", "package", "-d", outputLocation, chartLocation.getAbsolutePath()); + return runProcess(builder, "package"); + } + + private File runProcess(ProcessBuilder builder, String command) { + Process process = null; + String chartPath = ""; + try { + process = builder.start(); + if(command.equals("lint")) { + printLintingProcessOutput(process); + } + else { + chartPath = printPackagingProcessOutput(process); + } + assertExitCode(process); + } catch (IOException e) { + log.error(e.getMessage(), e); + throw new RuntimeException("Error occurred while running helm command."); + } catch (InterruptedException e) { + log.error(e.getMessage(), e); + Thread.currentThread().interrupt(); + throw new RuntimeException("execution interrupted"); + } + return new File(chartPath); + } + + private void printLintingProcessOutput(Process process) throws IOException { + final InputStream inputStream = process.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + reader.lines().forEach(log::info); + inputStream.close(); + } + + private String printPackagingProcessOutput(Process process) throws IOException { + String helmChartPath = ""; + final InputStream inputStream = process.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = reader.readLine()) != null){ + if (line.contains("Successfully packaged chart and saved it to: ")){ + helmChartPath = line.split("Successfully packaged chart and saved it to: ")[1]; + } + log.info(line); + } + inputStream.close(); + if(helmChartPath.isEmpty()){ + throw new RuntimeException("Could not generate the chart."); + } + return helmChartPath; + } + + private void assertExitCode(Process process) throws InterruptedException { + int exitCode = 0; + exitCode = process.waitFor(); + process.destroy(); + if (exitCode != 0){ + throw new RuntimeException("Error occurred while running helm command."); + } + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java new file mode 100644 index 0000000..8a28871 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/chartbuilder/KeyValueMerger.java @@ -0,0 +1,94 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder; + +import lombok.extern.slf4j.Slf4j; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.yaml.snakeyaml.Yaml; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.nio.file.Paths; +import java.util.Map; + +/** + * KeyValueMerger merges helm base templates key-values with key-values parsed from component specification file + * @author Dhrumin Desai + */ +@Component +@Slf4j +public class KeyValueMerger { + + @Autowired + private Yaml yaml; + + public KeyValueMerger(Yaml yaml) { + this.yaml = yaml; + } + + /** + * merges helm base templates key-values with key-values parsed from component specification file + * @param chartInfo populated ChartInfo object which holds key-values parsed from component spec file + * @param chartDir location of the base helm chart template + */ + public void mergeValuesToChart(ChartInfo chartInfo, File chartDir) { + mergeChartYamlFile(chartInfo, chartDir); + mergeValuesYamlFile(chartInfo, chartDir); + } + + private void mergeChartYamlFile(ChartInfo chartInfo, File chartDir) { + String chartYamlFilePath = Paths.get(chartDir.getAbsolutePath(), "Chart.yaml").toString(); + checkIfFIleExists(chartYamlFilePath, "Chart.yaml is not found in the given chart template."); + + Map<String, Object> chartYamlKV; + try { + chartYamlKV = yaml.load(new FileInputStream(chartYamlFilePath)); + chartYamlKV.put("name", chartInfo.getMetadata().getName()); + chartYamlKV.put("version", chartInfo.getMetadata().getVersion()); + chartYamlKV.put("description", chartInfo.getMetadata().getDescription()); + yaml.dump(chartYamlKV, new PrintWriter(chartYamlFilePath)); + } catch (FileNotFoundException e) { + log.error(e.getMessage()); + } + } + + private void mergeValuesYamlFile(ChartInfo chartInfo, File chartDir) { + String valuesYamlFilePath = Paths.get(chartDir.getAbsolutePath(), "values.yaml").toString(); + checkIfFIleExists(valuesYamlFilePath, "values.yaml is not found in the given chart template."); + Map<String, Object> valuesYamlKv; + try { + valuesYamlKv = yaml.load(new FileInputStream(valuesYamlFilePath)); + valuesYamlKv.putAll(chartInfo.getValues()); + yaml.dump(valuesYamlKv, new PrintWriter(valuesYamlFilePath)); + } catch (FileNotFoundException e) { + log.error(e.getMessage()); + } + } + + private void checkIfFIleExists(String filePath, String message) { + File valuesYaml = new File(filePath); + if (!valuesYaml.exists()) { + throw new RuntimeException(message); + } + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java new file mode 100644 index 0000000..47a7fbd --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/config/YamlConfig.java @@ -0,0 +1,45 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.Yaml; + +/** + * Factory for Yaml object + * @author Dhrumin Desai + */ +@Configuration +public class YamlConfig { + + /** + * creates Yaml instance + * @return constructed Yaml object + */ + @Bean + public Yaml getYamlInstance(){ + DumperOptions options = new DumperOptions(); + options.setIndent(2); + options.setPrettyFlow(true); + options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + return new Yaml(options); + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java new file mode 100644 index 0000000..7bcfefa --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartDistributor.java @@ -0,0 +1,29 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.distribution; + +import java.io.File; + +/** + * An interface for the helm chart distribution + * @author Dhrumin Desai + */ +public interface ChartDistributor { + void distribute(File chartFile); +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java new file mode 100644 index 0000000..ed861b0 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/distribution/ChartMuseumDistributor.java @@ -0,0 +1,79 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.distribution; + +import lombok.extern.slf4j.Slf4j; +import okhttp3.Credentials; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.IOException; +import java.util.Objects; + +/** + * Distributes helm chart to Chart Museum through REST + * @author Dhrumin Desai + */ +@Component +@Slf4j +public class ChartMuseumDistributor implements ChartDistributor { + + @Value("${chartmuseum.baseurl}") + private String chartMuseumUrl; + + @Value("${chartmuseum.auth.basic.username}") + private String username; + + @Value("${chartmuseum.auth.basic.password}") + private String password; + + /** + * distributes chart to Chart Museum + * @param chartFile packaged helm chart tgz file + */ + @Override + public void distribute(File chartFile) { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + Request request = createRequestBody(chartFile); + try { + Response response = client.newCall(request).execute(); + log.info(Objects.requireNonNull(response.body()).string()); + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } + } + + private Request createRequestBody(File chartFile) { + String credential = Credentials.basic(username, password); + MediaType mediaType = MediaType.parse("application/octet-stream"); + RequestBody body = RequestBody.create(chartFile, mediaType); + return new Request.Builder() + .url(chartMuseumUrl) + .method("POST", body) + .addHeader("Content-Type", "application/octet-stream") + .addHeader("Authorization", credential) + .build(); + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java new file mode 100644 index 0000000..45b15a6 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/ChartInfo.java @@ -0,0 +1,35 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo; + +import lombok.Data; + +import java.util.Map; + +/** + * POJO class to hold key-values parsed from the spec file. + * @author Dhrumin Desai + */ +@Data +public class ChartInfo { + + private Metadata metadata; + + private Map<String, Object> values; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java new file mode 100644 index 0000000..00408b2 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/chartinfo/Metadata.java @@ -0,0 +1,32 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo; + +import lombok.Data; + +/** + * POJO class to hold metadata of a helm chart + * @author Dhrumin Desai + */ +@Data +public class Metadata { + private String name; + private String version; + private String description; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java new file mode 100644 index 0000000..2b8504a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/Auxilary.java @@ -0,0 +1,76 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.HealthCheck; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Helm; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Policy; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Reconfigs; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.TlsInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Volumes; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Auxilary of + * Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Auxilary { + + private Helm helm; + + private HealthCheck healthcheck; + + private HealthCheck livehealthcheck; + + private Volumes[] volumes; + + private List<String> ports; + + @JsonProperty("log_info") + private Map<String, String> logInfo; + + @JsonProperty("tls_info") + private TlsInfo tlsInfo; + + private Policy policy; + + private Reconfigs reconfigs; + + private List<LinkedHashMap<String, String>> env; + + @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) + private Map<String, String> databases; + + @JsonProperty( value = "hpa_config", access = JsonProperty.Access.WRITE_ONLY) + private Object hpaConfig; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java new file mode 100644 index 0000000..80fa9cc --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/base/ComponentSpec.java @@ -0,0 +1,54 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Artifacts; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Parameters; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.PolicyInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Self; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common.Streams; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents base + * ComponentSpec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ComponentSpec { + + private Self self; + + private Streams streams; + + private Parameters[] parameters; + + private Auxilary auxilary; + + private Artifacts[] artifacts; + + @JsonProperty("policy_info") + private PolicyInfo policyInfo; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java new file mode 100644 index 0000000..742102c --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Artifacts.java @@ -0,0 +1,41 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Artifacts + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Artifacts { + + private String type; + + private String uri; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java new file mode 100644 index 0000000..3e1eb2b --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Calls.java @@ -0,0 +1,43 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Calls used + * in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Calls { + + @JsonProperty("config_key") + private String configKey; + + private RequestResponse request; + + private RequestResponse response; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java new file mode 100644 index 0000000..2e095f7 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/ConfigVolume.java @@ -0,0 +1,34 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A model class which represents Config Volume + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class ConfigVolume { + + private String name; + +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java new file mode 100644 index 0000000..b6b89a0 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Constraints.java @@ -0,0 +1,61 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Constraints + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Constraints { + + private Object equal; + + @JsonProperty("greater_than") + private int greaterThan; + + @JsonProperty("greater_or_equal") + private int greaterOrEqual; + + @JsonProperty("less_than") + private int lessThan; + + @JsonProperty("less_or_equal") + private int lessOrEqual; + + @JsonProperty("valid_values") + private Object[] validValues; + + private int length; + + @JsonProperty("min_length") + private int minLength; + + @JsonProperty("max_length") + private int maxLength; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java new file mode 100644 index 0000000..7f7b1ce --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Container.java @@ -0,0 +1,39 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Container + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Container { + + private String bind; + + private String mode; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java new file mode 100644 index 0000000..7a1f97d --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/EntrySchema.java @@ -0,0 +1,47 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Entry Schema + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class EntrySchema { + + private String name; + + private String description; + + private String type; + + private String value; + + private EntrySchema[] entry_schema; + + private boolean required; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java new file mode 100644 index 0000000..7aa87fc --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/HealthCheck.java @@ -0,0 +1,54 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents HealthCheck + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class HealthCheck { + + private String interval; + + private String timeout; + + private String script; + + @JsonProperty(required = true) + private String type; + + @JsonProperty(required = true) + private String endpoint; + + private Integer initialDelaySeconds; + + private Integer port; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java new file mode 100644 index 0000000..b210e34 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Helm.java @@ -0,0 +1,35 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A model class which represents helm field in Component Spec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Helm { + private Object applicationEnv; + + private Service service; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java new file mode 100644 index 0000000..d987479 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Host.java @@ -0,0 +1,39 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Host used in + * Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@EqualsAndHashCode +public class Host { + + private String path; + + private String mode; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java new file mode 100644 index 0000000..633fa27 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Parameters.java @@ -0,0 +1,68 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Parameters + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Parameters { + + private String name; + + private Object value; + + private String description; + + @JsonProperty("sourced_at_deployment") + private boolean sourcedAtDeployment; + + @JsonProperty("designer_editable") + private boolean designerEditable; + + @JsonProperty("policy_editable") + private boolean policyEditable; + + private boolean required; + + private String type; + + @JsonProperty("policy_group") + private String policyGroup; + + @JsonProperty("policy_schema") + private PolicySchema[] policySchemas; + + @JsonProperty("entry_schema") + private EntrySchema[] entrySchemas; + + private Constraints[] constraints; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java new file mode 100644 index 0000000..b5aa2e5 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Policy.java @@ -0,0 +1,47 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy used + * in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Policy { + + @JsonProperty("node_label") + private String nodeLabel; + + @JsonProperty("policy_id") + private String policyID; + + @JsonProperty("policy_model_id") + private String policyModelID; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java new file mode 100644 index 0000000..444cbe0 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicyInfo.java @@ -0,0 +1,38 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A model class which represents policyInfo field in Component Spec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class PolicyInfo { + + private Policy[] policy; + +} + diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java new file mode 100644 index 0000000..b584af5 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/PolicySchema.java @@ -0,0 +1,51 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy + * Schema used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class PolicySchema { + + private String name; + + private String description; + + private String type; + + private String value; + + @JsonProperty("entry_schema") + private EntrySchema[] entrySchemas; + + private boolean required; + + private Constraints[] constraints; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java new file mode 100644 index 0000000..01c5186 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Provides.java @@ -0,0 +1,44 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Provides + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Provides { + + private String route; + + private RequestResponse request; + + private RequestResponse response; + + // Used in ONAP + private String verb; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java new file mode 100644 index 0000000..fa3bddc --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Publishes.java @@ -0,0 +1,50 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Publishes + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Publishes { + + @JsonProperty("config_key") + private String configKey; + + private String format; + + private String type; + + private String version; + + // Used in ONAP + private String route; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java new file mode 100644 index 0000000..0aa6b77 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Reconfigs.java @@ -0,0 +1,47 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Reconfigs + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Reconfigs { + + private String dti; + + @JsonProperty("app_reconfig") + private String appReconfig; + + private String policy; + + private String streams; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java new file mode 100644 index 0000000..c4e494b --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/RequestResponse.java @@ -0,0 +1,39 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Request + * Response used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class RequestResponse { + + private String format; + + private String version; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java new file mode 100644 index 0000000..b45b391 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Self.java @@ -0,0 +1,47 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Self used in + * Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Self { + + @JsonProperty("component_type") + private String componentType; + + private String description; + + private String name; + + private String version; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java new file mode 100644 index 0000000..1677896 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Service.java @@ -0,0 +1,43 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A model class which represents service field in Component Spec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties +@EqualsAndHashCode +public class Service { + private String type; + + private String name; + + @JsonProperty("has_internal_only_ports") + private Boolean hasInternalOnlyPorts; + + private Object[] ports; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java new file mode 100644 index 0000000..852e3cd --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Streams.java @@ -0,0 +1,41 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Streams used + * in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Streams { + + private Publishes[] publishes; + + private Subscribes[] subscribes; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java new file mode 100644 index 0000000..5e45d91 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Subscribes.java @@ -0,0 +1,49 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Subscribes + * used in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Subscribes { + + @JsonProperty("config_key") + private String configKey; + + private String format; + + private String route; + + private String type; + + private String version; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java new file mode 100644 index 0000000..a57b738 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/TlsInfo.java @@ -0,0 +1,43 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * A model class which represents tlsInfo field in Component Spec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties +@EqualsAndHashCode +public class TlsInfo { + @JsonProperty("cert_directory") + private String certDirectory; + + @JsonProperty("use_tls") + private Boolean useTls; + + @JsonProperty("use_external_tls") + private Boolean useExternalTls; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java new file mode 100644 index 0000000..cf4539b --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/models/componentspec/common/Volumes.java @@ -0,0 +1,49 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.common; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author : Ravi Mantena + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP + * and DCAE Blueprint Applications Component Spec Model: A model class which represents Volumes used + * in Componentspec + */ +@Data +@JsonInclude(value = JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@EqualsAndHashCode +public class Volumes { + + private Container container; + + private Host host; + + @JsonProperty("config_volume") + private ConfigVolume configVolume; + + private String type; + + private String name; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java new file mode 100644 index 0000000..796ee91 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ChartTemplateStructureValidator.java @@ -0,0 +1,60 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.validation; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * A class to validate structure of the base helm directory + */ +public class ChartTemplateStructureValidator { + + /** + * validates base helm chart directory and throws error if the structure is not proper. + * @param chartTemplateLocation base helm chart dir location + */ + public static void validateChartTemplateStructure(String chartTemplateLocation) { + checkBaseDirectory(chartTemplateLocation); + } + + private static void checkBaseDirectory(String chartTemplateLocation) { + Path base = Paths.get(chartTemplateLocation, "base"); + Path charts = Paths.get(chartTemplateLocation, "base/charts"); + Path templates = Paths.get(chartTemplateLocation, "base/templates"); + Path chart = Paths.get(chartTemplateLocation, "base/Chart.yaml"); + Path values = Paths.get(chartTemplateLocation, "base/values.yaml"); + if(!Files.exists(base)){ + throw new RuntimeException("base directory not found in chart template location"); + } + if(!Files.exists(charts)){ + throw new RuntimeException("charts directory not found in base directory"); + } + if(!Files.exists(templates)){ + throw new RuntimeException("templates directory not found in base directory"); + } + if(!Files.exists(chart)){ + throw new RuntimeException("chart.yaml not found in base directory"); + } + if(!Files.exists(values)){ + throw new RuntimeException("values.yaml not found in base directory"); + } + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java new file mode 100644 index 0000000..dfda935 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidator.java @@ -0,0 +1,29 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.validation; + +import java.io.IOException; + +/** + * An interface for Component specification validator + * @author Dhrumin Desai + */ +public interface ComponentSpecValidator { + void validateSpecFile(String specFileLocation, String specSchemaLocation) throws IOException; +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java new file mode 100644 index 0000000..a74cab1 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/java/org/onap/dcaegen2/platform/helmchartgenerator/validation/ComponentSpecValidatorImpl.java @@ -0,0 +1,108 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator.validation; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.everit.json.schema.Schema; +import org.everit.json.schema.loader.SchemaLoader; +import org.json.JSONObject; +import org.json.JSONTokener; +import org.onap.dcaegen2.platform.helmchartgenerator.Utils; +import org.onap.dcaegen2.platform.helmchartgenerator.models.componentspec.base.ComponentSpec; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +/** + * A class for Component specification validation. + * @author Dhrumin Desai + */ +@Service +@Slf4j +public class ComponentSpecValidatorImpl implements ComponentSpecValidator { + + /** + * Validates the spec json file against schema and prints errors if found + * @param specFileLocation specification json file location + * @param specSchemaLocation json schema file location + * @throws IOException + */ + @Override + public void validateSpecFile(String specFileLocation, String specSchemaLocation) throws IOException { + File schemaFile = getSchemaFile(specSchemaLocation); + ComponentSpec cs = Utils.deserializeJsonFileToModel(specFileLocation, ComponentSpec.class); + validateSpecSchema(new File(specFileLocation), schemaFile); + validateHelmRequirements(cs); + } + + private File getSchemaFile(String specSchemaLocation) throws IOException { + if(specSchemaLocation.isEmpty()){ + return defaultSchemaFile(); + } + else{ + return new File(specSchemaLocation); + } + } + + private File defaultSchemaFile() throws IOException { + File schemaFile = File.createTempFile("schema", ".json"); + InputStream inputStream = new ClassPathResource("component-spec-schema.json").getInputStream(); + FileUtils.copyInputStreamToFile(inputStream, schemaFile); + return schemaFile; + } + + private void validateSpecSchema(File specFile, File schemaFile) { + try { + JSONTokener schemaData = new JSONTokener(new FileInputStream(schemaFile)); + JSONObject jsonSchema = new JSONObject(schemaData); + + JSONTokener jsonDataFile = new JSONTokener(new FileInputStream(specFile)); + JSONObject jsonObject = new JSONObject(jsonDataFile); + + Schema schemaValidator = SchemaLoader.load(jsonSchema); + schemaValidator.validate(jsonObject); + } catch (FileNotFoundException e) { + log.error(e.getMessage()); + throw new RuntimeException("Specfile or Schemafile not found."); + } + } + + private void validateHelmRequirements(ComponentSpec cs) { + checkHealthCheckSection(cs); + checkHelmSection(cs); + } + + private void checkHealthCheckSection(ComponentSpec cs) { + if(cs.getAuxilary().getHealthcheck().getPort() == null) { + throw new RuntimeException("port in healthcheck section is a required field but was not found"); + } + } + + private void checkHelmSection(ComponentSpec cs) { + if(cs.getAuxilary().getHelm() == null){ + throw new RuntimeException("helm section in component spec is required but was not found"); + } + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties new file mode 100644 index 0000000..df2005a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/application.properties @@ -0,0 +1,5 @@ +spring.main.web-application-type=NONE + +chartmuseum.baseurl=http://localhost:8081/api/charts +chartmuseum.auth.basic.username=TBD +chartmuseum.auth.basic.password=TBD
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json new file mode 100644 index 0000000..ddea3f0 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/main/resources/component-spec-schema.json @@ -0,0 +1,1162 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Component specification schema", + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "version": { + "$ref": "#/definitions/version" + }, + "description": { + "type": "string" + }, + "component_type": { + "type": "string", + "enum": [ + "docker", + "cdap" + ] + }, + "name": { + "$ref": "#/definitions/name" + } + }, + "required": [ + "version", + "name", + "description", + "component_type" + ] + }, + "streams": { + "type": "object", + "properties": { + "publishes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/publisher_http" + }, + { + "$ref": "#/definitions/publisher_message_router" + }, + { + "$ref": "#/definitions/publisher_data_router" + }, + { + "$ref": "#/definitions/publisher_kafka" + } + ] + } + }, + "subscribes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/subscriber_http" + }, + { + "$ref": "#/definitions/subscriber_message_router" + }, + { + "$ref": "#/definitions/subscriber_data_router" + }, + { + "$ref": "#/definitions/subscriber_kafka" + } + ] + } + } + }, + "required": [ + "publishes", + "subscribes" + ] + }, + "services": { + "type": "object", + "properties": { + "calls": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/caller" + } + }, + "provides": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/provider" + } + } + }, + "required": [ + "calls", + "provides" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/definitions/docker-parameters" + }, + { + "$ref": "#/definitions/cdap-parameters" + } + ] + }, + "auxilary": { + "oneOf": [ + { + "$ref": "#/definitions/auxilary_cdap" + }, + { + "$ref": "#/definitions/auxilary_docker" + } + ] + }, + "artifacts": { + "type": "array", + "description": "List of component artifacts", + "items": { + "$ref": "#/definitions/artifact" + } + }, + "policy_info": { + "type": "object", + "properties": { + "policy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "node_label": { + "type": "string" + }, + "policy_id": { + "type": "string" + }, + "policy_model_id": { + "type": "string" + } + }, + "required": [ + "node_label", + "policy_model_id" + ] + } + } + }, + "additionalProperties": false + } + }, + "required": [ + "self", + "streams", + "services", + "parameters", + "auxilary", + "artifacts" + ], + "additionalProperties": false, + "definitions": { + "cdap-parameters": { + "description": "There are three seperate ways to pass parameters to CDAP: app config, app preferences, program preferences. These are all treated as optional.", + "type": "object", + "properties": { + "program_preferences": { + "description": "A list of {program_id, program_type, program_preference} objects where program_preference is an object passed into program_id of type program_type", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/program_preference" + } + }, + "app_preferences": { + "description": "Parameters Passed down to the CDAP preference API", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "app_config": { + "description": "Parameters Passed down to the CDAP App Config", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + } + }, + "program_preference": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/program_type" + }, + "program_id": { + "type": "string" + }, + "program_pref": { + "description": "Parameters that the CDAP developer wants pushed to this program's preferences API. Optional", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + }, + "required": [ + "program_type", + "program_id", + "program_pref" + ] + }, + "program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "docker-parameters": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/parameter-list" + }, + { + "$ref": "#/definitions/parameter-other" + } + ] + }, + "parameter-list": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "Only valid type is list, the entry_schema is required - which contains the type of the list element. All properties set for the parameter apply to all elements in the list at this time", + "type": "string", + "enum": [ + "list" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional property used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is list. This is the only type it is currently supported for.", + "type": "object", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/list-parameter" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable by DevOps in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "policy_editable", + "sourced_at_deployment", + "entry_schema" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "parameter-other": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "description": "An optional property used to define policy_editable parameters as lists or maps", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "sourced_at_deployment", + "policy_editable" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "list-parameter": { + "type": "object", + "properties": { + "type": { + "description": "The required data type for each parameter in the list.", + "type": "string", + "enum": [ + "string", + "number" + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "policy_schema_parameter": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime", + "list", + "map" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional key that is used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is either list or map. If the type is list and the entry type is a simple type (string, number, boolean, datetime), follow with a simple string to describe the entry type. If the type is list and the entry type is a map, follow with an array to describe the keys for the entry map. If the type is list and the entry type is also list, this is not currently supported here. If the type is map, then follow with an array to describe the keys for this map. ", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "type" + ], + "additionalProperties": false + }, + "parameter-constraints": { + "type": "object", + "additionalProperties": false, + "properties": { + "equal": { + "description": "Constrains a property or parameter to a value equal to (‘=’) the value declared." + }, + "greater_than": { + "description": "Constrains a property or parameter to a value greater than (‘>’) the value declared.", + "type": "number" + }, + "greater_or_equal": { + "description": "Constrains a property or parameter to a value greater than or equal to (‘>=’) the value declared.", + "type": "number" + }, + "less_than": { + "description": "Constrains a property or parameter to a value less than (‘<’) the value declared.", + "type": "number" + }, + "less_or_equal": { + "description": "Constrains a property or parameter to a value less than or equal to (‘<=’) the value declared.", + "type": "number" + }, + "valid_values": { + "description": "Constrains a property or parameter to a value that is in the list of declared values.", + "type": "array" + }, + "length": { + "description": "Constrains the property or parameter to a value of a given length.", + "type": "number" + }, + "min_length": { + "description": "Constrains the property or parameter to a value to a minimum length.", + "type": "number" + }, + "max_length": { + "description": "Constrains the property or parameter to a value to a maximum length.", + "type": "number" + } + } + }, + "stream_message_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "message router", + "message_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "stream_kafka": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "kafka" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "publisher_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "subscriber_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "route", + "type" + ] + }, + "subscriber_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "subscriber_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + }, + "config_key": { + "description": "Data router subscribers require config info to setup their endpoints to handle requests. For example, needs username and password", + "type": "string" + } + }, + "required": [ + "format", + "version", + "route", + "type", + "config_key" + ] + }, + "subscriber_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "provider": { + "oneOf": [ + { + "$ref": "#/definitions/docker-provider" + }, + { + "$ref": "#/definitions/cdap-provider" + } + ] + }, + "cdap-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "service_name": { + "type": "string" + }, + "service_endpoint": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "service_name", + "service_endpoint", + "verb" + ] + }, + "docker-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "route": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "route" + ] + }, + "caller": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "config_key": { + "type": "string" + } + }, + "required": [ + "request", + "response", + "config_key" + ] + }, + "formatPair": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + } + } + }, + "name": { + "type": "string" + }, + "version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "artifact": { + "type": "object", + "description": "Component artifact object", + "properties": { + "uri": { + "type": "string", + "description": "Uri to artifact" + }, + "type": { + "type": "string", + "enum": [ + "jar", + "docker image" + ] + } + }, + "required": [ + "uri", + "type" + ] + }, + "auxilary_cdap": { + "title": "cdap component specification schema", + "type": "object", + "properties": { + "streamname": { + "type": "string" + }, + "artifact_name": { + "type": "string" + }, + "artifact_version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "namespace": { + "type": "string", + "description": "optional" + }, + "programs": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/cdap_program" + } + } + }, + "required": [ + "streamname", + "programs", + "artifact_name", + "artifact_version" + ] + }, + "cdap_program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "cdap_program": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/cdap_program_type" + }, + "program_id": { + "type": "string" + } + }, + "required": [ + "program_type", + "program_id" + ] + }, + "auxilary_docker": { + "title": "Docker component specification schema", + "type": "object", + "properties": { + "helm": { + "type": "object", + "properties": { + "applicationEnv": { + "type": "object" + }, + "service": { + "description": "Mapping for kubernetes services", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "NodePort", + "Cluster" + ] + }, + "name": { + "type": "string" + }, + "ports": { + "type": "array", + "items": { + "type": "object" + } + } + }, + "required": [ + "type", + "name", + "ports" + ] + } + }, + "required": [ + "service" + ] + }, + "healthcheck": { + "description": "Define the health check that Consul should perfom for this component", + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/docker_healthcheck_http" + }, + { + "$ref": "#/definitions/docker_healthcheck_script" + } + ] + }, + "ports": { + "description": "Port mapping to be used for Docker containers. Each entry is of the format <container port>:<host port>.", + "type": "array", + "items": { + "type": "string" + } + }, + "log_info": { + "description": "Component specific details for logging", + "type": "object", + "properties": { + "log_directory": { + "description": "The path in the container where the component writes its logs. If the component is following the EELF requirements, this would be the directory where the four EELF files are being written. (Other logs can be placed in the directory--if their names in '.log', they'll also be sent into ELK.)", + "type": "string" + }, + "alternate_fb_path": { + "description": "By default, the log volume is mounted at /var/log/onap/<component_type> in the sidecar container's file system. 'alternate_fb_path' allows overriding the default. Will affect how the log data can be found in the ELK system.", + "type": "string" + } + }, + "additionalProperties": false + }, + "tls_info": { + "description": "Component information to use tls certificates", + "type": "object", + "properties": { + "cert_directory": { + "description": "The path in the container where the component certificates will be placed by the init container", + "type": "string" + }, + "use_tls": { + "description": "Boolean flag to determine if the application is using tls certificates", + "type": "boolean" + }, + "use_external_tls": { + "description": "Boolean flag to determine if the application is using tls certificates for external communication", + "type": "boolean" + } + }, + "required": [ + "cert_directory", + "use_tls" + ], + "additionalProperties": false + }, + "databases": { + "description": "The databases the application is connecting to using the pgaas", + "type": "object", + "additionalProperties": { + "type": "string", + "enum": [ + "postgres" + ] + } + }, + "policy": { + "properties": { + "trigger_type": { + "description": "Only value of docker is supported at this time.", + "type": "string", + "enum": [ + "docker" + ] + }, + "script_path": { + "description": "Script command that will be executed for policy reconfiguration", + "type": "string" + } + }, + "required": [ + "trigger_type", + "script_path" + ], + "additionalProperties": false + }, + "volumes": { + "description": "Volume mapping to be used for Docker containers. Each entry is of the format below", + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/host_path_volume" + }, + { + "$ref": "#/definitions/config_map_volume" + } + ] + } + } + }, + "required": [ + "healthcheck" + ], + "additionalProperties": false + }, + "host_path_volume": { + "type": "object", + "properties": { + "host": { + "type": "object", + "path": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "host", + "container" + ] + }, + "config_map_volume": { + "type": "object", + "properties": { + "config_volume": { + "type": "object", + "name": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "config_volume", + "container" + ] + }, + "docker_healthcheck_http": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "http", + "https", + "HTTP", + "HTTPS" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "endpoint": { + "description": "Relative endpoint used by Consul to check health by making periodic HTTP GET calls", + "type": "string" + }, + "port": { + "description": "Port mapping for readiness section", + "type": "integer" + }, + "initialDelaySeconds": { + "description": "Initial delay in seconds for readiness section", + "type": "integer" + } + }, + "required": [ + "type", + "endpoint" + ] + }, + "docker_healthcheck_script": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "script", + "docker" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "script": { + "description": "Script command that will be executed by Consul to check health", + "type": "string" + }, + "initialDelaySeconds": { + "description": "Initial delay in seconds for readiness section", + "type": "integer" + } + }, + "required": [ + "type", + "script" + ] + } + } +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/addons/templates/certificates.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/addons/templates/certificates.yaml new file mode 100644 index 0000000..a871343 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/addons/templates/certificates.yaml @@ -0,0 +1,21 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ if and .Values.certDirectory .Values.global.cmpv2Enabled .Values.global.CMPv2CertManagerIntegration }} +{{ include "certManagerCertificate.certificate" . }} +{{ end }} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/Chart.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/Chart.yaml new file mode 100644 index 0000000..239978f --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/Chart.yaml @@ -0,0 +1,39 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 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========================================================= + +apiVersion: v2 +appVersion: "Honolulu" +description: TBD +name: TBD +version: TBD + +dependencies: + - name: common + version: ~8.x-0 + repository: '@local' + - name: repositoryGenerator + version: ~8.x-0 + repository: '@local' + - name: readinessCheck + version: ~8.x-0 + repository: '@local' + - name: dcaegen2-services-common + version: ~8.x-0 + repository: '@local' + - name: postgres + version: ~8.x-0 + repository: '@local' + condition: postgres.enabled diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/common-8.0.0.tgz b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/common-8.0.0.tgz Binary files differnew file mode 100644 index 0000000..910eedd --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/common-8.0.0.tgz diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/dcaegen2-services-common-8.0.0.tgz b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/dcaegen2-services-common-8.0.0.tgz Binary files differnew file mode 100644 index 0000000..0d1ca90 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/dcaegen2-services-common-8.0.0.tgz diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/postgres-8.0.0.tgz b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/postgres-8.0.0.tgz Binary files differnew file mode 100644 index 0000000..1618016 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/postgres-8.0.0.tgz diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/readinessCheck-8.0.0.tgz b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/readinessCheck-8.0.0.tgz Binary files differnew file mode 100644 index 0000000..2060b85 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/readinessCheck-8.0.0.tgz diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/repositoryGenerator-8.0.0.tgz b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/repositoryGenerator-8.0.0.tgz Binary files differnew file mode 100644 index 0000000..c8c5804 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/charts/repositoryGenerator-8.0.0.tgz diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/configmap.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/configmap.yaml new file mode 100644 index 0000000..eaa7f34 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/configmap.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "dcaegen2-services-common.configMap" . }} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/deployment.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/deployment.yaml new file mode 100644 index 0000000..6d554d3 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/deployment.yaml @@ -0,0 +1,18 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} +{{ include "dcaegen2-services-common.microserviceDeployment" . }}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/secret.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/secret.yaml new file mode 100644 index 0000000..2162630 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/secret.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "common.secretFast" . }} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/service.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/service.yaml new file mode 100644 index 0000000..115398a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/templates/service.yaml @@ -0,0 +1,19 @@ +{{/* + # ============LICENSE_START======================================================= + # Copyright (c) 2021 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========================================================= +*/}} + +{{ include "common.service" . }} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/values.yaml b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/values.yaml new file mode 100644 index 0000000..e83afd3 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/blueprint/base/values.yaml @@ -0,0 +1,96 @@ +# ============LICENSE_START======================================================= +# Copyright (c) 2021 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========================================================= + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + nodePortPrefixExt: 304 + +################################################################# +# Filebeat configuration defaults. +################################################################# +filebeatConfig: + logstashServiceName: log-ls + logstashPort: 5044 + +################################################################# +# initContainer images. +################################################################# +tlsImage: onap/org.onap.dcaegen2.deployments.tls-init-container:2.1.0 +consulLoaderImage: onap/org.onap.dcaegen2.deployments.consul-loader-container:1.1.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +image: TBD #DONE +pullPolicy: Always + +#policy sync image +dcaePolicySyncImage: onap/org.onap.dcaegen2.deployments.dcae-services-policy-sync:1.0.1 + +#postgres enable/disable +postgres: + enabled: false + +# log directory where logging sidecar should look for log files +# if absent, no sidecar will be deployed +#logDirectory: TBD #/opt/app/VESCollector/logs #DONE + +# directory where TLS certs should be stored +# if absent, no certs will be retrieved and stored +#certDirectory: TBD #/opt/app/dcae-certificate #DONE + +# TLS role -- set to true if microservice acts as server +# If true, an init container will retrieve a server cert +# and key from AAF and mount them in certDirectory. +#tlsServer: TBD #DONE + +# dependencies +readinessCheck: + wait_for: + - dcae-config-binding-service + - aaf-cm + +# probe configuration #NEED DISCUSSION +readiness: + initialDelaySeconds: TBD + periodSeconds: TBD + path: TBD + scheme: TBD + port: TBD + +# Resource Limit flavor -By Default using small +flavor: small +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: 2 + memory: 2Gi + requests: + cpu: 1 + memory: 1Gi + large: + limits: + cpu: 4 + memory: 4Gi + requests: + cpu: 2 + memory: 2Gi + unlimited: {} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoHelm.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoHelm.json new file mode 100644 index 0000000..f5e27f6 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoHelm.json @@ -0,0 +1,419 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "healthcheck": { + "type": "http", + "interval": 15, + "timeout": 1, + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoServices.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoServices.json new file mode 100644 index 0000000..eb5010a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecNoServices.json @@ -0,0 +1,432 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + } + }, + "healthcheck": { + "type": "http", + "interval": 15, + "timeout": 1, + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecSchema.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecSchema.json new file mode 100644 index 0000000..c15abde --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/invalidSpecSchema.json @@ -0,0 +1,382 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/schemas/component-spec-schema.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/schemas/component-spec-schema.json new file mode 100644 index 0000000..9b7fe77 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/schemas/component-spec-schema.json @@ -0,0 +1,1158 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Component specification schema", + "type": "object", + "properties": { + "self": { + "type": "object", + "properties": { + "version": { + "$ref": "#/definitions/version" + }, + "description": { + "type": "string" + }, + "component_type": { + "type": "string", + "enum": [ + "docker", + "cdap" + ] + }, + "name": { + "$ref": "#/definitions/name" + } + }, + "required": [ + "version", + "name", + "description", + "component_type" + ] + }, + "streams": { + "type": "object", + "properties": { + "publishes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/publisher_http" + }, + { + "$ref": "#/definitions/publisher_message_router" + }, + { + "$ref": "#/definitions/publisher_data_router" + }, + { + "$ref": "#/definitions/publisher_kafka" + } + ] + } + }, + "subscribes": { + "type": "array", + "uniqueItems": true, + "items": { + "oneOf": [ + { + "$ref": "#/definitions/subscriber_http" + }, + { + "$ref": "#/definitions/subscriber_message_router" + }, + { + "$ref": "#/definitions/subscriber_data_router" + }, + { + "$ref": "#/definitions/subscriber_kafka" + } + ] + } + } + }, + "required": [ + "publishes", + "subscribes" + ] + }, + "services": { + "type": "object", + "properties": { + "calls": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/caller" + } + }, + "provides": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/provider" + } + } + }, + "required": [ + "calls", + "provides" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/definitions/docker-parameters" + }, + { + "$ref": "#/definitions/cdap-parameters" + } + ] + }, + "auxilary": { + "oneOf": [ + { + "$ref": "#/definitions/auxilary_cdap" + }, + { + "$ref": "#/definitions/auxilary_docker" + } + ] + }, + "artifacts": { + "type": "array", + "description": "List of component artifacts", + "items": { + "$ref": "#/definitions/artifact" + } + }, + "policy_info": { + "type": "object", + "properties": { + "policy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "node_label": { + "type": "string" + }, + "policy_id": { + "type": "string" + }, + "policy_model_id": { + "type": "string" + } + }, + "required": [ + "node_label", + "policy_model_id" + ] + } + } + }, + "additionalProperties": false + } + }, + "required": [ + "self", + "streams", + "services", + "parameters", + "auxilary", + "artifacts" + ], + "additionalProperties": false, + "definitions": { + "cdap-parameters": { + "description": "There are three seperate ways to pass parameters to CDAP: app config, app preferences, program preferences. These are all treated as optional.", + "type": "object", + "properties": { + "program_preferences": { + "description": "A list of {program_id, program_type, program_preference} objects where program_preference is an object passed into program_id of type program_type", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/program_preference" + } + }, + "app_preferences": { + "description": "Parameters Passed down to the CDAP preference API", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "app_config": { + "description": "Parameters Passed down to the CDAP App Config", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + } + }, + "program_preference": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/program_type" + }, + "program_id": { + "type": "string" + }, + "program_pref": { + "description": "Parameters that the CDAP developer wants pushed to this program's preferences API. Optional", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + } + }, + "required": [ + "program_type", + "program_id", + "program_pref" + ] + }, + "program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "docker-parameters": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/parameter" + } + }, + "parameter": { + "oneOf": [ + { + "$ref": "#/definitions/parameter-list" + }, + { + "$ref": "#/definitions/parameter-other" + } + ] + }, + "parameter-list": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "Only valid type is list, the entry_schema is required - which contains the type of the list element. All properties set for the parameter apply to all elements in the list at this time", + "type": "string", + "enum": [ + "list" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional property used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is list. This is the only type it is currently supported for.", + "type": "object", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/list-parameter" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable by DevOps in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "policy_editable", + "sourced_at_deployment", + "entry_schema" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "parameter-other": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "designer_editable": { + "description": "A required property that declares a parameter as editable by designer in SDC Tool (true) or not (false).", + "type": "boolean" + }, + "sourced_at_deployment": { + "description": "A required property that declares that a parameter is assigned at deployment time (true) or not (false).", + "type": "boolean" + }, + "policy_editable": { + "description": "A required property that declares a parameter as editable in Policy UI (true) or not (false).", + "type": "boolean" + }, + "policy_group": { + "description": "An optional property used to group policy_editable parameters into groups. Each group will become it's own policy model. Any parameters without this property will be grouped together to form their own policy model", + "type": "string" + }, + "policy_schema": { + "description": "An optional property used to define policy_editable parameters as lists or maps", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "value", + "description", + "designer_editable", + "sourced_at_deployment", + "policy_editable" + ], + "additionalProperties": false, + "dependencies": { + "policy_schema": [ + "policy_editable" + ] + } + }, + "list-parameter": { + "type": "object", + "properties": { + "type": { + "description": "The required data type for each parameter in the list.", + "type": "string", + "enum": [ + "string", + "number" + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "policy_schema_parameter": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "description": "Default value for the parameter" + }, + "description": { + "description": "Description for the parameter.", + "type": "string" + }, + "type": { + "description": "The required data type for the parameter.", + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "datetime", + "list", + "map" + ] + }, + "required": { + "description": "An optional key that declares a parameter as required (true) or not (false). Default is true.", + "type": "boolean", + "default": true + }, + "constraints": { + "description": "The optional list of sequenced constraint clauses for the parameter.", + "type": "array", + "items": { + "$ref": "#/definitions/parameter-constraints" + } + }, + "entry_schema": { + "description": "The optional key that is used to declare the name of the Datatype definition for entries of certain types. entry_schema must be defined when the type is either list or map. If the type is list and the entry type is a simple type (string, number, boolean, datetime), follow with a simple string to describe the entry type. If the type is list and the entry type is a map, follow with an array to describe the keys for the entry map. If the type is list and the entry type is also list, this is not currently supported here. If the type is map, then follow with an array to describe the keys for this map. ", + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/policy_schema_parameter" + } + } + }, + "required": [ + "name", + "type" + ], + "additionalProperties": false + }, + "parameter-constraints": { + "type": "object", + "additionalProperties": false, + "properties": { + "equal": { + "description": "Constrains a property or parameter to a value equal to (‘=’) the value declared." + }, + "greater_than": { + "description": "Constrains a property or parameter to a value greater than (‘>’) the value declared.", + "type": "number" + }, + "greater_or_equal": { + "description": "Constrains a property or parameter to a value greater than or equal to (‘>=’) the value declared.", + "type": "number" + }, + "less_than": { + "description": "Constrains a property or parameter to a value less than (‘<’) the value declared.", + "type": "number" + }, + "less_or_equal": { + "description": "Constrains a property or parameter to a value less than or equal to (‘<=’) the value declared.", + "type": "number" + }, + "valid_values": { + "description": "Constrains a property or parameter to a value that is in the list of declared values.", + "type": "array" + }, + "length": { + "description": "Constrains the property or parameter to a value of a given length.", + "type": "number" + }, + "min_length": { + "description": "Constrains the property or parameter to a value to a minimum length.", + "type": "number" + }, + "max_length": { + "description": "Constrains the property or parameter to a value to a maximum length.", + "type": "number" + } + } + }, + "stream_message_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "message router", + "message_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "stream_kafka": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "kafka" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "publisher_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "config_key": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + } + }, + "required": [ + "format", + "version", + "config_key", + "type" + ] + }, + "publisher_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "subscriber_http": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "http", + "https" + ] + } + }, + "required": [ + "format", + "version", + "route", + "type" + ] + }, + "subscriber_message_router": { + "$ref": "#/definitions/stream_message_router" + }, + "subscriber_data_router": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + }, + "route": { + "type": "string" + }, + "type": { + "description": "Type of stream to be used", + "type": "string", + "enum": [ + "data router", + "data_router" + ] + }, + "config_key": { + "description": "Data router subscribers require config info to setup their endpoints to handle requests. For example, needs username and password", + "type": "string" + } + }, + "required": [ + "format", + "version", + "route", + "type", + "config_key" + ] + }, + "subscriber_kafka": { + "$ref": "#/definitions/stream_kafka" + }, + "provider": { + "oneOf": [ + { + "$ref": "#/definitions/docker-provider" + }, + { + "$ref": "#/definitions/cdap-provider" + } + ] + }, + "cdap-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "service_name": { + "type": "string" + }, + "service_endpoint": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "service_name", + "service_endpoint", + "verb" + ] + }, + "docker-provider": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "route": { + "type": "string" + }, + "verb": { + "type": "string", + "enum": [ + "GET", + "PUT", + "POST", + "DELETE" + ] + } + }, + "required": [ + "request", + "response", + "route" + ] + }, + "caller": { + "type": "object", + "properties": { + "request": { + "$ref": "#/definitions/formatPair" + }, + "response": { + "$ref": "#/definitions/formatPair" + }, + "config_key": { + "type": "string" + } + }, + "required": [ + "request", + "response", + "config_key" + ] + }, + "formatPair": { + "type": "object", + "properties": { + "format": { + "$ref": "#/definitions/name" + }, + "version": { + "$ref": "#/definitions/version" + } + } + }, + "name": { + "type": "string" + }, + "version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "artifact": { + "type": "object", + "description": "Component artifact object", + "properties": { + "uri": { + "type": "string", + "description": "Uri to artifact" + }, + "type": { + "type": "string", + "enum": [ + "jar", + "docker image" + ] + } + }, + "required": [ + "uri", + "type" + ] + }, + "auxilary_cdap": { + "title": "cdap component specification schema", + "type": "object", + "properties": { + "streamname": { + "type": "string" + }, + "artifact_name": { + "type": "string" + }, + "artifact_version": { + "type": "string", + "pattern": "^(\\d+\\.)(\\d+\\.)(\\*|\\d+)$" + }, + "namespace": { + "type": "string", + "description": "optional" + }, + "programs": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "#/definitions/cdap_program" + } + } + }, + "required": [ + "streamname", + "programs", + "artifact_name", + "artifact_version" + ] + }, + "cdap_program_type": { + "type": "string", + "enum": [ + "flows", + "mapreduce", + "schedules", + "spark", + "workflows", + "workers", + "services" + ] + }, + "cdap_program": { + "type": "object", + "properties": { + "program_type": { + "$ref": "#/definitions/cdap_program_type" + }, + "program_id": { + "type": "string" + } + }, + "required": [ + "program_type", + "program_id" + ] + }, + "auxilary_docker": { + "title": "Docker component specification schema", + "type": "object", + "properties": { + "helm": { + "type": "object", + "properties": { + "applicationEnv": { + "type": "object" + }, + "service": { + "description": "Mapping for kubernetes services", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "NodePort", + "Cluster" + ] + }, + "name": { + "type": "string" + }, + "ports": { + "type": "array", + "items": { + "type": "object" + } + } + }, + "required": [ + "type", + "name", + "ports" + ] + } + }, + "required": [ + "service" + ] + }, + "healthcheck": { + "description": "Define the health check that Consul should perfom for this component", + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/docker_healthcheck_http" + }, + { + "$ref": "#/definitions/docker_healthcheck_script" + } + ] + }, + "ports": { + "description": "Port mapping to be used for Docker containers. Each entry is of the format <container port>:<host port>.", + "type": "array", + "items": { + "type": "string" + } + }, + "log_info": { + "description": "Component specific details for logging", + "type": "object", + "properties": { + "log_directory": { + "description": "The path in the container where the component writes its logs. If the component is following the EELF requirements, this would be the directory where the four EELF files are being written. (Other logs can be placed in the directory--if their names in '.log', they'll also be sent into ELK.)", + "type": "string" + }, + "alternate_fb_path": { + "description": "By default, the log volume is mounted at /var/log/onap/<component_type> in the sidecar container's file system. 'alternate_fb_path' allows overriding the default. Will affect how the log data can be found in the ELK system.", + "type": "string" + } + }, + "additionalProperties": false + }, + "tls_info": { + "description": "Component information to use tls certificates", + "type": "object", + "properties": { + "cert_directory": { + "description": "The path in the container where the component certificates will be placed by the init container", + "type": "string" + }, + "use_tls": { + "description": "Boolean flag to determine if the application is using tls certificates", + "type": "boolean" + }, + "use_external_tls": { + "description": "Boolean flag to determine if the application is using tls certificates for external communication", + "type": "boolean" + } + }, + "required": [ + "cert_directory", + "use_tls" + ], + "additionalProperties": false + }, + "databases": { + "description": "The databases the application is connecting to using the pgaas", + "type": "object", + "additionalProperties": { + "type": "string", + "enum": [ + "postgres" + ] + } + }, + "policy": { + "properties": { + "trigger_type": { + "description": "Only value of docker is supported at this time.", + "type": "string", + "enum": [ + "docker" + ] + }, + "script_path": { + "description": "Script command that will be executed for policy reconfiguration", + "type": "string" + } + }, + "required": [ + "trigger_type", + "script_path" + ], + "additionalProperties": false + }, + "volumes": { + "description": "Volume mapping to be used for Docker containers. Each entry is of the format below", + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "$ref": "#/definitions/host_path_volume" + }, + { + "$ref": "#/definitions/config_map_volume" + } + ] + } + } + }, + "required": [ + "healthcheck" + ], + "additionalProperties": false + }, + "host_path_volume": { + "type": "object", + "properties": { + "host": { + "type": "object", + "path": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "host", + "container" + ] + }, + "config_map_volume": { + "type": "object", + "properties": { + "config_volume": { + "type": "object", + "name": { + "type": "string" + } + }, + "container": { + "type": "object", + "bind": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + }, + "required": [ + "config_volume", + "container" + ] + }, + "docker_healthcheck_http": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "http", + "https", + "HTTP", + "HTTPS" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "endpoint": { + "description": "Relative endpoint used by Consul to check health by making periodic HTTP GET calls", + "type": "string" + }, + "port": { + "description": "Port mapping for readiness section", + "type": "integer" + }, + "initialDelaySeconds": { + "description": "Initial delay in seconds for readiness section", + "type": "integer" + } + }, + "required": [ + "type", + "endpoint" + ] + }, + "docker_healthcheck_script": { + "properties": { + "type": { + "description": "Consul health check type", + "type": "string", + "enum": [ + "script", + "docker" + ] + }, + "interval": { + "description": "Interval duration in seconds i.e. 10s", + "default": "15s", + "type": "string" + }, + "timeout": { + "description": "Timeout in seconds i.e. 10s", + "default": "1s", + "type": "string" + }, + "script": { + "description": "Script command that will be executed by Consul to check health", + "type": "string" + } + }, + "required": [ + "type", + "script" + ] + } + } +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/ves.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/ves.json new file mode 100644 index 0000000..3829a1a --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/ves.json @@ -0,0 +1,455 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + }, + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + }, + { + "name": "metrics", + "port": 4444, + "internal_only": true + } + ] + } + }, + "healthcheck": { + "type": "http", + "interval": "15s", + "timeout": "1s", + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + }, + "databases": { + + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vesWithDb.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vesWithDb.json new file mode 100644 index 0000000..207be6d --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vesWithDb.json @@ -0,0 +1,452 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + , + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "applicationEnv": { + "PMSH_PG_URL": "dcae-pmsh-pg-primary", + "PMSH_PG_USERNAME": { + "secretUid": "pgUserCredsSecretUid", + "key": "login" + }, + "PMSH_PG_PASSWORD": { + "secretUid": "pgUserCredsSecretUid", + "key": "password" + } + }, + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + }, + { + "name": "metrics", + "port": 4444, + "internal_only": true + } + ] + } + }, + "healthcheck": { + "type": "http", + "interval": "15s", + "timeout": "1s", + "endpoint": "/healthcheck", + "port": 8080, + "initialDelaySeconds": 5 + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls": true, + "use_external_tls": true + } + }, + "policy_info":{ + "policy":[ + { + "node_label":"tca_policy_00", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app", + "policy_id":"tca_policy_id_10" + }, + { + "node_label":"tca_policy_11", + "policy_id":"tca_policy_id_11", + "policy_model_id":"onap.policies.monitoring.cdap.tca.hi.lo.app" + } + ] + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vescollector-componentspec-v3-helm.json b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vescollector-componentspec-v3-helm.json new file mode 100644 index 0000000..30b05e5 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/input/specs/vescollector-componentspec-v3-helm.json @@ -0,0 +1,475 @@ +{ + "self": { + "version": "1.8.0", + "name": "dcae-ves-collector", + "description": "Collector for receiving VES events through restful interface", + "component_type": "docker" + }, + "streams": { + "subscribes": [], + "publishes": [ + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-fault" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-measurement" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-syslog" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-other" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-mobileflow" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-statechange" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-thresholdCrossingAlert" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-voicequality" + }, + { + "format": "VES_specification", + "version": "5.28.4", + "type": "message router", + "config_key": "ves-sipsignaling" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-pnfRegistration" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-notification" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-perf3gpp" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-fault-supervision" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-provisioning" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-heartbeat" + }, + { + "format": "VES_specification", + "version": "7.30.2", + "type": "message router", + "config_key": "ves-3gpp-performance-assurance" + } + ] + }, + "services": { + "calls": [], + "provides": [ + { + "route": "/eventListener/v1", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v2", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v3", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v4", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "4.27.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v5", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "5.28.4" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + }, + { + "route": "/eventListener/v7", + "verb": "POST", + "request": { + "format": "VES_specification", + "version": "7.30.2" + }, + "response": { + "format": "ves.coll.response", + "version": "1.0.0" + } + } + ] + }, + "parameters": [ + { + "name": "streams_publishes", + "value": { + "ves-fault": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + }, + "ves-measurement": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT" + }, + "type": "message_router" + }, + "ves-notification": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT" + }, + "type": "message_router" + }, + "ves-pnfRegistration": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.VES_PNFREG_OUTPUT" + }, + "type": "message_router" + }, + "ves-heartbeat": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_HEARTBEAT_OUTPUT" + }, + "type": "message_router" + }, + "ves-other": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_OTHER_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-fault-supervision": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_FAULTSUPERVISION_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-provisioning": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PROVISIONING_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-heartbeat": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_HEARTBEAT_OUTPUT" + }, + "type": "message_router" + }, + "ves-3gpp-performance-assurance": { + "dmaap_info": { + "topic_url": "http://message-router:3904/events/unauthenticated.SEC_3GPP_PERFORMANCEASSURANCE_OUTPUT" + }, + "type": "message_router" + } + }, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.port", + "value": 8080, + "description": "standard http port collector will open for listening;", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.service.secure.port", + "value": 8443, + "description": "secure http port collector will open for listening ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.keystore.file.location", + "value": "/opt/app/dcae-certificate/cert.jks", + "description": "fs location of keystore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.keystore.passwordfile", + "value": "/opt/app/dcae-certificate/jks.pass", + "description": "location of keystore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.file.location", + "value": "/opt/app/dcae-certificate/trust.jks", + "description": "fs location of truststore file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.truststore.passwordfile", + "value": "/opt/app/dcae-certificate/trust.pass", + "description": "location of truststore password file in vm", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.dmaap.streamid", + "value": "fault=ves-fault|syslog=ves-syslog|heartbeat=ves-heartbeat|measurementsForVfScaling=ves-measurement|mobileFlow=ves-mobileflow|other=ves-other|stateChange=ves-statechange|thresholdCrossingAlert=ves-thresholdCrossingAlert|voiceQuality=ves-voicequality|sipSignaling=ves-sipsignaling|notification=ves-notification|pnfRegistration=ves-pnfRegistration|3GPP-FaultSupervision=ves-3gpp-fault-supervision|3GPP-Heartbeat=ves-3gpp-heartbeat|3GPP-Provisioning=ves-3gpp-provisioning|3GPP-PerformanceAssurance=ves-3gpp-performance-assurance", + "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed", + "sourced_at_deployment": true, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "auth.method", + "value": "noAuth", + "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "header.authlist", + "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy", + "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here", + "policy_editable": false, + "sourced_at_deployment": true, + "designer_editable": true + }, + { + "name": "collector.schema.checkflag", + "value": 1, + "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.schema.file", + "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.2.1_ONAP.json\"}", + "description": "VES schema file name per version used for validation", + "designer_editable": true, + "sourced_at_deployment": false, + "policy_editable": false + }, + { + "name": "event.transform.flag", + "value": 1, + "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "tomcat.maxthreads", + "value": "200", + "description": "Tomcat control for concurrent request", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.checkflag", + "value": 1, + "description": "Schema stndDefined validation flag. When enabled, collector will validate stndDefined fields in stndDefined domain events against mapped local schemas listed in file from property collector.externalSchema.mappingFileLocation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": true + }, + { + "name": "collector.externalSchema.schemasLocation", + "value": "./etc/externalRepo/", + "description": "External schemas repository. Path to schemas storage directory.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.externalSchema.mappingFileLocation", + "value": "./etc/externalRepo/schema-map.json", + "description": "Path to JSON file containing mapping of externally located stndDefined schemas to local schema files.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.schemaRefPath", + "value": "$.event.stndDefinedFields.schemaReference", + "description": "An internal path from validated JSON. Defines which field is taken as public schema reference, which is later mapped.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "event.externalSchema.stndDefinedDataPath", + "value": "$.event.stndDefinedFields.data", + "description": "An internal path from validated JSON. Defines which field of event will be validated during stndDefined validation.", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + }, + { + "name": "collector.description.api.version.location", + "value": "etc/api_version_description.json", + "description": "Path to the file containing description of api versions", + "sourced_at_deployment": false, + "policy_editable": false, + "designer_editable": false + } + ], + "auxilary": { + "helm": { + "service": { + "type": "NodePort", + "name": "dcae-ves-collector", + "has_internal_only_ports": true, + "ports": [ + { + "name": "http", + "port": 8443, + "plain_port": 8080, + "port_protocol": "http", + "nodePort": 17, + "useNodePortExt": true + } + ] + } + }, + "healthcheck": { + "type": "HTTP", + "interval": "15s", + "timeout": "1s", + "port": 8080, + "endpoint": "/healthcheck" + }, + "volumes": [{ + "config_volume": { + "name": "dcae-external-repo-configmap-schema-map" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/" + } + }, { + "config_volume": { + "name": "dcae-external-repo-configmap-sa88-rel16" + }, + "container": { + "bind": "/opt/app/VESCollector/etc/externalRepo/3gpp/rep/sa5/MnS/blob/SA88-Rel16/OpenAPI/" + } + }], + "ports": [ + "8080:0", + "8443:0" + ], + "log_info": { + "log_directory": "/opt/app/VESCollector/logs/" + }, + "tls_info":{ + "cert_directory":"/opt/app/dcae-certificate/", + "use_tls":true, + "use_external_tls": false + } + }, + "artifacts": [ + { + "type": "docker image", + "uri": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest" + } + ] +} + diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ChartTemplateStructureValidatorTest.java b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ChartTemplateStructureValidatorTest.java new file mode 100644 index 0000000..9bef191 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ChartTemplateStructureValidatorTest.java @@ -0,0 +1,40 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import org.junit.jupiter.api.Test; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ChartTemplateStructureValidator; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class ChartTemplateStructureValidatorTest { + + @Test + void validateTemplateStructure(){ + String validStructureLocation = "src/test/input/blueprint"; + assertDoesNotThrow(() -> ChartTemplateStructureValidator.validateChartTemplateStructure(validStructureLocation)); + } + + @Test + void invalidateTemplateStructureShouldThrowRuntimeError() { + String invalidStructureLocation = "test"; + assertThrows(RuntimeException.class, () -> ChartTemplateStructureValidator.validateChartTemplateStructure(invalidStructureLocation)); + } +} diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecParserTest.java b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecParserTest.java new file mode 100644 index 0000000..c14edda --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecParserTest.java @@ -0,0 +1,186 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ComponentSpecParser; +import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ComponentSpecValidator; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +@ExtendWith({MockitoExtension.class}) +class ComponentSpecParserTest { + + ComponentSpecParser parser; + + @Mock + ComponentSpecValidator validator; + + @BeforeEach + void setUp() { + parser = new ComponentSpecParser(validator); + } + + @Test + void extractChartInfo() throws Exception{ + String specLocation = "src/test/input/specs/ves.json"; + String chartTemplateLocation = "src/test/input/blueprint"; + String specSchemaLocation = ""; + ChartInfo chartInfo = parser.extractChartInfo(specLocation, chartTemplateLocation, specSchemaLocation); + + assertMetadata(chartInfo); + assertOuterKeyValues(chartInfo); + assertApplicationConfigSection(chartInfo); + assertReadinessCheck(chartInfo); + assertApplicationEnv(chartInfo); + assertService(chartInfo); + assertPolicyInfo(chartInfo); + assertCertificates(chartInfo); + assertConfigMap(chartInfo); + assertPostgres(chartInfo); + assertSecrets(chartInfo); + } + + private void assertApplicationConfigSection(ChartInfo chartInfo) { + Map<String, Object> applicationConfig = (Map<String, Object>) chartInfo.getValues().get("applicationConfig"); + assertThat(applicationConfig.size()).isEqualTo(20); + } + + private void assertOuterKeyValues(ChartInfo chartInfo) { + Map<String, Object> outerKv = chartInfo.getValues(); + assertThat(outerKv.get("image")).isEqualTo("nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"); + assertThat(outerKv.get("logDirectory")).isEqualTo("/opt/app/VESCollector/logs/"); + assertThat(outerKv.get("certDirectory")).isEqualTo("/opt/app/dcae-certificate/"); + assertThat(outerKv.get("tlsServer")).isEqualTo(true); + } + + private void assertMetadata(ChartInfo chartInfo) { + assertThat(chartInfo.getMetadata().getName()).isEqualTo("dcae-ves-collector"); + assertThat(chartInfo.getMetadata().getVersion()).isEqualTo("1.8.0"); + assertThat(chartInfo.getMetadata().getDescription()). + isEqualTo("Collector for receiving VES events through restful interface"); + } + + private void assertReadinessCheck(ChartInfo chartInfo) { + Map<String, Object> readiness = (Map<String, Object>) chartInfo.getValues().get("readiness"); + assertThat(readiness.get("scheme")).isEqualTo("http"); + assertThat(readiness.get("path")).isEqualTo("/healthcheck"); + assertThat(readiness.get("periodSeconds")).isEqualTo(15); + assertThat(readiness.get("port")).isEqualTo(8080); + assertThat(readiness.get("initialDelaySeconds")).isEqualTo(5); + assertThat(readiness.get("timeoutSeconds")).isEqualTo(1); + } + + private void assertApplicationEnv(ChartInfo chartInfo) { + ObjectMapper oMapper = new ObjectMapper(); + Map<String, Object> applicationEnv = (Map<String, Object>) chartInfo.getValues().get("applicationEnv"); + Map<String, Object> PMSH_PG_USERNAME = oMapper.convertValue(applicationEnv.get("PMSH_PG_USERNAME"), Map.class); + Map<String, Object> PMSH_PG_PASSWORD = oMapper.convertValue(applicationEnv.get("PMSH_PG_PASSWORD"), Map.class); + + assertThat(applicationEnv.get("PMSH_PG_URL")).isEqualTo("dcae-pmsh-pg-primary"); + assertThat(PMSH_PG_USERNAME.get("secretUid")).isEqualTo("pgUserCredsSecretUid"); + assertThat(PMSH_PG_USERNAME.get("key")).isEqualTo("login"); + assertThat(PMSH_PG_PASSWORD.get("secretUid")).isEqualTo("pgUserCredsSecretUid"); + assertThat(PMSH_PG_PASSWORD.get("key")).isEqualTo("password"); + } + + private void assertService(ChartInfo chartInfo) { + Map<String, Object> service = (Map<String, Object>) chartInfo.getValues().get("service"); + List<Map> ports = new ArrayList<Map>(); + for(Object portsGroup : (ArrayList) service.get("ports")){ + ports.add((Map<String, Object>) portsGroup); + } + assertThat(service.get("type")).isEqualTo("NodePort"); + assertThat(service.get("name")).isEqualTo("dcae-ves-collector"); + assertThat(service.get("has_internal_only_ports")).isEqualTo(true); + assertThat(ports.get(0).get("name")).isEqualTo("http"); + assertThat(ports.get(0).get("port")).isEqualTo(8443); + assertThat(ports.get(0).get("plain_port")).isEqualTo(8080); + assertThat(ports.get(0).get("port_protocol")).isEqualTo("http"); + assertThat(ports.get(0).get("nodePort")).isEqualTo(17); + assertThat(ports.get(0).get("useNodePortExt")).isEqualTo(true); + assertThat(ports.get(1).get("name")).isEqualTo("metrics"); + assertThat(ports.get(1).get("port")).isEqualTo(4444); + assertThat(ports.get(1).get("internal_only")).isEqualTo(true); + } + + private void assertPolicyInfo(ChartInfo chartInfo) { + Map<String, Object> policyInfo = (Map<String, Object>) chartInfo.getValues().get("policies"); + assertThat(policyInfo.get("policyID")).isEqualTo("'[\"tca_policy_id_10\", \"tca_policy_id_11\"]'\n"); + } + + private void assertCertificates(ChartInfo chartInfo) { + List certificates = (List) chartInfo.getValues().get("certificates"); + Map<String, Object> certificate = (Map<String, Object>) certificates.get(0); + assertThat(certificate.get("mountPath")).isEqualTo("/opt/app/dcae-certificate/external"); + assertThat(certificate.get("commonName")).isEqualTo("dcae-ves-collector"); + assertThat(((List) certificate.get("dnsNames")).get(0)).isEqualTo("dcae-ves-collector"); + assertThat(((List) ((Map<String, Map>) certificate.get("keystore")).get("outputType")).get(0)).isEqualTo("jks"); + assertThat((((Map<String, Map>) certificate.get("keystore")).get("passwordSecretRef")).get("name")).isEqualTo("ves-collector-cmpv2-keystore-password"); + assertThat((((Map<String, Map>) certificate.get("keystore")).get("passwordSecretRef")).get("key")).isEqualTo("password"); + assertThat((((Map<String, Map>) certificate.get("keystore")).get("passwordSecretRef")).get("create")).isEqualTo(true); + } + + private void assertConfigMap(ChartInfo chartInfo) { + List externalVolumes = (List) chartInfo.getValues().get("externalVolumes"); + Map<String, Object> volume_one = (Map<String, Object>) externalVolumes.get(0); + Map<String, Object> volume_two = (Map<String, Object>) externalVolumes.get(1); + assertThat(volume_one.get("name")).isEqualTo("dcae-external-repo-configmap-schema-map"); + assertThat(volume_one.get("type")).isEqualTo("configMap"); + assertThat(volume_one.get("mountPath")).isEqualTo("/opt/app/VESCollector/etc/externalRepo/"); + assertThat(volume_one.get("optional")).isEqualTo(true); + } + + private void assertPostgres(ChartInfo chartInfo) { + Map<String, Object> postgres = (Map<String, Object>) chartInfo.getValues().get("postgres"); + assertThat(postgres.get("nameOverride")).isEqualTo("dcae-ves-collector-postgres"); + assertThat(((Map<String, Object>) postgres.get("service")).get("name")).isEqualTo("dcae-ves-collector-postgres"); + assertThat(((Map<String, Object>) postgres.get("service")).get("name2")).isEqualTo("dcae-ves-collector-pg-primary"); + assertThat(((Map<String, Object>) postgres.get("service")).get("name3")).isEqualTo("dcae-ves-collector-pg-replica"); + assertThat(((Map<String, Object>) ((Map<String, Object>) postgres.get("container")).get("name")).get("primary")).isEqualTo("dcae-ves-collector-pg-primary"); + assertThat(((Map<String, Object>) ((Map<String, Object>) postgres.get("container")).get("name")).get("replica")).isEqualTo("dcae-ves-collector-pg-replica"); + assertThat(((Map<String, Object>) postgres.get("persistence")).get("mountSubPath")).isEqualTo("dcae-ves-collector/data"); + assertThat(((Map<String, Object>) postgres.get("persistence")).get("mountInitPath")).isEqualTo("dcae-ves-collector"); + assertThat(((Map<String, Object>) postgres.get("config")).get("pgUserName")).isEqualTo("ves-collector"); + assertThat(((Map<String, Object>) postgres.get("config")).get("pgDatabase")).isEqualTo("ves-collector"); + assertThat(((Map<String, Object>) postgres.get("config")).get("pgUserExternalSecret")).isEqualTo("{{ include \"common.release\" . }}-ves-collector-pg-user-creds"); + } + + private void assertSecrets(ChartInfo chartInfo) { + List<Object> secrets = (List<Object>) chartInfo.getValues().get("secrets"); + Map<String, Object> secret1 = (Map<String, Object>) secrets.get(0); + assertThat(secret1.get("uid")).isEqualTo("pg-user-creds"); + assertThat(secret1.get("name")).isEqualTo("{{ include \"common.release\" . }}-ves-collector-pg-user-creds"); + assertThat(secret1.get("type")).isEqualTo("basicAuth"); + assertThat(secret1.get("externalSecret")).isEqualTo("{{ ternary \"\" (tpl (default \"\" .Values.postgres.config.pgUserExternalSecret) .) (hasSuffix \"ves-collector-pg-user-creds\" .Values.postgres.config.pgUserExternalSecret) }}"); + assertThat(secret1.get("login")).isEqualTo("{{ .Values.postgres.config.pgUserName }}"); + assertThat(secret1.get("password")).isEqualTo("{{ .Values.postgres.config.pgUserPassword }}"); + assertThat(secret1.get("passwordPolicy")).isEqualTo("generate"); + } +}
\ No newline at end of file diff --git a/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecValidatorTest.java b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecValidatorTest.java new file mode 100644 index 0000000..c987c11 --- /dev/null +++ b/mod2/helm-generator/helmchartgenerator-core/src/test/java/org/onap/dcaegen2/platform/helmchartgenerator/ComponentSpecValidatorTest.java @@ -0,0 +1,68 @@ +/* + * # ============LICENSE_START======================================================= + * # Copyright (c) 2021 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========================================================= + */ + +package org.onap.dcaegen2.platform.helmchartgenerator; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ComponentSpecValidator; +import org.onap.dcaegen2.platform.helmchartgenerator.validation.ComponentSpecValidatorImpl; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@ExtendWith(MockitoExtension.class) +public class ComponentSpecValidatorTest { + + private static final String SPEC_SCHEMA = "src/test/input/specs/schemas/component-spec-schema.json"; + + ComponentSpecValidator validator; + + @BeforeEach + void setUp() { + validator = new ComponentSpecValidatorImpl(); + } + + @Test + void validSpecShouldNotThrowAnyException() { + String specSchema = "src/test/input/specs/schemas/component-spec-schema.json"; + String specFileLocation = "src/test/input/specs/ves.json"; + assertDoesNotThrow(() -> validator.validateSpecFile(specFileLocation, specSchema)); + } + + @Test + void invalidSpecShouldThrowRuntimeException() { + String specFileLocation = "src/test/input/specs/invalidSpecSchema.json"; + assertThrows(RuntimeException.class, () -> validator.validateSpecFile(specFileLocation, SPEC_SCHEMA)); + } + + @Test + void ifNoHelmSectionFoundThrowRuntimeError() { + String specFileLocation = "src/test/input/specs/invalidSpecNoHelm.json"; + assertThrows(RuntimeException.class, () -> validator.validateSpecFile(specFileLocation, SPEC_SCHEMA)); + } + + @Test + void ifNoServiceSectionFoundThrowRuntimeError() { + String specFileLocation = "src/test/input/specs/invalidSpecNoServices.json"; + assertThrows(RuntimeException.class, () -> validator.validateSpecFile(specFileLocation, SPEC_SCHEMA)); + } + +} diff --git a/mod2/helm-generator/lombok.config b/mod2/helm-generator/lombok.config new file mode 100644 index 0000000..8f7e8aa --- /dev/null +++ b/mod2/helm-generator/lombok.config @@ -0,0 +1 @@ +lombok.addLombokGeneratedAnnotation = true
\ No newline at end of file diff --git a/mod2/helm-generator/pom.xml b/mod2/helm-generator/pom.xml new file mode 100644 index 0000000..592611c --- /dev/null +++ b/mod2/helm-generator/pom.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ # ============LICENSE_START======================================================= + ~ # Copyright (c) 2021 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========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + <modules> + <module>helmchartgenerator-core</module> + <module>helmchartgenerator-cli</module> + </modules> + <parent> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>2.0.0</version> + </parent> + + <groupId>org.onap.dcaegen2.platform</groupId> + <artifactId>helmchartgenerator</artifactId> + <version>1.0.0-SNAPSHOT</version> + <name>helm-chart-generator</name> + <description>Helm chart generator</description> + <properties> + <java.version>11</java.version> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> + <spring-boot.version>2.4.0</spring-boot.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.20</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.10.3</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-yaml</artifactId> + <version>2.9.8</version> + </dependency> + <dependency> + <groupId>org.everit.json</groupId> + <artifactId>org.everit.json.schema</artifactId> + <version>1.3.0</version> + </dependency> + <dependency> + <groupId>com.vaadin.external.google</groupId> + <artifactId>android-json</artifactId> + <version>0.0.20131108.vaadin1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + <version>4.0.1</version> + </dependency> + </dependencies> + <dependencyManagement> + <dependencies> + <dependency> + <!-- Import dependency management from Spring Boot --> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.2</version> + </plugin> + </plugins> + </build> + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + <version>2.7</version> + </plugin> + </plugins> + </reporting> + +</project> |