summaryrefslogtreecommitdiffstats
path: root/blueprints-processor/plugin/generator-provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'blueprints-processor/plugin/generator-provider/src/test')
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/service/ConfigGeneratorNodeTest.java222
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/tool/EscapeUtilsTest.java51
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json36
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json36
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json355
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl61
-rw-r--r--blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl40
7 files changed, 801 insertions, 0 deletions
diff --git a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/service/ConfigGeneratorNodeTest.java b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/service/ConfigGeneratorNodeTest.java
new file mode 100644
index 000000000..941387347
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/service/ConfigGeneratorNodeTest.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.config.generator.service;
+
+import static org.mockito.Matchers.any;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.io.IOUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+import org.onap.ccsdk.config.data.adaptor.domain.ConfigResource;
+import org.onap.ccsdk.config.data.adaptor.domain.TransactionLog;
+import org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService;
+import org.onap.ccsdk.config.generator.ConfigGeneratorConstant;
+import org.onap.ccsdk.config.model.ConfigModelConstant;
+import org.onap.ccsdk.config.model.service.ConfigModelService;
+import org.onap.ccsdk.config.model.service.ConfigModelServiceImpl;
+import org.onap.ccsdk.config.model.utils.TransformationUtils;
+import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigGeneratorNodeTest {
+
+ private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigGeneratorNodeTest.class);
+
+ @Mock
+ private ConfigResourceService configResourceService;
+
+ @Mock
+ private ConfigRestAdaptorService configRestAdaptorService;
+
+ private ConfigModelService configModelService;
+
+ @Before
+ public void setUp() throws Exception {
+
+ configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
+
+ MockitoAnnotations.initMocks(this);
+
+ try {
+ Mockito.doAnswer(new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
+ Object[] args = invocationOnMock.getArguments();
+ if (args != null) {
+ logger.trace("Transaction info " + Arrays.asList(args));
+ }
+ return null;
+ }
+ }).when(configResourceService).save(any(TransactionLog.class));
+
+ Mockito.doAnswer(new Answer<List<ConfigResource>>() {
+ @Override
+ public List<ConfigResource> answer(InvocationOnMock invocationOnMock) throws Throwable {
+ List<ConfigResource> configResources = new ArrayList<>();
+ Object[] args = invocationOnMock.getArguments();
+ if (args != null) {
+ logger.trace("Transaction info " + Arrays.asList(args));
+ String resourceData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/configdata.json"), Charset.defaultCharset());
+ ConfigResource configResource = (ConfigResource) args[0];
+ configResource.setRecipeName("Sample-recipe");
+ configResource.setResourceData(resourceData);
+ configResources.add(configResource);
+ }
+ return configResources;
+ }
+ }).when(configResourceService).getConfigResource(any(ConfigResource.class));
+
+ } catch (SvcLogicException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testInputTemplateContentNData() throws Exception {
+
+ ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
+
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
+
+ String jsonData = IOUtils.toString(
+ ConfigGeneratorNodeTest.class.getClassLoader().getResourceAsStream("service_templates/configdata.json"),
+ Charset.defaultCharset());
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, jsonData);
+
+ String templateData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_CONTENT, templateData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, Object> componentContext = new HashMap<>();
+ configGeneratorNode.process(inParams, ctx, componentContext);
+ Assert.assertEquals("Failed to generate Configuration Status as Failure",
+ ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
+ ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+ Assert.assertNotNull("Failed to generate Configuration",
+ ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+
+ logger.trace("Generated Configuration:\n "
+ + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+ logger.trace("Generated Configuration:\n "
+ + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_MASK_INFO));
+
+ }
+
+ @Test
+ public void testInputTemplateWithNullData() throws Exception {
+
+ ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
+
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "test");
+
+ String jsonData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/configdata_with_null.json"), Charset.defaultCharset());
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, jsonData);
+
+ String templateData = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_CONTENT, templateData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, Object> componentContext = new HashMap<>();
+ configGeneratorNode.process(inParams, ctx, componentContext);
+ Assert.assertEquals("Failed to generate Configuration Status as Failure",
+ ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
+ ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+ Assert.assertNotNull("Failed to generate Configuration",
+ ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+
+ logger.trace("Generated Configuration:\n "
+ + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+ logger.trace("Generated Configuration:\n "
+ + ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_MASK_INFO));
+
+ }
+
+ @Test
+ public void testDBTemplateContentNData() throws Exception {
+
+ String fileContent = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/generate_configuration.json"), Charset.defaultCharset());
+
+ String baseConfigTemplateContent = IOUtils.toString(ConfigGeneratorNodeTest.class.getClassLoader()
+ .getResourceAsStream("service_templates/velocity/base-config-template.vtl"), Charset.defaultCharset());
+
+ Map<String, String> context = new HashMap<>();
+ context = configModelService.convertServiceTemplate2Properties(fileContent, context);
+
+ context.put("node_templates.base-config-template.content", baseConfigTemplateContent);
+
+ Assert.assertNotNull("Failed to Prepare Context : ", context);
+
+ context.put("request-id", "12345");
+ context.put("vnf-id", "vnf12345");
+ context.put("action-name", "config-generator-action");
+
+ Map<String, String> inparams = new HashMap<String, String>();
+ inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
+
+ SvcLogicContext inputContext = new SvcLogicContext();
+ context.forEach((name, value) -> {
+ inputContext.setAttribute(name, value);
+ });
+
+ TransformationUtils.printMap(context);
+ configModelService.assignInParamsFromModel(inputContext, inparams);
+ ConfigGeneratorNode configGeneratorNode = new ConfigGeneratorNode(configResourceService, configModelService);
+
+ Map<String, Object> componentContext = new HashMap<>();
+ configGeneratorNode.process(inparams, inputContext, componentContext);
+
+ Assert.assertEquals("Failed to generate Configuration Status as Failure",
+ ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,
+ inputContext.getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+ Assert.assertNotNull("Failed to generate Configuration", inputContext
+ .getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+
+ logger.trace("Generated Configuration:\n " + inputContext
+ .getAttribute("generate-configuration." + ConfigGeneratorConstant.OUTPUT_PARAM_GENERATED_CONFIG));
+ }
+
+ @Test
+ public void testTemplateContentNDataForMask() throws Exception {
+
+ }
+
+}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/tool/EscapeUtilsTest.java b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/tool/EscapeUtilsTest.java
new file mode 100644
index 000000000..0bd2384bf
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/java/org/onap/ccsdk/config/generator/tool/EscapeUtilsTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.config.generator.tool;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class EscapeUtilsTest {
+
+ @Test
+ public void testEscapeSql() {
+ Assert.assertEquals("", EscapeUtils.escapeSql(""));
+ Assert.assertEquals("text", EscapeUtils.escapeSql("text"));
+
+ Assert.assertEquals("''", EscapeUtils.escapeSql("'"));
+ Assert.assertEquals("\\\\", EscapeUtils.escapeSql("\\"));
+
+ Assert.assertEquals("text''text", EscapeUtils.escapeSql("text'text"));
+ Assert.assertEquals("text\\\\text", EscapeUtils.escapeSql("text\\text"));
+ }
+
+ @Test
+ public void testEscapeSequence() {
+ Assert.assertEquals("", EscapeUtils.escapeSequence(""));
+ Assert.assertEquals("text", EscapeUtils.escapeSequence("text"));
+
+ Assert.assertEquals("\\\'", EscapeUtils.escapeSequence("'"));
+ Assert.assertEquals("\\\"", EscapeUtils.escapeSequence("\""));
+ Assert.assertEquals("\\\\", EscapeUtils.escapeSequence("\\"));
+
+ Assert.assertEquals("text\\\'text", EscapeUtils.escapeSequence("text'text"));
+ Assert.assertEquals("text\\\"text", EscapeUtils.escapeSequence("text\"text"));
+ Assert.assertEquals("text\\\\text", EscapeUtils.escapeSequence("text\\text"));
+ }
+
+}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json
new file mode 100644
index 000000000..13d355cbc
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata.json
@@ -0,0 +1,36 @@
+{
+ "node0_hostname": "appc-host",
+ "node0_backup_router_address": "2001:2001:2001:2001:2001:2001:2001:2001",
+ "servers": [
+ "Server1",
+ "Server2",
+ "Server3"
+ ],
+ "tacplus-servers": [
+ {
+ "tacplus-server-name": "tacplus-server-name1",
+ "tacplus-server-source-address": "enc-dsdsasa1"
+ },
+ {
+ "tacplus-server-name": "tacplus-server-name2",
+ "tacplus-server-source-address": "enc-dsdsasa2"
+ }
+ ],
+ "classes": [
+ {
+ "name": "superuser-class",
+ "idle-timeout": 5,
+ "permissions": "all"
+ },
+ {
+ "name": "tacacs-adv-class",
+ "idle-timeout": 5
+ },
+ {
+ "name": "tacacs-base-class",
+ "idle-timeout": 5
+ }
+ ],
+ "system-password": "teamops-system-password",
+ "root-password": "teamops-root-password"
+}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json
new file mode 100644
index 000000000..d08acb17c
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/configdata_with_null.json
@@ -0,0 +1,36 @@
+{
+ "node0_hostname": null,
+ "node0_backup_router_address": "2001:2001:2001:2001:2001:2001:2001:2001",
+ "servers": [
+ "Server1",
+ "Server2",
+ "Server3"
+ ],
+ "tacplus-servers": [
+ {
+ "tacplus-server-name": null,
+ "tacplus-server-source-address": "enc-dsdsasa1"
+ },
+ {
+ "tacplus-server-name": "tacplus-server-name2",
+ "tacplus-server-source-address": "enc-dsdsasa2"
+ }
+ ],
+ "classes": [
+ {
+ "name": "superuser-class",
+ "idle-timeout": 5,
+ "permissions": "all"
+ },
+ {
+ "name": "tacacs-adv-class",
+ "idle-timeout": 5
+ },
+ {
+ "name": "tacacs-base-class",
+ "idle-timeout": 5
+ }
+ ],
+ "system-password": "teamops-system-password",
+ "root-password": "teamops-root-password"
+} \ No newline at end of file
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json
new file mode 100644
index 000000000..d2c16ede1
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/generate_configuration.json
@@ -0,0 +1,355 @@
+{
+ "metadata": {
+ "author": "ks220y@att.com",
+ "service-template-name": "VRR-baseconfiguration",
+ "service-template-version": "1.0.0",
+ "service-type": "AVPN",
+ "vnf-type": "VRR",
+ "action": "Base Configuration",
+ "sub-action": "Generate Configuration"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "vnf-id": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "base-config-template": {
+ "type": "artifact-config-template",
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "bundle-id",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "bundle-id",
+ "dictionary-source": "mdsal"
+ },
+ {
+ "name": "bundle-mac",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "bundle-mac",
+ "dictionary-source": "db"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "generate-configuration": {
+ "type": "component-config-generator",
+ "interfaces": {
+ "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "resource-type": "vnf-type",
+ "request-id": "{ \"get_attribute\" : \"request-id\" }",
+ "resource-id": "{ \"get_input\" : \"vnf-id\" }",
+ "action-name": "{ \"get_attribute\" : \"action-name\" }",
+ "template-name": "base-config-template"
+ },
+ "outputs": {
+ "generated-config": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "component-node": {
+
+ }
+ }
+ },
+ "config-generator-action": {
+ "type": "dg-config-generator",
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "GenerateConfiguration": {
+
+ }
+ }
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "generate-configuration",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ }
+ }
+ }
+ },
+ "node_types": {
+ "artifact-config-template": {
+ "description": "This is Configuration Velocity Template",
+ "version": "1.0.0",
+ "properties": {
+ "action-names": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "capabilities": {
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ },
+ "mapping": {
+ "type": "tosca.capability.Mapping",
+ "properties": {
+ "mapping": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-resource-assignment"
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Artifact"
+ },
+ "component-config-generator": {
+ "description": "This is Generate Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-data": {
+ "description": "Conditional : JSON string which is used to mash with template. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "template-content": {
+ "description": "Conditional : Dynamic Template used to generate Configuration.",
+ "required": false,
+ "type": "string"
+ },
+ "resource-type": {
+ "description": "Conditional : resource-type used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "request-id": {
+ "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "required": true,
+ "type": "string"
+ },
+ "resource-id": {
+ "description": "Conditional : Id used to pull the data content from the data base. Either template-data or ( resource-id and resource-type ) should be present",
+ "required": false,
+ "type": "string"
+ },
+ "action-name": {
+ "description": "Conditional : Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
+ "required": false,
+ "type": "string"
+ },
+ "template-name": {
+ "description": "Conditional : Name of the Artifact Node Template, to get the template Content. If template-content is present, then content wont be reterived from the Artifact Node Template.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "outputs": {
+ "generated-config": {
+ "description": "Generated Configuration for the Template adn Resource Data",
+ "required": true,
+ "type": "string"
+ },
+ "mask-info": {
+ "description": "If template contains mask encription keys, then this mask-info field will be generated, This JSON Content alligns to the bean org.onap.ccsdk.config.model.data.custom.MaskInfo ",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
+ "dg-config-generator": {
+ "description": "This is Activate DG for Config Generator Directed Graph",
+ "version": "1.0.0",
+ "properties": {
+ "mode": {
+ "required": false,
+ "type": "string",
+ "default": "sync"
+ },
+ "version": {
+ "required": false,
+ "type": "string",
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": "false"
+ }
+ },
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-config-generator",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "GenerateConfiguration": {
+ "inputs": {
+ "params": {
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.DG"
+ }
+ },
+ "data_types": {
+ "datatype-resource-assignment": {
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
+ "properties": {
+ "property": {
+ "required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
+ "type": "string"
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "datatype-property": {
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ }
+ }
+}
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl
new file mode 100644
index 000000000..e0ea400c6
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template.vtl
@@ -0,0 +1,61 @@
+<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm"
+xmlns:a="http://xml.juniper.net/junos/15.1X49/junos">
+ <version>15.1X49-D50.3</version>
+ <groups>
+ <name>node0</name>
+ <system>
+ #foreach($server in ${servers})
+ <server-host-name>$StringUtils.upperCase("$server")</server-host-name>
+ #end
+ </system>
+ <system>
+ <host-name>${node0_hostname}</host-name>
+ <backup-router>
+ <address>${node0_backup_router_address}</address>
+ <destination>$node0_backup_router_address</destination>
+ </backup-router>
+ #foreach($tacplus-server in ${tacplus-servers})
+ <tacplus-server>
+ <name>$tacplus-server.tacplus-server-name</name>
+ <source-address>$tacplus-server.tacplus-server-source-address</source-address>
+ </tacplus-server>
+ #end
+ <login>
+ <message>AT&amp;T information assets</message>
+ #foreach($class in ${classes})
+ <class>
+ <name>$class.name</name>
+ <idle-timeout>$class.idle-timeout</idle-timeout>
+ #if ($class.permissions)
+ <permissions>$class.permissions</permissions>
+ #end
+ </class>
+ #end
+ <user>
+ <name>readonly</name>
+ <full-name>Read Only Account Access</full-name>
+ <uid>1001</uid>
+ <class>tacacs-base-class</class>
+ </user>
+ <user>
+ <name>readwrite</name>
+ <full-name>Read - Write Account Access</full-name>
+ <uid>1002</uid>
+ <class>tacacs-adv-class</class>
+ <authentication>
+ <encrypted-password>${system-password}</encrypted-password>
+ </authentication>
+ </user>
+ <user>
+ <name>readwrite</name>
+ <full-name>Emergency Access Only</full-name>
+ <uid>1000</uid>
+ <class>superuser-class</class>
+ <authentication>
+ <encrypted-password>${root-password}</encrypted-password>
+ </authentication>
+ </user>
+ </login>
+ </system>
+ </groups>
+</configuration> \ No newline at end of file
diff --git a/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl
new file mode 100644
index 000000000..92dba1024
--- /dev/null
+++ b/blueprints-processor/plugin/generator-provider/src/test/resources/service_templates/velocity/base-config-template_group.vtl
@@ -0,0 +1,40 @@
+ <config>
+ <configuration>
+ <groups>
+ <name>${group-name}</name>
+ <routing-instances>
+ <instance>
+ <name>&lt;*&gt;</name>
+ <protocols>
+ <pim>
+ <dense-groups>
+ <dynamic-reject />
+ <pim-dense-group-type>
+ <name>224.0.1.40/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.1.39/32</name>
+ </pim-dense-group-type>
+ <pim-dense-group-type>
+ <name>224.0.0.0/4</name>
+ <reject />
+ </pim-dense-group-type>
+ </dense-groups>
+ <rp>
+ <auto-rp>
+ <discovery />
+ </auto-rp>
+ </rp>
+ <interface>
+ <name>&lt;*&gt;</name>
+ <disable />
+ <priority>1000</priority>
+ </interface>
+ <reset-tracking-bit />
+ </pim>
+ </protocols>
+ </instance>
+ </routing-instances>
+ </groups>
+ </configuration>
+ </config> \ No newline at end of file