summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bpgenerator/src/main/java')
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java37
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java51
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java14
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java12
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapInfo.java99
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ExternalTlsInfo.java153
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java9
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java481
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java13
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java9
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java107
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java (renamed from mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java)23
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java74
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java102
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java38
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java (renamed from mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java)6
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java37
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java43
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java54
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java9
-rw-r--r--mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java19
21 files changed, 823 insertions, 567 deletions
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java
new file mode 100644
index 0000000..16eca51
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/common/blueprint/BlueprintHelper.java
@@ -0,0 +1,37 @@
+/*============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.common.blueprint;
+
+
+import lombok.experimental.UtilityClass;
+
+import java.util.LinkedHashMap;
+
+@UtilityClass
+public class BlueprintHelper {
+
+ public static LinkedHashMap<String, Object> createInputValue(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;
+ }
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java
index a22d588..7c3193e 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PgaasNodeBuilder.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -19,6 +20,11 @@
*/
package org.onap.blueprintgenerator.core;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
import org.onap.blueprintgenerator.exception.DatabasesNotFoundException;
import org.onap.blueprintgenerator.models.GetAttribute;
import org.onap.blueprintgenerator.models.blueprint.GetInput;
@@ -27,7 +33,7 @@ import org.onap.blueprintgenerator.models.blueprint.pgaas.PgaasNode;
import org.onap.blueprintgenerator.models.blueprint.pgaas.PgaasNodeProperties;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-import java.util.*;
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createInputValue;
public class PgaasNodeBuilder {
@@ -39,29 +45,22 @@ public class PgaasNodeBuilder {
private static final String DB_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on";
-
- public static void addPgaasNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ public static void addPgaasNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate,
+ TreeMap<String, LinkedHashMap<String, Object>> inps) {
TreeMap<String, String> databases = cs.getAuxilary().getDatabases();
- if(databases == null){
+ if (databases == null) {
throw new DatabasesNotFoundException("databases section not found in componentspec");
}
- for(Map.Entry<String, String> database : databases.entrySet()){
+ for (Map.Entry<String, String> database : databases.entrySet()) {
addPgaasNode(database, nodeTemplate);
addPgaasInputs(database, inps);
}
}
- private static void addPgaasInputs(Map.Entry<String, String> database, TreeMap<String, LinkedHashMap<String, Object>> inps) {
- inps.put(database.getKey() + NAME_POSTFIX, getInputValue("string", "db name", ""));
- inps.put(database.getKey() + WRITER_FQDN_POSTFIX, getInputValue("string", "db writerfqdn", ""));
- }
-
- private static LinkedHashMap<String, Object> getInputValue(String type, String description, Object defaultValue) {
- LinkedHashMap<String, Object> inputValueMap = new LinkedHashMap();
- inputValueMap.put("type", type);
- inputValueMap.put("description", description);
- inputValueMap.put("default", defaultValue);
- return inputValueMap;
+ private static void addPgaasInputs(Map.Entry<String, String> database,
+ TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ inps.put(database.getKey() + NAME_POSTFIX, createInputValue("string", "db name", ""));
+ inps.put(database.getKey() + WRITER_FQDN_POSTFIX, createInputValue("string", "db writerfqdn", ""));
}
private static void addPgaasNode(Map.Entry<String, String> database, TreeMap<String, Node> nodeTemplate) {
@@ -69,18 +68,18 @@ public class PgaasNodeBuilder {
String dbName = database.getKey();
pgaasNode.setType(PGAAS_NODE_TYPE);
pgaasNode.setPgaasNodeProperties(buildPgaasNodeProperties(dbName));
- nodeTemplate.put(dbName + PGAAS_NODE_NAME_POSTFIX , pgaasNode);
+ nodeTemplate.put(dbName + PGAAS_NODE_NAME_POSTFIX, pgaasNode);
}
private static PgaasNodeProperties buildPgaasNodeProperties(String dbName) {
PgaasNodeProperties pgaasNodeProperties = new PgaasNodeProperties();
GetInput nameValue = new GetInput();
- nameValue.setGet_input(dbName + NAME_POSTFIX);
+ nameValue.setBpInputName(dbName + NAME_POSTFIX);
pgaasNodeProperties.setName(nameValue);
GetInput writerfqdnValue = new GetInput();
- writerfqdnValue.setGet_input(dbName + WRITER_FQDN_POSTFIX);
+ writerfqdnValue.setBpInputName(dbName + WRITER_FQDN_POSTFIX);
pgaasNodeProperties.setWriterfqdn(writerfqdnValue);
pgaasNodeProperties.setUseExisting(USE_EXISTING);
@@ -90,7 +89,7 @@ public class PgaasNodeBuilder {
public static ArrayList<LinkedHashMap<String, String>> getPgaasNodeRelationships(ComponentSpec cs) {
ArrayList<LinkedHashMap<String, String>> relationships = new ArrayList<>();
- for(Map.Entry<String, String> database : cs.getAuxilary().getDatabases().entrySet()){
+ for (Map.Entry<String, String> database : cs.getAuxilary().getDatabases().entrySet()) {
LinkedHashMap<String, String> relationship = new LinkedHashMap<>();
relationship.put("type", DB_RELATIONSHIP_TYPE);
relationship.put("target", database.getKey() + PGAAS_NODE_NAME_POSTFIX);
@@ -101,23 +100,23 @@ public class PgaasNodeBuilder {
public static LinkedHashMap<String, Object> getEnvVariables(TreeMap<String, String> databases) {
LinkedHashMap<String, Object> envVariables = new LinkedHashMap<String, Object>();
- for(Map.Entry<String, String> database : databases.entrySet()){
+ for (Map.Entry<String, String> database : databases.entrySet()) {
String name = database.getKey().toUpperCase();
envVariables.put("<<", "*envs");
GetInput nameValue = new GetInput();
- nameValue.setGet_input(name.toLowerCase() + NAME_POSTFIX);
+ nameValue.setBpInputName(name.toLowerCase() + NAME_POSTFIX);
envVariables.put(name + "_DB_NAME", nameValue);
GetAttribute adminHostValue = buildGetAttributeValue(name.toLowerCase(), "admin", "host");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
GetAttribute adminUserValue = buildGetAttributeValue(name.toLowerCase(), "admin", "user");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
GetAttribute adminPasswordValue = buildGetAttributeValue(name.toLowerCase(), "admin", "password");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
}
return envVariables;
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java
index a947ab7..1c3713b 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/core/PolicyNodeBuilder.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -36,9 +37,10 @@ public class PolicyNodeBuilder {
private static final String POLICY_NODE_TYPE = "clamp.nodes.policy";
private static final String POLICY_RELATIONSHIP_TYPE = "cloudify.relationships.depends_on";
- public static void addPolicyNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate, TreeMap<String, LinkedHashMap<String, Object>> inps) {
+ public static void addPolicyNodesAndInputs(ComponentSpec cs, TreeMap<String, Node> nodeTemplate,
+ TreeMap<String, LinkedHashMap<String, Object>> inps) {
List<TypePolicy> policyList = cs.getPolicyInfo().getTypePolicyList();
- for(TypePolicy policy: policyList){
+ for (TypePolicy policy : policyList) {
addPolicyNodesToNodeTemplate(policy, nodeTemplate);
addPolicyInputs(policy, inps);
}
@@ -54,7 +56,7 @@ public class PolicyNodeBuilder {
inputValueMap.put("type", type);
inputValueMap.put("description", description);
inputValueMap.put("default", defaultValue);
- return inputValueMap;
+ return inputValueMap;
}
private static void addPolicyNodesToNodeTemplate(TypePolicy policy, TreeMap<String, Node> nodeTemplate) {
@@ -68,7 +70,7 @@ public class PolicyNodeBuilder {
PolicyNodeProperties policyNodeProperties = new PolicyNodeProperties();
GetInput policyIdGetInput = new GetInput();
- policyIdGetInput.setGet_input(policy.getNode_label() + "_policy_id");
+ policyIdGetInput.setBpInputName(policy.getNode_label() + "_policy_id");
policyNodeProperties.setPolicyId(policyIdGetInput);
policyNodeProperties.setPolicyModelId(policy.getPolicy_model_id());
@@ -79,7 +81,7 @@ public class PolicyNodeBuilder {
public static ArrayList<LinkedHashMap<String, String>> getPolicyRelationships(ComponentSpec cs) {
ArrayList<LinkedHashMap<String, String>> relationships = new ArrayList<>();
List<TypePolicy> policyList = cs.getPolicyInfo().getTypePolicyList();
- for(TypePolicy policy: policyList){
+ for (TypePolicy policy : policyList) {
LinkedHashMap<String, String> relationship = new LinkedHashMap<>();
relationship.put("type", POLICY_RELATIONSHIP_TYPE);
relationship.put("target", policy.getNode_label());
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
index 04745dc..b39a8ec 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java
@@ -1,8 +1,9 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
- Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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
@@ -23,6 +24,7 @@ package org.onap.blueprintgenerator.models.blueprint;
import java.util.LinkedHashMap;
import java.util.TreeMap;
+import org.onap.blueprintgenerator.models.blueprint.dmaap.DmaapObj;
import org.onap.blueprintgenerator.models.componentspec.CallsObj;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Parameters;
@@ -113,7 +115,7 @@ public class Appconfig {
String pName = p.getName();
if(p.isSourced_at_deployment()) {
GetInput paramInput = new GetInput();
- paramInput.setGet_input(pName);
+ paramInput.setBpInputName(pName);
parameters.put(pName, paramInput);
if(!p.getValue().equals("")) {
@@ -139,7 +141,7 @@ public class Appconfig {
}
if(override != null) {
GetInput ov = new GetInput();
- ov.setGet_input("service_component_name_override");
+ ov.setBpInputName("service_component_name_override");
parameters.put("service_component_name_override", ov);
LinkedHashMap<String, Object> over = new LinkedHashMap<String, Object>();
over.put("type", "string");
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapInfo.java
deleted file mode 100644
index 97dafc7..0000000
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapInfo.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**============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
-
- 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 java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.TreeMap;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.Getter; import lombok.Setter;
-
-@Getter @Setter
-@JsonInclude(value=Include.NON_NULL)
-public class DmaapInfo {
- private GetInput topic_url;
- private GetInput username;
- private GetInput password;
- private GetInput location;
- private GetInput delivery_url;
- private GetInput subscriber_id;
-
- public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRInfo(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
- stringType.put("type", "string");
-
- config = config.replaceAll("-", "_");
- if(type == 'p') {
- config = config + "_publish_url";
- }
- else if(type == 's') {
- config = config+ "_subscribe_url";
- }
-
- GetInput topic = new GetInput();
- topic.setGet_input(config);
- this.setTopic_url(topic);
-
- retInputs.put(config, stringType);
-
- return retInputs;
- }
-
- public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRInfo(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
- stringType.put("type", "string");
-
- GetInput username = new GetInput();
- username.setGet_input(config + "_" + "username");
- this.setUsername(username);
- retInputs.put(config + "_" + "username", stringType);
-
- GetInput password = new GetInput();
- password.setGet_input(config + "_" + "password");
- this.setPassword(password);
- retInputs.put(config + "_" + "password", stringType);
-
- GetInput location = new GetInput();
- location.setGet_input(config + "_" + "location");
- this.setLocation(location);
- retInputs.put(config + "_" + "location", stringType);
-
- GetInput deliveryUrl = new GetInput();
- deliveryUrl.setGet_input(config + "_" + "delivery_url");
- this.setDelivery_url(deliveryUrl);
- retInputs.put(config + "_" + "delivery_url", stringType);
-
- GetInput subscriberID = new GetInput();
- subscriberID.setGet_input(config + "_" + "subscriber_id");
- this.setSubscriber_id(subscriberID);
- retInputs.put(config + "_" + "subscriber_id", stringType);
-
-
- return retInputs;
- }
-}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ExternalTlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ExternalTlsInfo.java
deleted file mode 100644
index cf97dec..0000000
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ExternalTlsInfo.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**============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;
- }
- }
-}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java
index 351c2b2..3d5ca3d 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java
@@ -1,9 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Modifications Copyright (c) 2020 Nokia. All rights reserved.
+ 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.
@@ -22,6 +21,7 @@
package org.onap.blueprintgenerator.models.blueprint;
+import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -33,5 +33,6 @@ import lombok.Setter;
@AllArgsConstructor
public class GetInput {
- private Object get_input;
+ @JsonProperty("get_input")
+ private Object bpInputName;
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
index d7947f8..5087066 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java
@@ -1,15 +1,14 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
- Modifications Copyright (c) 2020 Nokia. All rights reserved.
+ 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,
@@ -21,167 +20,183 @@
package org.onap.blueprintgenerator.models.blueprint;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.USE_EXTERNAL_TLS_FIELD;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;
-
+import lombok.Getter;
+import lombok.Setter;
+import org.onap.blueprintgenerator.common.blueprint.BlueprintHelper;
+import org.onap.blueprintgenerator.models.blueprint.tls.ExternalCertificateParametersFactory;
+import org.onap.blueprintgenerator.models.blueprint.tls.ExternalTlsInfoFactory;
+import org.onap.blueprintgenerator.models.blueprint.tls.TlsInfo;
+import org.onap.blueprintgenerator.models.blueprint.tls.impl.ExternalTlsInfo;
import org.onap.blueprintgenerator.models.componentspec.Auxilary;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
import org.onap.blueprintgenerator.models.dmaapbp.DmaapStreams;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-
-import lombok.Getter;
-import lombok.Setter;
-
@Getter
@Setter
@JsonInclude(value = Include.NON_NULL)
public class Properties {
- private Appconfig application_config;
- private Auxilary docker_config;
- private Object image;
- private GetInput location_id;
- private String service_component_type;
- private TreeMap<String, Object> log_info;
- private String dns_name;
- private Object replicas;
- private String name;
- private GetInput topic_name;
- private GetInput feed_name;
- 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;
-
- public TreeMap<String, LinkedHashMap<String, Object>> createOnapProperties(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
-
- //set the image
- GetInput image = new GetInput();
- image.setGet_input("image");
- this.setImage(image);
- LinkedHashMap<String, Object> img = new LinkedHashMap<String, Object>();
- img.put("type", "string");
- img.put("default", cs.getArtifacts()[0].getUri());
- retInputs.put("image", img);
-
- //set the location id
- GetInput location = new GetInput();
- location.setGet_input("location_id");
- this.setLocation_id(location);
- LinkedHashMap<String, Object> locMap = new LinkedHashMap();
- locMap.put("type", "string");
- locMap.put("default", "");
- retInputs.put("location_id", locMap);
-
- //set the log info
- this.setLog_info(cs.getAuxilary().getLog_info());
-
- //set the replicas
- GetInput replica = new GetInput();
- replica.setGet_input("replicas");
- this.setReplicas(replica);
- LinkedHashMap<String, Object> rep = makeInput("integer", "number of instances", 1);
- retInputs.put("replicas", rep);
-
- //set the dns name
- //this.setDns_name(cs.getSelf().getName());
-
- //set the name
- //this.setName(cs.getSelf().getName());
-
- //set the docker config
- Auxilary aux = cs.getAuxilary();
+
+ private Appconfig application_config;
+ private Auxilary docker_config;
+ private Object image;
+ private GetInput location_id;
+ private String service_component_type;
+ private TreeMap<String, Object> log_info;
+ private String dns_name;
+ private Object replicas;
+ private String name;
+ private GetInput topic_name;
+ private GetInput feed_name;
+ 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;
+ private ExternalTlsInfoFactory externalCertFactory;
+
+ public Properties() {
+ ExternalCertificateParametersFactory externalCertificateDataFactory = new ExternalCertificateParametersFactory();
+ externalCertFactory = new ExternalTlsInfoFactory(externalCertificateDataFactory);
+ }
+
+ public TreeMap<String, LinkedHashMap<String, Object>> createOnapProperties(
+ TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
+
+ //set the image
+ GetInput image = new GetInput();
+ image.setBpInputName("image");
+ this.setImage(image);
+ LinkedHashMap<String, Object> img = new LinkedHashMap<String, Object>();
+ img.put("type", "string");
+ img.put("default", cs.getArtifacts()[0].getUri());
+ retInputs.put("image", img);
+
+ //set the location id
+ GetInput location = new GetInput();
+ location.setBpInputName("location_id");
+ this.setLocation_id(location);
+ LinkedHashMap<String, Object> locMap = new LinkedHashMap();
+ locMap.put("type", "string");
+ locMap.put("default", "");
+ retInputs.put("location_id", locMap);
+
+ //set the log info
+ this.setLog_info(cs.getAuxilary().getLog_info());
+
+ //set the replicas
+ GetInput replica = new GetInput();
+ replica.setBpInputName("replicas");
+ this.setReplicas(replica);
+ LinkedHashMap<String, Object> rep = BlueprintHelper.createInputValue("integer", "number of instances", 1);
+ retInputs.put("replicas", rep);
+
+ //set the dns name
+ //this.setDns_name(cs.getSelf().getName());
+
+ //set the name
+ //this.setName(cs.getSelf().getName());
+
+ //set the docker config
+ Auxilary aux = cs.getAuxilary();
// if(aux.getPorts() != null) {
// retInputs = aux.createPorts(retInputs);
// }
- this.setDocker_config(aux);
-
- //set the app config
- Appconfig app = new Appconfig();
- retInputs = app.createAppconfig(retInputs, cs, override, false);
- this.setApplication_config(app);
-
- // set always_pull_image
- this.always_pull_image = new GetInput();
- this.always_pull_image.setGet_input("always_pull_image");
- LinkedHashMap<String, Object> inputAlwaysPullImage = makeInput("boolean",
- "Set to true if the image should always be pulled",
- true);
- retInputs.put("always_pull_image", inputAlwaysPullImage);
-
-
- //set service component type
- String sType = cs.getSelf().getName();
- sType = sType.replace('.', '-');
- this.setService_component_type(sType);
-
- //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
- ResourceConfig resource = new ResourceConfig();
- retInputs = resource.createResourceConfig(retInputs, cs.getSelf().getName());
- this.setResource_config(resource);
-
- return retInputs;
- }
-
- public TreeMap<String, LinkedHashMap<String, Object>> createDmaapProperties(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
- TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
- retInputs = inps;
-
- //set the image
- GetInput image = new GetInput();
- image.setGet_input("tag_version");
- this.setImage(image);
- LinkedHashMap<String, Object> img = new LinkedHashMap<String, Object>();
- img.put("type", "string");
- img.put("default", cs.getArtifacts()[0].getUri());
- retInputs.put("tag_version", img);
-
-
- //set the location id
- GetInput location = new GetInput();
- location.setGet_input("location_id");
- this.setLocation_id(location);
- LinkedHashMap<String, Object> locMap = new LinkedHashMap();
- locMap.put("type", "string");
- locMap.put("default", "");
- retInputs.put("location_id", locMap);
-
- //set the log info
- this.setLog_info(cs.getAuxilary().getLog_info());
-
- //set service component type
- String sType = cs.getSelf().getName();
- sType = sType.replace('.', '-');
- this.setService_component_type(sType);
-
- //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 = makeInput("integer", "number of instances", 1);
- retInputs.put("replicas", rep);
+ this.setDocker_config(aux);
+
+ //set the app config
+ Appconfig app = new Appconfig();
+ retInputs = app.createAppconfig(retInputs, cs, override, false);
+ this.setApplication_config(app);
+
+ // set always_pull_image
+ this.always_pull_image = new GetInput();
+ this.always_pull_image.setBpInputName("always_pull_image");
+ LinkedHashMap<String, Object> inputAlwaysPullImage = BlueprintHelper.createInputValue("boolean",
+ "Set to true if the image should always be pulled",
+ true);
+ retInputs.put("always_pull_image", inputAlwaysPullImage);
+
+ //set service component type
+ String sType = cs.getSelf().getName();
+ sType = sType.replace('.', '-');
+ this.setService_component_type(sType);
+
+ //set the tls info for internal and external communication
+ TreeMap<String, Object> tls_info = cs.getAuxilary().getTls_info();
+ if (tls_info != null) {
+ addTlsInfo(cs, retInputs);
+ if (tls_info.get(USE_EXTERNAL_TLS_FIELD) != null) {
+ retInputs.putAll(addExternalTlsInfo(cs));
+ }
+ }
+
+ //set the reource config
+ ResourceConfig resource = new ResourceConfig();
+ retInputs = resource.createResourceConfig(retInputs, cs.getSelf().getName());
+ this.setResource_config(resource);
+
+ return retInputs;
+ }
+
+ public TreeMap<String, LinkedHashMap<String, Object>> createDmaapProperties(
+ TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
+ retInputs = inps;
+
+ //set the image
+ GetInput image = new GetInput();
+ image.setBpInputName("tag_version");
+ this.setImage(image);
+ LinkedHashMap<String, Object> img = new LinkedHashMap<String, Object>();
+ img.put("type", "string");
+ img.put("default", cs.getArtifacts()[0].getUri());
+ retInputs.put("tag_version", img);
+
+ //set the location id
+ GetInput location = new GetInput();
+ location.setBpInputName("location_id");
+ this.setLocation_id(location);
+ LinkedHashMap<String, Object> locMap = new LinkedHashMap();
+ locMap.put("type", "string");
+ locMap.put("default", "");
+ retInputs.put("location_id", locMap);
+
+ //set the log info
+ this.setLog_info(cs.getAuxilary().getLog_info());
+
+ //set service component type
+ String sType = cs.getSelf().getName();
+ sType = sType.replace('.', '-');
+ this.setService_component_type(sType);
+
+ //set the tls info for internal and external communication
+ TreeMap<String, Object> tls_info = cs.getAuxilary().getTls_info();
+ if (tls_info != null) {
+ addTlsInfo(cs, retInputs);
+ if (tls_info.get(USE_EXTERNAL_TLS_FIELD) != null) {
+ retInputs.putAll(addExternalTlsInfo(cs));
+ }
+ }
+
+ //set the replicas
+ GetInput replica = new GetInput();
+ replica.setBpInputName("replicas");
+ this.setReplicas(replica);
+ LinkedHashMap<String, Object> rep = BlueprintHelper.createInputValue("integer", "number of instances", 1);
+ retInputs.put("replicas", rep);
// //set the dns name
// this.setDns_name(cs.getSelf().getName());
@@ -189,95 +204,89 @@ public class Properties {
// //set the name
// this.setName(cs.getSelf().getName());
- //set the docker config
- Auxilary aux = cs.getAuxilary();
+ //set the docker config
+ Auxilary aux = cs.getAuxilary();
// if(aux.getPorts() != null) {
// retInputs = aux.createPorts(retInputs);
// }
- this.setDocker_config(aux);
-
- //set the appconfig
- Appconfig app = new Appconfig();
- retInputs = app.createAppconfig(retInputs, cs, override, true);
- this.setApplication_config(app);
-
- //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")) {
- 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")) {
- String feed = p.getConfig_key() + "_feed";
- DmaapStreams drStreams = new DmaapStreams();
- retInputs = drStreams.createStreams(inps, cs, feed, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
- pubStreams.add(drStreams);
- }
- }
- }
-
- //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")) {
- 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")) {
- String feed = s.getConfig_key() + "_feed";
- DmaapStreams drStreams = new DmaapStreams();
- retInputs = drStreams.createStreams(inps, cs, feed, s.getType(), s.getConfig_key(), s.getRoute(), 's');
- subStreams.add(drStreams);
- }
- }
- }
-
- if (pubStreams.size() != 0) {
- this.setStreams_publishes(pubStreams);
- }
- if (subStreams.size() != 0) {
- this.setStreams_subscribes(subStreams);
- }
-
- //set the reource config
- ResourceConfig resource = new ResourceConfig();
- retInputs = resource.createResourceConfig(retInputs, cs.getSelf().getName());
- this.setResource_config(resource);
-
-
- return retInputs;
- }
-
- private void addTlsInfo(ComponentSpec cs, TreeMap<String, LinkedHashMap<String, Object>> retInputs) {
- TlsInfo tlsInfo = new TlsInfo();
- tlsInfo.setCertDirectory((String) cs.getAuxilary().getTls_info().get("cert_directory"));
- GetInput useTLSFlag = new GetInput();
- useTLSFlag.setGet_input("use_tls");
- tlsInfo.setUseTls(useTLSFlag);
- this.setTls_info(tlsInfo);
- 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;
- }
+ this.setDocker_config(aux);
+
+ //set the appconfig
+ Appconfig app = new Appconfig();
+ retInputs = app.createAppconfig(retInputs, cs, override, true);
+ this.setApplication_config(app);
+
+ //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")) {
+ 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")) {
+ String feed = p.getConfig_key() + "_feed";
+ DmaapStreams drStreams = new DmaapStreams();
+ retInputs = drStreams
+ .createStreams(inps, cs, feed, p.getType(), p.getConfig_key(), p.getRoute(), 'p');
+ pubStreams.add(drStreams);
+ }
+ }
+ }
+
+ //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")) {
+ 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")) {
+ String feed = s.getConfig_key() + "_feed";
+ DmaapStreams drStreams = new DmaapStreams();
+ retInputs = drStreams
+ .createStreams(inps, cs, feed, s.getType(), s.getConfig_key(), s.getRoute(), 's');
+ subStreams.add(drStreams);
+ }
+ }
+ }
+
+ if (pubStreams.size() != 0) {
+ this.setStreams_publishes(pubStreams);
+ }
+ if (subStreams.size() != 0) {
+ this.setStreams_subscribes(subStreams);
+ }
+
+ //set the reource config
+ ResourceConfig resource = new ResourceConfig();
+ retInputs = resource.createResourceConfig(retInputs, cs.getSelf().getName());
+ this.setResource_config(resource);
+
+ return retInputs;
+ }
+
+ private void addTlsInfo(ComponentSpec cs, TreeMap<String, LinkedHashMap<String, Object>> retInputs) {
+ TlsInfo tlsInfo = new TlsInfo();
+ tlsInfo.setCertDirectory((String) cs.getAuxilary().getTls_info().get("cert_directory"));
+ GetInput useTLSFlag = new GetInput();
+ useTLSFlag.setBpInputName("use_tls");
+ tlsInfo.setUseTls(useTLSFlag);
+ this.setTls_info(tlsInfo);
+ LinkedHashMap<String, Object> useTlsFlagInput = BlueprintHelper.createInputValue("boolean",
+ "flag to indicate tls enable/disable",
+ cs.getAuxilary().getTls_info().get("use_tls"));
+ retInputs.put("use_tls", useTlsFlagInput);
+ }
+
+ private Map<String, LinkedHashMap<String, Object>> addExternalTlsInfo(ComponentSpec cs) {
+ this.setExternal_cert(externalCertFactory.createFromComponentSpec(cs));
+ return externalCertFactory.createInputListFromComponentSpec(cs);
+ }
+
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
index f1a9a17..13aa0d0 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -23,8 +24,6 @@ package org.onap.blueprintgenerator.models.blueprint;
import java.util.LinkedHashMap;
import java.util.TreeMap;
-import com.fasterxml.jackson.annotation.JsonInclude;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
@@ -91,11 +90,11 @@ public class ResourceConfig {
TreeMap<String, GetInput> lim = new TreeMap<String, GetInput>();
GetInput cpu = new GetInput();
- cpu.setGet_input(name + "cpu_limit");
+ cpu.setBpInputName(name + "cpu_limit");
lim.put("cpu", cpu);
GetInput memL = new GetInput();
- memL.setGet_input(name + "memory_limit");
+ memL.setBpInputName(name + "memory_limit");
lim.put("memory", memL);
retInputs.put(name + "cpu_limit", m);
@@ -107,11 +106,11 @@ public class ResourceConfig {
TreeMap<String, GetInput> req = new TreeMap<String, GetInput>();
GetInput cpuR = new GetInput();
- cpuR.setGet_input(name + "cpu_request");
+ cpuR.setBpInputName(name + "cpu_request");
req.put("cpu", cpuR);
GetInput memR = new GetInput();
- memR.setGet_input(name + "memory_request");
+ memR.setBpInputName(name + "memory_request");
req.put("memory", memR);
retInputs.put(name + "cpu_request", m);
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
index f81bf9a..1055fbd 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java
@@ -1,8 +1,9 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
- Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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
@@ -106,7 +107,7 @@ public class StartInputs {
}
else {
GetInput env = new GetInput();
- env.setGet_input("envs");
+ env.setBpInputName("envs");
this.setEnvs(env);
eMap.put("default", "{}");
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java
new file mode 100644
index 0000000..464fc4a
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java
@@ -0,0 +1,107 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.dmaap;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Getter;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+import java.util.LinkedHashMap;
+import java.util.TreeMap;
+
+@Getter
+@Setter
+@JsonInclude(value = Include.NON_NULL)
+public class DmaapInfo {
+
+ private static final String UNDERSCORE = "_";
+
+ private GetInput topic_url;
+ private GetInput username;
+ private GetInput password;
+ private GetInput location;
+ private GetInput delivery_url;
+ private GetInput subscriber_id;
+
+ public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRInfo(
+ TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type) {
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
+ retInputs = inps;
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<String, Object>();
+ stringType.put("type", "string");
+
+ config = config.replaceAll("-", "_");
+ if (type == 'p') {
+ config = config + "_publish_url";
+ } else if (type == 's') {
+ config = config + "_subscribe_url";
+ }
+
+ GetInput topic = new GetInput();
+ topic.setBpInputName(config);
+ this.setTopic_url(topic);
+
+ retInputs.put(config, stringType);
+
+ return retInputs;
+ }
+
+ public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRInfo(
+ TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type) {
+ TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps;
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
+ stringType.put("type", "string");
+
+ String userNameInputName = createInputName(config, "username");
+ GetInput username = new GetInput(userNameInputName);
+ this.setUsername(username);
+ retInputs.put(userNameInputName, stringType);
+
+ String passwordInputName = createInputName(config, "password");
+ GetInput password = new GetInput(passwordInputName);
+ this.setPassword(password);
+ retInputs.put(passwordInputName, stringType);
+
+ String locationInputName = createInputName(config, "location");
+ GetInput location = new GetInput(locationInputName);
+ this.setLocation(location);
+ retInputs.put(locationInputName, stringType);
+
+ String deliveryUrlInputName = createInputName(config, "delivery_url");
+ GetInput deliveryUrl = new GetInput(deliveryUrlInputName);
+ this.setDelivery_url(deliveryUrl);
+ retInputs.put(deliveryUrlInputName, stringType);
+
+ String subscriberIdInputName = createInputName(config, "subscriber_id");
+ GetInput subscriberID = new GetInput(subscriberIdInputName);
+ this.setSubscriber_id(subscriberID);
+ retInputs.put(subscriberIdInputName, stringType);
+
+ return retInputs;
+ }
+
+ private String createInputName(String config, String inputName) {
+ return config + UNDERSCORE + inputName;
+ }
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java
index 7d78e3d..6af69e5 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java
@@ -1,8 +1,9 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
- Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
- ================================================================================
+ Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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
@@ -18,15 +19,17 @@
*/
-package org.onap.blueprintgenerator.models.blueprint;
-
-import java.util.LinkedHashMap;
-import java.util.TreeMap;
+package org.onap.blueprintgenerator.models.blueprint.dmaap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Getter;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+import java.util.LinkedHashMap;
+import java.util.TreeMap;
-import lombok.Getter; import lombok.Setter;
@JsonInclude(value=Include.NON_NULL)
@Getter @Setter
public class DmaapObj {
@@ -53,13 +56,13 @@ public class DmaapObj {
this.setDmaap_info(infoType);
//set username
GetInput u = new GetInput();
- u.setGet_input(config + "_" + num +"_aaf_username");
+ u.setBpInputName(config + "_" + num +"_aaf_username");
this.setUser(u);
retInputs.put(config + "_" + num +"_aaf_username", stringType);
//set password
GetInput p = new GetInput();
- p.setGet_input(config + "_" + num +"_aaf_password");
+ p.setBpInputName(config + "_" + num +"_aaf_password");
this.setPass(p);
retInputs.put(config + "_" + num +"_aaf_password", stringType);
}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java
new file mode 100644
index 0000000..546a809
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java
@@ -0,0 +1,74 @@
+/*============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.tls;
+
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createInputValue;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.COMMON_NAME_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_COMMON_NAME;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_SANS;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.SANS_FIELD;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.onap.blueprintgenerator.models.blueprint.tls.api.ExternalCertificateDataFactory;
+import org.onap.blueprintgenerator.models.blueprint.tls.impl.ExternalCertificateParameters;
+
+/**
+ * Factory class for providing parameters of ExternalCertificate. Allow to get ExternalCertificateParameters Object and
+ * input list
+ */
+public class ExternalCertificateParametersFactory extends ExternalCertificateDataFactory {
+
+ /**
+ * Create ExternalCertificateParameters Object
+ *
+ * @return ExternalCertificateParameters
+ */
+ public ExternalCertificateParameters create() {
+ ExternalCertificateParameters externalCertificateParameters = new ExternalCertificateParameters();
+ externalCertificateParameters.setCommonName(createPrefixedGetInput(COMMON_NAME_FIELD));
+ externalCertificateParameters.setSans(createPrefixedGetInput(SANS_FIELD));
+ return externalCertificateParameters;
+ }
+
+ /**
+ * Create input list for ExternalCertificateParameters
+ *
+ * @return Input list
+ */
+ public Map<String, LinkedHashMap<String, Object>> createInputList() {
+ Map<String, LinkedHashMap<String, Object>> retInputs = new LinkedHashMap<>();
+
+ LinkedHashMap<String, Object> commonNameInputMap = createInputValue("string",
+ "Common name which should be present in certificate.",
+ DEFAULT_COMMON_NAME);
+ retInputs.put(addPrefix(COMMON_NAME_FIELD), commonNameInputMap);
+
+ LinkedHashMap<String, Object> sansInputMap = createInputValue("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;
+ }
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java
new file mode 100644
index 0000000..e954afc
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java
@@ -0,0 +1,102 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia 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.blueprintgenerator.models.blueprint.tls;
+
+import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createInputValue;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.CA_NAME_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.CERT_DIRECTORY_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.CERT_TYPE_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_CA;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.DEFAULT_CERT_TYPE;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.USE_EXTERNAL_TLS_FIELD;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+import org.onap.blueprintgenerator.models.blueprint.tls.api.ExternalCertificateDataFactory;
+import org.onap.blueprintgenerator.models.blueprint.tls.impl.ExternalTlsInfo;
+import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
+
+/**
+ * Factory class for providing ExternalTlsInfo data. Allow to get ExternalTlsInfo Object and Inputs list.
+ */
+public class ExternalTlsInfoFactory extends ExternalCertificateDataFactory {
+
+ private ExternalCertificateParametersFactory externalCertificateParametersFactory;
+
+ /**
+ * Constructor for ExternalTlsInfoFactory
+ *
+ * @param externalCertificateDataFactory Factory providing external certificate parameters.
+ */
+ public ExternalTlsInfoFactory(ExternalCertificateParametersFactory externalCertificateDataFactory) {
+ this.externalCertificateParametersFactory = externalCertificateDataFactory;
+ }
+
+ /**
+ * Create ExternalTlsInfo from ComponentSpec Object
+ *
+ * @param cs ComponentSpec Object
+ * @return ExternalTlsInfo Object
+ */
+ public ExternalTlsInfo createFromComponentSpec(ComponentSpec cs) {
+ ExternalTlsInfo externalTlsInfoBp = new ExternalTlsInfo();
+ TreeMap<String, Object> tlsInfoCs = cs.getAuxilary().getTls_info();
+
+ externalTlsInfoBp.setExternalCertDirectory((String) tlsInfoCs.get(CERT_DIRECTORY_FIELD));
+ externalTlsInfoBp.setUseExternalTls(createPrefixedGetInput(USE_EXTERNAL_TLS_FIELD));
+ externalTlsInfoBp.setCaName(createPrefixedGetInput(CA_NAME_FIELD));
+ externalTlsInfoBp.setCertType(createPrefixedGetInput(CERT_TYPE_FIELD));
+ externalTlsInfoBp.setExternalCertificateParameters(externalCertificateParametersFactory.create());
+
+ return externalTlsInfoBp;
+ }
+
+ /**
+ * Create input list from ComponentSpec Object
+ *
+ * @param cs ComponentSpec Object
+ * @return Input list
+ */
+ public Map<String, LinkedHashMap<String, Object>> createInputListFromComponentSpec(ComponentSpec cs) {
+ Map<String, LinkedHashMap<String, Object>> retInputs = new HashMap<>();
+
+ Map<String, Object> externalTlsInfoCs = cs.getAuxilary().getTls_info();
+ LinkedHashMap<String, Object> useTlsFlagInput = createInputValue("boolean",
+ "Flag to indicate external tls enable/disable.",
+ externalTlsInfoCs.get(USE_EXTERNAL_TLS_FIELD));
+ retInputs.put(addPrefix(USE_EXTERNAL_TLS_FIELD), useTlsFlagInput);
+
+ LinkedHashMap<String, Object> caNameInputMap = createInputValue("string",
+ "Name of Certificate Authority configured on CertService side.",
+ DEFAULT_CA);
+ retInputs.put(addPrefix(CA_NAME_FIELD), caNameInputMap);
+
+ LinkedHashMap<String, Object> certTypeInputMap = createInputValue("string",
+ "Format of provided certificates",
+ DEFAULT_CERT_TYPE);
+ retInputs.put(addPrefix(CERT_TYPE_FIELD), certTypeInputMap);
+
+ retInputs.putAll(externalCertificateParametersFactory.createInputList());
+ return retInputs;
+ }
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java
new file mode 100644
index 0000000..cdbfd32
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java
@@ -0,0 +1,38 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia 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.blueprintgenerator.models.blueprint.tls;
+
+public class TlsConstants {
+
+ public static final String EXTERNAL_CERT_DIRECTORY_FIELD = "external_cert_directory";
+ public static final String CERT_DIRECTORY_FIELD = "cert_directory";
+ public static final String INPUT_PREFIX = "external_cert_";
+ public static final String USE_EXTERNAL_TLS_FIELD = "use_external_tls";
+ public static final String CA_NAME_FIELD = "ca_name";
+ public static final String EXTERNAL_CERTIFICATE_PARAMETERS_FIELD = "external_certificate_parameters";
+ public static final String COMMON_NAME_FIELD = "common_name";
+ public static final String SANS_FIELD = "sans";
+ public static final String CERT_TYPE_FIELD = "cert_type";
+
+ public static final String DEFAULT_CA = "RA";
+ public static final Object DEFAULT_CERT_TYPE = "P12";
+ public static final String DEFAULT_COMMON_NAME = "sample.onap.org";
+ public static final String DEFAULT_SANS = "sample.onap.org:component.sample.onap.org";
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java
index 2130fe3..027f996 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -17,12 +18,13 @@
============LICENSE_END=========================================================
*/
-package org.onap.blueprintgenerator.models.blueprint;
+package org.onap.blueprintgenerator.models.blueprint.tls;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
@Getter
@Setter
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java
new file mode 100644
index 0000000..21b20e4
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java
@@ -0,0 +1,37 @@
+/*============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.tls.api;
+
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.INPUT_PREFIX;
+
+public abstract class ExternalCertificateDataFactory {
+
+ protected static GetInput createPrefixedGetInput(String fieldName) {
+ return new GetInput(addPrefix(fieldName));
+ }
+
+ protected static String addPrefix(String fieldName) {
+ return INPUT_PREFIX + fieldName;
+ }
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java
new file mode 100644
index 0000000..e3ccca1
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java
@@ -0,0 +1,43 @@
+/*============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.tls.impl;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.COMMON_NAME_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.SANS_FIELD;
+
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class ExternalCertificateParameters {
+
+ @JsonProperty(COMMON_NAME_FIELD)
+ private GetInput commonName;
+
+ @JsonProperty(SANS_FIELD)
+ private GetInput sans;
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java
new file mode 100644
index 0000000..588dbb5
--- /dev/null
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java
@@ -0,0 +1,54 @@
+/*============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.tls.impl;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.onap.blueprintgenerator.models.blueprint.GetInput;
+
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.CA_NAME_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.CERT_TYPE_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.EXTERNAL_CERTIFICATE_PARAMETERS_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.EXTERNAL_CERT_DIRECTORY_FIELD;
+import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.USE_EXTERNAL_TLS_FIELD;
+
+@Getter
+@Setter
+@NoArgsConstructor
+public class ExternalTlsInfo {
+
+ @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;
+
+}
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
index e84901c..37d7d2d 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapNode.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -15,7 +16,6 @@
See the License for the specific language governing permissions and
limitations under the License.
============LICENSE_END=========================================================
-
*/
package org.onap.blueprintgenerator.models.dmaapbp;
@@ -33,7 +33,6 @@ import org.onap.blueprintgenerator.models.blueprint.Properties;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
import org.onap.blueprintgenerator.models.componentspec.Publishes;
import org.onap.blueprintgenerator.models.componentspec.Subscribes;
-import org.onap.blueprintgenerator.models.onapbp.OnapNode;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -129,7 +128,7 @@ public class DmaapNode extends Node{
//create and set the properties
Properties props = new Properties();
GetInput topicInput = new GetInput();
- topicInput.setGet_input(name + "_name");
+ topicInput.setBpInputName(name + "_name");
props.setFeed_name(topicInput);
//props.setUseExisting(true);
retInputs.put(name + "_name", stringType);
@@ -149,7 +148,7 @@ public class DmaapNode extends Node{
//create and set the properties
Properties props = new Properties();
GetInput topicInput = new GetInput();
- topicInput.setGet_input(name + "_name");
+ topicInput.setBpInputName(name + "_name");
props.setTopic_name(topicInput);
//props.setUseExisting(true);
retInputs.put(name + "_name", stringType);
diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
index b26d45d..e2847d7 100644
--- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
+++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/dmaapbp/DmaapStreams.java
@@ -1,7 +1,8 @@
-/**============LICENSE_START=======================================================
+/*============LICENSE_START=======================================================
org.onap.dcae
================================================================================
Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
+ 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.
@@ -23,10 +24,8 @@ package org.onap.blueprintgenerator.models.dmaapbp;
import java.util.LinkedHashMap;
import java.util.TreeMap;
-import org.onap.blueprintgenerator.models.blueprint.Appconfig;
import org.onap.blueprintgenerator.models.blueprint.GetInput;
import org.onap.blueprintgenerator.models.componentspec.ComponentSpec;
-import org.onap.blueprintgenerator.models.componentspec.HealthCheck;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -66,7 +65,7 @@ public class DmaapStreams {
//set the location
GetInput location = new GetInput();
- location.setGet_input(key + "_" + name + "_location");
+ location.setBpInputName(key + "_" + name + "_location");
retInputs.put(key + "_" + name + "_location", stringType);
this.setLocation(location);
@@ -75,25 +74,25 @@ public class DmaapStreams {
if(o == 's') {
//set the username
GetInput username = new GetInput();
- username.setGet_input(key + "_" + name + "_username");
+ username.setBpInputName(key + "_" + name + "_username");
this.setUsername(username);
retInputs.put(key + "_" + name + "_username", stringType);
//set the password
GetInput password = new GetInput();
- password.setGet_input(key + "_" + name + "_password");
+ password.setBpInputName(key + "_" + name + "_password");
this.setPassword(password);
retInputs.put(key + "_" + name + "_password", stringType);
//set privileged
GetInput priviliged = new GetInput();
- priviliged.setGet_input(key + "_" + name + "_priviliged");
+ priviliged.setBpInputName(key + "_" + name + "_priviliged");
this.setPrivileged(priviliged);
retInputs.put(key + "_" + name + "_priviliged", stringType);
//set decompress
GetInput decompress = new GetInput();
- decompress.setGet_input(key + "_" + name + "_decompress");
+ decompress.setBpInputName(key + "_" + name + "_decompress");
this.setDecompress(decompress);
retInputs.put(key + "_" + name + "_decompress", stringType);
@@ -110,10 +109,10 @@ public class DmaapStreams {
} else {
//set the client role
GetInput client = new GetInput();
- client.setGet_input(key + "_" + name + "_client_role");
+ client.setBpInputName(key + "_" + name + "_client_role");
this.setClient_role(client);
retInputs.put(key + "_" + name + "_client_role", stringType);
}
return retInputs;
}
-} \ No newline at end of file
+}