From 55dcf3197958c76b1622a0c26489e68fe77e0314 Mon Sep 17 00:00:00 2001 From: Ravi Mantena Date: Wed, 21 Oct 2020 15:47:38 -0400 Subject: Blueprint Generator Refactored Code Issue-ID: DCAEGEN2-2472 Change-Id: I2ade7fb3b4196554eb4ecadd918fd45cb6ba8a52 Signed-off-by: Ravi Mantena --- .../test/BlueprintGeneratorTestSuite.java | 40 +++ .../test/BlueprintGeneratorTests.java | 109 +++++++ .../test/BlueprintJarComparatorTest.java | 115 +++++++ ...nalCertificateParametersFactoryServiceTest.java | 61 ++++ .../test/OnapBlueprintServiceTest.java | 257 ++++++++++++++++ .../test/OnapComponentSpecTest.java | 58 ++++ .../blueprintgenerator/test/OnapTestUtils.java | 207 +++++++++++++ .../onap/blueprintgenerator/test/TlsInfoTest.java | 168 ++++++++++ ...ponentSpec_withTlsFalseAndExternalTlsFalse.json | 43 +++ ...omponentSpec_withTlsTrueAndExternalTlsTrue.json | 43 +++ ...tComponentSpec_withTlsTrueAndNoExternalTls.json | 42 +++ .../testComponentSpec_withoutTlsInfo.json | 38 +++ .../test/resources/componentspecs/testImports.yaml | 4 + .../src/test/resources/componentspecs/ves.json | 337 +++++++++++++++++++++ .../src/test/resources/policyjson/policyInput.json | 28 ++ 15 files changed, 1550 insertions(+) create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java create mode 100644 mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/testImports.yaml create mode 100644 mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json create mode 100644 mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json (limited to 'mod/bpgenerator/onap/src/test') 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> 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> 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 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> 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> 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 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> 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> 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 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> 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 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 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 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 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> 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 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 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