From bc2e6287569ed6a848acf31b26097f54934baf9b Mon Sep 17 00:00:00 2001 From: kjaniak Date: Fri, 26 Jun 2020 12:56:51 +0200 Subject: Add factories for Ext tls parameters Code cleanup, renames Issue-ID: DCAEGEN2-2251 Change-Id: Ibf36780473480210bea1c76d117b28c71831487a Signed-off-by: kjaniak Signed-off-by: Tomasz Wrobel --- .../models/blueprint/Appconfig.java | 12 +- .../models/blueprint/DmaapInfo.java | 99 ----- .../models/blueprint/DmaapObj.java | 84 ---- .../models/blueprint/ExternalTlsInfo.java | 153 ------- .../models/blueprint/GetInput.java | 9 +- .../models/blueprint/Properties.java | 481 +++++++++++---------- .../models/blueprint/ResourceConfig.java | 13 +- .../models/blueprint/StartInputs.java | 9 +- .../models/blueprint/TlsInfo.java | 37 -- .../models/blueprint/dmaap/DmaapInfo.java | 107 +++++ .../models/blueprint/dmaap/DmaapObj.java | 87 ++++ .../tls/ExternalCertificateParametersFactory.java | 74 ++++ .../blueprint/tls/ExternalTlsInfoFactory.java | 102 +++++ .../models/blueprint/tls/TlsConstants.java | 38 ++ .../models/blueprint/tls/TlsInfo.java | 39 ++ .../tls/api/ExternalCertificateDataFactory.java | 37 ++ .../tls/impl/ExternalCertificateParameters.java | 43 ++ .../models/blueprint/tls/impl/ExternalTlsInfo.java | 54 +++ .../models/dmaapbp/DmaapNode.java | 9 +- .../models/dmaapbp/DmaapStreams.java | 19 +- 20 files changed, 862 insertions(+), 644 deletions(-) delete mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapInfo.java delete mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java delete mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ExternalTlsInfo.java delete mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java create mode 100644 mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java (limited to 'mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models') 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 over = new LinkedHashMap(); 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> createOnapDmaapMRInfo(TreeMap> inps, String config, char type) { - TreeMap> retInputs = new TreeMap>(); - retInputs = inps; - LinkedHashMap stringType = new LinkedHashMap(); - 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> createOnapDmaapDRInfo(TreeMap> inps, String config, char type) { - TreeMap> retInputs = new TreeMap>(); - retInputs = inps; - LinkedHashMap stringType = new LinkedHashMap(); - 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/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java deleted file mode 100644 index 7d78e3d..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/DmaapObj.java +++ /dev/null @@ -1,84 +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.LinkedHashMap; -import java.util.TreeMap; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Getter; import lombok.Setter; -@JsonInclude(value=Include.NON_NULL) -@Getter @Setter -public class DmaapObj { - private Object dmaap_info; - private String type; - private GetInput pass; - private GetInput user; - - public TreeMap> createOnapDmaapMRObj(TreeMap> inps, - String config, char type, String n, String num, boolean isDmaap) { - TreeMap> retInputs = new TreeMap>(); - LinkedHashMap stringType = new LinkedHashMap(); - stringType.put("type", "string"); - retInputs = inps; - - //set the dmaapinfo - DmaapInfo info = new DmaapInfo(); - if(!isDmaap){ - info.createOnapDmaapMRInfo(inps, config, type); - this.setDmaap_info(info); - } - else{ - String infoType = "<<" + n + ">>"; - this.setDmaap_info(infoType); - //set username - GetInput u = new GetInput(); - u.setGet_input(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"); - this.setPass(p); - retInputs.put(config + "_" + num +"_aaf_password", stringType); - } - return retInputs; - } - public TreeMap> createOnapDmaapDRObj(TreeMap> inps, String config, char type, String n, String num, boolean isDmaap) { - TreeMap> retInputs = new TreeMap>(); - retInputs = inps; - - //set the dmaapinfo - DmaapInfo info = new DmaapInfo(); - if(!isDmaap){ - info.createOnapDmaapDRInfo(inps, config, type); - this.setDmaap_info(info); - } - else { - String infoType = "<<" + n + ">>"; - this.setDmaap_info(infoType); - } - 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 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> createInputMapFromComponentSpec(ComponentSpec cs){ - Map> retInputs = new HashMap<>(); - - Map tlsInfoCs = cs.getAuxilary().getTls_info(); - LinkedHashMap 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 caNameInputMap = Properties.makeInput("string", - "Name of Certificate Authority configured on CertService side.", - DEFAULT_CA); - retInputs.put(addPrefix(CA_NAME_FIELD), caNameInputMap); - - LinkedHashMap 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> createInputMap(){ - Map> retInputs = new LinkedHashMap<>(); - - LinkedHashMap commonNameInputMap = Properties.makeInput("string", - "Common name which should be present in certificate.", - DEFAULT_COMMON_NAME); - retInputs.put(addPrefix(COMMON_NAME_FIELD), commonNameInputMap); - - LinkedHashMap 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 log_info; - private String dns_name; - private Object replicas; - private String name; - private GetInput topic_name; - private GetInput feed_name; - ArrayList streams_publishes; - ArrayList streams_subscribes; - private TlsInfo tls_info; - private ExternalTlsInfo external_cert; - private ResourceConfig resource_config; - private GetInput always_pull_image; - //private boolean useExisting; - - public TreeMap> createOnapProperties(TreeMap> inps, ComponentSpec cs, String override) { - TreeMap> retInputs = new TreeMap>(); - retInputs = inps; - - //set the image - GetInput image = new GetInput(); - image.setGet_input("image"); - this.setImage(image); - LinkedHashMap img = new LinkedHashMap(); - 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 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 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 log_info; + private String dns_name; + private Object replicas; + private String name; + private GetInput topic_name; + private GetInput feed_name; + ArrayList streams_publishes; + ArrayList 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> createOnapProperties( + TreeMap> inps, ComponentSpec cs, String override) { + TreeMap> retInputs = inps; + + //set the image + GetInput image = new GetInput(); + image.setBpInputName("image"); + this.setImage(image); + LinkedHashMap img = new LinkedHashMap(); + 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 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 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 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> createDmaapProperties(TreeMap> inps, ComponentSpec cs, String override) { - TreeMap> retInputs = new TreeMap>(); - retInputs = inps; - - //set the image - GetInput image = new GetInput(); - image.setGet_input("tag_version"); - this.setImage(image); - LinkedHashMap img = new LinkedHashMap(); - 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 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 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 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 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> createDmaapProperties( + TreeMap> inps, ComponentSpec cs, String override) { + TreeMap> retInputs = new TreeMap>(); + retInputs = inps; + + //set the image + GetInput image = new GetInput(); + image.setBpInputName("tag_version"); + this.setImage(image); + LinkedHashMap img = new LinkedHashMap(); + 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 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 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 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 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 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> 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 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> 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 makeInput(String type, String description, Object defaultValue) { - LinkedHashMap 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 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 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> 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 useTlsFlagInput = BlueprintHelper.createInputValue("boolean", + "flag to indicate tls enable/disable", + cs.getAuxilary().getTls_info().get("use_tls")); + retInputs.put("use_tls", useTlsFlagInput); + } + + private Map> 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 lim = new TreeMap(); 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 req = new TreeMap(); 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/TlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java deleted file mode 100644 index 2130fe3..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TlsInfo.java +++ /dev/null @@ -1,37 +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 com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -public class TlsInfo { - - @JsonProperty("cert_directory") - private String certDirectory; - - @JsonProperty("use_tls") - private GetInput useTls; -} 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> createOnapDmaapMRInfo( + TreeMap> inps, String config, char type) { + TreeMap> retInputs = new TreeMap>(); + retInputs = inps; + LinkedHashMap stringType = new LinkedHashMap(); + 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> createOnapDmaapDRInfo( + TreeMap> inps, String config, char type) { + TreeMap> retInputs = inps; + LinkedHashMap 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/dmaap/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java new file mode 100644 index 0000000..6af69e5 --- /dev/null +++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java @@ -0,0 +1,87 @@ +/*============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; + +@JsonInclude(value=Include.NON_NULL) +@Getter @Setter +public class DmaapObj { + private Object dmaap_info; + private String type; + private GetInput pass; + private GetInput user; + + public TreeMap> createOnapDmaapMRObj(TreeMap> inps, + String config, char type, String n, String num, boolean isDmaap) { + TreeMap> retInputs = new TreeMap>(); + LinkedHashMap stringType = new LinkedHashMap(); + stringType.put("type", "string"); + retInputs = inps; + + //set the dmaapinfo + DmaapInfo info = new DmaapInfo(); + if(!isDmaap){ + info.createOnapDmaapMRInfo(inps, config, type); + this.setDmaap_info(info); + } + else{ + String infoType = "<<" + n + ">>"; + this.setDmaap_info(infoType); + //set username + GetInput u = new GetInput(); + u.setBpInputName(config + "_" + num +"_aaf_username"); + this.setUser(u); + retInputs.put(config + "_" + num +"_aaf_username", stringType); + + //set password + GetInput p = new GetInput(); + p.setBpInputName(config + "_" + num +"_aaf_password"); + this.setPass(p); + retInputs.put(config + "_" + num +"_aaf_password", stringType); + } + return retInputs; + } + public TreeMap> createOnapDmaapDRObj(TreeMap> inps, String config, char type, String n, String num, boolean isDmaap) { + TreeMap> retInputs = new TreeMap>(); + retInputs = inps; + + //set the dmaapinfo + DmaapInfo info = new DmaapInfo(); + if(!isDmaap){ + info.createOnapDmaapDRInfo(inps, config, type); + this.setDmaap_info(info); + } + else { + String infoType = "<<" + n + ">>"; + this.setDmaap_info(infoType); + } + return retInputs; + } +} 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> createInputList() { + Map> retInputs = new LinkedHashMap<>(); + + LinkedHashMap commonNameInputMap = createInputValue("string", + "Common name which should be present in certificate.", + DEFAULT_COMMON_NAME); + retInputs.put(addPrefix(COMMON_NAME_FIELD), commonNameInputMap); + + LinkedHashMap 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 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> createInputListFromComponentSpec(ComponentSpec cs) { + Map> retInputs = new HashMap<>(); + + Map externalTlsInfoCs = cs.getAuxilary().getTls_info(); + LinkedHashMap 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 caNameInputMap = createInputValue("string", + "Name of Certificate Authority configured on CertService side.", + DEFAULT_CA); + retInputs.put(addPrefix(CA_NAME_FIELD), caNameInputMap); + + LinkedHashMap 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/tls/TlsInfo.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java new file mode 100644 index 0000000..027f996 --- /dev/null +++ b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java @@ -0,0 +1,39 @@ +/*============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.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 +@NoArgsConstructor +public class TlsInfo { + + @JsonProperty("cert_directory") + private String certDirectory; + + @JsonProperty("use_tls") + private GetInput useTls; +} 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 +} -- cgit 1.2.3-korg