diff options
author | 2020-10-21 15:47:38 -0400 | |
---|---|---|
committer | 2020-11-19 12:44:18 -0500 | |
commit | 55dcf3197958c76b1622a0c26489e68fe77e0314 (patch) | |
tree | 1abf70007833878c5e60a4e112d68fe6d5cb5636 /mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint | |
parent | c8d244d826cc1d9b2ad7aeb0ca0874e321ad4577 (diff) |
Blueprint Generator Refactored Code Issue-ID: DCAEGEN2-2472
Change-Id: I2ade7fb3b4196554eb4ecadd918fd45cb6ba8a52
Signed-off-by: Ravi Mantena <rx908f@att.com>
Diffstat (limited to 'mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint')
27 files changed, 0 insertions, 1998 deletions
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 deleted file mode 100644 index e9157ad..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Appconfig.java +++ /dev/null @@ -1,152 +0,0 @@ -/*============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; - -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isDataRouterType; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isMessageRouterType; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createStringInput; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import java.util.LinkedHashMap; -import java.util.TreeMap; -import lombok.Getter; -import lombok.Setter; -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; -import org.onap.blueprintgenerator.models.componentspec.Publishes; -import org.onap.blueprintgenerator.models.componentspec.Subscribes; - -@Getter -@Setter -public class Appconfig { - - private CallsObj[] service_calls; - private TreeMap<String, DmaapObj> streams_publishes; - private TreeMap<String, DmaapObj> streams_subscribes; - private TreeMap<String, Object> params; - - @JsonAnyGetter - public TreeMap<String, Object> getParams() { - return params; - } - - public TreeMap<String, LinkedHashMap<String, Object>> createAppconfig( - TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec componentSpec, String override, - boolean isDmaap) { - - service_calls = new CallsObj[0]; - streams_publishes = createStreamPublishes(componentSpec, inps, isDmaap); - streams_subscribes = createStreamSubscribes(componentSpec, inps, isDmaap); - params = createParameters(componentSpec, inps, override); - - return inps; - } - - private TreeMap<String, DmaapObj> createStreamPublishes(ComponentSpec componentSpec, - TreeMap<String, LinkedHashMap<String, Object>> inps, boolean isDmaap) { - TreeMap<String, DmaapObj> streamPublishes = new TreeMap<>(); - for (Publishes publishes : componentSpec.getStreams().getPublishes()) { - String config = publishes.getConfig_key(); - DmaapObj pub = new DmaapObj(); - if (isDataRouterType(publishes.getType())) { - //in this case the data router information gets added to the params so for now leave it alone - String name = publishes.getConfig_key() + "_feed"; - pub.createOnapDmaapDRObj(inps, config, 'p', name, name, isDmaap); - } else if (isMessageRouterType(publishes.getType())) { - String name = publishes.getConfig_key() + "_topic"; - pub.createOnapDmaapMRObj(inps, config, 'p', name, name, isDmaap); - } - pub.setType(publishes.getType()); - streamPublishes.put(config, pub); - } - return streamPublishes; - } - - private TreeMap<String, DmaapObj> createStreamSubscribes(ComponentSpec componentSpec, - TreeMap<String, LinkedHashMap<String, Object>> inputs, boolean isDmaap) { - TreeMap<String, DmaapObj> streamSubscribes = new TreeMap<>(); - for (Subscribes subscribes : componentSpec.getStreams().getSubscribes()) { - String config = subscribes.getConfig_key(); - DmaapObj sub = new DmaapObj(); - if (isDataRouterType(subscribes.getType())) { - //in this case the data router information gets added to the params so for now leave it alone - String name = subscribes.getConfig_key() + "_feed"; - sub.createOnapDmaapDRObj(inputs, config, 'p', name, name, isDmaap); - } else if (isMessageRouterType(subscribes.getType())) { - String name = subscribes.getConfig_key() + "_topic"; - sub.createOnapDmaapMRObj(inputs, config, 's', name, name, isDmaap); - } - sub.setType(subscribes.getType()); - streamSubscribes.put(config, sub); - } - return streamSubscribes; - } - - private TreeMap<String, Object> createParameters(ComponentSpec componentSpec, - TreeMap<String, LinkedHashMap<String, Object>> inputs, - String override) { - TreeMap<String, Object> parameters = new TreeMap<>(); - for (Parameters params : componentSpec.getParameters()) { - String pName = params.getName(); - if (params.isSourced_at_deployment()) { - GetInput paramInput = new GetInput(); - paramInput.setBpInputName(pName); - parameters.put(pName, paramInput); - - if (!params.getValue().equals("")) { - LinkedHashMap<String, Object> input = createStringInput(params.getValue()); - inputs.put(pName, input); - } else { - LinkedHashMap<String, Object> input = new LinkedHashMap<>(); - input.put("type", "string"); - inputs.put(pName, input); - } - } else { - if ("string".equals(params.getType())) { - String val = (String) params.getValue(); - val = '"' + val + '"'; - parameters.put(pName, val); - } else { - parameters.put(pName, params.getValue()); - } - } - } - handleOverride(override, parameters, inputs); - return parameters; - } - - private void handleOverride(String override, TreeMap<String, Object> parameters, - TreeMap<String, LinkedHashMap<String, Object>> inps) { - if (override != null) { - GetInput ov = new GetInput(); - ov.setBpInputName("service_component_name_override"); - parameters.put("service_component_name_override", ov); - LinkedHashMap<String, Object> over = new LinkedHashMap<>(); - over.put("type", "string"); - over.put("default", override); - inps.put("service_component_name_override", over); - } - } - -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java deleted file mode 100644 index f2ef7aa..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Blueprint.java +++ /dev/null @@ -1,151 +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.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.TreeMap; -import java.util.regex.Pattern; -import lombok.Getter; -import lombok.Setter; -import org.onap.blueprintgenerator.core.Fixes; -import org.onap.blueprintgenerator.models.componentspec.ComponentSpec; -import org.onap.blueprintgenerator.models.dmaapbp.DmaapBlueprint; -import org.onap.blueprintgenerator.models.onapbp.OnapBlueprint; - -@Getter @Setter -@JsonInclude(JsonInclude.Include.NON_NULL) - -public class Blueprint { - - - private String tosca_definitions_version; - - private String description; - - private ArrayList<String> imports; - - private TreeMap<String, LinkedHashMap<String, Object>> inputs; - - private TreeMap<String, Node> node_templates; - - public Blueprint createBlueprint(ComponentSpec cs, String name, char bpType, String importPath, String override) { - Blueprint bp = new Blueprint(); - if(bpType == 'o') { - OnapBlueprint onap = new OnapBlueprint(); - bp = onap.createOnapBlueprint(cs, importPath, override); - bp = bp.setQuotations(bp); - } - - if(bpType == 'd') { - DmaapBlueprint dmaap = new DmaapBlueprint(); - bp = dmaap.createDmaapBlueprint(cs, importPath, override); - bp = bp.setQuotations(bp); - } - return bp; - } - - public Blueprint setQuotations(Blueprint bp) { - for(String s: bp.getInputs().keySet()) { - LinkedHashMap<String, Object> temp = bp.getInputs().get(s); - if(temp.get("type") == "string") { - String def = (String) temp.get("default"); - if(def != null){ - def = def.replaceAll("\"$", "").replaceAll("^\"", ""); - } - def = '"' + def + '"'; - temp.replace("default", def); - bp.getInputs().replace(s, temp); - } - } - - return bp; - } - - public void blueprintToYaml(String outputPath, String bluePrintName, ComponentSpec cs) { - File outputFile; - String name = bluePrintName.equals("") ? cs.getSelf().getName() : bluePrintName; - if(name.contains(".")) { - name = name.replaceAll(Pattern.quote("."), "_"); - } - if(name.contains(" ")) { - name = name.replaceAll(" ", ""); - } - String file = name + ".yaml"; - outputFile = new File(outputPath, file); - outputFile.getParentFile().mkdirs(); - try { - outputFile.createNewFile(); - } catch (IOException e) { - throw new RuntimeException(e); - } - - String version = "#blueprint_version: " + cs.getSelf().getVersion() + '\n'; - String description = "#description: " + cs.getSelf().getDescription() + '\n'; - - try(BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, false))) { - writer.write(description); - writer.write(version); - } catch (IOException e1) { - throw new RuntimeException(e1); - } - - //read the translated blueprint into the file - ObjectMapper blueprintMapper = new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)); - - try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true)))) { - blueprintMapper.writeValue(out, this); - } catch (IOException e) { - throw new RuntimeException(e); - } - - try { - Fixes.fixSingleQuotes(outputFile); - } catch (IOException e) { - throw new RuntimeException(e); - } - - System.out.println("Blueprint created"); - } - - public String blueprintToString() { - String ret = ""; - - ObjectMapper blueprintMapper = new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)); - try { - ret = blueprintMapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - - return Fixes.applyFixes(ret); - } -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/BpConstants.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/BpConstants.java deleted file mode 100644 index d0d79a4..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/BpConstants.java +++ /dev/null @@ -1,43 +0,0 @@ -/*============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; - -public final class BpConstants { - - private BpConstants() {} - - public static final String CLOUDIFY_DSL_1_3 = "cloudify_dsl_1_3"; - - public static final String CONTENERIZED_SERVICE_COMPONENT_USING_DMAAP = "dcae.nodes.ContainerizedServiceComponentUsingDmaap"; - public static final String CONTENERIZED_SERVICE_COMPONENT = "dcae.nodes.ContainerizedServiceComponent"; - public static final String FEED = "dcaegen2.nodes.Feed"; - public static final String TOPIC = "dcaegen2.nodes.Topic"; - public static final String PUBLISH_EVENTS = "dcaegen2.relationships.publish_events"; - public static final String PUBLISH_FILES = "dcaegen2.relationships.publish_files"; - public static final String SUBSCRIBE_TO_EVENTS = "dcaegen2.relationships.subscribe_to_events"; - public static final String SUBSCRIBE_TO_FILES = "dcaegen2.relationships.subscribe_to_files"; - - public static final String TOSCA_DATATYPES_ROOT = "tosca.datatypes.Root"; - public static final String TOSCA_NODES_ROOT = "tosca.nodes.Root"; - public static final String TOSCA_SIMPLE_YAML = "tosca_simple_yaml_1_0_0"; - - public static final String MEMORY_LIMIT = "128Mi"; - public static final String CPU_LIMIT = "250m"; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ConcatObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ConcatObj.java deleted file mode 100644 index edc257c..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ConcatObj.java +++ /dev/null @@ -1,57 +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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonRawValue; - -import lombok.Getter; import lombok.Setter; -import lombok.NoArgsConstructor; - -// TODO: Auto-generated Javadoc -/** - * The Class ConcatObj. - */ -@JsonIgnoreProperties(ignoreUnknown = true) - -/* (non-Javadoc) - * @see java.lang.Object#toString() - */ -@Getter @Setter -//@Builder - -/** - * Instantiates a new concat obj. - */ -@NoArgsConstructor -@JsonInclude(value=Include.NON_NULL) - -public class ConcatObj { - - /** The concat. */ - private ArrayList<Object> concat; -} - 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 deleted file mode 100644 index 3d5ca3d..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetInput.java +++ /dev/null @@ -1,38 +0,0 @@ -/*============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; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Getter -@Setter -@NoArgsConstructor -@AllArgsConstructor -public class GetInput { - - @JsonProperty("get_input") - private Object bpInputName; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetProperty.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetProperty.java deleted file mode 100644 index 1f9bf1c..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/GetProperty.java +++ /dev/null @@ -1,55 +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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -import lombok.Getter; import lombok.Setter; -import lombok.NoArgsConstructor; - -// TODO: Auto-generated Javadoc -/** - * The Class GetProperty. - */ -@JsonIgnoreProperties(ignoreUnknown = true) - -/* (non-Javadoc) - * @see java.lang.Object#toString() - */ -@Getter @Setter -//@Builder - -/** - * Instantiates a new gets the property. - */ -@NoArgsConstructor -@JsonInclude(value=Include.NON_NULL) - -public class GetProperty { - - /** The get property. */ - private ArrayList<String> get_property; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java deleted file mode 100644 index 7b55e17..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Imports.java +++ /dev/null @@ -1,67 +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.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import lombok.Getter; -import lombok.Setter; - -@Getter @Setter -@JsonInclude(value=Include.NON_NULL) -public class Imports { - /** The imports. */ - private ArrayList<String> imports; - - public static ArrayList<String> createOnapImports() { - ArrayList<String> imps = new ArrayList<>(); - imps.add("https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml"); - imps.add("plugin:k8splugin?version=3.4.2"); - imps.add("plugin:dcaepolicyplugin?version=2.4.0"); - return imps; - } - - public static ArrayList<String> createDmaapImports(){ - ArrayList<String> imps = new ArrayList<>(); - imps.add("https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml"); - imps.add("plugin:k8splugin?version=3.4.2"); - imps.add("plugin:dmaap?version=1.5.0"); - return imps; - } - - public static ArrayList<String> createImportsFromFile(String path) { - ObjectMapper importMapper = new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true)); - File importPath = new File(path); - try { - Imports imports = importMapper.readValue(importPath, Imports.class); - imports.getImports().removeIf(String::isBlank); - return imports.getImports(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java deleted file mode 100644 index 435059e..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Interfaces.java +++ /dev/null @@ -1,40 +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 org.onap.blueprintgenerator.models.componentspec.ComponentSpec; - -import lombok.Getter; import lombok.Setter; - -@Getter @Setter -public class Interfaces { - private Start start; - public TreeMap<String, LinkedHashMap<String, Object>> createInterface(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){ - //create the start object - Start start = new Start(); - TreeMap<String, LinkedHashMap<String, Object>> retInputs = start.createOnapStart(inps, cs); - this.setStart(start); - return retInputs; - } -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Node.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Node.java deleted file mode 100644 index ee75ce0..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Node.java +++ /dev/null @@ -1,35 +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 lombok.Getter; import lombok.Setter; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.TreeMap; - -@Getter @Setter -public class Node { - private String type; - private TreeMap<String, Interfaces> interfaces; - private Properties properties; - private ArrayList<LinkedHashMap<String, String>> relationships; -} 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 deleted file mode 100644 index 9aa5354..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Properties.java +++ /dev/null @@ -1,290 +0,0 @@ -/*============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; - -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createBooleanInput; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createIntegerInput; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createStringInput; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isMessageRouterType; -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.isDataRouterType; -import static org.onap.blueprintgenerator.models.blueprint.tls.TlsConstants.USE_EXTERNAL_TLS_FIELD; - -import com.fasterxml.jackson.annotation.JsonIgnore; -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.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; - - -@Getter -@Setter -@JsonInclude(value = Include.NON_NULL) -public class Properties { - - private static final String EMPTY_VALUE = ""; - - ArrayList<DmaapStreams> streams_publishes; - ArrayList<DmaapStreams> streams_subscribes; - 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; - private TlsInfo tls_info; - private ExternalTlsInfo external_cert; - private ResourceConfig resource_config; - private GetInput always_pull_image; - private Boolean useExisting; - @JsonIgnore - 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 componentSpec, String override) { - TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps; - - //set the image - GetInput image = new GetInput(); - image.setBpInputName("image"); - this.setImage(image); - retInputs.put("image", createStringInput(componentSpec.getImageUri())); - - //set the location id - GetInput location = new GetInput(); - location.setBpInputName("location_id"); - this.setLocation_id(location); - retInputs.put("location_id", createStringInput(EMPTY_VALUE)); - - //set the log info - this.setLog_info(componentSpec.getAuxilary().getLog_info()); - - //set the replicas - GetInput replica = new GetInput(); - replica.setBpInputName("replicas"); - this.setReplicas(replica); - LinkedHashMap<String, Object> rep = createIntegerInput("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 = componentSpec.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, componentSpec, 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 = createBooleanInput( - "Set to true if the image should always be pulled", - true); - retInputs.put("always_pull_image", inputAlwaysPullImage); - - //set service component type - String serviceComponentType = componentSpec.getSelfName().replace('.', '-'); - this.setService_component_type(serviceComponentType); - - //set the tls info for internal and external communication - TreeMap<String, Object> tls_info = componentSpec.getAuxilary().getTls_info(); - if (tls_info != null) { - addTlsInfo(componentSpec, retInputs); - if (tls_info.get(USE_EXTERNAL_TLS_FIELD) != null) { - retInputs.putAll(addExternalTlsInfo(componentSpec)); - } - } - - //set the reource config - ResourceConfig resource = new ResourceConfig(); - retInputs = resource.createResourceConfig(retInputs, componentSpec.getSelf().getName()); - this.setResource_config(resource); - - return retInputs; - } - - public TreeMap<String, LinkedHashMap<String, Object>> createDmaapProperties( - TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec componentSpec, String override) { - TreeMap<String, LinkedHashMap<String, Object>> retInputs = inps; - - //set the image - GetInput image = new GetInput(); - image.setBpInputName("tag_version"); - this.setImage(image); - retInputs.put("tag_version", createStringInput(componentSpec.getImageUri())); - - //set the location id - GetInput location = new GetInput(); - location.setBpInputName("location_id"); - this.setLocation_id(location); - retInputs.put("location_id", createStringInput(EMPTY_VALUE)); - - //set the log info - this.setLog_info(componentSpec.getAuxilary().getLog_info()); - - //set service component type - String serviceComponentType = componentSpec.getSelfName().replace('.', '-'); - this.setService_component_type(serviceComponentType); - - //set the tls info for internal and external communication - TreeMap<String, Object> tls_info = componentSpec.getAuxilary().getTls_info(); - if (tls_info != null) { - addTlsInfo(componentSpec, retInputs); - if (tls_info.get(USE_EXTERNAL_TLS_FIELD) != null) { - retInputs.putAll(addExternalTlsInfo(componentSpec)); - } - } - - //set the replicas - GetInput replica = new GetInput(); - replica.setBpInputName("replicas"); - this.setReplicas(replica); - LinkedHashMap<String, Object> rep = createIntegerInput("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 = componentSpec.getAuxilary(); -// if(aux.getPorts() != null) { -// retInputs = aux.createPorts(retInputs); -// } - this.setDocker_config(aux); - - //set the appconfig - Appconfig app = new Appconfig(); - retInputs = app.createAppconfig(retInputs, componentSpec, override, true); - this.setApplication_config(app); - - //set the stream publishes - ArrayList<DmaapStreams> pubStreams = new ArrayList<>(); - if (componentSpec.getStreams().getPublishes() != null) { - for (Publishes publishes : componentSpec.getStreams().getPublishes()) { - if (isMessageRouterType(publishes.getType())) { - String topic = publishes.getConfig_key() + "_topic"; - DmaapStreams mrStreams = new DmaapStreams(); - retInputs = mrStreams - .createStreams(inps, componentSpec, topic, publishes.getType(), publishes.getConfig_key(), - publishes.getRoute(), 'p'); - pubStreams.add(mrStreams); - } else if (isDataRouterType(publishes.getType())) { - String feed = publishes.getConfig_key() + "_feed"; - DmaapStreams drStreams = new DmaapStreams(); - retInputs = drStreams - .createStreams(inps, componentSpec, feed, publishes.getType(), publishes.getConfig_key(), - publishes.getRoute(), 'p'); - pubStreams.add(drStreams); - } - } - } - - //set the stream subscribes - ArrayList<DmaapStreams> subStreams = new ArrayList<>(); - if (componentSpec.getStreams().getSubscribes() != null) { - for (Subscribes subscribes : componentSpec.getStreams().getSubscribes()) { - if (isMessageRouterType(subscribes.getType())) { - String topic = subscribes.getConfig_key() + "_topic"; - DmaapStreams mrStreams = new DmaapStreams(); - retInputs = mrStreams - .createStreams(inps, componentSpec, topic, subscribes.getType(), subscribes.getConfig_key(), - subscribes.getRoute(), 's'); - subStreams.add(mrStreams); - } else if (isDataRouterType(subscribes.getType())) { - String feed = subscribes.getConfig_key() + "_feed"; - DmaapStreams drStreams = new DmaapStreams(); - retInputs = drStreams - .createStreams(inps, componentSpec, feed, subscribes.getType(), subscribes.getConfig_key(), - subscribes.getRoute(), 's'); - subStreams.add(drStreams); - } - } - } - - if (!pubStreams.isEmpty()) { - this.setStreams_publishes(pubStreams); - } - if (!subStreams.isEmpty()) { - this.setStreams_subscribes(subStreams); - } - - //set the reource config - ResourceConfig resource = new ResourceConfig(); - retInputs = resource.createResourceConfig(retInputs, componentSpec.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 = createBooleanInput( - "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 deleted file mode 100644 index 3618be3..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/ResourceConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/*============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; - -import static org.onap.blueprintgenerator.common.blueprint.BlueprintHelper.createStringInput; -import static org.onap.blueprintgenerator.models.blueprint.BpConstants.CPU_LIMIT; -import static org.onap.blueprintgenerator.models.blueprint.BpConstants.MEMORY_LIMIT; - -import java.util.LinkedHashMap; -import java.util.TreeMap; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -//TODO: Auto-generated Javadoc -/* (non-Javadoc) - * @see java.lang.Object#toString() - */ -@Getter -@Setter - -/* (non-Javadoc) - * @see java.lang.Object#toString() - */ -@Builder - -/** - * Instantiates a new resource config obj. - */ -@NoArgsConstructor - -/** - * Instantiates a new resource config obj. - * - * @param limits the limits - * @param requests the requests - */ -@AllArgsConstructor - -public class ResourceConfig { - - private TreeMap<String, GetInput> limits; - private TreeMap<String, GetInput> requests; - - - /** - * Creates the resource config. - * - * @param inputs the inputs - * @param name the name - * @return the tree map - */ - public TreeMap<String, LinkedHashMap<String, Object>> createResourceConfig( - TreeMap<String, LinkedHashMap<String, Object>> inputs, String name) { - - String namePrefix = getNamePrefix(name); - - limits = createInputs(inputs, namePrefix, "limit"); - requests = createInputs(inputs, namePrefix, "request"); - - return inputs; - } - - private TreeMap<String, GetInput> createInputs(TreeMap<String, LinkedHashMap<String, Object>> inputs, - String namePrefix, - String inputType) { - - LinkedHashMap<String, Object> memoryLimit = createStringInput(MEMORY_LIMIT); - LinkedHashMap<String, Object> cpuLimit = createStringInput(CPU_LIMIT); - - final String cpuKey = namePrefix + "cpu_" + inputType; - final String memoryKey = namePrefix + "memory_" + inputType; - TreeMap<String, GetInput> inps = new TreeMap<>(); - - insertInput("cpu", cpuKey, inps); - insertInput("memory", memoryKey, inps); - - inputs.put(cpuKey, cpuLimit); - inputs.put(memoryKey, memoryLimit); - - return inps; - } - - private void insertInput(String type, String name, TreeMap<String, GetInput> inputs) { - GetInput input = new GetInput(); - input.setBpInputName(name); - inputs.put(type, input); - } - - private String getNamePrefix(String name) { - return (name == null || name.isEmpty()) ? "" : name + "_"; - } -} - diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java deleted file mode 100644 index 0b03777..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/Start.java +++ /dev/null @@ -1,47 +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 org.onap.blueprintgenerator.models.componentspec.ComponentSpec; - -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 Start { - private StartInputs inputs; - private LinkedHashMap<String, Object> envs; - - public TreeMap<String, LinkedHashMap<String, Object>> createOnapStart(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs) { - - //create the start inputs - StartInputs inputs = new StartInputs(); - inputs.createOnapStartInputs(inps, cs); - this.setInputs(inputs); - - return inps; - } -} 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 deleted file mode 100644 index a0cfe20..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/StartInputs.java +++ /dev/null @@ -1,118 +0,0 @@ -/*============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; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.TreeMap; - -import org.onap.blueprintgenerator.core.PgaasNodeBuilder; -import org.onap.blueprintgenerator.models.componentspec.Auxilary; -import org.onap.blueprintgenerator.models.componentspec.ComponentSpec; - -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 StartInputs { - private ArrayList<String> ports; - private Object envs; - - public TreeMap<String, LinkedHashMap<String, Object>> createOnapStartInputs(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs){ - - int count = 0; - ArrayList<String> portList = new ArrayList<>(); - Auxilary aux = cs.getAuxilary(); - - if (aux.getPorts() != null) { - - for(Object p : aux.getPorts()) { - String[] ports = p.toString().split(":"); - String internal - = String.format("concat: [\"%s:\", {get_input: external_port_%d}]" - , ports[0], count); - portList.add(internal); - - LinkedHashMap<String, Object> portType = new LinkedHashMap<>(); - portType.put("type", "string"); - portType.put("default", ports[1]); - inps.put("external_port_" + count, portType); - - count++; - } - - } - - this.setPorts(portList); -// ArrayList<String> port = new ArrayList<String>(); -// String external = ""; -// if(cs.getAuxilary().getPorts() != null) { -// for(String s: cs.getAuxilary().getPorts()) { -// //create the ports -// String portNumber = ""; -// StringBuffer buf = new StringBuffer(); -// for(int i = 0; i < s.length(); i++) { -// if(!(s.charAt(i) == ':')) { -// buf.append(s.charAt(i)); -// } -// else { -// external = s.replace(buf.toString() + ":", ""); -// break; -// } -// } -// portNumber = buf.toString(); -// String p = "concat: [" + '"' + portNumber + ":" + '"' +", {get_input: external_port }]"; -// port.add(p); -// } -// } -// this.setPorts(port); -// //add the external port input -// if(cs.getAuxilary().getPorts() != null) { -// stringType.put("type", "string"); -// stringType.put("description", "Kubernetes node port on which collector is exposed"); -// stringType.put("default", "'" + external + "'") ; -// retInputs.put("external_port", stringType); -// } - - //set the envs - LinkedHashMap<String, Object> eMap = new LinkedHashMap<>(); - if(cs.getAuxilary().getDatabases() != null){ - //set db env variables - LinkedHashMap<String, Object> envVars = PgaasNodeBuilder.getEnvVariables(cs.getAuxilary().getDatabases()); - this.setEnvs(envVars); - eMap.put("default", "&envs {}"); - } - else { - GetInput env = new GetInput(); - env.setBpInputName("envs"); - this.setEnvs(env); - eMap.put("default", "{}"); - } - inps.put("envs", eMap); - - - return inps; - } -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TemplateNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TemplateNode.java deleted file mode 100644 index 7137cdb..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/TemplateNode.java +++ /dev/null @@ -1,69 +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 org.onap.blueprintgenerator.models.componentspec.Auxilary; -import org.onap.blueprintgenerator.models.componentspec.ComponentSpec; -import org.onap.blueprintgenerator.models.componentspec.HealthCheck; -import org.onap.blueprintgenerator.models.onapbp.OnapNode; - -import lombok.Getter; import lombok.Setter; - - -public class TemplateNode extends OnapNode{ - -// public void createTemplateNode() { -// //dummy inputs just used for the inputs so i can reuse code -// TreeMap<String, LinkedHashMap<String, Object>> inps = new TreeMap<String, LinkedHashMap<String, Object>>(); -// -// //create a dummy componentspec to set the values later on -// ComponentSpec cs = new ComponentSpec(); -// Auxilary aux = new Auxilary(); -// HealthCheck health = new HealthCheck(); -// health.setEndpoint("/healthcheck"); -// health.setInterval("15s"); -// health.setTimeout("1s"); -// health.setType("https"); -// aux.setHealthcheck(health); -// String[] ports = new String[1]; -// ports[0] = "9999:9999"; -// aux.setPorts(ports); -// cs.setAuxilary(aux); -// -// //set the type -// this.setType("dcae.nodes.ContainerizedPlatformComponent"); -// -// //set the interface -// Interfaces inter = new Interfaces(); -// inter.createOnapInterface(inps, cs); -// TreeMap<String, Interfaces> interfaces = new TreeMap<String, Interfaces>(); -// interfaces.put("cloudify.interfaces.lifecycle", inter); -// this.setInterfaces(interfaces); -// -// -// //create the properties -// Properties props = new Properties(); -// props.createTemplateProperties(cs); -// this.setProperties(props); -// } -} 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 deleted file mode 100644 index 0cec284..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapInfo.java +++ /dev/null @@ -1,105 +0,0 @@ -/*============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) { - LinkedHashMap<String, Object> 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); - - inps.put(config, stringType); - - return inps; - } - - 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/dmaap/DmaapObj.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java deleted file mode 100644 index 30f59e2..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/dmaap/DmaapObj.java +++ /dev/null @@ -1,83 +0,0 @@ -/*============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<String, LinkedHashMap<String, Object>> createOnapDmaapMRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, - String config, char type, String n, String num, boolean isDmaap) { - LinkedHashMap<String, Object> stringType = new LinkedHashMap<>(); - stringType.put("type", "string"); - - //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); - inps.put(config + "_" + num +"_aaf_username", stringType); - - //set password - GetInput p = new GetInput(); - p.setBpInputName(config + "_" + num +"_aaf_password"); - this.setPass(p); - inps.put(config + "_" + num +"_aaf_password", stringType); - } - return inps; - } - public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num, boolean isDmaap) { - - //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 inps; - } -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java deleted file mode 100644 index 35f958e..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNode.java +++ /dev/null @@ -1,35 +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.pgaas; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.onap.blueprintgenerator.models.blueprint.Node; - -@Getter -@Setter -@NoArgsConstructor -public class PgaasNode extends Node { - - @JsonProperty("properties") - private PgaasNodeProperties pgaasNodeProperties; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java deleted file mode 100644 index 709c66e..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/pgaas/PgaasNodeProperties.java +++ /dev/null @@ -1,40 +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.pgaas; - -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 PgaasNodeProperties { - - @JsonProperty("writerfqdn") - private GetInput writerfqdn; - - @JsonProperty("name") - private GetInput name; - - @JsonProperty("use_existing") - private boolean useExisting; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java deleted file mode 100644 index b4740df..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNode.java +++ /dev/null @@ -1,34 +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.policy; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.onap.blueprintgenerator.models.blueprint.Node; - -@Getter @Setter -@NoArgsConstructor -public class PolicyNode extends Node { - - @JsonProperty("properties") - private PolicyNodeProperties policyNodeProperties; -} diff --git a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java b/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.java deleted file mode 100644 index 6d23b23..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/policy/PolicyNodeProperties.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.policy; - -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 PolicyNodeProperties { - - @JsonProperty("policy_id") - private GetInput policyId; - - @JsonProperty("policy_model_id") - private String policyModelId; -} 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 deleted file mode 100644 index 546a809..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalCertificateParametersFactory.java +++ /dev/null @@ -1,74 +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.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 deleted file mode 100644 index e954afc..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/ExternalTlsInfoFactory.java +++ /dev/null @@ -1,102 +0,0 @@ -/*============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 deleted file mode 100644 index cdbfd32..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsConstants.java +++ /dev/null @@ -1,38 +0,0 @@ -/*============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 deleted file mode 100644 index 027f996..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/TlsInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -/*============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 deleted file mode 100644 index 21b20e4..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/api/ExternalCertificateDataFactory.java +++ /dev/null @@ -1,37 +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.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 deleted file mode 100644 index e3ccca1..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalCertificateParameters.java +++ /dev/null @@ -1,43 +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.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 deleted file mode 100644 index 588dbb5..0000000 --- a/mod/bpgenerator/src/main/java/org/onap/blueprintgenerator/models/blueprint/tls/impl/ExternalTlsInfo.java +++ /dev/null @@ -1,54 +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.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; - -} |