summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/onap/src/main/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bpgenerator/onap/src/main/java/org/onap')
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java110
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java47
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java60
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java44
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java54
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java42
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java51
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java48
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java46
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java49
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java48
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java47
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java46
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java48
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java45
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java89
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java45
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java50
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java49
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java49
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java60
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java52
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java45
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java51
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java43
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java66
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java49
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java116
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java111
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java166
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java152
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java66
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java103
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java50
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java71
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java87
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java98
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java67
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java222
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java138
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java99
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java259
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java59
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java98
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java97
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java65
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java144
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java104
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java150
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java105
50 files changed, 4060 insertions, 0 deletions
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
new file mode 100644
index 0000000..3b9dd49
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
@@ -0,0 +1,110 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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;
+
+
+import org.onap.blueprintgenerator.model.base.Blueprint;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
+import org.onap.blueprintgenerator.service.OnapBlueprintService;
+import org.onap.blueprintgenerator.service.common.CommonUtils;
+import org.onap.blueprintgenerator.service.common.ComponentSpecService;
+import org.onap.blueprintgenerator.service.dmaap.DmaapBlueprintService;
+import org.onap.policycreate.service.PolicyModelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+
+import static java.lang.System.exit;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP - Blueprint Generator Main Application to create Policy Models or Blueprints
+ */
+
+@ComponentScan({"org.onap.blueprintgenerator","org.onap.policycreate"})
+@SpringBootApplication
+public class BlueprintGeneratorMainApplication implements CommandLineRunner {
+
+ @Autowired
+ private ComponentSpecService componentSpecService;
+
+ @Autowired
+ private PolicyModelService policyModelService;
+
+ @Autowired
+ private CommonUtils commonUtils;
+
+ @Autowired
+ private PolicyModelService onapPolicyModelNodeService;
+
+ @Autowired
+ private ComponentSpecService onapComponentSpecService;
+
+ @Autowired
+ private CommonUtils onapCommonUtils;
+
+ @Autowired
+ private OnapBlueprintService onapBlueprintService;
+
+ @Autowired
+ private DmaapBlueprintService dmaapBlueprintService;
+
+ public static void main(String[] args) {
+ SpringApplication.run(BlueprintGeneratorMainApplication.class, args);
+ }
+
+ @Override
+ public void run(String... args) {
+ if (args.length >=2 && args[0].equals("app") && args[1].equals("ONAP")) {
+ onapCommonUtils.printInstructions();
+ if(args.length >=4 && args[2].equals("-type") && args[3].equals("policycreate")){
+ Input input = onapCommonUtils.parseInputs(args);
+ ComponentSpec componentSpec = componentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ onapPolicyModelNodeService.createPolicyModels(componentSpec.getParameters(), input.getOutputPath());
+ }
+ else {
+ Input input = onapCommonUtils.parseInputs(args);
+ OnapComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ if (input.getBpType().equals("o")) {
+ Blueprint blueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ onapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
+ System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ } else if (input.getBpType().equals("d")) {
+ Blueprint blueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ dmaapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
+ System.out.println(dmaapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ }
+ }
+ }
+
+ exit(0);
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java
new file mode 100644
index 0000000..d7c76a9
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: External Certificate Parameters
+ */
+
+
+@Data
+public class ExternalCertificateParameters {
+
+ @JsonProperty(Constants.COMMON_NAME_FIELD)
+ private GetInput commonName;
+
+ @JsonProperty(Constants.SANS_FIELD)
+ private GetInput sans;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java
new file mode 100644
index 0000000..197104d
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: External TLS Info
+ */
+
+
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ExternalTlsInfo {
+
+ @JsonProperty(Constants.EXTERNAL_CERT_DIRECTORY_FIELD)
+ private String externalCertDirectory;
+
+ @JsonProperty(Constants.USE_EXTERNAL_TLS_FIELD)
+ private GetInput useExternalTls;
+
+ @JsonProperty(Constants.CA_NAME_FIELD)
+ private GetInput caName;
+
+ @JsonProperty(Constants.CERT_TYPE_FIELD)
+ private GetInput certType;
+
+ @JsonProperty(Constants.EXTERNAL_CERTIFICATE_PARAMETERS_FIELD)
+ private ExternalCertificateParameters externalCertificateParameters;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java
new file mode 100644
index 0000000..2d5bca7
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java
@@ -0,0 +1,44 @@
+
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Get Attribute
+ */
+
+
+@Data
+public class GetAttribute {
+
+ @JsonProperty("get_attribute")
+ private Object attribute;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java
new file mode 100644
index 0000000..3721d55
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java
@@ -0,0 +1,54 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Info
+ */
+
+
+@Data
+@JsonInclude(value= Include.NON_NULL)
+public class Info {
+
+ private GetInput topic_url;
+
+ private GetInput username;
+
+ private GetInput password;
+
+ private GetInput location;
+
+ private GetInput delivery_url;
+
+ private GetInput subscriber_id;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java
new file mode 100644
index 0000000..04ef7e7
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Interfaces
+ */
+
+
+@Data
+public class Interfaces {
+
+ private Start start;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java
new file mode 100644
index 0000000..ea28d62
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Node derived from Common Module Node Model used by both DCAE and ONAP
+ */
+
+
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Node extends org.onap.blueprintgenerator.model.base.Node {
+
+ private Map<String, Interfaces> interfaces;
+
+ private Properties properties;
+
+ private List<Map<String, String>> relationships;
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java
new file mode 100644
index 0000000..4dd7b0f
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import org.onap.blueprintgenerator.model.base.Blueprint;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Blueprint derived from Common Module Blueprint Model used by both DCAE and ONAP
+ */
+
+
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OnapBlueprint extends Blueprint {
+
+ private Map<String, Node> node_templates;
+
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java
new file mode 100644
index 0000000..af6fb54
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Pgaas Node
+ */
+
+
+@Data
+@NoArgsConstructor
+public class PgaasNode extends Node {
+
+ @JsonProperty("properties")
+ private PgaasNodeProperties pgaasNodeProperties;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java
new file mode 100644
index 0000000..37ddb73
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Pgaas Node Properties
+ */
+
+
+
+@Data
+public class PgaasNodeProperties {
+
+ @JsonProperty("writerfqdn")
+ private GetInput writerfqdn;
+
+ @JsonProperty("name")
+ private GetInput name;
+
+ @JsonProperty("use_existing")
+ private boolean useExisting;
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java
new file mode 100644
index 0000000..08b9096
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Policy Model
+ */
+
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PolicyModel {
+
+ private String tosca_definition_version;
+ private Map<String, PolicyModelNode> node_types;
+ private Map<String, PolicyModelNode> data_types;
+
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java
new file mode 100644
index 0000000..c418b8e
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Policy Model Node
+ */
+
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PolicyModelNode {
+
+ private String derived_from;
+
+ private Map<String, PolicyProperties> properties;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java
new file mode 100644
index 0000000..cc08814
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Policy Node derived from Common Module Node Model used by both DCAE and ONAP
+ */
+
+
+@Data
+@NoArgsConstructor
+public class PolicyNode extends Node {
+
+ @JsonProperty("properties")
+ private PolicyNodeProperties policyNodeProperties;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java
new file mode 100644
index 0000000..3f472c8
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Policy Node Properties
+ */
+
+
+@Data
+@NoArgsConstructor
+public class PolicyNodeProperties {
+
+ @JsonProperty("policy_id")
+ private GetInput policyId;
+
+ @JsonProperty("policy_model_id")
+ private String policyModelId;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java
new file mode 100644
index 0000000..5a63b00
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Policy Properties
+ */
+
+
+@Data
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PolicyProperties {
+
+ private String type;
+
+ private Object entry_schema;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java
new file mode 100644
index 0000000..11fc06e
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import org.onap.blueprintgenerator.model.componentspec.OnapAuxilary;
+import org.onap.blueprintgenerator.model.dmaap.Streams;
+import org.onap.blueprintgenerator.model.dmaap.TlsInfo;
+import org.onap.blueprintgenerator.service.common.ExternalTlsInfoFactoryService;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Properties
+ */
+
+
+@Data
+@JsonInclude(value = Include.NON_NULL)
+public class Properties {
+
+ private Appconfig application_config;
+
+ private OnapAuxilary docker_config;
+
+ private Object image;
+
+ private GetInput location_id;
+
+ private String service_component_type;
+
+ private Map<String, Object> log_info;
+
+ private String dns_name;
+
+ private Object replicas;
+
+ private String name;
+
+ private GetInput topic_name;
+
+ private GetInput feed_name;
+
+ private List<Streams> streams_publishes;
+
+ private List<Streams> streams_subscribes;
+
+ private TlsInfo tls_info;
+
+ private ResourceConfig resource_config;
+
+ private GetInput always_pull_image;
+
+ private Boolean useExisting;
+
+ @JsonIgnore
+ private ExternalTlsInfoFactoryService externalCertFactory;
+
+ private ExternalTlsInfo external_cert;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java
new file mode 100644
index 0000000..8b41fd2
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Resource Config
+ */
+
+
+@Data
+public class ResourceConfig {
+
+ private Map<String, GetInput> limits;
+
+ private Map<String, GetInput> requests;
+
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java
new file mode 100644
index 0000000..7aa1566
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import org.onap.blueprintgenerator.model.componentspec.common.Calls;
+import org.onap.blueprintgenerator.model.componentspec.common.Provides;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Services
+ */
+
+
+@Data
+@JsonInclude(value=Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Services {
+
+ private Calls[] calls;
+
+ private Provides[] provides;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java
new file mode 100644
index 0000000..3740668
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Start
+ */
+
+
+@Data
+@JsonInclude(value= JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Start {
+
+ private StartInputs inputs;
+
+ private Map<String, Object> envs;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java
new file mode 100644
index 0000000..458852e
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.common;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Common Model used by both ONAP and DMAAP: Start Inputs under Start
+ */
+
+
+@Data
+@JsonInclude(value= JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class StartInputs {
+
+ private Object envs;
+
+ private List<String> ports;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java
new file mode 100644
index 0000000..0923195
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.componentspec;
+
+import org.onap.blueprintgenerator.model.componentspec.base.Auxilary;
+import org.onap.blueprintgenerator.model.componentspec.common.Volumes;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Component Spec Model for ONAP Auxillary derived from Common Module Auxillary used by both DCAE and ONAP
+ */
+
+
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OnapAuxilary extends Auxilary {
+
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private List<Object> ports;
+
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Map<String, Object> log_info;
+
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Map<String, Object> tls_info;
+
+ private Volumes[] volumes;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java
new file mode 100644
index 0000000..5a64366
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.componentspec;
+
+import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Component Spec Model for ONAP Component Spec derived from Common Module Component Spec used by both DCAE and ONAP
+ */
+
+
+@Data
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OnapComponentSpec extends ComponentSpec {
+
+ private Services services;
+
+ private OnapAuxilary auxilary;
+
+ @JsonProperty("policy_info")
+ private PolicyInfo policyInfo;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java
new file mode 100644
index 0000000..3ec5fe3
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java
@@ -0,0 +1,45 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.componentspec;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Component Spec Model for Policy Info
+ */
+
+
+@Data
+public class PolicyInfo {
+
+ @JsonProperty("policy")
+ private List<TypePolicy> typePolicyList;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java
new file mode 100644
index 0000000..b7d32a4
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.componentspec;
+
+
+import org.onap.blueprintgenerator.model.componentspec.common.Calls;
+import org.onap.blueprintgenerator.model.componentspec.common.Provides;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Component Spec Model for Services
+ */
+
+
+@Data
+@JsonInclude(value= Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Services {
+
+ private Calls[] calls;
+
+ private Provides[] provides;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java
new file mode 100644
index 0000000..6ba7daf
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.componentspec;
+
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Component Spec Model for Type Policy
+ */
+
+
+@Data
+public class TypePolicy {
+
+ private String node_label;
+ private String policy_id;
+ private String policy_model_id;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java
new file mode 100644
index 0000000..14d0c51
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.dmaap;
+
+import org.onap.blueprintgenerator.model.common.GetInput;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import lombok.Data;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * DMAAP Model for Streams
+ */
+
+
+@Data
+@JsonInclude(value= Include.NON_NULL)
+public class Streams {
+
+ private String name;
+
+ private GetInput location;
+
+ private GetInput client_role;
+
+ private String type;
+
+ private GetInput username;
+
+ private GetInput password;
+
+ //private GetInput delivery_url;
+
+ private GetInput privileged;
+
+ private GetInput decompress;
+
+ private String route;
+
+ private String scheme;
+
+
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java
new file mode 100644
index 0000000..9290bf9
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.model.dmaap;
+
+import org.onap.blueprintgenerator.model.common.GetInput;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * DMAAP Model for TLS Info
+ */
+
+
+@Data
+@NoArgsConstructor
+public class TlsInfo {
+
+ @JsonProperty("cert_directory")
+ private String certDirectory;
+
+ @JsonProperty("use_tls")
+ private GetInput useTls;
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
new file mode 100644
index 0000000..fed3707
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
@@ -0,0 +1,116 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service;
+
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.Info;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Service to create Message Router and Data Router Information
+ */
+
+@Service
+public class InfoService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // Method to create info for Message Router
+ public Map<String,Object> createMessageRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config, char type) {
+
+ Map<String,Object> response = new HashMap<>();
+ Info info = new Info();
+
+ 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);
+ info.setTopic_url(topic);
+
+ inputs.put(config, stringType);
+
+ response.put("info", info);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // Method to create info for Data Router
+ public Map<String,Object> createDataRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config) {
+
+ Map<String,Object> response = new HashMap<>();
+ Info info = new Info();
+
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
+ stringType.put("type", "string");
+
+ String userNameInputName = blueprintHelperService.joinUnderscore(config, "username");
+ GetInput username = new GetInput(userNameInputName);
+ info.setUsername(username);
+ inputs.put(userNameInputName, stringType);
+
+ String userpasswordInputName = blueprintHelperService.joinUnderscore(config, "password");
+ GetInput password = new GetInput(userpasswordInputName);
+ info.setPassword(password);
+ inputs.put(userpasswordInputName, stringType);
+
+ String userlocationInputName = blueprintHelperService.joinUnderscore(config, "location");
+ GetInput location = new GetInput(userlocationInputName);
+ info.setLocation(location);
+ inputs.put(userlocationInputName, stringType);
+
+ String userdeliveryUrlInputName = blueprintHelperService.joinUnderscore(config, "delivery_url");
+ GetInput deliveryUrl = new GetInput(userdeliveryUrlInputName);
+ info.setDelivery_url(deliveryUrl);
+ inputs.put(userdeliveryUrlInputName, stringType);
+
+ String usersubscriberIDInputName = blueprintHelperService.joinUnderscore(config, "subscriber_id");
+ GetInput subscriberID = new GetInput(usersubscriberIDInputName);
+ info.setSubscriber_id(subscriberID);
+ inputs.put(usersubscriberIDInputName, stringType);
+
+ response.put("info", info);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java
new file mode 100644
index 0000000..f25c18c
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java
@@ -0,0 +1,111 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service;
+
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.exception.BlueprintException;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.OnapBlueprint;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.service.base.BlueprintService;
+import org.onap.blueprintgenerator.service.common.ImportsService;
+import org.onap.blueprintgenerator.service.common.NodeService;
+import org.onap.blueprintgenerator.service.common.PgaasNodeService;
+import org.onap.blueprintgenerator.service.common.PolicyNodeService;
+import org.onap.blueprintgenerator.service.common.QuotationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Service to create ONAP Blueprint
+ */
+
+@Service
+public class OnapBlueprintService extends BlueprintService {
+
+ @Autowired
+ private NodeService nodeService;
+
+ @Autowired
+ private PolicyNodeService policyNodeService;
+
+ @Autowired
+ private PgaasNodeService pgaasNodeService;
+
+ @Autowired
+ private QuotationService quotationService;
+
+ @Autowired
+ protected ImportsService importsService;
+
+ // Method to generate Onap Blueprint
+ public OnapBlueprint createBlueprint(OnapComponentSpec onapComponentSpec, Input input) {
+ try {
+ OnapBlueprint blueprint = new OnapBlueprint();
+ blueprint.setTosca_definitions_version(Constants.TOSCA_DEF_VERSION);
+
+ //if (!"".equals(input.getImportPath()))
+ if (!StringUtils.isEmpty(input.getImportPath()))
+ blueprint.setImports(importsService.createImportsFromFile(input.getImportPath()));
+ else
+ blueprint.setImports(importsService.createImports(input.getBpType()));
+
+ Map<String, Node> nodeTemplate = new TreeMap<>();
+ String nodeName = onapComponentSpec.getSelf().getName();
+ Map<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
+
+ Map<String, Object> onapNodeResponse = nodeService.createOnapNode(inputs, onapComponentSpec, input.getServiceNameOverride());
+ inputs = (Map<String, LinkedHashMap<String, Object>>) onapNodeResponse.get("inputs");
+ nodeTemplate.put(nodeName, (Node) onapNodeResponse.get("onapNode"));
+ blueprint.setNode_templates(nodeTemplate);
+
+ if (onapComponentSpec.getPolicyInfo() != null)
+ policyNodeService.addPolicyNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+
+ if (onapComponentSpec.getAuxilary() != null && onapComponentSpec.getAuxilary().getDatabases() != null)
+ pgaasNodeService.addPgaasNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+
+ blueprint.setInputs(inputs);
+
+ return quotationService.setQuotations(blueprint);
+ } catch (Exception ex) {
+ throw new BlueprintException("Unable to create ONAP Blueprint Object from given input parameters", ex);
+ }
+ }
+
+
+}
+
+
+
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java
new file mode 100644
index 0000000..c6d744c
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java
@@ -0,0 +1,166 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.Appconfig;
+import org.onap.blueprintgenerator.model.common.Dmaap;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.common.Calls;
+import org.onap.blueprintgenerator.model.componentspec.common.Parameters;
+import org.onap.blueprintgenerator.model.componentspec.common.Publishes;
+import org.onap.blueprintgenerator.model.componentspec.common.Subscribes;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to create App Config
+ */
+
+
+@Service("onapAppConfigService")
+public class AppConfigService {
+
+ @Autowired
+ private DmaapService dmaapService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ public Map<String,Object> createAppconfig(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override, boolean isDmaap) {
+
+ Map<String,Object> response = new HashMap<>();
+ Appconfig appconfig = new Appconfig();
+
+ Calls[] call = new Calls[0];
+ appconfig.setService_calls(call);
+
+ Map<String, Dmaap> streamPublishes = new TreeMap<>();
+ if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
+ if (blueprintHelperService.isDataRouterType(publishes.getType())) {
+ String config = publishes.getConfig_key();
+ String name = config + Constants._FEED;
+ Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
+ dmaap.setType(publishes.getType());
+ streamPublishes.put(config, dmaap);
+ } else if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
+ String config = publishes.getConfig_key();
+ String name = config + Constants._TOPIC;
+ Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapMessageRouter(inputs, config, 'p', name, name, isDmaap);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
+ dmaap.setType(publishes.getType());
+ streamPublishes.put(config, dmaap);
+ }
+ }
+ }
+ }
+
+ Map<String, Dmaap> streamSubscribes = new TreeMap<>();
+
+ if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes subscribes : onapComponentSpec.getStreams().getSubscribes()) {
+ if (blueprintHelperService.isDataRouterType(subscribes.getType())) {
+ String config = subscribes.getConfig_key();
+ String name = config + Constants._FEED;
+ Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
+ dmaap.setType(subscribes.getType());
+ streamSubscribes.put(config, dmaap);
+ } else if (blueprintHelperService.isMessageRouterType(subscribes.getType())) {
+ String config = subscribes.getConfig_key();
+ String name = config + Constants._TOPIC;
+ Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapMessageRouter(inputs, config, 's', name, name, isDmaap);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
+ dmaap.setType(subscribes.getType());
+ streamSubscribes.put(config, dmaap);
+ }
+ }
+ }
+ }
+
+ appconfig.setStreams_publishes(streamPublishes);
+ appconfig.setStreams_subscribes(streamSubscribes);
+
+ Map<String, Object> parameters = new TreeMap<>();
+ for(Parameters p: onapComponentSpec.getParameters()) {
+ String pName = p.getName();
+ if(p.isSourced_at_deployment()) {
+ GetInput paramInput = new GetInput();
+ paramInput.setBpInputName(pName);
+ parameters.put(pName, paramInput);
+ if(!"".equals(p.getValue())) {
+ LinkedHashMap<String, Object> pInputs = blueprintHelperService.createStringInput( p.getValue());
+ inputs.put(pName, pInputs);
+ } else {
+ LinkedHashMap<String, Object> pInputs = new LinkedHashMap<>();
+ pInputs.put("type", "string");
+ inputs.put(pName, pInputs);
+ }
+ } else {
+ if("string".equals(p.getType())) {
+ String val =(String) p.getValue();
+ val = '"' + val + '"';
+ parameters.put(pName, val);
+ }
+ else {
+ parameters.put(pName, p.getValue());
+ // Updated code to resolve the issue of missing \ for collector.schema.file
+ //parameters.put(pName, pName.equals("collector.schema.file") ? ((String)p.getValue()).replace("\"", "\\\"") : p.getValue());
+ }
+ }
+ }
+ if(override != null) {
+ GetInput ov = new GetInput();
+ ov.setBpInputName(Constants.SERVICE_COMPONENT_NAME_OVERRIDE);
+ parameters.put(Constants.SERVICE_COMPONENT_NAME_OVERRIDE, ov);
+ LinkedHashMap<String, Object> over = blueprintHelperService.createStringInput( override);
+ inputs.put(Constants.SERVICE_COMPONENT_NAME_OVERRIDE, over);
+ }
+ appconfig.setParams(parameters);
+
+ response.put("appconfig", appconfig);
+ response.put("inputs", inputs);
+ return response;
+
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java
new file mode 100644
index 0000000..97ed47f
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java
@@ -0,0 +1,152 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+
+
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.CommandLine;
+import org.onap.blueprintgenerator.model.common.Input;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import static java.lang.System.exit;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to Print Instructions and Parse Inputs
+ */
+
+
+@Service("onapCommonUtilsService")
+public class CommonUtils {
+
+ public void printInstructions() {
+ System.out.println("OPTIONS:");
+ System.out.println("-i OR --component-spec: The path of the ONAP Blueprint INPUT JSON SPEC FILE (Required)");
+ System.out.println("-p OR --blueprint-path: The path of the ONAP Blueprint OUTPUT where it will be saved (Required)");
+ System.out.println("-n OR --blueprint-name: The NAME of the ONAP Blueprint OUTPUT that will be created (Optional)");
+ System.out.println("-t OR --imports: The path of the ONAP Blueprint IMPORT FILE (Optional)");
+ System.out.println("-o OR --service-name-override: The Value used to OVERRIDE the SERVICE NAME of the ONAP Blueprint (Optional)");
+ System.out.println("-d OR --dmaap-plugin: The option to create a ONAP Blueprint with DMAAP Plugin (Optional)");
+ System.out.println("Syntax to run from command line: \n For Blueprint : java -jar target/<JAR Filename>.jar app ONAP -i componentspec -p OutputBlueprintPath -n Blueprintname -d \n For PolicyCreate: java -jar target/<JAR Filename>.jar app ONAP -type policycreate -i componentspec -p OutputPolicyPath");
+ }
+
+ public Input parseInputs(String[] args) {
+ String[] modArgs = new String[args.length];
+ for(int i=0; i<args.length; i++){
+ if(args[i].contains("--component-spec"))
+ modArgs[i] = "-_component_spec";
+ else if(args[i].contains("--blueprint-path"))
+ modArgs[i] = "-_blueprint_path";
+ else if(args[i].contains("--blueprint-name"))
+ modArgs[i] = "-_blueprint_name";
+ else if(args[i].contains("--imports"))
+ modArgs[i] = "-_imports";
+ else if(args[i].contains("--service-name-override"))
+ modArgs[i] = "-_service_name_override";
+ else if(args[i].contains("--dmaap-plugin"))
+ modArgs[i] = "-_dmaap_plugin";
+ else
+ modArgs[i] = args[i];
+ }
+ String commands = " ";
+ for (String s : modArgs) {
+
+ commands = commands + " " + s;
+ }
+
+ //checks if the required inputs are present or not
+ if (!(commands.contains(" -i ")|| commands.contains(" -_component_spec "))
+ && !(commands.contains(" -p ") || commands.contains(" -_blueprint_path ") ) ) {
+ System.out.println("\n Please enter the ONAP Blueprint required inputs for: \n -i (The path of the ONAP Blueprint INPUT JSON SPEC FILE), \n -p (The path of the ONAP Blueprint OUTPUT where it will be saved)");
+ exit(-1);
+ }
+
+
+ CommandLineParser parser = new DefaultParser();
+ HelpFormatter formatter = new HelpFormatter();
+
+ Options options = new Options();
+
+ options.addOption("i", "Spec", true, "ComponentSpec Input File of the ONAP Blueprint");
+ options.addOption("_component_spec", "Spec", true, "ComponentSpec Input File of the ONAP Blueprint");
+ options.addOption("p", "Path", true, "Path of the ONAP Blueprint OUTPUT");
+ options.addOption("_blueprint_path", "Path", true, "Path of the ONAP Blueprint OUTPUT");
+ options.addOption("n", "name", true, "NAME of the ONAP Blueprint OUTPUT");
+ options.addOption("_blueprint_name", "name", true, "NAME of the ONAP Blueprint OUTPUT");
+ options.addOption("t", "Import File", true, "Import file for the OUTPUT Blueprint Imports");
+ options.addOption("_imports", "Import File", true, "Import file for the OUTPUT Blueprint Imports");
+ options.addOption("o", "Service name Override", true, "Value used to override the OUTPUT Blueprint service name");
+ options.addOption("_service_name_override", "Service name Override", true, "Value used to override the OUTPUT Blueprint service name");
+ options.addOption("d", "Dmaap Plugin", false, "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
+ options.addOption("_dmaap_plugin", "Dmaap Plugin", false, "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
+
+ Input input = new Input();
+ try {
+ CommandLine commandLine = parser.parse(options, modArgs);
+ input.setComponentSpecPath(commandLine.getOptionValue("i") == null ? commandLine.getOptionValue("_component_spec") : commandLine.getOptionValue("i"));
+ input.setOutputPath(commandLine.getOptionValue("p") == null ? commandLine.getOptionValue("_blueprint_path") : commandLine.getOptionValue("p"));
+ input.setBluePrintName(commandLine.getOptionValue("n") == null ? commandLine.getOptionValue("_blueprint_name") : commandLine.getOptionValue("n"));
+ input.setImportPath(commandLine.getOptionValue("t") == null ? commandLine.getOptionValue("_imports") : commandLine.getOptionValue("t"));
+ input.setBpType((commands.contains(" -d ") || commands.contains(" -_dmaap_plugin ") ) ? "d" : "o");
+ input.setServiceNameOverride(commandLine.getOptionValue("o") == null ? commandLine.getOptionValue("_service_name_override") == null ? "" : commandLine.getOptionValue("_service_name_override") : commandLine.getOptionValue("o"));
+ } catch (ParseException ex) {
+ ex.printStackTrace();
+ System.out.println(ex.getMessage());
+ formatter.printHelp("Required/Valid Inputs to create ONAP Blueprint are not provided", options);
+ exit(-1);
+ }
+ if (StringUtils.isEmpty(input.getComponentSpecPath())) {
+ System.out.println("The path of the ONAP Blueprint INPUT JSON SPEC FILE is not specified");
+ exit(-1);
+ }
+ if (StringUtils.isEmpty(input.getOutputPath())) {
+ System.out.println("The path of the ONAP Blueprint OUTPUT where it will be saved is not specified");
+ exit(-1);
+ }
+ if (commands.contains(" -n ") || commands.contains(" -_blueprint_name ")) {
+ if (StringUtils.isEmpty(input.getBluePrintName())) {
+ System.out.println("The NAME of the ONAP Blueprint OUTPUT that will be created is not specified");
+ exit(-1);
+ }
+ }
+ if (commands.contains(" -t ")|| commands.contains(" -_imports ")) {
+ if (StringUtils.isEmpty(input.getImportPath())) {
+ System.out.println("The path of the ONAP Blueprint Imports File is not specified");
+ exit(-1);
+ }
+ }
+
+ return input;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
new file mode 100644
index 0000000..e8d648d
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.exception.ComponentSpecException;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to create Component Spec from File
+ */
+
+
+@Service("onapComponentSpecService")
+public class ComponentSpecService {
+
+ @Qualifier("objectMapper")
+ @Autowired
+ private ObjectMapper componentMapper;
+
+ @Qualifier("yamlObjectMapper")
+ @Autowired
+ private ObjectMapper yamlComponentMapper;
+
+ public OnapComponentSpec createComponentSpecFromFile(String componentSpecPath) {
+ OnapComponentSpec componentSpec;
+ try {
+ if(!componentSpecPath.endsWith(".json"))
+ componentMapper = yamlComponentMapper;
+ componentSpec = componentMapper.readValue(new File(componentSpecPath), OnapComponentSpec.class);
+ } catch (Exception ex) {
+ throw new ComponentSpecException("Unable to create ONAP Component Spec from the input file: "+ componentSpecPath, ex);
+ }
+ return componentSpec;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java
new file mode 100644
index 0000000..d4b2c42
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java
@@ -0,0 +1,103 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.model.common.Dmaap;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.service.InfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add DMAAP Message and Data Routers
+ */
+
+
+@Service
+public class DmaapService {
+
+ @Autowired
+ private InfoService infoService;
+
+ // Method is used to create the Dmaap Message Router
+ public Map<String,Object> createDmaapMessageRouter(Map<String, LinkedHashMap<String, Object>> inputs,String config, char type, String counter, String num, boolean isDmaap) {
+
+ Map<String,Object> response = new HashMap<>();
+ Dmaap dmaap = new Dmaap();
+
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap();
+ stringType.put("type", "string");
+
+ if(!isDmaap){
+ Map<String, Object> infoResponse = infoService.createMessageRouterInfo(inputs, config, type);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
+ dmaap.setDmaap_info(infoResponse.get("info"));
+ }
+ else{
+ String infoType = "<<" + counter + ">>";
+ dmaap.setDmaap_info(infoType);
+
+ GetInput u = new GetInput();
+ u.setBpInputName(config + "_" + num +"_aaf_username");
+ dmaap.setUser(u);
+ inputs.put(config + "_" + num +"_aaf_username", stringType);
+
+ GetInput p = new GetInput();
+ p.setBpInputName(config + "_" + num +"_aaf_password");
+ dmaap.setPass(p);
+ inputs.put(config + "_" + num +"_aaf_password", stringType);
+ }
+ response.put("dmaap", dmaap);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // Method is used to create the Dmaap Data Router
+ public Map<String,Object> createDmaapDataRouter(Map<String, LinkedHashMap<String, Object>> inputs, String config, String counter, boolean isDmaap) {
+
+ Map<String,Object> response = new HashMap<>();
+ Dmaap dmaap = new Dmaap();
+
+ if(!isDmaap){
+ Map<String, Object> infoResponse = infoService.createDataRouterInfo(inputs, config);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
+ dmaap.setDmaap_info(infoResponse.get("info"));
+ }
+ else {
+ String infoType = "<<" + counter + ">>";
+ dmaap.setDmaap_info(infoType);
+ }
+ response.put("dmaap", dmaap);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java
new file mode 100644
index 0000000..ab48ada
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 Nokia. All rights reserved.
+ * * Copyright (c) 2020 AT&T. 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add External Certificate Data Factory
+ */
+
+
+@Service
+public abstract class ExternalCertificateDataFactoryService {
+
+ // Method to concatenate Constant with field
+ protected static GetInput createPrefixedGetInput(String fieldName) {
+ return new GetInput(addPrefix(fieldName));
+ }
+
+ // Method to concatenate the Constant INPUT_PREFIX to the input field
+ protected static String addPrefix(String fieldName) { return Constants.INPUT_PREFIX + fieldName; }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java
new file mode 100644
index 0000000..b739e4b
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java
@@ -0,0 +1,71 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.ExternalCertificateParameters;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add External Certificate Parameters
+ */
+
+
+@Service
+public class ExternalCertificateParametersFactoryService extends ExternalCertificateDataFactoryService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // method to create external certificate parameters
+ public ExternalCertificateParameters create() {
+ ExternalCertificateParameters externalCertificateParameters = new ExternalCertificateParameters();
+ externalCertificateParameters.setCommonName(createPrefixedGetInput(Constants.COMMON_NAME_FIELD));
+ externalCertificateParameters.setSans(createPrefixedGetInput(Constants.SANS_FIELD));
+ return externalCertificateParameters;
+ }
+
+ // method to create input list for external certificate parameters factory
+ public Map<String, LinkedHashMap<String, Object>> createInputList() {
+ Map<String, LinkedHashMap<String, Object>> retInputs = new LinkedHashMap<>();
+
+ LinkedHashMap<String, Object> commonNameInputMap = blueprintHelperService.createStringInput("Common name which should be present in certificate.",Constants.DEFAULT_COMMON_NAME);
+ retInputs.put(addPrefix(Constants.COMMON_NAME_FIELD), commonNameInputMap);
+
+ LinkedHashMap<String, Object> sansInputMap = blueprintHelperService.createStringInput("\"List of Subject Alternative Names (SANs) which should be present in certificate. " +
+ "Delimiter - : Should contain a common_name value and other FQDNs under which the given " +"component is accessible.\"",Constants.DEFAULT_SANS);
+ retInputs.put(addPrefix(Constants.SANS_FIELD), sansInputMap);
+
+ return retInputs;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java
new file mode 100644
index 0000000..10364ab
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.ExternalTlsInfo;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add External TLS Info
+ */
+
+
+@Service
+public class ExternalTlsInfoFactoryService extends ExternalCertificateDataFactoryService {
+
+ @Autowired
+ private ExternalCertificateParametersFactoryService externalCertificateParametersFactoryService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ //Method to create External TLS Info from Component Spec
+ public ExternalTlsInfo createFromComponentSpec(OnapComponentSpec cs) {
+ ExternalTlsInfo externalTlsInfoBp = new ExternalTlsInfo();
+ Map<String, Object> tlsInfoCs = cs.getAuxilary().getTls_info();
+
+ externalTlsInfoBp.setExternalCertDirectory((String) tlsInfoCs.get(Constants.CERT_DIRECTORY_FIELD));
+ externalTlsInfoBp.setUseExternalTls(createPrefixedGetInput(Constants.USE_EXTERNAL_TLS_FIELD));
+ externalTlsInfoBp.setCaName(createPrefixedGetInput(Constants.CA_NAME_FIELD));
+ externalTlsInfoBp.setCertType(createPrefixedGetInput(Constants.CERT_TYPE_FIELD));
+ externalTlsInfoBp.setExternalCertificateParameters(externalCertificateParametersFactoryService.create());
+
+ return externalTlsInfoBp;
+ }
+
+ //Method to create Input List for External TLS Info from Component Spec
+ public Map<String, LinkedHashMap<String, Object>> createInputListFromComponentSpec(OnapComponentSpec cs) {
+
+ Map<String, LinkedHashMap<String, Object>> retInputs = new HashMap<>();
+
+ Map<String, Object> externalTlsInfoCs = cs.getAuxilary().getTls_info();
+ LinkedHashMap<String, Object> useTlsFlagInput = blueprintHelperService.createBooleanInput("Flag to indicate external tls enable/disable.",externalTlsInfoCs.get(Constants.USE_EXTERNAL_TLS_FIELD));
+ retInputs.put(addPrefix(Constants.USE_EXTERNAL_TLS_FIELD), useTlsFlagInput);
+
+ LinkedHashMap<String, Object> caNameInputMap = blueprintHelperService.createStringInput("Name of Certificate Authority configured on CertService side.",Constants.DEFAULT_CA);
+ retInputs.put(addPrefix(Constants.CA_NAME_FIELD), caNameInputMap);
+
+ LinkedHashMap<String, Object> certTypeInputMap = blueprintHelperService.createStringInput("Format of provided certificates",Constants.DEFAULT_CERT_TYPE);
+ retInputs.put(addPrefix(Constants.CERT_TYPE_FIELD), certTypeInputMap);
+
+ retInputs.putAll(externalCertificateParametersFactoryService.createInputList());
+ return retInputs;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java
new file mode 100644
index 0000000..cb9c03c
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.blueprintgenerator.model.common.Imports;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: DCAE/ONAP - Blueprint Generator
+ * Common Module: Used by ONAP Blueprint Application
+ * Service: For Imports
+ */
+
+@Service
+public class ImportsService {
+
+ @Value("${imports.onap.types}")
+ private String importsOnapTypes;
+
+ @Value("${imports.onap.K8s.plugintypes}")
+ private String importsOnapK8sPlugintypes;
+
+ @Value("${imports.onap.K8s.dcaepolicyplugin}")
+ private String importsOnapK8sDcaepolicyplugin;
+
+ @Value("${imports.dmaap.dmaapplugin}")
+ private String importsDmaapDmaapplugin;
+
+ @Value("${import.Postgres}")
+ private String importPostgres;
+
+ @Value("${import.Clamp}")
+ private String importClamp;
+
+
+ @Qualifier("yamlObjectMapper")
+ @Autowired
+ protected ObjectMapper yamlObjectMapper;
+
+ public List<String> createImports(String bpType) {
+ List<String> imports = new ArrayList<>();
+ if (bpType.equals("o")) {
+ imports.add(importsOnapTypes);
+ imports.add(importsOnapK8sPlugintypes);
+ imports.add(importsOnapK8sDcaepolicyplugin);
+ imports.add(importPostgres);
+ imports.add(importClamp);
+ }
+ else {
+ imports.add(importsOnapTypes);
+ imports.add(importsOnapK8sPlugintypes);
+ imports.add(importsDmaapDmaapplugin);
+ imports.add(importPostgres);
+ imports.add(importClamp);
+ }
+ return imports;
+ }
+
+ public List<String> createImportsFromFile(String path) throws IOException {
+ File importPath = new File(path);
+ Imports imports = yamlObjectMapper.readValue(importPath, Imports.class);
+ imports.getImports().removeIf(String::isBlank);
+ return imports.getImports();
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java
new file mode 100644
index 0000000..bfd14a4
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java
@@ -0,0 +1,67 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.model.common.Interfaces;
+import org.onap.blueprintgenerator.model.common.Start;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add Interfaces
+ */
+
+
+@Service
+public class InterfacesService {
+
+ @Autowired
+ private StartService startService;
+
+ // Method to create Interface to include Start and Start inputs sections in BP
+ public Map<String,Object> createInterface(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec){
+
+ Map<String,Object> response = new HashMap<>();
+ Interfaces interfaces = new Interfaces();
+
+ Map<String, Object> startResponse = startService.createStart(inputs, onapComponentSpec);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) startResponse.get("inputs");
+
+ interfaces.setStart((Start) startResponse.get("start"));
+
+ response.put("interfaces", interfaces);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
+
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java
new file mode 100644
index 0000000..b8da0d7
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java
@@ -0,0 +1,222 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.Interfaces;
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.Properties;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.common.Publishes;
+import org.onap.blueprintgenerator.model.componentspec.common.Subscribes;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.List;
+
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add ONAP/DMAAP/Feed/Topic Nodes
+ */
+
+
+@Service
+public class NodeService {
+
+ @Autowired
+ private InterfacesService interfacesService;
+
+ @Autowired
+ private PolicyNodeService policyNodeService;
+
+ @Autowired
+ private PgaasNodeService pgaasNodeService;
+
+ @Autowired
+ private PropertiesService propertiesService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // method to create Onap Node to include interface
+ public Map<String,Object> createOnapNode(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
+
+ Map<String,Object> response = new HashMap<>();
+ Node onapNode = new Node();
+
+ Map<String, Object> onapResponse = interfacesService.createInterface(inputs, onapComponentSpec);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) onapResponse.get("inputs");
+
+ Map<String, Interfaces> interfaces = new TreeMap<>();
+ interfaces.put(Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) onapResponse.get("interfaces"));
+ onapNode.setInterfaces(interfaces);
+
+ onapNode.setType(Constants.DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT);
+
+ List<Map<String, String>> relationships = new ArrayList();
+
+ if(onapComponentSpec.getPolicyInfo() != null){
+ List<Map<String, String>> policyRelationshipsList = policyNodeService.getPolicyRelationships(onapComponentSpec);
+ relationships.addAll(policyRelationshipsList);
+ }
+
+ if(onapComponentSpec.getAuxilary().getDatabases() != null){
+ List<Map<String, String>> pgaasRelationshipsList = pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
+ relationships.addAll(pgaasRelationshipsList);
+ }
+
+ onapNode.setRelationships(relationships);
+
+ Map<String, Object> propertiesResponse = propertiesService.createOnapProperties(inputs, onapComponentSpec, override);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) propertiesResponse.get("inputs");
+ onapNode.setProperties((org.onap.blueprintgenerator.model.common.Properties)propertiesResponse.get("properties"));
+
+ response.put("onapNode", onapNode);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // method to create Dmaap Node to include interface
+ public Map<String,Object> createDmaapNode(OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs, String override) {
+
+ Map<String,Object> response = new HashMap<>();
+ Node dmaapNode = new Node();
+
+ dmaapNode.setType(Constants.DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT_USING_DMAAP);
+
+ Map<String, Object> dmaapResponse = interfacesService.createInterface(inputs, onapComponentSpec);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapResponse.get("inputs");
+
+ Map<String, Interfaces> interfaces = new TreeMap<>();
+ interfaces.put(Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) dmaapResponse.get("interfaces"));
+ dmaapNode.setInterfaces(interfaces);
+
+ List<Map<String, String>> relationships = new ArrayList();
+
+ if(onapComponentSpec.getStreams().getPublishes() != null) {
+ for(Publishes publishes: onapComponentSpec.getStreams().getPublishes()) {
+ Map<String, String> pubRelations = new LinkedHashMap();
+ if(blueprintHelperService.isMessageRouterType(publishes.getType())){
+ pubRelations.put("type", Constants.PUBLISH_EVENTS);
+ pubRelations.put("target", publishes.getConfig_key() + Constants._TOPIC);
+ } else if(blueprintHelperService.isDataRouterType(publishes.getType())){
+ pubRelations.put("type", Constants.PUBLISH_FILES);
+ pubRelations.put("target", publishes.getConfig_key() + Constants._FEED);
+ }
+ relationships.add(pubRelations);
+ }
+ }
+
+ if(onapComponentSpec.getStreams().getSubscribes() != null) {
+ for(Subscribes subscribes: onapComponentSpec.getStreams().getSubscribes()) {
+ Map<String, String> subRelations = new LinkedHashMap();
+ if(blueprintHelperService.isMessageRouterType(subscribes.getType())){
+ subRelations.put("type", Constants.SUBSCRIBE_TO_EVENTS);
+ subRelations.put("target", subscribes.getConfig_key() + Constants._TOPIC);
+ } else if(blueprintHelperService.isDataRouterType(subscribes.getType())){
+ subRelations.put("type", Constants.SUBSCRIBE_TO_FILES);
+ subRelations.put("target", subscribes.getConfig_key() + Constants._FEED);
+ }
+ relationships.add(subRelations);
+ }
+ }
+
+ if(onapComponentSpec.getPolicyInfo() != null){
+ List<Map<String, String>> policyRelationshipsList = policyNodeService.getPolicyRelationships(onapComponentSpec);
+ relationships.addAll(policyRelationshipsList);
+ }
+
+ if(onapComponentSpec.getAuxilary().getDatabases() != null){
+ List<Map<String, String>> pgaasRelationshipsList = pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
+ relationships.addAll(pgaasRelationshipsList);
+ }
+
+ dmaapNode.setRelationships(relationships);
+
+ Map<String, Object> propertiesResponse = propertiesService.createDmaapProperties(inputs, onapComponentSpec, override);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) propertiesResponse.get("inputs");
+ dmaapNode.setProperties((org.onap.blueprintgenerator.model.common.Properties)propertiesResponse.get("properties"));
+
+ response.put("dmaapNode", dmaapNode);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // method to create Feed Node for Streams
+ public Map<String,Object> createFeedNode(Map<String, LinkedHashMap<String, Object>> inputs, String name){
+ Map<String,Object> response = new HashMap<>();
+ Node feedNode = new Node();
+
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap();
+ stringType.put("type", "string");
+
+ feedNode.setType(Constants.FEED);
+
+ org.onap.blueprintgenerator.model.common.Properties props = new org.onap.blueprintgenerator.model.common.Properties();
+ GetInput topicInput = new GetInput();
+ topicInput.setBpInputName(name + "_name");
+ props.setFeed_name(topicInput);
+ props.setUseExisting(true);
+ inputs.put(name + "_name", stringType);
+ feedNode.setProperties(props);
+
+ response.put("feedNode", feedNode);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // method to create Topic Node for Streams
+ public Map<String,Object> createTopicNode(Map<String, LinkedHashMap<String, Object>> inputs, String name){
+ Map<String,Object> response = new HashMap<>();
+ Node topicNode = new Node();
+
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap();
+ stringType.put("type", "string");
+
+ topicNode.setType(Constants.TOPIC);
+
+ org.onap.blueprintgenerator.model.common.Properties props = new Properties();
+ GetInput topicInput = new GetInput();
+ topicInput.setBpInputName(name + "_name");
+ props.setTopic_name(topicInput);
+ inputs.put(name + "_name", stringType);
+ topicNode.setProperties(props);
+
+ response.put("topicNode", topicNode);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java
new file mode 100644
index 0000000..ff45701
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java
@@ -0,0 +1,138 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.exception.DatabasesNotFoundException;
+
+
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.PgaasNode;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.PgaasNodeProperties;
+import org.onap.blueprintgenerator.model.common.GetAttribute;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add Pgaas Node
+ */
+
+
+@Service
+public class PgaasNodeService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // method to create Pgaas Nodes and Inputs for Databases
+ public void addPgaasNodesAndInputs(OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplate, Map<String, LinkedHashMap<String, Object>> inputs) {
+ Map<String, String> databases = onapComponentSpec.getAuxilary().getDatabases();
+ for(Map.Entry<String, String> database : databases.entrySet()){
+ addPgaasNode(database, nodeTemplate);
+ addPgaasInputs(database, inputs);
+ }
+ }
+
+ private void addPgaasInputs(Map.Entry<String, String> database, Map<String, LinkedHashMap<String, Object>> inputs) {
+ inputs.put(database.getKey() + Constants.NAME_POSTFIX, blueprintHelperService.createStringInput( "db name", ""));
+ inputs.put(database.getKey() + Constants.WRITER_FQDN_POSTFIX, blueprintHelperService.createStringInput( "db writerfqdn", ""));
+ }
+
+ private void addPgaasNode(Map.Entry<String, String> database, Map<String, Node> nodeTemplate) {
+ PgaasNode pgaasNode = new PgaasNode();
+ String dbName = database.getKey();
+ pgaasNode.setType(Constants.PGAAS_NODE_TYPE);
+ pgaasNode.setPgaasNodeProperties(buildPgaasNodeProperties(dbName));
+ nodeTemplate.put(dbName + Constants.PGAAS_NODE_NAME_POSTFIX , pgaasNode);
+ }
+
+ private PgaasNodeProperties buildPgaasNodeProperties(String dbName) {
+ PgaasNodeProperties pgaasNodeProperties = new PgaasNodeProperties();
+
+ GetInput nameValue = new GetInput();
+ nameValue.setBpInputName(dbName + Constants.NAME_POSTFIX);
+ pgaasNodeProperties.setName(nameValue);
+
+ GetInput writerfqdnValue = new GetInput();
+ writerfqdnValue.setBpInputName(dbName + Constants.WRITER_FQDN_POSTFIX);
+ pgaasNodeProperties.setWriterfqdn(writerfqdnValue);
+
+ pgaasNodeProperties.setUseExisting(Constants.USE_EXISTING);
+
+ return pgaasNodeProperties;
+ }
+
+ // method to create Pgaas Node Relationships for Databases
+ public List<Map<String, String>> getPgaasNodeRelationships(OnapComponentSpec onapComponentSpec) {
+ List<Map<String, String>> relationships = new ArrayList<>();
+ for(Map.Entry<String, String> database : onapComponentSpec.getAuxilary().getDatabases().entrySet()){
+ Map<String, String> relationship = new LinkedHashMap<>();
+ relationship.put("type", Constants.DB_RELATIONSHIP_TYPE);
+ relationship.put("target", database.getKey() + Constants.PGAAS_NODE_NAME_POSTFIX);
+ relationships.add(relationship);
+ }
+ return relationships;
+ }
+
+ // method to create Env Variables for Databases
+ public Map<String, Object> getEnvVariables(Map<String, String> databases) {
+ Map<String, Object> envVariables = new LinkedHashMap<>();
+ for(Map.Entry<String, String> database : databases.entrySet()){
+ String name = database.getKey().toUpperCase();
+ envVariables.put("<<", "*envs");
+
+ GetInput nameValue = new GetInput();
+ nameValue.setBpInputName(name.toLowerCase() + Constants.NAME_POSTFIX);
+ envVariables.put(name + "_DB_NAME", nameValue);
+
+ GetAttribute adminHostValue = buildGetAttributeValue(name.toLowerCase(), "admin", "host");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
+
+ GetAttribute adminUserValue = buildGetAttributeValue(name.toLowerCase(), "admin", "user");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
+
+ GetAttribute adminPasswordValue = buildGetAttributeValue(name.toLowerCase(), "admin", "password");
+ envVariables.put( name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
+ }
+ return envVariables;
+ }
+
+ private GetAttribute buildGetAttributeValue(String dbName, String owner, String type) {
+ GetAttribute attribute = new GetAttribute();
+ attribute.setAttribute(Arrays.asList(dbName + Constants.PGAAS_NODE_NAME_POSTFIX, owner, type));
+ return attribute;
+ }
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java
new file mode 100644
index 0000000..7f6c63d
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java
@@ -0,0 +1,99 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.PolicyNode;
+import org.onap.blueprintgenerator.model.common.PolicyNodeProperties;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.TypePolicy;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add Policy Node
+ */
+
+
+@Service("onapPolicyNodeService")
+public class PolicyNodeService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // Method to add Policy Nodes and Inputs
+ public void addPolicyNodesAndInputs(OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplate, Map<String, LinkedHashMap<String, Object>> inputs) {
+ List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList();
+ for(TypePolicy policy: policyList){
+ addPolicyNodesToNodeTemplate(policy, nodeTemplate);
+ addPolicyInputs(policy, inputs);
+ }
+ }
+
+ private void addPolicyInputs(TypePolicy policy, Map<String, LinkedHashMap<String, Object>> inputs) {
+ String defaultValue = policy.getPolicy_id();
+ defaultValue = defaultValue != null ? defaultValue : "";
+ inputs.put(policy.getNode_label() + "_policy_id", blueprintHelperService.createStringInput("policy_id", defaultValue));
+ }
+
+ private void addPolicyNodesToNodeTemplate(TypePolicy policy, Map<String, Node> nodeTemplate) {
+ PolicyNode policyNode = new PolicyNode();
+ policyNode.setType(Constants.POLICY_NODE_TYPE);
+ policyNode.setPolicyNodeProperties(getPolicyNodeProperties(policy));
+ nodeTemplate.put(policy.getNode_label(), policyNode);
+ }
+
+ private PolicyNodeProperties getPolicyNodeProperties(TypePolicy policy) {
+ PolicyNodeProperties policyNodeProperties = new PolicyNodeProperties();
+ GetInput policyIdGetInput = new GetInput();
+ policyIdGetInput.setBpInputName(policy.getNode_label() + "_policy_id");
+ policyNodeProperties.setPolicyId(policyIdGetInput);
+ policyNodeProperties.setPolicyModelId(policy.getPolicy_model_id());
+ return policyNodeProperties;
+ }
+
+ // Method to add Policy Relationships
+ public List<Map<String, String>> getPolicyRelationships(OnapComponentSpec onapComponentSpec) {
+ List<Map<String, String>> relationships = new ArrayList<>();
+ List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList();
+ for(TypePolicy policy: policyList){
+ Map<String, String> relationship = new LinkedHashMap<>();
+ relationship.put("type", Constants.POLICY_RELATIONSHIP_TYPE);
+ relationship.put("target", policy.getNode_label());
+ relationships.add(relationship);
+ }
+ return relationships;
+ }
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java
new file mode 100644
index 0000000..e858d88
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java
@@ -0,0 +1,259 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.Appconfig;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.ResourceConfig;
+import org.onap.blueprintgenerator.model.componentspec.OnapAuxilary;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.common.Publishes;
+import org.onap.blueprintgenerator.model.componentspec.common.Subscribes;
+import org.onap.blueprintgenerator.model.dmaap.Streams;
+import org.onap.blueprintgenerator.model.dmaap.TlsInfo;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.onap.blueprintgenerator.service.dmaap.StreamsService;
+import org.onap.blueprintgenerator.model.common.Properties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to create Properties Node
+ */
+
+
+
+@Service("onapPropertiesService")
+public class PropertiesService {
+
+ @Autowired
+ private AppConfigService appConfigService;
+
+ @Autowired
+ private ResourceConfigService resourceConfigService;
+
+ @Autowired
+ private StreamsService streamsService;
+
+ @Autowired
+ private ExternalTlsInfoFactoryService externalTlsInfoFactoryService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // Method to create ONAP properties
+ public Map<String,Object> createOnapProperties(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
+ Map<String,Object> response = new HashMap<>();
+ org.onap.blueprintgenerator.model.common.Properties properties = new org.onap.blueprintgenerator.model.common.Properties();
+
+ GetInput image = new GetInput();
+ image.setBpInputName("image");
+ properties.setImage(image);
+
+ LinkedHashMap<String, Object> img = new LinkedHashMap<>();
+ inputs.put("image", blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
+
+
+ GetInput location = new GetInput();
+ location.setBpInputName("location_id");
+ properties.setLocation_id(location);
+
+ LinkedHashMap<String, Object> locMap = new LinkedHashMap();
+ inputs.put("location_id", blueprintHelperService.createStringInput(Constants.EMPTY_VALUE));
+
+ properties.setLog_info(onapComponentSpec.getAuxilary().getLog_info());
+
+ GetInput replica = new GetInput();
+ replica.setBpInputName("replicas");
+ properties.setReplicas(replica);
+
+ LinkedHashMap<String, Object> replicas = blueprintHelperService.createIntegerInput("number of instances", 1);
+ inputs.put("replicas", replicas);
+
+ OnapAuxilary onapAuxilary = onapComponentSpec.getAuxilary();
+
+ properties.setDocker_config(onapAuxilary);
+
+ Map<String, Object> appConfigResponse = appConfigService.createAppconfig(inputs, onapComponentSpec, override, false);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) appConfigResponse.get("inputs");
+ properties.setApplication_config((Appconfig) appConfigResponse.get("appconfig"));
+
+ GetInput always_pull_image = new GetInput();
+ always_pull_image.setBpInputName("always_pull_image");
+
+ properties.setAlways_pull_image(always_pull_image);
+
+ LinkedHashMap<String, Object> inputAlwaysPullImage = blueprintHelperService.createBooleanInput("Set to true if the image should always be pulled",true);
+ inputs.put("always_pull_image", inputAlwaysPullImage);
+
+ String sType = onapComponentSpec.getSelf().getName();
+ sType = sType.replace('.', '-');
+ properties.setService_component_type(sType);
+
+ Map<String, Object> tls_info = onapComponentSpec.getAuxilary().getTls_info();
+ if(tls_info != null) {
+ addTlsInfo(onapComponentSpec, inputs, properties);
+ if (tls_info.get(Constants.USE_EXTERNAL_TLS_FIELD) != null) {
+ inputs.putAll(addExternalTlsInfo(onapComponentSpec,properties));
+ }
+ }
+
+ Map<String, Object> resourceConfigResponse = resourceConfigService.createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
+ inputs = (Map<String, LinkedHashMap<String, Object>>) resourceConfigResponse.get("inputs");
+ properties.setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
+
+ response.put("properties", properties);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ // Method to create Dmaap properties
+ public Map<String,Object> createDmaapProperties(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
+ Map<String,Object> response = new HashMap<>();
+ org.onap.blueprintgenerator.model.common.Properties properties = new org.onap.blueprintgenerator.model.common.Properties();
+
+ GetInput image = new GetInput();
+ image.setBpInputName("tag_version");
+ properties.setImage(image);
+
+ LinkedHashMap<String, Object> img = new LinkedHashMap<>();
+ inputs.put("tag_version", blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
+
+ GetInput location = new GetInput();
+ location.setBpInputName("location_id");
+ properties.setLocation_id(location);
+
+ LinkedHashMap<String, Object> locMap = new LinkedHashMap();
+ inputs.put("location_id", blueprintHelperService.createStringInput(Constants.EMPTY_VALUE));
+
+ properties.setLog_info(onapComponentSpec.getAuxilary().getLog_info());
+
+ String sType = onapComponentSpec.getSelf().getName();
+ sType = sType.replace('.', '-');
+ properties.setService_component_type(sType);
+
+ Map<String, Object> tls_info = onapComponentSpec.getAuxilary().getTls_info();
+ if(tls_info != null) {
+ addTlsInfo(onapComponentSpec, inputs, properties);
+ if (tls_info.get(Constants.USE_EXTERNAL_TLS_FIELD) != null) {
+ inputs.putAll(addExternalTlsInfo(onapComponentSpec,properties));
+ }
+ }
+
+ GetInput replica = new GetInput();
+ replica.setBpInputName("replicas");
+ properties.setReplicas(replica);
+
+ LinkedHashMap<String, Object> rep = blueprintHelperService.createIntegerInput( "number of instances", 1);
+ inputs.put("replicas", rep);
+
+ OnapAuxilary onapAuxilary = onapComponentSpec.getAuxilary();
+
+ properties.setDocker_config(onapAuxilary);
+
+ Map<String, Object> appConfigResponse = appConfigService.createAppconfig(inputs, onapComponentSpec, override, true);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) appConfigResponse.get("inputs");
+ properties.setApplication_config((Appconfig) appConfigResponse.get("appconfig"));
+
+
+ List<Streams> pubStreams = new ArrayList();
+ if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
+ if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
+ String topic = publishes.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> streamsMessageRouterResponse = streamsService.createStreams(inputs, topic, publishes.getType(), publishes.getConfig_key(), publishes.getRoute(), 'p');
+ inputs = (Map<String, LinkedHashMap<String, Object>>) streamsMessageRouterResponse.get("inputs");
+ pubStreams.add((Streams) streamsMessageRouterResponse.get("streams"));
+ } else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
+ String feed = publishes.getConfig_key() + Constants._FEED;
+ Map<String, Object> streamsDataRouterResponse = streamsService.createStreams(inputs, feed, publishes.getType(), publishes.getConfig_key(), publishes.getRoute(), 'p');
+ inputs = (Map<String, LinkedHashMap<String, Object>>) streamsDataRouterResponse.get("inputs");
+ pubStreams.add((Streams) streamsDataRouterResponse.get("streams"));
+ }
+ }
+ }
+ }
+
+ ArrayList<Streams> subStreams = new ArrayList();
+ if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes subscribes : onapComponentSpec.getStreams().getSubscribes()) {
+ if (blueprintHelperService.isMessageRouterType(subscribes.getType())) {
+ String topic = subscribes.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> streamsMessageRouterResponse = streamsService.createStreams(inputs, topic, subscribes.getType(), subscribes.getConfig_key(), subscribes.getRoute(), 's');
+ inputs = (Map<String, LinkedHashMap<String, Object>>) streamsMessageRouterResponse.get("inputs");
+ subStreams.add((Streams) streamsMessageRouterResponse.get("streams"));
+ } else if (blueprintHelperService.isDataRouterType(subscribes.getType())) {
+ String feed = subscribes.getConfig_key() + Constants._FEED;
+ Map<String, Object> streamsDataRouterResponse = streamsService.createStreams(inputs, feed, subscribes.getType(), subscribes.getConfig_key(), subscribes.getRoute(), 's');
+ inputs = (Map<String, LinkedHashMap<String, Object>>) streamsDataRouterResponse.get("inputs");
+ subStreams.add((Streams) streamsDataRouterResponse.get("streams"));
+ }
+ }
+ }
+ }
+
+ if(!pubStreams.isEmpty())
+ properties.setStreams_publishes(pubStreams);
+
+ if(!subStreams.isEmpty())
+ properties.setStreams_subscribes(subStreams);
+
+ Map<String, Object> resourceConfigResponse = resourceConfigService.createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
+ inputs = (Map<String, LinkedHashMap<String, Object>>) resourceConfigResponse.get("inputs");
+ properties.setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
+
+ response.put("properties", properties);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+ private void addTlsInfo(OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs, Properties properties) {
+ TlsInfo tlsInfo = new TlsInfo();
+ tlsInfo.setCertDirectory((String) onapComponentSpec.getAuxilary().getTls_info().get("cert_directory"));
+ GetInput useTLSFlag = new GetInput();
+ useTLSFlag.setBpInputName("use_tls");
+ tlsInfo.setUseTls(useTLSFlag);
+ properties.setTls_info(tlsInfo);
+ LinkedHashMap<String, Object> useTlsFlagInput = blueprintHelperService.createBooleanInput("flag to indicate tls enable/disable",onapComponentSpec.getAuxilary().getTls_info().get("use_tls"));
+ inputs.put("use_tls", useTlsFlagInput);
+ }
+
+ private Map<String, LinkedHashMap<String, Object>> addExternalTlsInfo(OnapComponentSpec onapComponentSpec, Properties properties) {
+ properties.setExternal_cert(externalTlsInfoFactoryService.createFromComponentSpec(onapComponentSpec));
+ return externalTlsInfoFactoryService.createInputListFromComponentSpec(onapComponentSpec);
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java
new file mode 100644
index 0000000..c79ec56
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.model.common.OnapBlueprint;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to set Quotations of generated Blueprint
+ */
+
+
+@Service
+public class QuotationService {
+
+ // Method to add Quotes for String Types
+ public OnapBlueprint setQuotations(OnapBlueprint 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;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java
new file mode 100644
index 0000000..7b03372
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.ResourceConfig;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add ResourceConfig
+ */
+
+
+@Service("onapResourceConfigService")
+public class ResourceConfigService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ //Method to create Resouce Config for properties
+ public Map<String,Object> createResourceConfig(Map<String, LinkedHashMap<String, Object>> inputs, String name){
+ Map<String,Object> response = new HashMap<>();
+ ResourceConfig resourceConfig = new ResourceConfig();
+
+ LinkedHashMap<String, Object> memoryLimit = blueprintHelperService.createStringInput(Constants.MEMORY_LIMIT_128Mi);
+
+ LinkedHashMap<String, Object> cpuLimit = blueprintHelperService.createStringInput( Constants.CPU_LIMIT_250m);
+
+ name = blueprintHelperService.getNamePrefix(name);
+
+ Map<String, GetInput> lim = new TreeMap<>();
+
+ GetInput cpu = new GetInput();
+ cpu.setBpInputName(name + Constants.CPU_LIMIT);
+ lim.put("cpu", cpu);
+
+ GetInput memL = new GetInput();
+ memL.setBpInputName(name + Constants.MEMORY_LIMIT);
+ lim.put("memory", memL);
+
+ inputs.put(name + Constants.CPU_LIMIT, cpuLimit);
+ inputs.put(name + Constants.MEMORY_LIMIT, memoryLimit);
+
+ resourceConfig.setLimits(lim);
+
+ Map<String, GetInput> req = new TreeMap<>();
+
+ GetInput cpuR = new GetInput();
+ cpuR.setBpInputName(name + Constants.CPU_REQUEST);
+ req.put("cpu", cpuR);
+
+ GetInput memR = new GetInput();
+ memR.setBpInputName(name + Constants.MEMORY_REQUEST);
+ req.put("memory", memR);
+
+ inputs.put(name + Constants.CPU_REQUEST, cpuLimit);
+ inputs.put(name + Constants.MEMORY_REQUEST, memoryLimit);
+
+ resourceConfig.setRequests(req);
+
+ response.put("resourceConfig", resourceConfig);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java
new file mode 100644
index 0000000..20c3656
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java
@@ -0,0 +1,97 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.common.StartInputs;
+import org.onap.blueprintgenerator.model.componentspec.OnapAuxilary;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add Start Inputs Node under Start
+ */
+
+
+@Service
+public class StartInputsService {
+
+ @Autowired
+ private PgaasNodeService pgaasNodeService;
+
+ //Method to create Start Inputs for Start in Interfaces
+ public Map<String, Object> createStartInputs(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec){
+
+ Map<String,Object> response = new HashMap<>();
+ StartInputs startInputs = new StartInputs();
+
+ int count = 0;
+ List<String> portList = new ArrayList();
+ OnapAuxilary aux = onapComponentSpec.getAuxilary();
+
+ if (aux.getPorts() != null) {
+ for(Object p : aux.getPorts()) {
+ String[] ports = p.toString().split(":");
+ portList.add(String.format("concat: [\"%s:\", {get_input: external_port_%d}]" , ports[0], count));
+
+ LinkedHashMap<String, Object> portType = new LinkedHashMap();
+ portType.put("type", "string");
+ portType.put("default", ports[1]);
+ inputs.put("external_port_" + count, portType);
+ count++;
+ }
+ }
+
+ startInputs.setPorts(portList);
+
+ LinkedHashMap<String, Object> envMap = new LinkedHashMap();
+ if(onapComponentSpec.getAuxilary().getDatabases() != null){
+ Map<String, Object> envVars = pgaasNodeService.getEnvVariables(onapComponentSpec.getAuxilary().getDatabases());
+ startInputs.setEnvs(envVars);
+ envMap.put("default", "&envs {}");
+ }
+ else {
+ GetInput env = new GetInput();
+ env.setBpInputName("envs");
+ startInputs.setEnvs(env);
+ envMap.put("default", "{}");
+ }
+ inputs.put("envs", envMap);
+
+ response.put("startInputs", startInputs);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java
new file mode 100644
index 0000000..3fbfdb1
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.common;
+
+
+import org.onap.blueprintgenerator.model.common.Start;
+import org.onap.blueprintgenerator.model.common.StartInputs;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Common ONAP Service used by ONAP and DMAAP Blueprint to add Start Node
+ */
+
+
+@Service
+public class StartService {
+
+ @Autowired
+ private StartInputsService startInputsService;
+
+ // Method to create Start for Interfaces
+ public Map<String,Object> createStart(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec) {
+ Map<String,Object> response = new HashMap<>();
+ Start start = new Start();
+
+ Map<String, Object> startInputsResponse = startInputsService.createStartInputs(inputs, onapComponentSpec);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) startInputsResponse.get("inputs");
+ start.setInputs((StartInputs) startInputsResponse.get("startInputs"));
+
+ response.put("start", start);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java
new file mode 100644
index 0000000..002bd6c
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java
@@ -0,0 +1,144 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.dmaap;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.exception.BlueprintException;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.OnapBlueprint;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.model.componentspec.common.Publishes;
+import org.onap.blueprintgenerator.model.componentspec.common.Subscribes;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.onap.blueprintgenerator.service.base.BlueprintService;
+import org.onap.blueprintgenerator.service.common.ImportsService;
+import org.onap.blueprintgenerator.service.common.NodeService;
+import org.onap.blueprintgenerator.service.common.PgaasNodeService;
+import org.onap.blueprintgenerator.service.common.PolicyNodeService;
+import org.onap.blueprintgenerator.service.common.QuotationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Service to create DMAAP Blueprint
+ */
+
+@Service
+public class DmaapBlueprintService extends BlueprintService {
+
+ @Autowired
+ protected ImportsService importsService;
+
+ @Autowired
+ private NodeService nodeService;
+
+ @Autowired
+ private PolicyNodeService policyNodeService;
+
+ @Autowired
+ private PgaasNodeService pgaasNodeService;
+
+ @Autowired
+ private QuotationService quotationService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ // method to generate Dmaap Blueprint
+ public OnapBlueprint createBlueprint(OnapComponentSpec onapComponentSpec, Input input) {
+ try {
+ OnapBlueprint blueprint = new OnapBlueprint();
+ blueprint.setTosca_definitions_version(Constants.TOSCA_DEF_VERSION);
+ blueprint.setDescription(onapComponentSpec.getSelf().getDescription());
+
+ Map<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
+
+ //if (!"".equals(input.getImportPath()))
+ if (!StringUtils.isEmpty(input.getImportPath()) )
+ blueprint.setImports(importsService.createImportsFromFile(input.getImportPath()));
+ else
+ blueprint.setImports(importsService.createImports(input.getBpType()));
+
+ Map<String, Node> nodeTemplate = new TreeMap();
+
+ Map<String, Object> dmaapNodeResponse = nodeService.createDmaapNode(onapComponentSpec, inputs, input.getServiceNameOverride());
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapNodeResponse.get("inputs");
+ nodeTemplate.put(onapComponentSpec.getSelf().getName(), (Node) dmaapNodeResponse.get("dmaapNode"));
+
+ if (onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
+ if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
+ String topic = publishes.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> topicNodeResponse = nodeService.createTopicNode(inputs, topic);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse.get("inputs");
+ nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
+ } else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
+ String feed = publishes.getConfig_key() + Constants._FEED;
+ Map<String, Object> feedNodeResponse = nodeService.createFeedNode(inputs, feed);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse.get("inputs");
+ nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
+ }
+ }
+ }
+ if (onapComponentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes s : onapComponentSpec.getStreams().getSubscribes()) {
+ if (blueprintHelperService.isMessageRouterType(s.getType())) {
+ String topic = s.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> topicNodeResponse = nodeService.createTopicNode(inputs, topic);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse.get("inputs");
+ nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
+ } else if (blueprintHelperService.isDataRouterType(s.getType())) {
+ String feed = s.getConfig_key() + Constants._FEED;
+ Map<String, Object> feedNodeResponse = nodeService.createFeedNode(inputs, feed);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse.get("inputs");
+ nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
+ }
+ }
+ }
+ }
+
+ if (onapComponentSpec.getPolicyInfo() != null)
+ policyNodeService.addPolicyNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+
+ if (onapComponentSpec.getAuxilary() != null && onapComponentSpec.getAuxilary().getDatabases() != null)
+ pgaasNodeService.addPgaasNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+
+ blueprint.setNode_templates(nodeTemplate);
+ blueprint.setInputs(inputs);
+ return quotationService.setQuotations(blueprint);
+ } catch (Exception ex) {
+ throw new BlueprintException("Unable to create ONAP DMAAP Blueprint Object from given input parameters", ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java
new file mode 100644
index 0000000..16687fc
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java
@@ -0,0 +1,104 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.service.dmaap;
+
+import org.onap.blueprintgenerator.model.common.GetInput;
+import org.onap.blueprintgenerator.model.dmaap.Streams;
+import org.onap.blueprintgenerator.service.base.BlueprintHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Service to create Streams
+ */
+
+
+@Service
+public class StreamsService {
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ //Methos to create streams for Dmaap Blueprint
+ public Map<String, Object> createStreams(Map<String, LinkedHashMap<String, Object>> inputs, String name, String type, String key, String route, char o){
+ Map<String,Object> response = new HashMap<>();
+ Streams streams = new Streams();
+
+ LinkedHashMap<String, Object> stringType = new LinkedHashMap();
+ stringType.put("type", "string");
+
+ streams.setName(name);
+ streams.setType(type);
+
+ GetInput location = new GetInput();
+ location.setBpInputName(key + "_" + name + "_location");
+ inputs.put(key + "_" + name + "_location", stringType);
+ streams.setLocation(location);
+
+ if(blueprintHelperService.isDataRouterType(type)) {
+ if('s' == o) {
+ GetInput username = new GetInput();
+ username.setBpInputName(key + "_" + name + "_username");
+ streams.setUsername(username);
+ inputs.put(key + "_" + name + "_username", stringType);
+
+ GetInput password = new GetInput();
+ password.setBpInputName(key + "_" + name + "_password");
+ streams.setPassword(password);
+ inputs.put(key + "_" + name + "_password", stringType);
+
+ GetInput priviliged = new GetInput();
+ priviliged.setBpInputName(key + "_" + name + "_priviliged");
+ streams.setPrivileged(priviliged);
+ inputs.put(key + "_" + name + "_priviliged", stringType);
+
+ GetInput decompress = new GetInput();
+ decompress.setBpInputName(key + "_" + name + "_decompress");
+ streams.setDecompress(decompress);
+ inputs.put(key + "_" + name + "_decompress", stringType);
+
+ streams.setRoute(route);
+ streams.setScheme("https");
+ }
+
+
+ } else {
+ GetInput client = new GetInput();
+ client.setBpInputName(key + "_" + name + "_client_role");
+ streams.setClient_role(client);
+ inputs.put(key + "_" + name + "_client_role", stringType);
+ }
+ response.put("streams", streams);
+ response.put("inputs", inputs);
+ return response;
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java
new file mode 100644
index 0000000..05dbcae
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.policycreate.service;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.componentspec.common.EntrySchema;
+import org.onap.blueprintgenerator.model.componentspec.common.Parameters;
+import org.onap.blueprintgenerator.model.componentspec.common.PolicySchema;
+import org.onap.policycreate.model.PolicyModelNode;
+import org.onap.policycreate.model.PolicyProperties;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.List;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * To create Node Type, Data Type and Translate Entry Schema for Policy Model Node
+ */
+
+
+@Service("onapPolicyModelNodeService")
+public class PolicyModelNodeService {
+
+ // Method to create Nodes for Policy
+ public Map<String,Object> creatNodeType(String policyName, Parameters[] params) {
+ String hasEntrySchema = "";
+ Map<String,Object> response = new HashMap<>();
+ PolicyModelNode policyModelNode = new PolicyModelNode();
+
+ Map<String, PolicyProperties> props = new TreeMap<>();
+ for(Parameters p: params) {
+ if(p.getPolicy_group() != null && p.getPolicy_group().equals(policyName)) {
+ String name = p.getName();
+ String type = p.getType();
+ PolicyProperties polProps = new PolicyProperties();
+ if(p.getPolicy_schema() != null) {
+ polProps.setType("map");
+ ArrayList<String> entrySchema = new ArrayList<String>();
+ entrySchema.add("type: onap.datatypes." + name);
+ polProps.setEntry_schema(entrySchema);
+ hasEntrySchema = name;
+ props.put(name, polProps);
+ }
+ else {
+ polProps.setType(type);
+ props.put(name, polProps);
+ }
+ }
+ }
+ policyModelNode.setDerived_from(Constants.TOSCA_DATATYPES_ROOT);
+ policyModelNode.setProperties(props);
+ response.put("hasEntrySchema", hasEntrySchema);
+ response.put("policyModelNode", policyModelNode);
+ return response;
+ }
+
+ // Method to create Data Types for Policy
+ public Map<String, PolicyModelNode> createDataTypes(String param, Parameters[] parameters){
+ Map<String, PolicyModelNode> dataType = new TreeMap<>();
+ PolicyModelNode node = new PolicyModelNode();
+ node.setDerived_from(Constants.TOSCA_DATATYPES_ROOT);
+
+ Map<String, PolicyProperties> properties = new TreeMap<>();
+ Parameters par = new Parameters();
+ for(Parameters p: parameters) {
+ if(param.equals(p.getName())) {
+ par = p;
+ break;
+ }
+ }
+
+ for(PolicySchema pol: par.getPolicy_schema()) {
+ if(pol.getEntry_schema() != null) {
+ PolicyProperties prop =new PolicyProperties();
+ prop.setType("map");
+ ArrayList<String> schema = new ArrayList<String>();
+ schema.add("type: onap.datatypes." + pol.getName());
+ prop.setEntry_schema(schema);
+ properties.put(pol.getName(), prop);
+ dataType = translateEntrySchema(dataType, pol.getEntry_schema(), pol.getName());
+ }
+ else {
+ PolicyProperties prop = new PolicyProperties();
+ prop.setType(pol.getType());
+ properties.put(pol.getName(), prop);
+ }
+ }
+
+ node.setProperties(properties);
+ dataType.put("onap.datatypes." + param, node);
+ return dataType;
+ }
+
+ private Map<String, PolicyModelNode> translateEntrySchema(Map<String, PolicyModelNode> dataType, EntrySchema[] entry, String name){
+ Map<String, PolicyModelNode> data = dataType;
+ PolicyModelNode node = new PolicyModelNode();
+ node.setDerived_from(Constants.TOSCA_NODES_ROOT);
+ Map<String, PolicyProperties> properties = new TreeMap<>();
+
+ for(EntrySchema e: entry) {
+ if(e.getEntry_schema() != null) {
+ PolicyProperties prop = new PolicyProperties();
+ prop.setType("list");
+ List<String> schema = new ArrayList<>();
+ schema.add("type: onap.datatypes." + e.getName());
+ prop.setEntry_schema(schema);
+ properties.put(e.getName(), prop);
+ data = translateEntrySchema(data, e.getEntry_schema(), e.getName());
+ node.setProperties(properties);
+ } else {
+ PolicyProperties prop = new PolicyProperties();
+ prop.setType(e.getType());
+ properties.put(e.getName(), prop);
+ node.setProperties(properties);
+ }
+ }
+
+ dataType.put("onap.datatypes." + name, node);
+ return data;
+ }
+
+}
+
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java
new file mode 100644
index 0000000..bbc6259
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * * ============LICENSE_START=======================================================
+ * * org.onap.dcae
+ * * ================================================================================
+ * * Copyright (c) 2020 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.policycreate.service;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.componentspec.common.Parameters;
+import org.onap.policycreate.exception.PolicyCreateException;
+import org.onap.policycreate.model.PolicyModel;
+import org.onap.policycreate.model.PolicyModelNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Service for Policy Model to create Policy Models, Policy Group Names and Convert Policy to Yaml
+ */
+
+
+@Service("onapPolicyModelService")
+public class PolicyModelService {
+
+ @Qualifier("yamlObjectMapper")
+ @Autowired
+ protected ObjectMapper yamlObjectMapper;
+
+ @Autowired
+ private PolicyModelNodeService policyModelNodeService;
+
+ // Method to create Policy Models
+ public void createPolicyModels(Parameters[] params, String filePath) {
+ try {
+ List<String> policyGroups = getPolicyGroupNames(params);
+ for (String s : policyGroups) {
+ PolicyModel model = new PolicyModel();
+ model.setTosca_definition_version(Constants.TOSCA_SIMPLE_YAML);
+
+ Map<String, Object> response = policyModelNodeService.creatNodeType(s, params);
+ String nodeTypeName = "onap.policy." + s;
+ Map<String, PolicyModelNode> nodeType = new TreeMap<>();
+ nodeType.put(nodeTypeName, (PolicyModelNode) response.get("policyModelNode"));
+ model.setNode_types(nodeType);
+
+ if (!"".equals(response.get("hasEntrySchema")))
+ model.setData_types(policyModelNodeService.createDataTypes((String) response.get("hasEntrySchema"), params));
+ policyModelToYaml(filePath, model, s);
+ }
+ } catch (Exception ex) {
+ throw new PolicyCreateException("Unable to create Policies from given input parameters", ex);
+ }
+ }
+
+ private List<String> getPolicyGroupNames(Parameters[] params) {
+ List<String> names = new ArrayList<>();
+ for (Parameters p : params) {
+ if (p.isPolicy_editable()) {
+ if (names.isEmpty()) {
+ names.add(p.getPolicy_group());
+ } else if (!names.contains(p.getPolicy_group())) {
+ names.add(p.getPolicy_group());
+ }
+ }
+ }
+ return names;
+ }
+
+ private void policyModelToYaml(String path, PolicyModel model, String name) throws IOException {
+ File outputFile = new File(path, name + ".yml");
+ outputFile.getParentFile().mkdirs();
+ yamlObjectMapper.writeValue(outputFile, model);
+ }
+
+}
+