- To execute the application
```bash
-java -jar target/blueprint-generator-1.2.1-SNAPSHOT-executable.jar
+java -jar target/blueprint-generator-1.4.0-SNAPSHOT-executable.jar
```
it will look like this:
```bash
-java -jar target/blueprint-generator-1.2.1-SNAPSHOT-executable.jar blueprint -p Blueprints -i ComponentSpecs/TestComponentSpec.json -n HelloWorld -d
+java -jar target/blueprint-generator-1.4.0-SNAPSHOT-executable.jar blueprint -p Blueprints -i ComponentSpecs/TestComponentSpec.json -n HelloWorld -d
```
This command will create a blueprint from the component spec TestComponentSpec. The blueprint file name will be called HelloWorld.yaml and it will be in the directory Blueprints. The blueprint will also contain the DMaaP plugin.
it will look like this:
```bash
-java -jar target/blueprint-generator-1.2.1-SNAPSHOT-executable.jar policy -p models -i ComponentSpecs/TestComponentSpec.json
+java -jar target/blueprint-generator-1.4.0-SNAPSHOT-executable.jar policy -p models -i ComponentSpecs/TestComponentSpec.json
```
This command will create a directory called models and put the policy models created from the component spec given in that directory. (A component spec may generate multiple policy models)
\ No newline at end of file
--- /dev/null
+
+#description: Test component spec
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml
+inputs:
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ envs:
+ default: {}
+ external_cert_ca_name:
+ type: string
+ description: Name of Certificate Authority configured on CertService side.
+ default: "RA"
+ external_cert_cert_type:
+ type: string
+ description: Format of provided certificates
+ default: "P12"
+ external_cert_common_name:
+ type: string
+ description: Common name which should be present in certificate.
+ default: "sample.onap.org"
+ external_cert_sans:
+ type: string
+ description: "List of Subject Alternative Names (SANs) which should be present
+ in certificate. Delimiter - : Should contain common_name value and other FQDNs
+ under which given component is accessible."
+ default: "sample.onap.org:component.sample.onap.org"
+ external_cert_use_external_tls:
+ type: boolean
+ description: Flag to indicate external tls enable/disable.
+ default: false
+ external_port_0:
+ type: string
+ default: "80"
+ external_port_1:
+ type: string
+ default: "99"
+ image:
+ type: string
+ default: "test.tester"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ test.component.spec_cpu_limit:
+ type: string
+ default: "250m"
+ test.component.spec_cpu_request:
+ type: string
+ default: "250m"
+ test.component.spec_memory_limit:
+ type: string
+ default: "128Mi"
+ test.component.spec_memory_request:
+ type: string
+ default: "128Mi"
+ use_tls:
+ type: boolean
+ description: flag to indicate tls enable/disable
+ default: false
+node_templates:
+ test.component.spec:
+ type: dcae.nodes.ContainerizedServiceComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["80:", {get_input: external_port_0}]
+ - concat: ["99:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes: {}
+ streams_subscribes: {}
+ service_component_name_override:
+ get_input: service_component_name_override
+ docker_config:
+ healthcheck:
+ interval: 300s
+ timeout: 120s
+ script: /etc/init.d/nagios status
+ type: docker
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ service_component_type: test-component-spec
+ replicas:
+ get_input: replicas
+ tls_info:
+ cert_directory: /opt/app/dcae-certificate/
+ use_tls:
+ get_input: use_tls
+ external_cert:
+ external_cert_directory: /opt/app/dcae-certificate/
+ use_external_tls:
+ get_input: external_cert_use_external_tls
+ ca_name:
+ get_input: external_cert_ca_name
+ cert_type:
+ get_input: external_cert_cert_type
+ external_certificate_parameters:
+ common_name:
+ get_input: external_cert_common_name
+ sans:
+ get_input: external_cert_sans
+ resource_config:
+ limits:
+ cpu:
+ get_input: test.component.spec_cpu_limit
+ memory:
+ get_input: test.component.spec_memory_limit
+ requests:
+ cpu:
+ get_input: test.component.spec_cpu_request
+ memory:
+ get_input: test.component.spec_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships: []
\ No newline at end of file
--- /dev/null
+
+#description: Test component spec
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml
+inputs:
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ envs:
+ default: {}
+ external_cert_ca_name:
+ type: string
+ description: Name of Certificate Authority configured on CertService side.
+ default: "RA"
+ external_cert_cert_type:
+ type: string
+ description: Format of provided certificates
+ default: "P12"
+ external_cert_common_name:
+ type: string
+ description: Common name which should be present in certificate.
+ default: "sample.onap.org"
+ external_cert_sans:
+ type: string
+ description: "List of Subject Alternative Names (SANs) which should be present
+ in certificate. Delimiter - : Should contain common_name value and other FQDNs
+ under which given component is accessible."
+ default: "sample.onap.org:component.sample.onap.org"
+ external_cert_use_external_tls:
+ type: boolean
+ description: Flag to indicate external tls enable/disable.
+ default: true
+ external_port_0:
+ type: string
+ default: "80"
+ external_port_1:
+ type: string
+ default: "99"
+ image:
+ type: string
+ default: "test.tester"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ test.component.spec_cpu_limit:
+ type: string
+ default: "250m"
+ test.component.spec_cpu_request:
+ type: string
+ default: "250m"
+ test.component.spec_memory_limit:
+ type: string
+ default: "128Mi"
+ test.component.spec_memory_request:
+ type: string
+ default: "128Mi"
+ use_tls:
+ type: boolean
+ description: flag to indicate tls enable/disable
+ default: true
+node_templates:
+ test.component.spec:
+ type: dcae.nodes.ContainerizedServiceComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["80:", {get_input: external_port_0}]
+ - concat: ["99:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes: {}
+ streams_subscribes: {}
+ service_component_name_override:
+ get_input: service_component_name_override
+ docker_config:
+ healthcheck:
+ interval: 300s
+ timeout: 120s
+ script: /etc/init.d/nagios status
+ type: docker
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ service_component_type: test-component-spec
+ replicas:
+ get_input: replicas
+ tls_info:
+ cert_directory: /opt/app/dcae-certificate/
+ use_tls:
+ get_input: use_tls
+ external_cert:
+ external_cert_directory: /opt/app/dcae-certificate/
+ use_external_tls:
+ get_input: external_cert_use_external_tls
+ ca_name:
+ get_input: external_cert_ca_name
+ cert_type:
+ get_input: external_cert_cert_type
+ external_certificate_parameters:
+ common_name:
+ get_input: external_cert_common_name
+ sans:
+ get_input: external_cert_sans
+ resource_config:
+ limits:
+ cpu:
+ get_input: test.component.spec_cpu_limit
+ memory:
+ get_input: test.component.spec_memory_limit
+ requests:
+ cpu:
+ get_input: test.component.spec_cpu_request
+ memory:
+ get_input: test.component.spec_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships: []
\ No newline at end of file
--- /dev/null
+
+#description: Test component spec
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml
+inputs:
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ envs:
+ default: {}
+ external_port_0:
+ type: string
+ default: "80"
+ external_port_1:
+ type: string
+ default: "99"
+ image:
+ type: string
+ default: "test.tester"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ test.component.spec_cpu_limit:
+ type: string
+ default: "250m"
+ test.component.spec_cpu_request:
+ type: string
+ default: "250m"
+ test.component.spec_memory_limit:
+ type: string
+ default: "128Mi"
+ test.component.spec_memory_request:
+ type: string
+ default: "128Mi"
+ use_tls:
+ type: boolean
+ description: flag to indicate tls enable/disable
+ default: true
+node_templates:
+ test.component.spec:
+ type: dcae.nodes.ContainerizedServiceComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["80:", {get_input: external_port_0}]
+ - concat: ["99:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes: {}
+ streams_subscribes: {}
+ service_component_name_override:
+ get_input: service_component_name_override
+ docker_config:
+ healthcheck:
+ interval: 300s
+ timeout: 120s
+ script: /etc/init.d/nagios status
+ type: docker
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ service_component_type: test-component-spec
+ replicas:
+ get_input: replicas
+ tls_info:
+ cert_directory: /opt/app/dcae-certificate/
+ use_tls:
+ get_input: use_tls
+ resource_config:
+ limits:
+ cpu:
+ get_input: test.component.spec_cpu_limit
+ memory:
+ get_input: test.component.spec_memory_limit
+ requests:
+ cpu:
+ get_input: test.component.spec_cpu_request
+ memory:
+ get_input: test.component.spec_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships: []
\ No newline at end of file
--- /dev/null
+
+#description: Test component spec
+#blueprint_version: 1.0.1
+---
+tosca_definitions_version: cloudify_dsl_1_3
+imports:
+- http://www.getcloudify.org/spec/cloudify/3.4/types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/k8splugin/1.7.2/k8splugin_types.yaml
+- https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R6/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml
+inputs:
+ always_pull_image:
+ type: boolean
+ description: Set to true if the image should always be pulled
+ default: true
+ envs:
+ default: {}
+ external_port_0:
+ type: string
+ default: "80"
+ external_port_1:
+ type: string
+ default: "99"
+ image:
+ type: string
+ default: "test.tester"
+ location_id:
+ type: string
+ default: ""
+ replicas:
+ type: integer
+ description: number of instances
+ default: 1
+ service_component_name_override:
+ type: string
+ default: ""
+ test.component.spec_cpu_limit:
+ type: string
+ default: "250m"
+ test.component.spec_cpu_request:
+ type: string
+ default: "250m"
+ test.component.spec_memory_limit:
+ type: string
+ default: "128Mi"
+ test.component.spec_memory_request:
+ type: string
+ default: "128Mi"
+node_templates:
+ test.component.spec:
+ type: dcae.nodes.ContainerizedServiceComponent
+ interfaces:
+ cloudify.interfaces.lifecycle:
+ start:
+ inputs:
+ ports:
+ - concat: ["80:", {get_input: external_port_0}]
+ - concat: ["99:", {get_input: external_port_1}]
+ envs:
+ get_input: envs
+ properties:
+ application_config:
+ service_calls: []
+ streams_publishes: {}
+ streams_subscribes: {}
+ service_component_name_override:
+ get_input: service_component_name_override
+ docker_config:
+ healthcheck:
+ interval: 300s
+ timeout: 120s
+ script: /etc/init.d/nagios status
+ type: docker
+ image:
+ get_input: image
+ location_id:
+ get_input: location_id
+ service_component_type: test-component-spec
+ replicas:
+ get_input: replicas
+ resource_config:
+ limits:
+ cpu:
+ get_input: test.component.spec_cpu_limit
+ memory:
+ get_input: test.component.spec_memory_limit
+ requests:
+ cpu:
+ get_input: test.component.spec_cpu_request
+ memory:
+ get_input: test.component.spec_memory_request
+ always_pull_image:
+ get_input: always_pull_image
+ relationships: []
\ No newline at end of file
--- /dev/null
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": false,
+ "use_external_tls": false
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
--- /dev/null
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true,
+ "use_external_tls": true
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
--- /dev/null
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
--- /dev/null
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ]
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
</parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator</artifactId>
- <version>1.3.3-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
--- /dev/null
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia. 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.blueprintgenerator.models.blueprint;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class ExternalTlsInfo {
+
+ static final String USE_EXTERNAL_TLS_FIELD = "use_external_tls";
+
+ private static final String DEFAULT_CA = "RA";
+ private static final Object DEFAULT_CERT_TYPE = "P12";
+
+ private static final String INPUT_PREFIX = "external_cert_";
+ private static final String EXTERNAL_CERT_DIRECTORY_FIELD = "external_cert_directory";
+ private static final String CA_NAME_FIELD = "ca_name";
+ private static final String CERT_TYPE_FIELD = "cert_type";
+ private static final String EXTERNAL_CERTIFICATE_PARAMETERS_FIELD = "external_certificate_parameters";
+
+ @JsonProperty(EXTERNAL_CERT_DIRECTORY_FIELD)
+ private String externalCertDirectory;
+
+ @JsonProperty(USE_EXTERNAL_TLS_FIELD)
+ private GetInput useExternalTls;
+
+ @JsonProperty(CA_NAME_FIELD)
+ private GetInput caName;
+
+ @JsonProperty(CERT_TYPE_FIELD)
+ private GetInput certType;
+
+ @JsonProperty(EXTERNAL_CERTIFICATE_PARAMETERS_FIELD)
+ private ExternalCertificateParameters externalCertificateParameters;
+
+ static ExternalTlsInfo createFromComponentSpec(ComponentSpec cs) {
+ ExternalTlsInfo externalTlsInfoBp = new ExternalTlsInfo();
+ TreeMap<String, Object> tlsInfoCs = cs.getAuxilary().getTls_info();
+
+ externalTlsInfoBp.setExternalCertDirectory((String) tlsInfoCs.get("cert_directory"));
+ externalTlsInfoBp.setUseExternalTls(createGetInput(USE_EXTERNAL_TLS_FIELD));
+ externalTlsInfoBp.setCaName(createGetInput(CA_NAME_FIELD));
+ externalTlsInfoBp.setCertType(createGetInput(CERT_TYPE_FIELD));
+
+ ExternalCertificateParameters externalCertificateParameters =
+ ExternalCertificateParameters.create();
+ externalTlsInfoBp.setExternalCertificateParameters(externalCertificateParameters);
+
+ return externalTlsInfoBp;
+ }
+
+ static Map<String, LinkedHashMap<String, Object>> createInputMapFromComponentSpec(ComponentSpec cs){
+ Map<String, LinkedHashMap<String, Object>> retInputs = new HashMap<>();
+
+ Map<String, Object> tlsInfoCs = cs.getAuxilary().getTls_info();
+ LinkedHashMap<String, Object> useTlsFlagInput = Properties.makeInput("boolean",
+ "Flag to indicate external tls enable/disable.",
+ tlsInfoCs.get(USE_EXTERNAL_TLS_FIELD));
+ retInputs.put(addPrefix(USE_EXTERNAL_TLS_FIELD), useTlsFlagInput);
+
+ LinkedHashMap<String, Object> caNameInputMap = Properties.makeInput("string",
+ "Name of Certificate Authority configured on CertService side.",
+ DEFAULT_CA);
+ retInputs.put(addPrefix(CA_NAME_FIELD), caNameInputMap);
+
+ LinkedHashMap<String, Object> certTypeInputMap = Properties.makeInput("string",
+ "Format of provided certificates",
+ DEFAULT_CERT_TYPE);
+ retInputs.put(addPrefix(CERT_TYPE_FIELD), certTypeInputMap);
+
+ retInputs.putAll(ExternalCertificateParameters.createInputMap());
+ return retInputs;
+ }
+
+ private static GetInput createGetInput(String fieldName) {
+ return new GetInput(addPrefix(fieldName));
+ }
+
+ private static String addPrefix(String fieldName) {
+ return INPUT_PREFIX + fieldName;
+ }
+
+ @Getter
+ @Setter
+ @NoArgsConstructor
+ public static class ExternalCertificateParameters {
+
+ private static final String DEFAULT_COMMON_NAME = "sample.onap.org";
+ private static final String DEFAULT_SANS = "sample.onap.org:component.sample.onap.org";
+
+ private static final String COMMON_NAME_FIELD = "common_name";
+ private static final String SANS_FIELD = "sans";
+
+ @JsonProperty(COMMON_NAME_FIELD)
+ private GetInput commonName;
+
+ @JsonProperty(SANS_FIELD)
+ private GetInput sans;
+
+
+ private static ExternalCertificateParameters create() {
+ ExternalCertificateParameters externalCertificateParameters = new ExternalCertificateParameters();
+ externalCertificateParameters.setCommonName(createGetInput(COMMON_NAME_FIELD));
+ externalCertificateParameters.setSans(createGetInput(SANS_FIELD));
+ return externalCertificateParameters;
+ }
+
+ private static Map<String, LinkedHashMap<String, Object>> createInputMap(){
+ Map<String, LinkedHashMap<String, Object>> retInputs = new LinkedHashMap<>();
+
+ LinkedHashMap<String, Object> commonNameInputMap = Properties.makeInput("string",
+ "Common name which should be present in certificate.",
+ DEFAULT_COMMON_NAME);
+ retInputs.put(addPrefix(COMMON_NAME_FIELD), commonNameInputMap);
+
+ LinkedHashMap<String, Object> sansInputMap = Properties.makeInput("string",
+ "\"List of Subject Alternative Names (SANs) which should be present in certificate. " +
+ "Delimiter - : Should contain common_name value and other FQDNs under which given " +
+ "component is accessible.\"",
+ DEFAULT_SANS);
+ retInputs.put(addPrefix(SANS_FIELD), sansInputMap);
+ return retInputs;
+ }
+ }
+}
-/**============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Modifications Copyright (c) 2020 Nokia. 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
+ 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=========================================================
+ 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.blueprintgenerator.models.blueprint;
-import lombok.Getter; import lombok.Setter;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
-@Getter @Setter
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
public class GetInput {
private Object get_input;
import lombok.Getter; import lombok.Setter;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.TreeMap;
+
@Getter @Setter
public class Node {
private String type;
+ private TreeMap<String, Interfaces> interfaces;
+ private Properties properties;
+ private ArrayList<LinkedHashMap<String, String>> relationships;
}
-/**============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
+ ================================================================================
+ Modifications Copyright (c) 2020 Nokia. 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
See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END=========================================================
-
*/
package org.onap.blueprintgenerator.models.blueprint;
import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.TreeMap;
import org.onap.blueprintgenerator.models.componentspec.Auxilary;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import lombok.Getter; import lombok.Setter;
+import lombok.Getter;
+import lombok.Setter;
-@Getter @Setter
-@JsonInclude(value=Include.NON_NULL)
+@Getter
+@Setter
+@JsonInclude(value = Include.NON_NULL)
public class Properties {
private Appconfig application_config;
private Auxilary docker_config;
ArrayList<DmaapStreams> streams_publishes;
ArrayList<DmaapStreams> streams_subscribes;
private TlsInfo tls_info;
+ private ExternalTlsInfo external_cert;
private ResourceConfig resource_config;
private GetInput always_pull_image;
//private boolean useExisting;
GetInput replica = new GetInput();
replica.setGet_input("replicas");
this.setReplicas(replica);
- LinkedHashMap<String, Object> rep = new LinkedHashMap<String, Object>();
- rep.put("type", "integer");
- rep.put("description", "number of instances");
- rep.put("default", 1);
+ LinkedHashMap<String, Object> rep = makeInput("integer", "number of instances", 1);
retInputs.put("replicas", rep);
//set the dns name
// set always_pull_image
this.always_pull_image = new GetInput();
this.always_pull_image.setGet_input("always_pull_image");
- LinkedHashMap<String, Object> inputAlwaysPullImage = new LinkedHashMap<String, Object>();
- inputAlwaysPullImage.put("type", "boolean");
- inputAlwaysPullImage.put("description", "Set to true if the image should always be pulled");
- inputAlwaysPullImage.put("default", true);
+ LinkedHashMap<String, Object> inputAlwaysPullImage = makeInput("boolean",
+ "Set to true if the image should always be pulled",
+ true);
retInputs.put("always_pull_image", inputAlwaysPullImage);
sType = sType.replace('.', '-');
this.setService_component_type(sType);
- //set the tls info
- if(cs.getAuxilary().getTls_info() != null){
- addTlsInfo(cs,retInputs);
+ //set the tls info for internal and external communication
+ if (cs.getAuxilary().getTls_info() != null) {
+ addTlsInfo(cs, retInputs);
+ addExternalTlsInfo(cs, retInputs);
}
//set the reource config
sType = sType.replace('.', '-');
this.setService_component_type(sType);
- //set the tls info
- if(cs.getAuxilary().getTls_info() != null){
- addTlsInfo(cs,retInputs);
+ //set the tls info for internal and external communication
+ if (cs.getAuxilary().getTls_info() != null) {
+ addTlsInfo(cs, retInputs);
+ addExternalTlsInfo(cs, retInputs);
}
//set the replicas
GetInput replica = new GetInput();
replica.setGet_input("replicas");
this.setReplicas(replica);
- LinkedHashMap<String, Object> rep = new LinkedHashMap<String, Object>();
- rep.put("type", "integer");
- rep.put("description", "number of instances");
- rep.put("default", 1);
+ LinkedHashMap<String, Object> rep = makeInput("integer", "number of instances", 1);
retInputs.put("replicas", rep);
// //set the dns name
//set the stream publishes
ArrayList<DmaapStreams> pubStreams = new ArrayList();
- if(cs.getStreams().getPublishes() != null) {
- for(Publishes p: cs.getStreams().getPublishes()) {
- if(p.getType().equals("message_router") || p.getType().equals("message router")) {
+ if (cs.getStreams().getPublishes() != null) {
+ for (Publishes p : cs.getStreams().getPublishes()) {
+ if (p.getType().equals("message_router") || p.getType().equals("message router")) {
String topic = p.getConfig_key() + "_topic";
DmaapStreams mrStreams = new DmaapStreams();
retInputs = mrStreams.createStreams(inps, cs, topic, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
pubStreams.add(mrStreams);
- }
- else if(p.getType().equals("data_router") || p.getType().equals("data router")){
+ } else if (p.getType().equals("data_router") || p.getType().equals("data router")) {
String feed = p.getConfig_key() + "_feed";
DmaapStreams drStreams = new DmaapStreams();
retInputs = drStreams.createStreams(inps, cs, feed, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
//set the stream subscribes
ArrayList<DmaapStreams> subStreams = new ArrayList();
- if(cs.getStreams().getSubscribes() != null) {
- for(Subscribes s: cs.getStreams().getSubscribes()) {
- if(s.getType().equals("message_router") || s.getType().equals("message router")) {
+ if (cs.getStreams().getSubscribes() != null) {
+ for (Subscribes s : cs.getStreams().getSubscribes()) {
+ if (s.getType().equals("message_router") || s.getType().equals("message router")) {
String topic = s.getConfig_key() + "_topic";
DmaapStreams mrStreams = new DmaapStreams();
retInputs = mrStreams.createStreams(inps, cs, topic, s.getType(), s.getConfig_key(), s.getRoute(), 's');
subStreams.add(mrStreams);
- }
- else if(s.getType().equals("data_router") || s.getType().equals("data router")){
+ } else if (s.getType().equals("data_router") || s.getType().equals("data router")) {
String feed = s.getConfig_key() + "_feed";
DmaapStreams drStreams = new DmaapStreams();
retInputs = drStreams.createStreams(inps, cs, feed, s.getType(), s.getConfig_key(), s.getRoute(), 's');
}
}
- if(pubStreams.size() != 0) {
+ if (pubStreams.size() != 0) {
this.setStreams_publishes(pubStreams);
}
- if(subStreams.size() != 0) {
+ if (subStreams.size() != 0) {
this.setStreams_subscribes(subStreams);
}
useTLSFlag.setGet_input("use_tls");
tlsInfo.setUseTls(useTLSFlag);
this.setTls_info(tlsInfo);
- LinkedHashMap<String, Object> useTlsFlagInput = new LinkedHashMap<String, Object>();
- useTlsFlagInput.put("type", "boolean");
- useTlsFlagInput.put("description", "flag to indicate tls enable/disable");
- useTlsFlagInput.put("default", cs.getAuxilary().getTls_info().get("use_tls"));
+ LinkedHashMap<String, Object> useTlsFlagInput = makeInput("boolean",
+ "flag to indicate tls enable/disable",
+ cs.getAuxilary().getTls_info().get("use_tls"));
retInputs.put("use_tls", useTlsFlagInput);
}
+
+ private void addExternalTlsInfo(ComponentSpec cs, Map<String, LinkedHashMap<String, Object>> retInputs) {
+ if(cs.getAuxilary().getTls_info().get(ExternalTlsInfo.USE_EXTERNAL_TLS_FIELD) == null)
+ return;
+ this.setExternal_cert(ExternalTlsInfo.createFromComponentSpec(cs));
+ retInputs.putAll(ExternalTlsInfo.createInputMapFromComponentSpec(cs));
+ }
+
+ static LinkedHashMap<String, Object> makeInput(String type, String description, Object defaultValue) {
+ LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
+ inputMap.put("type", type);
+ inputMap.put("description", description);
+ inputMap.put("default", defaultValue);
+ return inputMap;
+ }
}
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
================================================================================
+ Modifications Copyright (c) 2020 Nokia. 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
// this.setPorts(ports);
// return retInputs;
// }
-}
\ No newline at end of file
+}
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
================================================================================
+ Modifications Copyright (c) 2020 Nokia. 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
bp.setInputs(inps);
return bp;
}
-}
\ No newline at end of file
+}
public class DmaapNode extends Node{
- private TreeMap<String, Interfaces> interfaces;
- private Properties properties;
- private ArrayList<LinkedHashMap<String, String>> relationships;
-
public TreeMap<String, LinkedHashMap<String, Object>> createDmaapNode(ComponentSpec cs, TreeMap<String, LinkedHashMap<String, Object>> inps, String override) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
+ ================================================================================
+ Modifications Copyright (c) 2020 Nokia. 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
this.setTosca_definitions_version("cloudify_dsl_1_3");
//set the imports
- if(importPath != "") {
+ if(!"".equals(importPath)) {
Imports imps = new Imports();
this.setImports(imps.createImportsFromFile(importPath));
}
return bp;
}
-}
\ No newline at end of file
+}
@JsonInclude(value=Include.NON_NULL)
public class OnapNode extends Node{
- private TreeMap<String, Interfaces> interfaces;
- private Properties properties;
- private ArrayList<LinkedHashMap<String, String>> relationships;
public TreeMap<String, LinkedHashMap<String, Object>> createOnapNode(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
return retInputs;
}
-}
\ No newline at end of file
+}
assertEquals(true, test);
}
+
+
@Test
public void dmaapPluginTest() {
ComponentSpec cs = new ComponentSpec();
--- /dev/null
+/**============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia. 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.blueprintgenerator.core;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.onap.blueprintgenerator.models.blueprint.Blueprint;
+import org.onap.blueprintgenerator.models.blueprint.ExternalTlsInfo;
+import org.onap.blueprintgenerator.models.blueprint.Node;
+import org.onap.blueprintgenerator.models.blueprint.TlsInfo;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+@RunWith(Parameterized.class)
+public class TlsInfoTest {
+
+ @Parameterized.Parameter
+ public char bpType;
+
+ @Parameterized.Parameters(name = "Blueprint type: {0}")
+ public static List<Character> data() {
+ return Arrays.asList('o', 'd');
+ }
+
+ @Test
+ public void useTlsTrueAndUseExternalTlsTrueTest(){
+ Blueprint bp = createBlueprintFromFile("TestCases/TlsInfo/testComponentSpec_withTlsTrueAndExternalTlsTrue.json");
+
+ assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, true);
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
+ }
+
+ @Test
+ public void useTlsFalseAndUseExternalTlsFalseTest(){
+ Blueprint bp = createBlueprintFromFile("TestCases/TlsInfo/testComponentSpec_withTlsFalseAndExternalTlsFalse.json");
+
+ assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, false);
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, false);
+ }
+
+ @Test
+ public void useTlsTrueAndNoExternalTlsFlagTest(){
+ Blueprint bp = createBlueprintFromFile("TestCases/TlsInfo/testComponentSpec_withTlsTrueAndNoExternalTls.json");
+
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
+ assertBlueprintHasNoExternalTlsInfo(bp);
+ }
+
+ @Test
+ public void noTlsInfo(){
+ Blueprint bp = createBlueprintFromFile("TestCases/TlsInfo/testComponentSpec_withoutTlsInfo.json");
+
+ assertBlueprintHasNoTlsInfo(bp);
+ assertBlueprintHasNoExternalTlsInfo(bp);
+ }
+
+ private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(Blueprint bp, boolean useFlagDefault) {
+ //should create proper inputs
+ assertContainsInputWithDefault(bp, "external_cert_use_external_tls", useFlagDefault);
+ assertContainsInputWithDefault(bp, "external_cert_ca_name", "\"RA\"");
+ assertContainsInputWithDefault(bp, "external_cert_cert_type", "\"P12\"");
+ assertContainsInputWithDefault(bp, "external_cert_common_name", "\"sample.onap.org\"");
+ assertContainsInputWithDefault(bp, "external_cert_sans",
+ "\"sample.onap.org:component.sample.onap.org\"");
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should create proper externalTlsInfo object in node properties
+ ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
+ assertNotNull(externalTlsInfo);
+
+ assertEquals("external_cert_ca_name", externalTlsInfo.getCaName().getGet_input());
+ assertEquals("external_cert_cert_type", externalTlsInfo.getCertType().getGet_input());
+ assertEquals("external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getGet_input());
+ assertEquals("/opt/app/dcae-certificate/", externalTlsInfo.getExternalCertDirectory());
+
+ ExternalTlsInfo.ExternalCertificateParameters extCertParams = externalTlsInfo.getExternalCertificateParameters();
+ assertNotNull(extCertParams);
+
+ assertEquals("external_cert_common_name", extCertParams.getCommonName().getGet_input());
+ assertEquals("external_cert_sans", extCertParams.getSans().getGet_input());
+ }
+
+ private void assertBlueprintContainsTlsInfoWithUseFlagDefault(Blueprint bp, boolean useFlagDefault) {
+ //shold create proper inputs
+ assertContainsInputWithDefault(bp, "use_tls", useFlagDefault);
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should create proper tlsInfo object in node properties
+ TlsInfo tlsInfo = node.getProperties().getTls_info();
+ assertEquals("use_tls", tlsInfo.getUseTls().getGet_input());
+ assertEquals("/opt/app/dcae-certificate/", tlsInfo.getCertDirectory());
+
+ }
+
+ private void assertBlueprintHasNoExternalTlsInfo(Blueprint bp) {
+ //should not create inputs for external tls
+ assertFalse(bp.getInputs().containsKey("external_cert_use_external_tls"));
+ assertFalse(bp.getInputs().containsKey("external_cert_common_name"));
+ assertFalse(bp.getInputs().containsKey("external_cert_ca_name"));
+ assertFalse(bp.getInputs().containsKey("external_cert_sans"));
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should not create externalTlsInfo object in node properties
+ ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
+ assertNull(externalTlsInfo);
+ }
+
+
+ private void assertBlueprintHasNoTlsInfo(Blueprint bp) {
+ //should not create inputs for tls
+ assertFalse(bp.getInputs().containsKey("use_tls"));
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should not create tlsInfo object in node properties
+ assertNull(node.getProperties().getTls_info());
+ }
+
+ private void assertContainsInputWithDefault(Blueprint bp, String inputName, Object defaultValue) {
+ LinkedHashMap<String, Object> input = bp.getInputs().get(inputName);
+ assertNotNull(input);
+ assertEquals(defaultValue, input.get("default"));
+ }
+
+ private Blueprint createBlueprintFromFile(String path) {
+ ComponentSpec cs = new ComponentSpec();
+ cs.createComponentSpecFromFile(path);
+
+ Blueprint bp = new Blueprint();
+ bp = bp.createBlueprint(cs, "", this.bpType, "", "");
+ return bp;
+ }
+}
major=1
-minor=3
-patch=3
+minor=4
+patch=0
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT
"uniqueItems": true,
"items": {
"oneOf": [
- { "$ref": "#/definitions/publisher_http" },
- { "$ref": "#/definitions/publisher_message_router" },
- { "$ref": "#/definitions/publisher_data_router" }
+ { "$ref": "#/definitions/publisher_http" },
+ { "$ref": "#/definitions/publisher_message_router" },
+ { "$ref": "#/definitions/publisher_data_router" }
]
}
},
"uniqueItems": true,
"items": {
"oneOf": [
- { "$ref": "#/definitions/subscriber_http" },
- { "$ref": "#/definitions/subscriber_message_router" },
- { "$ref": "#/definitions/subscriber_data_router" }
+ { "$ref": "#/definitions/subscriber_http" },
+ { "$ref": "#/definitions/subscriber_message_router" },
+ { "$ref": "#/definitions/subscriber_data_router" }
]
}
}
"provides"
]
},
- "parameters" : {
+ "parameters" : {
"anyOf" : [
{"$ref": "#/definitions/docker-parameters"},
{"$ref": "#/definitions/cdap-parameters"}
"policy_info": {
"type": "object",
"properties": {
- "policy":
+ "policy":
{
"type": "array",
- "items":
+ "items":
{
"type": "object",
- "properties":
+ "properties":
{
- "node_label":
+ "node_label":
{
"type": "string"
},
- "policy_id":
+ "policy_id":
{
- "type": "string"
+ "type": "string"
},
- "policy_model_id":
+ "policy_model_id":
{
- "type": "string"
+ "type": "string"
}
},
"required": ["node_label", "policy_model_id"]
"app_preferences" : {
"description" : "Parameters Passed down to the CDAP preference API",
"type": "array",
- "uniqueItems": true,
- "items": {
- "$ref": "#/definitions/parameter"
- }
+ "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"
- }
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
}
}
},
},
"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"
- }
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "$ref": "#/definitions/parameter"
+ }
}
},
"required": ["program_type", "program_id", "program_pref"]
},
"parameter": {
"oneOf": [
- {"$ref": "#/definitions/parameter-list"},
- {"$ref": "#/definitions/parameter-other"}
+ {"$ref": "#/definitions/parameter-list"},
+ {"$ref": "#/definitions/parameter-other"}
]
},
"parameter-list": {
}
},
"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"}
+ "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).",
"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"
- ],
+ "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": {
"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"]
+ "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" : [
"service_name",
"service_endpoint",
"verb"
- ]
+ ]
},
"docker-provider": {
"type": "object",
"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"
- ],
+ "cert_directory","use_tls"
+ ],
"additionalProperties": false
},
"databases": {
}
},
"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"
- }
+ "properties": {
+ "trigger_type": {
+ "description": "Only value of docker is supported at this time.",
+ "type": "string",
+ "enum": ["docker"]
},
- "required": [
- "trigger_type","script_path"
- ],
- "additionalProperties": false
+ "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",
+ "type": "object",
"properties": {
"host":{
- "type":"object",
+ "type":"object",
"path": {"type": "string"}
},
"container":{
- "type":"object",
+ "type":"object",
"bind": { "type": "string"},
"mode": { "type": "string"}
}
"required": [
"type",
"endpoint"
- ]
+ ]
},
"docker_healthcheck_script": {
"properties": {
"required": [
"type",
"script"
- ]
+ ]
}
}
}
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator</artifactId>
- <version>1.3.1</version>
+ <version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>