summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/onap
diff options
context:
space:
mode:
Diffstat (limited to 'mod/bpgenerator/onap')
-rw-r--r--mod/bpgenerator/onap/pom.xml71
-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
-rw-r--r--mod/bpgenerator/onap/src/main/resources/application.properties36
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java40
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java109
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java115
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java61
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java257
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java58
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java207
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java168
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json43
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json43
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json42
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json38
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testImports.yaml4
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json337
-rw-r--r--mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json28
-rw-r--r--mod/bpgenerator/onap/version.properties29
68 files changed, 5746 insertions, 0 deletions
diff --git a/mod/bpgenerator/onap/pom.xml b/mod/bpgenerator/onap/pom.xml
new file mode 100644
index 0000000..799a683
--- /dev/null
+++ b/mod/bpgenerator/onap/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ /*
+ ~ * ============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=========================================================
+ ~ */
+ ~
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.onap.dcaegen2.platform</groupId>
+ <artifactId>blueprint-generator-onap</artifactId>
+ <version>1.7.0</version>
+ <packaging>jar</packaging>
+
+ <name>Onap</name>
+ <description>This Application is used to generate ONAP Blueprint YAML Files for given Component Specs</description>
+
+ <parent>
+ <groupId>org.onap.dcaegen2.platform</groupId>
+ <artifactId>blueprint-generator</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.dcaegen2.platform</groupId>
+ <artifactId>blueprint-generator-common</artifactId>
+ <version>2.0.0</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>2.2.5.RELEASE</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <finalName>onap-blueprint-generator-${project.version}</finalName>
+ </build>
+
+</project> \ No newline at end of file
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);
+ }
+
+}
+
diff --git a/mod/bpgenerator/onap/src/main/resources/application.properties b/mod/bpgenerator/onap/src/main/resources/application.properties
new file mode 100644
index 0000000..3b70df6
--- /dev/null
+++ b/mod/bpgenerator/onap/src/main/resources/application.properties
@@ -0,0 +1,36 @@
+#
+# /*
+# * ============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=========================================================
+# */
+#
+#
+
+spring.main.banner-mode=off
+spring.output.ansi.enabled=ALWAYS
+
+imports.onap.types=https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+imports.onap.K8s.plugintypes=plugin:k8splugin?version=3.4.2
+imports.onap.K8s.dcaepolicyplugin=plugin:dcaepolicyplugin?version=2.4.0
+
+imports.dmaap.dmaapplugin=plugin:dmaap?version=1.5.0
+
+import.Postgres=plugin:pgaas?version=1.3.0
+import.Clamp=plugin:clamppolicyplugin?version=1.1.0
+
+
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
new file mode 100644
index 0000000..b19a823
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * * ============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.test;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Test Suite for Test Cases
+ */
+
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ OnapComponentSpecTest.class, OnapBlueprintServiceTest.class,ExternalCertificateParametersFactoryServiceTest.class/*, BlueprintJarComparatorTest.class*/})
+public class BlueprintGeneratorTestSuite {
+}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
new file mode 100644
index 0000000..ea324da
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
@@ -0,0 +1,109 @@
+/*
+ *
+ * * ============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.test;
+
+import org.onap.blueprintgenerator.BlueprintGeneratorMainApplication;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+import org.onap.blueprintgenerator.service.OnapBlueprintService;
+import org.onap.blueprintgenerator.service.common.ComponentSpecService;
+import org.onap.blueprintgenerator.service.dmaap.DmaapBlueprintService;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.onap.policycreate.service.PolicyModelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Test Cases
+ */
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = BlueprintGeneratorMainApplication.class, initializers = ConfigFileApplicationContextInitializer.class)
+@TestPropertySource(
+ properties = {
+ "ves=ves.json",
+ "testImports=testImports.yaml",
+ "useTlsTrueAndUseExternalTlsTrueTest=testComponentSpec_withTlsTrueAndExternalTlsTrue.json",
+ "useTlsFalseAndUseExternalTlsFalseTest=testComponentSpec_withTlsFalseAndExternalTlsFalse.json",
+ "useTlsTrueAndNoExternalTlsFlagTest=testComponentSpec_withTlsTrueAndNoExternalTls.json",
+ "noTlsInfo=testComponentSpec_withoutTlsInfo.json"
+ }
+)
+@Ignore
+public class BlueprintGeneratorTests {
+
+ @Qualifier("objectMapper")
+ @Autowired
+ protected ObjectMapper objectMapper;
+
+ @Qualifier("yamlObjectMapper")
+ @Autowired
+ protected ObjectMapper yamlObjectMapper;
+
+ @Value("${ves}")
+ protected String ves;
+
+ @Value("${testImports}")
+ protected String testImports;
+
+ @Value("${useTlsTrueAndUseExternalTlsTrueTest}")
+ protected String useTlsTrueAndUseExternalTlsTrueTest;
+
+ @Value("${useTlsFalseAndUseExternalTlsFalseTest}")
+ protected String useTlsFalseAndUseExternalTlsFalseTest;
+
+ @Value("${useTlsTrueAndNoExternalTlsFlagTest}")
+ protected String useTlsTrueAndNoExternalTlsFlagTest;
+
+ @Value("${noTlsInfo}")
+ protected String noTlsInfo;
+
+ @Autowired
+ protected ComponentSpecService onapComponentSpecService;
+
+ @Autowired
+ protected DmaapBlueprintService dmaapBlueprintService;
+
+ @Autowired
+ protected OnapBlueprintService onapBlueprintService;
+
+ @Autowired
+ protected PolicyModelService policyModelService;
+
+ @Autowired
+ protected OnapTestUtils onapTestUtils;
+
+ protected OnapComponentSpec onapComponentSpec = null;
+
+}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
new file mode 100644
index 0000000..d10d3ff
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * * ============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.test;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.jupiter.api.Order;
+import org.junit.runners.MethodSorters;
+import org.onap.blueprintgenerator.test.BlueprintGeneratorTests;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Paths;
+
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Bueprint Jar Comparision with Previos version to make sure Bps are not broken with new changes
+ */
+
+
+@Ignore
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
+
+ private String previousJarVersion = "0.1";
+ private String latestJarVersion = "1.0";
+ private String previousVersion = "0_1";
+ private String latestVersion = "1_0";
+ private String latestJarPath = Paths.get("target").toAbsolutePath().toString() + "\\";
+ private String previousJarPath = Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
+ private String inputPath = Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
+ private String inputPolicyPath = Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
+ private String outputPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
+ private String previousJar = "onap-blueprint-generator-" + previousJarVersion + ".jar";
+ private String latestJar = "onap-blueprint-generator-" + latestJarVersion + ".jar";
+
+ @Test
+ @Order(value=1)
+ public void filesCleanup() throws IOException {
+ FileUtils.deleteDirectory(new File(outputPath));
+ }
+
+ @Test
+ public void jarTestVeswithDmaapK8s() throws IOException, InterruptedException {
+ String inputFileName = ves;
+ String outputFileName = "dcae-ves-collector-dmaap-";
+ String inputImportsFileName = testImports;
+
+ String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
+ " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ Runtime.getRuntime().exec(previousJarCommand);
+
+ String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
+ " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ Runtime.getRuntime().exec(latestJarCommand);
+
+ Thread.sleep(8000);
+
+ Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option don't match!",
+ FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ }
+
+ @Test
+ public void jarTestVeswithoutDmaapK8s() throws IOException, InterruptedException {
+ String inputFileName = ves;
+ String outputFileName = "dcae-ves-collector-";
+ String inputImportsFileName = testImports;
+
+ String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
+ " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName ;
+ Runtime.getRuntime().exec(previousJarCommand);
+
+ String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
+ " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName ;
+ Runtime.getRuntime().exec(latestJarCommand);
+
+ Thread.sleep(8000);
+
+ Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option dont match!",
+ FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ }
+
+
+}
+
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
new file mode 100644
index 0000000..021bc49
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
@@ -0,0 +1,61 @@
+/*============LICENSE_START=======================================================
+ org.onap.dcae
+ ================================================================================
+ Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
+ 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.test;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.common.ExternalCertificateParameters;
+import org.onap.blueprintgenerator.service.common.ExternalCertificateParametersFactoryService;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.blueprintgenerator.constants.Constants.COMMON_NAME_FIELD;
+import static org.onap.blueprintgenerator.constants.Constants.SANS_FIELD;
+
+public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGeneratorTests{
+
+ private static final String PREFIXED_COMMON_NAME_FIELD = Constants.INPUT_PREFIX + COMMON_NAME_FIELD;
+ private static final String PREFIXED_SANS_FIELD = Constants.INPUT_PREFIX + SANS_FIELD;
+ private static final String DEFAULT = "default";
+
+ @Autowired
+ private ExternalCertificateParametersFactoryService externalCertificateParametersFactoryService;
+
+ @Test
+ public void shouldCreateExternalCertificatePropertiesObject() {
+
+ ExternalCertificateParameters result = externalCertificateParametersFactoryService.create();
+ assertEquals(result.getCommonName().getBpInputName(), PREFIXED_COMMON_NAME_FIELD);
+ assertEquals(result.getSans().getBpInputName(), PREFIXED_SANS_FIELD);
+ }
+
+ @Test
+ public void shouldCreateCorrectInputListWithDefaultValuesTakenFromComponentSpec() {
+
+ Map<String, LinkedHashMap<String, Object>> result = externalCertificateParametersFactoryService.createInputList();
+ assertEquals(Constants.DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
+ assertEquals(Constants.DEFAULT_SANS, result.get(PREFIXED_SANS_FIELD).get(DEFAULT));
+ }
+}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
new file mode 100644
index 0000000..351f94e
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
@@ -0,0 +1,257 @@
+/*
+ *
+ * * ============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.test;
+
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+import org.onap.blueprintgenerator.constants.Constants;
+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.common.Properties;
+import org.junit.Test;
+import org.junit.jupiter.api.DisplayName;
+import picocli.CommandLine;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.Paths;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertArrayEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP Blueprint Test Cases for ONAP and DMAAP
+ */
+
+
+public class OnapBlueprintServiceTest extends BlueprintGeneratorTests {
+
+ private String outputfilesPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString();
+
+ @DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File")
+ @Test
+ public void testServiceNameOverrideK8sBlueprint() throws IOException {
+ Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testServiceNameOverrideK8sBlueprint", "", "o", "");
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull("K8s Blueprint for Service Name Override Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
+ System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+
+ onapTestUtils.verifyToscaDefVersion("Service Name Override K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImports("Service Name Override K8s",onapBlueprint,false);
+
+ Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
+ assertNotNull("Service Name Override K8s Blueprint Inputs Section is NULL", k8sBpInputs);
+ assertTrue("Service Name Override K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
+ assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+
+ Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
+ assertNotNull("Service Name Override K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
+ assertTrue("Service Name Override K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
+
+ assertEquals("Service Name Override K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull("Service Name Override K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
+
+
+ Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
+ onapTestUtils.verifyArtifacts("Service Name Override K8s",onapComponentSpec,bpInputs,"o");
+
+ onapTestUtils.verifyStreamsPublishes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("Service Name Override K8s",onapComponentSpec);
+ onapTestUtils.verifyHealthCheck("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("Service Name Override K8s",onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("Service Name Override K8s",onapComponentSpec);
+ onapTestUtils.verifyDockerConfig("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ }
+
+ @DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File with Import File")
+ @Test
+ public void testServiceNameOverrideImportFileK8sBlueprint() throws IOException {
+ Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "o", "");
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull("K8s Blueprint for Service Name Override with Import File Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion("Service Name Override with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile("Service Name Override with Import File K8s",onapBlueprint,input.getImportPath());
+
+
+ Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
+ assertNotNull("Service Name Override with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
+ assertTrue("Service Name Override with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
+ assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+
+ Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
+ assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
+ assertTrue("Service Name Override with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
+
+ assertEquals("Service Name Override with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
+
+
+ Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
+ onapTestUtils.verifyArtifacts("Service Name Override with Import File K8s",onapComponentSpec,bpInputs,"o");
+
+ onapTestUtils.verifyStreamsPublishes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("Service Name Override with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyHealthCheck("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("Service Name Override with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("Service Name Override with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyDockerConfig("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ }
+
+ @DisplayName("Testing K8s Blueprint with DB")
+ @Test
+ public void testDMAAPK8sBlueprintWithDB() {
+ Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprintWithDB", "", "d", "");
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
+ }
+
+ @DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File")
+ @Test
+ public void testDMAAPK8sBlueprint() {
+ Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprint", "", "d", "");
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
+ System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+
+ policyModelService.createPolicyModels(onapComponentSpec.getParameters(), "models");
+
+ onapTestUtils.verifyToscaDefVersion("DMAAP K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ //onapTestUtils.verifyBpImports("DMAAP K8s",onapBlueprint,false);
+
+ Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
+ assertNotNull("DMAAP K8s Blueprint Inputs Section is NULL", k8sBpInputs);
+ assertTrue("DMAAP K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ //assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
+ //assertEquals("DMAAP K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
+ assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
+ assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+
+ Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
+ assertNotNull("DMAAP K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
+ assertTrue("DMAAP K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
+
+ assertEquals("DMAAP K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull("DMAAP K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull("DMAAP K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP K8s",onapComponentSpec);
+ onapTestUtils.verifyHealthCheck("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP K8s",onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP K8s",onapComponentSpec);
+ onapTestUtils.verifyDockerConfig("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplates);
+ }
+
+ @DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File with Import File")
+ @Test
+ public void testDMAAPK8sImportFileBlueprint() throws IOException {
+ Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "d", "");
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull("K8s Blueprint for DMAAP Component Spec with Import File is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion("DMAAP with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile("DMAAP with Import File K8s",onapBlueprint,input.getImportPath());
+
+ Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
+ assertNotNull("DMAAP with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
+ assertTrue("DMAAP with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ //assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
+ //assertEquals("DMAAP with Import File K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
+ assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
+ assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+
+ Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
+ assertNotNull("DMAAP with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
+ assertTrue("DMAAP with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
+
+ assertEquals("DMAAP with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyHealthCheck("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP with Import File K8s",onapComponentSpec);
+ onapTestUtils.verifyDockerConfig("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
+ }
+
+}
+
+
+
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
new file mode 100644
index 0000000..633c205
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
@@ -0,0 +1,58 @@
+/*
+ *
+ * * ============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.test;
+
+
+import org.onap.blueprintgenerator.exception.ComponentSpecException;
+import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
+import org.junit.Test;
+import org.junit.jupiter.api.DisplayName;
+
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * ONAP ComponentSpec Test Cases
+ */
+
+public class OnapComponentSpecTest extends BlueprintGeneratorTests {
+
+ @DisplayName("Testing ComponentSpec File Generation for Invalid File")
+ @Test(expected = ComponentSpecException.class)
+ public void testComponentSpecForInvalidFile() {
+ onapComponentSpecService.createComponentSpecFromFile("invalid.json");
+ }
+
+ @DisplayName("Testing ComponentSpec File Generation for Valid DMAAP File")
+ @Test
+ public void testComponentSpecForValidVesFile(){
+ ComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath());
+ assertEquals("ComponentSpec name not matching for Valid Ves File",onapComponentSpec.getSelf().getName(), "dcae-ves-collector");
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
new file mode 100644
index 0000000..9033fbe
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
@@ -0,0 +1,207 @@
+/*
+ *
+ * * ============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.test;
+
+import org.onap.blueprintgenerator.constants.Constants;
+import org.onap.blueprintgenerator.model.base.Blueprint;
+import org.onap.blueprintgenerator.model.common.Input;
+import org.onap.blueprintgenerator.model.common.Node;
+import org.onap.blueprintgenerator.model.common.Properties;
+import org.onap.blueprintgenerator.model.componentspec.OnapAuxilary;
+import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
+
+import org.onap.blueprintgenerator.model.componentspec.common.Calls;
+import org.onap.blueprintgenerator.model.componentspec.common.Provides;
+import org.onap.blueprintgenerator.model.componentspec.common.HealthCheck;
+import org.onap.blueprintgenerator.model.componentspec.common.Parameters;
+import org.onap.blueprintgenerator.model.componentspec.common.Volumes;
+import org.onap.blueprintgenerator.model.componentspec.common.Artifacts;
+import org.onap.blueprintgenerator.model.dmaap.Streams;
+import org.junit.Ignore;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * @author : Ravi Mantena
+ * @date 10/16/2020
+ * Application: ONAP - Blueprint Generator
+ * Test Utilities used in Test Suite and Test Cases
+ */
+
+@Component
+@Ignore
+public class OnapTestUtils extends BlueprintGeneratorTests {
+
+ @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;
+
+
+
+ public Input getInput(String componentSpecPath,String outputPath,String bluePrintName,String importPath,String bpType,String serviceNameOverride){
+ Input input = new Input();
+ input.setComponentSpecPath(componentSpecPath);
+ input.setBluePrintName(bluePrintName);
+ input.setOutputPath(outputPath);
+ input.setBpType(bpType);
+ input.setServiceNameOverride(serviceNameOverride);
+ input.setImportPath(importPath);
+ return input;
+ }
+
+ public Input getInput(String componentSpecPath){
+ Input input = new Input();
+ input.setComponentSpecPath(componentSpecPath);
+ return input;
+ }
+
+ public void verifyToscaDefVersion(String type,Blueprint blueprint,String toscaDefVersion){
+ String bpToscaDefVersion = blueprint.getTosca_definitions_version();
+ assertNotNull(type + " TOSCA Definition Version is NULL", bpToscaDefVersion);
+ assertEquals(type + " TOSCA Definition Version is not Matching", bpToscaDefVersion, toscaDefVersion);
+ }
+
+ public void verifyBpImports(String type,Blueprint blueprint, boolean validateimps) {
+ String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
+ if (validateimps) {
+ String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsDmaapDmaapplugin,importPostgres,importClamp};
+ assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, testImports);
+ }
+ else{
+ String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsOnapK8sDcaepolicyplugin,importPostgres,importClamp};
+ assertArrayEquals(type + " Blueprint Imports is not matching with default Onap K8s Blueprint imports", bpImports, testImports);
+ }
+
+ }
+
+ public void verifyBpImportsFromFile(String type,Blueprint blueprint, String importPath) throws IOException {
+ Blueprint importFileRead = yamlObjectMapper.readValue(new File(importPath), Blueprint.class);
+ String[] importFileImports = importFileRead.getImports().toArray(new String[importFileRead.getImports().size()]);
+ String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
+ assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, importFileImports);
+
+ }
+
+ public void verifyStreamsPublishes(String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
+ List<Streams> streamsPublishes = nodeTemplateProperties.getStreams_publishes();
+ if (!(streamsPublishes == null)) {
+ assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is NULL", streamsPublishes);
+ assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes Section Size is 0", streamsPublishes.size() > 0);
+ assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(0).getType(), Constants.MESSAGEROUTER_VALUE);
+ assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(1).getType(), Constants.MESSAGEROUTER_VALUE);
+ }
+ }
+
+ public void verifyStreamsSubscribes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ List<Streams> streamsSubscribes = nodeTemplateProperties.getStreams_subscribes();
+ if (!(streamsSubscribes == null)) {
+ assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is NULL", streamsSubscribes);
+ assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes Section Size is 0", streamsSubscribes.size() > 0);
+ assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(0).getType(), Constants.MESSAGE_ROUTER);
+ assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(1).getType(), Constants.DATA_ROUTER);
+ }
+ }
+
+ public void verifyServicesCalls(String type, OnapComponentSpec onapComponentSpec){
+ Calls[] csServicesCalls = onapComponentSpec.getServices().getCalls();
+ assertNotNull(type + " ComponentSpec Services Calls is NULL", csServicesCalls);
+ //assertTrue(type + " ComponentSpec Services Calls Section Size is 0", csServicesCalls.length > 0);
+ }
+
+ public void verifyServicesProvides(String type, OnapComponentSpec onapComponentSpec){
+ Provides[] csServicesProvides = onapComponentSpec.getServices().getProvides();
+ assertNotNull(type + " ComponentSpec Services Provides is NULL", csServicesProvides);
+ assertTrue(type + " ComponentSpec Services Provides Section Size is 0", csServicesProvides.length > 0);
+ }
+
+ public void verifyDockerConfig(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ OnapAuxilary dockerConfig = nodeTemplateProperties.getDocker_config();
+ assertNotNull(type +" Blueprint Docker Config Section is NULL", dockerConfig);
+ }
+
+
+ public void verifyParameters(String type, OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplates) {
+ Parameters[] csParameters = onapComponentSpec.getParameters();
+ assertNotNull(type +" ComponentSpec Parameters Section is NULL", csParameters);
+ assertTrue(type + " ComponentSpec Parameters Section Size is 0", csParameters.length > 0);
+ }
+
+ public void verifyAuxilary(String type, OnapComponentSpec onapComponentSpec){
+ OnapAuxilary csAuxilary = onapComponentSpec.getAuxilary();
+ assertNotNull(type +" ComponentSpec Auxilary Section is NULL", csAuxilary);
+ }
+
+ public void verifyHealthCheck(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ HealthCheck csAuxilaryHealthcheck = onapComponentSpec.getAuxilary().getHealthcheck();
+ assertNotNull(type +" ComponentSpec Auxilary Health Check Section is NULL", csAuxilaryHealthcheck);
+ HealthCheck healthCheck = nodeTemplateProperties.getDocker_config().getHealthcheck();
+ assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck Section is NULL", healthCheck);
+ assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Interval Tag is not matching", healthCheck.getInterval(), csAuxilaryHealthcheck.getInterval());
+ assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Timeout Tag is not matching", healthCheck.getTimeout(), csAuxilaryHealthcheck.getTimeout());
+ assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Script Tag is not matching", healthCheck.getEndpoint(), csAuxilaryHealthcheck.getEndpoint());
+ assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Type Tag is not matching", healthCheck.getType(), csAuxilaryHealthcheck.getType());
+ }
+
+ public void verifyVolumes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ Volumes[] csAuxilaryVolumes = onapComponentSpec.getAuxilary().getVolumes();
+ assertNotNull(type +" ComponentSpec Auxilary Live Health Check Section is NULL", csAuxilaryVolumes);
+ Volumes[] onapVolumes = nodeTemplateProperties.getDocker_config().getVolumes();
+ assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:LiveHealthcheck Section is NULL", onapVolumes);
+ }
+
+ public void verifyArtifacts(String type,OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs,String bptype){
+ Artifacts[] csArtifacts = onapComponentSpec.getArtifacts();
+ assertNotNull(type + " ComponentSpec Artifacts Section is NULL", csArtifacts);
+ assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("image").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
+ //assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("tag_version").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
+
+ }
+
+}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
new file mode 100644
index 0000000..f4bbe3e
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
@@ -0,0 +1,168 @@
+/*============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.test;
+
+
+import org.junit.Test;
+import org.junit.runners.Parameterized;
+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.common.ExternalCertificateParameters;
+import org.onap.blueprintgenerator.model.common.ExternalTlsInfo;
+import org.onap.blueprintgenerator.model.dmaap.TlsInfo;
+
+
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+
+
+//@RunWith(Parameterized.class)
+public class TlsInfoTest extends BlueprintGeneratorTests {
+
+ @Parameterized.Parameter
+ public char bpType;
+
+ @Parameterized.Parameters(name = "Blueprint type: {0}")
+ public static List<Character> data() {
+ return Arrays.asList('o', 'd');
+ }
+
+
+ @Test
+ public void useTlsTrueAndUseExternalTlsTrueTest(){
+ //Input input = input.setComponentSpecPath(componentSpecPath + "testComponentSpec_withTlsTrueAndExternalTlsTrue.json");
+ OnapBlueprint bp = createBlueprintFromFile(Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndUseExternalTlsTrueTest).toFile().getAbsolutePath());
+
+ assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, true);
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
+ }
+
+ @Test
+ public void useTlsFalseAndUseExternalTlsFalseTest(){
+ OnapBlueprint bp = createBlueprintFromFile(Paths.get("src", "test", "resources", "componentspecs", useTlsFalseAndUseExternalTlsFalseTest).toFile().getAbsolutePath());
+
+ assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, false);
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, false);
+ }
+
+ @Test
+ public void useTlsTrueAndNoExternalTlsFlagTest(){
+ OnapBlueprint bp = createBlueprintFromFile(Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndNoExternalTlsFlagTest).toFile().getAbsolutePath());
+
+ assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
+ assertBlueprintHasNoExternalTlsInfo(bp);
+ }
+
+ @Test
+ public void noTlsInfo(){
+ OnapBlueprint bp = createBlueprintFromFile(Paths.get("src", "test", "resources", "componentspecs", noTlsInfo).toFile().getAbsolutePath());
+
+ assertBlueprintHasNoTlsInfo(bp);
+ assertBlueprintHasNoExternalTlsInfo(bp);
+ }
+
+ private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
+ //should create proper inputs
+ assertContainsInputWithDefault(bp, "external_cert_use_external_tls", useFlagDefault);
+ assertContainsInputWithDefault(bp, "external_cert_ca_name", "\"RA\"");
+ assertContainsInputWithDefault(bp, "external_cert_cert_type", "\"P12\"");
+ assertContainsInputWithDefault(bp, "external_cert_common_name", "\"sample.onap.org\"");
+ assertContainsInputWithDefault(bp, "external_cert_sans",
+ "\"sample.onap.org:component.sample.onap.org\"");
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should create proper externalTlsInfo object in node properties
+ ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
+ assertNotNull(externalTlsInfo);
+
+ assertEquals("external_cert_ca_name", externalTlsInfo.getCaName().getBpInputName());
+ assertEquals("external_cert_cert_type", externalTlsInfo.getCertType().getBpInputName());
+ assertEquals("external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getBpInputName());
+ assertEquals("/opt/app/dcae-certificate/", externalTlsInfo.getExternalCertDirectory());
+
+ ExternalCertificateParameters extCertParams = externalTlsInfo.getExternalCertificateParameters();
+ assertNotNull(extCertParams);
+
+ assertEquals("external_cert_common_name", extCertParams.getCommonName().getBpInputName());
+ assertEquals("external_cert_sans", extCertParams.getSans().getBpInputName());
+ }
+
+ private void assertBlueprintContainsTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
+ //shold create proper inputs
+ assertContainsInputWithDefault(bp, "use_tls", useFlagDefault);
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should create proper tlsInfo object in node properties
+ TlsInfo tlsInfo = node.getProperties().getTls_info();
+ assertEquals("use_tls", tlsInfo.getUseTls().getBpInputName());
+ assertEquals("/opt/app/dcae-certificate/", tlsInfo.getCertDirectory());
+
+ }
+
+ private void assertBlueprintHasNoExternalTlsInfo(OnapBlueprint bp) {
+ //should not create inputs for external tls
+ assertFalse(bp.getInputs().containsKey("external_cert_use_external_tls"));
+ assertFalse(bp.getInputs().containsKey("external_cert_common_name"));
+ assertFalse(bp.getInputs().containsKey("external_cert_ca_name"));
+ assertFalse(bp.getInputs().containsKey("external_cert_sans"));
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should not create externalTlsInfo object in node properties
+ ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
+ assertNull(externalTlsInfo);
+ }
+
+
+ private void assertBlueprintHasNoTlsInfo(OnapBlueprint bp) {
+ //should not create inputs for tls
+ assertFalse(bp.getInputs().containsKey("use_tls"));
+
+ Node node = bp.getNode_templates().get("test.component.spec");
+
+ //should not create tlsInfo object in node properties
+ assertNull(node.getProperties().getTls_info());
+ }
+
+ private void assertContainsInputWithDefault(OnapBlueprint bp, String inputName, Object defaultValue) {
+ LinkedHashMap<String, Object> input = bp.getInputs().get(inputName);
+ assertNotNull(input);
+ assertEquals(defaultValue, input.get("default"));
+ }
+
+ private OnapBlueprint createBlueprintFromFile(String path) {
+ onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(path);
+ Input input = onapTestUtils.getInput(path, "", "", "", "o", "");
+ OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ return onapBlueprint;
+ }
+}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json
new file mode 100644
index 0000000..da75ab8
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json
@@ -0,0 +1,43 @@
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": false,
+ "use_external_tls": false
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json
new file mode 100644
index 0000000..f13e3fd
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json
@@ -0,0 +1,43 @@
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true,
+ "use_external_tls": true
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json
new file mode 100644
index 0000000..517c461
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json
@@ -0,0 +1,42 @@
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true
+ }
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json
new file mode 100644
index 0000000..a94c987
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json
@@ -0,0 +1,38 @@
+{
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+
+ "parameters": [],
+
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ]
+ },
+ "artifacts": [{
+ "type": "docker image",
+ "uri": "test.tester"
+ }]
+
+}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testImports.yaml b/mod/bpgenerator/onap/src/test/resources/componentspecs/testImports.yaml
new file mode 100644
index 0000000..42a482d
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testImports.yaml
@@ -0,0 +1,4 @@
+imports:
+ - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
+ - plugin:k8splugin?version=3.0.0
+ - plugin:dcaepolicyplugin?version=2.4.0 \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json
new file mode 100644
index 0000000..6655a2c
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json
@@ -0,0 +1,337 @@
+{
+ "self": {
+ "version": "1.5.0",
+ "name": "dcae-ves-collector",
+ "description": "Collector for receiving VES events through restful interface",
+ "component_type": "docker"
+ },
+ "streams": {
+ "subscribes": [
+ {
+ "format": "dataformat_Hello_World_PM",
+ "version": "1.0.0",
+ "route": "/TEST_HELLO_WORLD_SUB_MR",
+ "type": "message_router",
+ "config_key": "TEST-SUB-MR"
+ },
+ {
+ "format": "dataformat_Hello_World_PM DR",
+ "version": "1.0.0",
+ "route": "/TEST_HELLO_WORLD_SUB_DR",
+ "type": "data_router",
+ "config_key": "TEST-SUB-DR"
+ }
+ ],
+ "publishes": [
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-fault"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-measurement"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-other"
+ },
+ {
+ "format": "VES_specification",
+ "version": "5.28.4",
+ "type": "message router",
+ "config_key": "ves-heartbeat-secondary"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.0",
+ "type": "message router",
+ "config_key": "ves-pnfRegistration"
+ },
+ {
+ "format": "VES_specification",
+ "version": "7.30.0",
+ "type": "message router",
+ "config_key": "ves-notification"
+ }
+ ]
+ },
+ "services": {
+ "calls": [],
+ "provides": [
+ {
+ "route": "/eventListener/v1",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v2",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v3",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v4",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "4.27.2"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v5",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "5.28.4"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ },
+ {
+ "route": "/eventListener/v7",
+ "verb": "POST",
+ "request": {
+ "format": "VES_specification",
+ "version": "7.30.0"
+ },
+ "response": {
+ "format": "ves.coll.response",
+ "version": "1.0.0"
+ }
+ }
+ ]
+ },
+ "parameters": [
+ {
+ "name": "collector.service.port",
+ "value": 8080,
+ "description": "standard http port collector will open for listening;",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.service.secure.port",
+ "value": 8443,
+ "description": "secure http port collector will open for listening ",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": true
+ },
+ {
+ "name": "collector.keystore.file.location",
+ "value": "/opt/app/dcae-certificate/keystore.jks",
+ "description": "fs location of keystore file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.keystore.passwordfile",
+ "value": "/opt/app/dcae-certificate/.password",
+ "description": "location of keystore password file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.truststore.file.location",
+ "value": "/opt/app/dcae-certificate/truststore.jks",
+ "description": "fs location of truststore file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.truststore.passwordfile",
+ "value": "/opt/app/dcae-certificate/.trustpassword",
+ "description": "location of truststore password file in vm",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.dmaap.streamid",
+ "value": "fault=ves-fault,ves-fault-secondary|syslog=ves-syslog,ves-syslog-secondary|heartbeat=ves-heartbeat,ves-heartbeat-secondary|measurementsForVfScaling=ves-measurement,ves-measurement-secondary|mobileFlow=ves-mobileflow,ves-mobileflow-secondary|other=ves-other,ves-other-secondary|stateChange=ves-statechange,ves-statechange-secondary|thresholdCrossingAlert=ves-thresholdCrossingAlert,ves-thresholdCrossingAlert-secondary|voiceQuality=ves-voicequality,ves-voicequality-secondary|sipSignaling=ves-sipsignaling,ves-sipsignaling-secondary|notification=ves-notification,ves-notification-secondary|pnfRegistration=ves-pnfRegistration,ves-pnfRegistration-secondary",
+ "description": "domain-to-streamid mapping used by VESCollector to distributes events based on domain. Both primary and secondary config_key are included for resilency (multiple streamid can be included commma separated). The streamids MUST match to topic config_keys. For single site without resiliency deployment - configkeys with -secondary suffix can be removed",
+ "sourced_at_deployment": true,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "auth.method",
+ "value": "noAuth",
+ "description": "Property to manage application mode, possible configurations: noAuth - default option - no security (http) , certOnly - auth by certificate (https), basicAuth - auth by basic auth username and password (https),certBasicAuth - auth by certificate and basic auth username / password (https),",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "header.authlist",
+ "value": "sample1,$2a$10$pgjaxDzSuc6XVFEeqvxQ5u90DKJnM/u7TJTcinAlFJVaavXMWf/Zi|userid1,$2a$10$61gNubgJJl9lh3nvQvY9X.x4e5ETWJJ7ao7ZhJEvmfJigov26Z6uq|userid2,$2a$10$G52y/3uhuhWAMy.bx9Se8uzWinmbJa.dlm1LW6bYPdPkkywLDPLiy",
+ "description": "List of id and base 64 encoded password.For each onboarding VNF - unique userid and password should be assigned and communicated to VNF owner. Password value should be base64 encoded in config here",
+ "policy_editable": false,
+ "sourced_at_deployment": true,
+ "designer_editable": true
+ },
+ {
+ "name": "collector.schema.checkflag",
+ "value": 1,
+ "description": "Schema check validation flag. When enabled, collector will validate input VES events against VES Schema defined on collector.schema.file ",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "collector.schema.file",
+ "value": "{\"v1\":\"./etc/CommonEventFormat_27.2.json\",\"v2\":\"./etc/CommonEventFormat_27.2.json\",\"v3\":\"./etc/CommonEventFormat_27.2.json\",\"v4\":\"./etc/CommonEventFormat_27.2.json\",\"v5\":\"./etc/CommonEventFormat_28.4.1.json\",\"v7\":\"./etc/CommonEventFormat_30.json\"}",
+ "description": "VES schema file name per version used for validation",
+ "designer_editable": true,
+ "sourced_at_deployment": false,
+ "policy_editable": false
+ },
+ {
+ "name": "event.transform.flag",
+ "value": 1,
+ "description": "flag to enable tranformation rules defined under eventTransform.json; this is applicable when event tranformation rules preset should be activated for transforming <VES5.4 events to 5.4",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ },
+ {
+ "name": "testParam1",
+ "value": "test-param-1",
+ "description": "testParam1",
+ "sourced_at_deployment": true,
+ "policy_editable": true,
+ "policy_group": "Test_Parameters",
+ "required": true,
+ "designer_editable": true,
+ "policy_schema": [
+ {
+ "name": "PolicySchemaTest",
+ "description": "List of objects for vnf type monitorng",
+ "type": "String",
+ "entry_schema": [
+ {
+ "name": "TestEntrySchema",
+ "description": "entry",
+ "type": "string",
+ "value": "None"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "tomcat.maxthreads",
+ "value": "200",
+ "description": "Tomcat control for concurrent request",
+ "sourced_at_deployment": false,
+ "policy_editable": false,
+ "designer_editable": false
+ }
+ ],
+ "auxilary": {
+ "healthcheck": {
+ "type": "http",
+ "interval": "15s",
+ "timeout": "1s",
+ "endpoint": "/healthcheck"
+ },
+ "livehealthcheck": {
+ "type": "http",
+ "interval": "15s",
+ "timeout": "1s",
+ "endpoint": "/livehealthcheck"
+ },
+ "databases": {
+ "dti": "postgres"
+ },
+ "reconfigs": {
+ "app_reconfig": "abc"
+ },
+ "policy": {
+ "trigger_type": "docker",
+ "script_path": "/opt/app/manager/bin/reconfigure.sh"
+ },
+ "volumes": [
+ {
+ "container": {
+ "bind": "/opt/app/dcae-certificate"
+ },
+ "host": {
+ "path": "/opt/app/dcae-certificate"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/VESCollector/logs"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/VESCollector/logs"
+ }
+ },
+ {
+ "container": {
+ "bind": "/opt/app/VESCollector/etc"
+ },
+ "host": {
+ "path": "/opt/logs/DCAE/VESCollector/etc"
+ }
+ }
+ ],
+ "ports": [
+ "8080:8080",
+ "8443:8443"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true,
+ "use_external_tls": true
+ }
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "nexus.onap.org:10001/onap/org.onap.dcaegen2.collectors.ves.vescollector:latest"
+ }
+ ]
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json b/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json
new file mode 100644
index 0000000..fb89e1a
--- /dev/null
+++ b/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json
@@ -0,0 +1,28 @@
+{
+ "policies": [
+ {
+ "configAttributes": "",
+ "configName": "",
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": false
+ },
+ {
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": true
+ },
+ {
+ "configAttributes": "",
+ "configName": "",
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": false
+ }
+ ],
+ "policy": [
+ {
+ "policy_id" : "id_0"
+ }
+ ]
+} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/version.properties b/mod/bpgenerator/onap/version.properties
new file mode 100644
index 0000000..93e7833
--- /dev/null
+++ b/mod/bpgenerator/onap/version.properties
@@ -0,0 +1,29 @@
+#
+# /*
+# * ============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=========================================================
+# */
+#
+#
+
+major=1
+minor=7
+patch=0
+base_version=${major}.${minor}.${patch}
+release_version=${base_version}
+snapshot_version=${base_version}-SNAPSHOT