summaryrefslogtreecommitdiffstats
path: root/blueprints-processor/plugin/model-provider/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'blueprints-processor/plugin/model-provider/src/test')
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java216
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java43
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java103
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java198
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java77
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java90
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java47
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java140
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java219
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java76
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java62
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java193
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json100
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json118
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json33
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json16
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json591
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json265
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json407
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl1
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl0
-rw-r--r--blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json171
22 files changed, 0 insertions, 3166 deletions
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java
deleted file mode 100644
index 760c245fd..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/ResourceDictionaryUtilsTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.features.model;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesProperties;
-import org.onap.ccsdk.features.model.utils.ResourceDictionaryUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceDictionaryUtilsTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryUtilsTest.class);
-
- @Test
- public void validateSingleInputSource() {
- try {
- logger.info(" **************** Validating validateSingleInputSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("input", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment input sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment input sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment input sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void validateSingleDbSource() {
- try {
- logger.info(" **************** Validating validateSingleDbSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-db-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("db", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertNotNull("Resource assignment db sourceName sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
-
- Assert.assertNotNull("Resource assignment db dependecy is missing ", resourceAssignment.getDependencies());
- Assert.assertEquals("Resource assignment db dependecy count mismatch ", 2,
- resourceAssignment.getDependencies().size());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void validateMultiSource() {
- try {
- logger.info(" **************** Validating validateMultiSource *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-multi-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("input", sourceDef);
- sources.put("mdsal", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertNotNull("Resource assignment db sourceName sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment db sourceName sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- Assert.assertNull("Resource assignment multi sourceName sourceName definition is present ",
- resourceAssignment.getDictionarySource());
- Assert.assertNull("Resource assignment multi sourceName dependecy is present ",
- resourceAssignment.getDependencies());
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testSourceDefault() {
- logger.info(" **************** Validating testSourceDefault *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("default", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment default sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment default sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment default sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- }
-
- @Test
- public void testSourceMdsal() {
- logger.info(" **************** Validating testSourceMdsal *****************");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName("test-input-key");
-
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setType(ValidTypes.DATA_TYPE_STRING);
-
- SourcesProperties sourcesProp = new SourcesProperties();
- sourcesProp.setDependencies(Arrays.asList(new String[] {"vnf-id", "vnf-name"}));
-
- SourcesDefinition sourceDef = new SourcesDefinition();
- sourceDef.setProperties(sourcesProp);
-
- HashMap<String, SourcesDefinition> sources = new HashMap<>();
- sources.put("mdsal", sourceDef);
-
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setProperty(propertyDefinition);
- resourceDefinition.setSources(sources);
-
- ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
-
- Assert.assertNotNull("Resource assignment mdsal sourceName is missing ",
- resourceAssignment.getDictionarySource());
- Assert.assertNotNull("Resource assignment mdsal sourceName property is missing ",
- resourceAssignment.getProperty());
- Assert.assertNotNull("Resource assignment mdsal sourceName property type is missing ",
- resourceAssignment.getProperty().getType());
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java
deleted file mode 100644
index 8ff1ff8de..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonParserUtilsTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.features.model.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class JsonParserUtilsTest {
-
- @Test
- public void testParse() {
- final String jsonExample = "{\"key\":\"value\"}";
-
- JsonNode rootJsonNode = JsonParserUtils.parse(jsonExample, "$");
- Assert.assertEquals(jsonExample, rootJsonNode.toString());
-
- JsonNode keyJsonNode = JsonParserUtils.parse(rootJsonNode, "$['key']");
- Assert.assertEquals("value", keyJsonNode.asText());
-
- Assert.assertEquals(jsonExample,
- JsonParserUtils.parseNSet("{\"key\":\"NOT_VALUE\"}", "$['key']", keyJsonNode).toString());
-
- rootJsonNode = JsonParserUtils.parse("{\"key\":\"NOT_VALUE\"}", "$");
- Assert.assertEquals(jsonExample, JsonParserUtils.parseNSet(rootJsonNode, "$['key']", keyJsonNode).toString());
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java
deleted file mode 100644
index 96d5f89f5..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/JsonUtilsTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.features.model.utils;
-
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.ValidTypes;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class JsonUtilsTest {
-
- @Test
- public void testPopulatePrimitiveValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populatePrimitiveValues("key1", "value", "", objectNode);
- JsonUtils.populatePrimitiveValues("key2", true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveValues("key3", 1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveValues("key4", 1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
- JsonUtils.populatePrimitiveValues("key5", "13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
-
- assertTrue("value".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean());
- assertTrue(objectNode.get("key3").asInt() == 1);
- assertTrue(objectNode.get("key4").floatValue() == 1.1f);
- assertTrue("13213123131".equals(objectNode.get("key5").asText()));
- }
-
- @Test
- public void testPopulatePrimitiveValuesArrayNode() {
- ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
- JsonUtils.populatePrimitiveValues("value", "", objectNode);
- JsonUtils.populatePrimitiveValues(true, ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveValues(1, ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveValues(1.1f, ValidTypes.DATA_TYPE_FLOAT, objectNode);
- JsonUtils.populatePrimitiveValues("13213123131", ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
-
- assertTrue(objectNode.size() == 5);
- }
-
- @Test
- public void testPopulatePrimitiveDefaultValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populatePrimitiveDefaultValues("key1", "", objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key2", ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key3", ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveDefaultValues("key4", ValidTypes.DATA_TYPE_FLOAT, objectNode);
-
- assertTrue("".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean() == false);
- assertTrue(objectNode.get("key3").asInt() == 0);
- assertTrue(objectNode.get("key4").floatValue() == 0.0f);
- }
-
- @Test
- public void testPopulatePrimitiveDefaultValuesForArrayNode() {
- ArrayNode objectNode = JsonNodeFactory.instance.arrayNode();
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode("", objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_INTEGER, objectNode);
- JsonUtils.populatePrimitiveDefaultValuesForArrayNode(ValidTypes.DATA_TYPE_FLOAT, objectNode);
-
- assertTrue(objectNode.size() == 4);
- }
-
- @Test
- public void testPopulateJsonNodeValues() {
- ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
- JsonUtils.populateJsonNodeValues("key1", JsonNodeFactory.instance.textNode("value"),
- ValidTypes.DATA_TYPE_STRING, objectNode);
- JsonUtils.populateJsonNodeValues("key2", JsonNodeFactory.instance.booleanNode(true),
- ValidTypes.DATA_TYPE_BOOLEAN, objectNode);
- JsonUtils.populateJsonNodeValues("key3", JsonNodeFactory.instance.numberNode(1), ValidTypes.DATA_TYPE_INTEGER,
- objectNode);
- JsonUtils.populateJsonNodeValues("key4", JsonNodeFactory.instance.numberNode(1.1f), ValidTypes.DATA_TYPE_FLOAT,
- objectNode);
- JsonUtils.populateJsonNodeValues("key5", JsonNodeFactory.instance.textNode("13213123131"),
- ValidTypes.DATA_TYPE_TIMESTAMP, objectNode);
- assertTrue(objectNode.get("key2").asBoolean());
-
- assertTrue("value".equals(objectNode.get("key1").asText()));
- assertTrue(objectNode.get("key2").asBoolean());
- assertTrue(objectNode.get("key3").asInt() == 1);
- assertTrue(objectNode.get("key4").floatValue() == 1.1f);
- assertTrue("13213123131".equals(objectNode.get("key5").asText()));
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java
deleted file mode 100644
index 60ef24049..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtilsTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * 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.features.model.utils;
-
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ResourceAssignmentUtilsTest {
-
- @Test
- public void testGetArtifactNodeContent() {
- String nodeTemplateName = "nodeTemplateNmae";
- String templateContent = "content";
- Map<String, Object> context = new HashMap<String, Object>();
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".content", templateContent);
-
- String retrievedContent = ResourceAssignmentUtils.getArtifactNodeContent(nodeTemplateName, context);
-
- assertTrue(templateContent.equals(retrievedContent));
- }
-
- @Test
- public void testGetArtifactNodeMapping() {
- String nodeTemplateName = "nodeTemplateNmae";
- String templateContent = "[]";
- Map<String, Object> context = new HashMap<String, Object>();
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".mapping", templateContent);
-
- List<ResourceAssignment> map = ResourceAssignmentUtils.getArtifactNodeMapping(nodeTemplateName, context);
- assertTrue(map.size() == 0);
- }
-
- @Test
- public void testCleanContextTemplateNDictionaryKeys() {
- String recipeName = "recipe";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".", "value1");
- componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + ".", "value2");
- ResourceAssignmentUtils.cleanContextTemplateNDictionaryKeys(componentContext);
-
- assertTrue(componentContext.size() == 1);
- }
-
- @Test
- public void testGetDictionaryKeyValue() {
- String recipeName = "recipe";
- String dictionaryName = "dictionaryKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
- "value1");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setDictionaryName(dictionaryName);
-
- String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceAssignment);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testGetDictionaryKeyValueWithDictionaryDefinition() {
- String recipeName = "recipe";
- String dictionaryName = "dictionaryKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryName,
- "value1");
- ResourceDefinition resourceDefinition = new ResourceDefinition();
- resourceDefinition.setName(dictionaryName);
-
- String value = (String) ResourceAssignmentUtils.getDictionaryKeyValue(componentContext, resourceDefinition);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testGetTemplateKeyValue() {
- String recipeName = "recipe";
- String templateKeyName = "templateKey";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
- componentContext.put(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName,
- "value1");
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName(templateKeyName);
-
- String value = (String) ResourceAssignmentUtils.getTemplateKeyValue(componentContext, resourceAssignment);
- assertTrue("value1".equals(value));
- }
-
- @Test
- public void testSetResourceDataValue() throws Exception {
- String recipeName = "recipe";
- Map<String, Object> componentContext = new HashMap<String, Object>();
- componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);
-
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, null);
- Object value = "value";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue(value.equals(resourceAssignment.getProperty().getValue()));
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_INTEGER, null);
- value = "1";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((int) resourceAssignment.getProperty().getValue() == 1);
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_BOOLEAN, null);
- value = "true";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((boolean) resourceAssignment.getProperty().getValue());
-
- resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_FLOAT, null);
- value = "1.1";
- ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, value);
- assertTrue((float) resourceAssignment.getProperty().getValue() == 1.1f);
- }
-
- @Test
- public void testSetFailedResourceDataValue() throws Exception {
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
- String message = "message";
- ResourceAssignmentUtils.setFailedResourceDataValue(null, resourceAssignment, message);
-
- assertTrue(message.equals(resourceAssignment.getMessage()));
- assertTrue(ConfigModelConstant.STATUS_FAILURE.equals(resourceAssignment.getStatus()));
- }
-
- @Test(expected = ConfigModelException.class)
- public void testAssertTemplateKeyValueNotNull() throws Exception {
- Map<String, Object> componentContext = null;
- ResourceAssignment resourceAssignment = createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "value");
- ResourceAssignmentUtils.assertTemplateKeyValueNotNull(componentContext, resourceAssignment);
- }
-
- @Test
- public void testGenerateResourceDataForAssignments() throws Exception {
- List<ResourceAssignment> assignments = new ArrayList<ResourceAssignment>();
- assignments.add(createResourceAssignment("name1", ValidTypes.DATA_TYPE_STRING, "string"));
- assignments.add(createResourceAssignment("name2", ValidTypes.DATA_TYPE_BOOLEAN, true));
- assignments.add(createResourceAssignment("name3", ValidTypes.DATA_TYPE_INTEGER, 1));
- assignments.add(createResourceAssignment("name4", ValidTypes.DATA_TYPE_FLOAT, 1.1f));
- assignments.add(createResourceAssignment("name5", ValidTypes.DATA_TYPE_TIMESTAMP, "1523908097735"));
- assignments.add(createResourceAssignment("name6", "", new HashMap<String, String>()));
- ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- }
-
- public void testResourceAssignmentForNullEmptyValues() throws Exception {
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode raContent =
- mapper.readTree(new File("src/test/resources/service_templates/ra-content-with-mising-value.json"));
-
- List<ResourceAssignment> assignments =
- mapper.readValue(raContent.toString(), new TypeReference<List<ResourceAssignment>>() {});
-
- ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);
- }
-
- private ResourceAssignment createResourceAssignment(String name, String dataType, Object value) {
- PropertyDefinition property = new PropertyDefinition();
- property.setType(dataType);
- property.setValue(value);
- property.setRequired(true);
- ResourceAssignment ra = new ResourceAssignment();
- ra.setName(name);
- ra.setProperty(property);
- return ra;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java
deleted file mode 100644
index 525dda4e1..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtilsTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.features.model.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.data.ArtifactDefinition;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-
-public class ServiceTemplateUtilsTest {
-
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
-
- @Test
- public void testPopulateVnfNodeProperties() {
- NodeTemplate nodeTemplate = createNodeTemplate();
-
- String nodeTemplateKey = "nodeTemplateKey";
- Map<String, String> context = new HashMap<String, String>();
-
- Map<String, String> result =
- serviceTemplateUtils.populateVnfNodeProperties(nodeTemplateKey, nodeTemplate, context, null);
-
- Assert.assertTrue(result.size() > 0);
- }
-
- @Test
- public void testPopulateNodeTemplateArtifacts() {
- String nodeTemplateKey = "nodeTemplateKey";
- NodeTemplate nodeTemplate = createNodeTemplate();
- Map<String, String> context = new HashMap<String, String>();
-
- Map<String, String> result =
- serviceTemplateUtils.populateNodeTemplateArtifacts(nodeTemplateKey, nodeTemplate, context);
-
- Assert.assertTrue(result.size() > 0);
- }
-
- private NodeTemplate createNodeTemplate() {
- NodeTemplate nodeTemplate = new NodeTemplate();
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put("prop1", "value");
- CapabilityAssignment capabilityAssignment = new CapabilityAssignment();
- capabilityAssignment.setProperties(properties);
- Map<String, CapabilityAssignment> capabilities = new HashMap<String, CapabilityAssignment>();
- capabilities.put("key", capabilityAssignment);
- nodeTemplate.setCapabilities(capabilities);
-
- ArtifactDefinition artifactDefinition = new ArtifactDefinition();
- artifactDefinition.setFile("file");
- artifactDefinition.setDeployPath("deployPath");
- artifactDefinition.setContent("content");
- Map<String, ArtifactDefinition> artifacts = new HashMap<String, ArtifactDefinition>();
- artifacts.put("artifactName1", artifactDefinition);
- nodeTemplate.setArtifacts(artifacts);
-
- return nodeTemplate;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java
deleted file mode 100644
index f73bc1af2..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/utils/TransformationUtilsTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.features.model.utils;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class TransformationUtilsTest {
-
- @Test
- public void testGetJson() {
- Map<String, Object> configparameters = new HashMap<String, Object>();
- configparameters.put("key", "value");
- String json = TransformationUtils.getJson(configparameters);
- assertTrue("{\"key\":\"value\"}".equals(json));
- }
-
- @Test
- public void testGetJsonNodeForString() {
- String content = "{\"key\":\"value\"}";
- JsonNode jsonNodeForString = TransformationUtils.getJsonNodeForString(content);
- assertNotNull(jsonNodeForString);
- }
-
- @Test
- public void testGetMapfromJson() {
- String content = "{\"key\":\"value\"}";
- Map<String, Object> mapfromJson = TransformationUtils.getMapfromJson(content);
- assertTrue(mapfromJson.size() == 1);
- assertTrue("value".equals(mapfromJson.get("key")));
- }
-
- @Test
- public void testGetMapfromJsonString() {
- String content = "{\"key\":\"value\"}";
- Map<String, Object> mapfromJson = TransformationUtils.getMapfromJsonString(content);
- assertTrue(mapfromJson.size() == 1);
- assertTrue("value".equals(mapfromJson.get("key")));
- }
-
- @Test
- public void testConvertJson2RootProperties() throws Exception {
- Map<String, String> context = new HashMap<String, String>();
- String jsonContent = "{\"key\":\"value\"}";
- Map<String, String> convertJson2RootProperties =
- TransformationUtils.convertJson2RootProperties(context, jsonContent);
- assertTrue(convertJson2RootProperties.size() == 1);
- assertTrue("value".equals(convertJson2RootProperties.get("key")));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetJsonNodeAndTreeToValueAndConvertJson2Properties() throws Exception {
- Map<String, String> configparameters = new HashMap<String, String>();
- configparameters.put("key", "value");
- JsonNode jsonNode = TransformationUtils.getJsonNode(configparameters);
- assertNotNull(jsonNode);
-
- Map<String, String> result = TransformationUtils.treeToValue(jsonNode, HashMap.class);
- assertTrue("value".equals(result.get("key")));
-
- result = TransformationUtils.convertJson2Properties(null, jsonNode, null);
- assertTrue("value".equals(result.get("key")));
- }
-
- @Test
- public void testGetJsonSchema() {
- String jsonSchema = TransformationUtils.getJsonSchema(String.class);
- assertNotNull(jsonSchema);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java
deleted file mode 100644
index 72a49ebc7..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.features.model.validator;
-
-import java.nio.charset.Charset;
-import org.apache.commons.io.IOUtils;
-import org.junit.Test;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ServiceTemplateValidationTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateValidationTest.class);
-
- @Test
- public void validateServiceTemplate() {
- try {
- logger.info(" **************** Validating Default *****************");
- String serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
- .getResourceAsStream("service_templates/default.json"), Charset.defaultCharset());
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
- logger.info(" **************** Reqource Assignment *****************");
- serviceTemplateContent = IOUtils.toString(ServiceTemplateValidationTest.class.getClassLoader()
- .getResourceAsStream("service_templates/resource_assignment.json"), Charset.defaultCharset());
- serviceTemplateValidator.validateServiceTemplate(serviceTemplateContent);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java
deleted file mode 100644
index 9c048f48e..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ComponentNodeTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.features.params.service;
-
-import static org.mockito.Matchers.any;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.testing.mock.osgi.MockOsgi;
-import org.junit.After;
-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.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.service.ComponentNodeDelegate;
-import org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.osgi.framework.BundleContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ComponentNodeTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeTest.class);
- @Mock
- private ConfigResourceService configResourceService;
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- BundleContext bundleContext = MockOsgi.newBundleContext();
-
- @Before
- public void before() {
- MockitoAnnotations.initMocks(this);
-
- MockComponentNode mockSvcLogicPlugin = new MockComponentNode();
- bundleContext.registerService(MockComponentNode.class, mockSvcLogicPlugin, null);
-
- 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));
- } catch (SvcLogicException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @After
- public void after() {
-
- }
-
- @Test
- public void testProcess() {
-
- try {
- String serviceTemplateContent = FileUtils.readFileToString(
- new File("src/test/resources/componentnode/default.json"), Charset.defaultCharset());
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
-
- Map<String, String> map = new HashMap<>();
- configModelService.convertServiceTemplate2Properties(serviceTemplateContent, map);
-
- SvcLogicContext ctx = new SvcLogicContext();
- map.forEach((name, value) -> {
- if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
- ctx.setAttribute(name, value);
- }
- });
- ctx.setAttribute("vnf-id", "1234");
-
- ComponentNodeServiceImpl componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
-
- ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
- Map<String, String> inParams = new HashMap<>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
-
- componentNodeDelegate.process(inParams, ctx);
- TransformationUtils.printMap(inParams);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Test(expected = SvcLogicException.class)
- public void testFailure() throws Exception {
- ComponentNodeServiceImpl componentNodeService =
- new ComponentNodeServiceImpl(bundleContext, configResourceService, configRestAdaptorService);
- ComponentNodeDelegate componentNodeDelegate = new ComponentNodeDelegate(componentNodeService);
-
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ConfigModelConstant.PROPERTY_SELECTOR, "generate-configuration");
- SvcLogicContext ctx = new SvcLogicContext();
- componentNodeDelegate.process(inParams, ctx);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java
deleted file mode 100644
index 3e62fafd0..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ConfigModelServiceTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.features.params.service;
-
-import static org.junit.Assert.fail;
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.domain.ConfigModel;
-import org.onap.ccsdk.features.model.domain.ConfigModelContent;
-import org.onap.ccsdk.features.model.service.ConfigModelService;
-import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;
-import org.onap.ccsdk.features.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 ConfigModelServiceTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigModelServiceTest.class);
-
- @Mock
- private ConfigRestAdaptorService configRestAdaptorService;
-
- @Test
- public void testConfigAssignmentInputOutputParams() throws Exception {
-
- String fileContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- context = configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
-
- Assert.assertNotNull("Failed to Prepare Context : ", context);
-
- context.put("request-id", "12345");
- context.put("vnf-id", "vnf12345");
-
- Map<String, String> inparams = new HashMap<String, String>();
- inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
-
- SvcLogicContext inputContext = new SvcLogicContext();
- context.forEach((name, value) -> {
- inputContext.setAttribute(name, value);
- });
-
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
- Assert.assertNotNull("In Param is Null : ", inparams);
- Assert.assertNotNull("Failed to get entity-id in Inparms : ", inparams.get("resource-id"));
- Assert.assertEquals("Failed to get entity-id vlaue in Inparms ", String.valueOf("vnf12345"),
- inparams.get("resource-id"));
- Assert.assertNotNull("Failed to get request-id in Inparms : ", inparams.get("request-id"));
- Assert.assertEquals("Failed to get request-id vlaue in Inparms ", String.valueOf("12345"),
- inparams.get("request-id"));
-
- configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
- logger.info("*************** Output Params *************");
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- }
-
- @Test
- public void testConvertServiceTemplate2PropertiesComplex() throws Exception {
- String fileContent = FileUtils.readFileToString(
- new File("src/test/resources/service_templates/resource_assignment.json"), Charset.defaultCharset());
-
- Map<String, String> context = new HashMap<>();
- context.put("host-password", "1234");
- context.put("host-ip-address", "[123.23.34.45, 123.23.34.45]");
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- configModelServiceImpl.convertServiceTemplate2Properties(fileContent, context);
-
- // TransformationUtils.printMap(context);
-
- Map<String, String> inparams = new HashMap<String, String>();
- inparams.put(ConfigModelConstant.PROPERTY_SELECTOR, "resource-assignment");
- logger.info("Before Input Result: " + inparams);
-
- SvcLogicContext inputContext = new SvcLogicContext();
- context.forEach((name, value) -> {
- inputContext.setAttribute(name, value);
- });
-
- configModelServiceImpl.assignInParamsFromModel(inputContext, inparams);
- logger.info("----------Input Result: " + inparams);
-
- inputContext.setAttribute("assignment-params", "default-assigned");
- configModelServiceImpl.assignOutParamsFromModel(inputContext, inparams);
-
- // TransformationUtils.printProperty(inputContext.toProperties());
-
- }
-
- @Test
- public void testGetNodeTemplateContent() throws Exception {
- String templateContent = "{\"id\":\"id\"}";
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent + ".content",
- templateContent);
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- String content = configModelServiceImpl.getNodeTemplateContent(context, templateContent);
-
- Assert.assertEquals(content, templateContent);
- }
-
- @Test
- public void testGetNodeTemplateMapping() throws Exception {
- String templateContent = "{\"capabilities\":{\"mapping\":{\"properties\":{\"mapping\":[\"test\"]}}}}";
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateContent, templateContent);
-
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- configModelServiceImpl.getNodeTemplateMapping(context, templateContent);
- // Assert.assertEquals(content, templateContent);
- }
-
- @Test
- public void testValidateServiceTemplate() throws Exception {
- ConfigModelServiceImpl configModelServiceImpl = new ConfigModelServiceImpl(configRestAdaptorService);
- ServiceTemplate serviceTemplate = new ServiceTemplate();
-
- try {
- configModelServiceImpl.validateServiceTemplate(null);
- fail("Should have thrown exception");
- } catch (SvcLogicException e) {
- }
-
- try {
- configModelServiceImpl.validateServiceTemplate(serviceTemplate);
- fail("Should have thrown exception");
- } catch (SvcLogicException e) {
- }
-
- Map<String, String> metadata = new HashMap<String, String>();
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR, "author");
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME, "name");
- metadata.put(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION, "version");
- serviceTemplate.setMetadata(metadata);
-
- Assert.assertTrue(configModelServiceImpl.validateServiceTemplate(serviceTemplate));
- }
-
- @Test
- public void testPrepareContext() throws Exception {
- Mockito.when(configRestAdaptorService.getResource(Matchers.anyString(), Matchers.anyString(), Matchers.any()))
- .thenReturn(createConfigModel());
-
- String input = "{\"action-name\": \"resource-assignment-action\"}";
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
-
- Map<String, String> ctx =
- configModelService.prepareContext(null, input, "serviceTemplateName", "serviceTemplateVersion");
- Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
-
- ctx = configModelService.prepareContext(null, input, "{}");
- Assert.assertEquals("resource-assignment-action", ctx.get(ConfigModelConstant.PROPERTY_ACTION_NAME));
- }
-
- @Test
- public void testConvertServiceTemplate2Properties() throws Exception {
- Map<String, String> metadata = new HashMap<String, String>();
- metadata.put("key", "value");
- ServiceTemplate serviceTemplate = new ServiceTemplate();
- serviceTemplate.setMetadata(metadata);
- Map<String, String> context = new HashMap<String, String>();
-
- ConfigModelService configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- Map<String, String> ctx = configModelService.convertServiceTemplate2Properties(serviceTemplate, context);
-
- Assert.assertEquals("value", ctx.get("key"));
- }
-
- private ConfigModel createConfigModel() {
- ConfigModel configModel = new ConfigModel();
- List<ConfigModelContent> configModelContents = new ArrayList<ConfigModelContent>();
- ConfigModelContent configModelContent = new ConfigModelContent();
- configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);
- configModelContent.setContent("{\"description\": \"description\"}");
- configModelContents.add(configModelContent);
- configModel.setConfigModelContents(configModelContents);
- configModel.setPublished("Y");
- return configModel;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java
deleted file mode 100644
index a1e273a84..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ExpressionUtilsTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.features.params.service;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-import org.onap.ccsdk.features.model.utils.ExpressionUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ExpressionUtilsTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ExpressionUtilsTest.class);
-
- @Test
- public void testProcessJsonExpression() throws Exception {
- String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/default.json"),
- Charset.defaultCharset());
-
- SvcLogicContext context = new SvcLogicContext();
- context.setAttribute("host-password", "1234");
- context.setAttribute("host-ip-address", "[\"123.23.34.45\", \"123.23.34.45\"]");
- context.setAttribute("loopback-default", "[\"Sample\", \"Brinda\"]");
-
- Map<String, String> inparams = new HashMap<String, String>();
- ExpressionUtils jsonExpressionUtils = new ExpressionUtils(context, inparams);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(fileContent);
- jsonExpressionUtils.processJsonExpression(rootArray);
-
- }
-
- @Test
- public void testJson2Property() throws Exception {
- String fileContent = FileUtils.readFileToString(new File("src/test/resources/properties/convert.json"),
- Charset.defaultCharset());
-
- List<String> blockKeys = new ArrayList<String>();
- blockKeys.add(
- "interfaces.ResourceAssignmentService.operations.getResourceAssignment.inputs.assignment-mappings");
- blockKeys.add("interfaces.ResourceAssignmentService.operations.getResourceAssignment.outputs");
- blockKeys.add("type");
-
- Map<String, String> workflowMap = new HashMap<>();
- Map<String, String> propertyMap =
- TransformationUtils.convertJson2Properties(workflowMap, fileContent, blockKeys);
-
- TransformationUtils.printMap(propertyMap);
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java
deleted file mode 100644
index e779a361a..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/MockComponentNode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.features.params.service;
-
-import java.util.Map;
-import org.onap.ccsdk.features.model.service.ComponentNode;
-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;
-
-public class MockComponentNode implements ComponentNode {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(MockComponentNode.class);
-
- @Override
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received preCondition ");
- componentContext.put("test-key", "test");
- return true;
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
-
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received Request " + componentContext);
- }
-
- @Override
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received preProcess ");
-
- }
-
- @Override
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- logger.info("Received postProcess ");
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java b/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java
deleted file mode 100644
index 5c89d45ae..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/java/org/onap/ccsdk/features/params/service/ServiceTemplateCreateUtils.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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.features.params.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-
-public class ServiceTemplateCreateUtils {
-
- public void createNodeTypes(String serviceTemplateFileName) throws IOException {
- if (StringUtils.isNotBlank(serviceTemplateFileName)) {
- String fileContent =
- FileUtils.readFileToString(new File(serviceTemplateFileName), Charset.defaultCharset());
- if (StringUtils.isNotBlank(fileContent)) {
- // System.out.println("NodeTypeCreateUtils.createNodeTypes()" +fileContent );
- ServiceTemplate serviceTemplate = TransformationUtils.readValue(fileContent, ServiceTemplate.class);
-
- String formattedServiceTemplateContent = TransformationUtils.getJson(serviceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/default.json"),
- formattedServiceTemplateContent, Charset.defaultCharset());
-
- createVrrNodeTemplate(serviceTemplate);
- createDictionarySchema();
-
- }
- }
- }
-
- public void createNodeTypes(ServiceTemplate serviceTemplate) throws IOException {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, node_types) -> {
-
- if (node_types != null && StringUtils.isNotBlank(node_types.getDerivedFrom())) {
-
- try {
- String fileName = "src/test/resources/node_types/";
- if (ConfigModelConstant.MODEL_TYPE_NODE_VNF.equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "vnf/" + nodeTypeKey + ".json";
- }
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "dg/" + nodeTypeKey + ".json";
- }
- if (ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT
- .equalsIgnoreCase(node_types.getDerivedFrom())) {
- fileName = fileName + "component/" + nodeTypeKey + ".json";
- }
- String content = TransformationUtils.getJson(node_types, true);
- FileUtils.write(new File(fileName), content, Charset.defaultCharset());
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
- System.out.println("NodeTypeCreateUtils.createNodeTypes()" + nodeTypeKey);
- });
- }
-
- }
-
- public void createResourceAssignmentNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
- if (serviceTemplate != null) {
- ServiceTemplate workingServiceTemplate = new ServiceTemplate();
- workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
-
- Map<String, DataType> data_types = new HashMap<String, DataType>();
- data_types.put("datatype-property", serviceTemplate.getDataTypes().get("datatype-property"));
- data_types.put("datatype-resource-assignment",
- serviceTemplate.getDataTypes().get("datatype-resource-assignment"));
-
- workingServiceTemplate.setDataTypes(data_types);
-
- TopologyTemplate topology_template = new TopologyTemplate();
- Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
-
- Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
-
- node_templates.put("base-config-template", node_Templates.get("base-config-template"));
- node_templates.put("licence-template", node_Templates.get("licence-template"));
-
- node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
- node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
-
- topology_template.setNodeTemplates(node_templates);
- topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
-
- Map<String, NodeType> node_types = new HashMap<String, NodeType>();
- node_types.put("artifact-config-template", serviceTemplate.getNodeTypes().get("artifact-config-template"));
- node_types.put("dg-resource-assignment", serviceTemplate.getNodeTypes().get("dg-resource-assignment"));
- node_types.put("component-resource-assignment",
- serviceTemplate.getNodeTypes().get("component-resource-assignment"));
-
- workingServiceTemplate.setNodeTypes(node_types);
- workingServiceTemplate.setTopologyTemplate(topology_template);
-
- String workingServiceTemplateConmtent = TransformationUtils.getJson(workingServiceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/resource_assignment.json"),
- workingServiceTemplateConmtent, Charset.defaultCharset());
-
- File lcmFile = new File(
- "../../../northbound/selfservice-api/provider/src/test/resources/service_templates/resource_assignment.json");
- FileUtils.writeStringToFile(lcmFile, workingServiceTemplateConmtent, Charset.defaultCharset());
-
- File resourceAssignmetFile = new File(
- "../../../plugin/assignment/provider/src/test/resources/service_templates/resource_assignment.json");
- FileUtils.writeStringToFile(resourceAssignmetFile, workingServiceTemplateConmtent,
- Charset.defaultCharset());
-
- System.out.println("NodeTypeCreateUtils.createNodeTemplate() :" + workingServiceTemplateConmtent);
- }
-
- }
-
- public void createVrrNodeTemplate(ServiceTemplate serviceTemplate) throws IOException {
- if (serviceTemplate != null) {
- ServiceTemplate workingServiceTemplate = new ServiceTemplate();
- workingServiceTemplate.setMetadata(serviceTemplate.getMetadata());
-
- TopologyTemplate topology_template = new TopologyTemplate();
- Map<String, NodeTemplate> node_templates = new HashMap<String, NodeTemplate>();
-
- Map<String, NodeTemplate> node_Templates = serviceTemplate.getTopologyTemplate().getNodeTemplates();
-
- node_templates.put("resource-assignment-action", node_Templates.get("resource-assignment-action"));
- node_templates.put("resource-assignment", node_Templates.get("resource-assignment"));
-
- node_templates.put("activate-action", node_Templates.get("activate-action"));
- node_templates.put("base-config-template", node_Templates.get("base-config-template"));
- node_templates.put("licence-template", node_Templates.get("licence-template"));
- node_templates.put("vrr-netconf-device", node_Templates.get("vrr-netconf-device"));
- node_templates.put("get-netconf-config", node_Templates.get("get-netconf-config"));
- node_templates.put("edit-netconf-config", node_Templates.get("edit-netconf-config"));
- node_templates.put("transaction-netconf-baseconfig", node_Templates.get("transaction-netconf-baseconfig"));
-
- topology_template.setNodeTemplates(node_templates);
- topology_template.setInputs(serviceTemplate.getTopologyTemplate().getInputs());
-
- workingServiceTemplate.setTopologyTemplate(topology_template);
-
- String workingServiceTemplateContent = TransformationUtils.getJson(workingServiceTemplate, true);
-
- FileUtils.writeStringToFile(new File("src/test/resources/service_templates/vrr_config.json"),
- workingServiceTemplateContent, Charset.defaultCharset());
-
- }
- }
-
- public void createDictionarySchema() throws IOException {
- String schema = TransformationUtils.getJsonSchema(ResourceDefinition.class);
- FileUtils.writeStringToFile(new File("src/test/resources/dictionary/dictionary_schema.json"), schema,
- Charset.defaultCharset());
- }
-
- public static void main(String[] args) {
- try {
- ServiceTemplateCreateUtils utils = new ServiceTemplateCreateUtils();
- utils.createNodeTypes("src/test/resources/service_templates/default.json");
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json
deleted file mode 100644
index e538b0c48..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/componentnode/default.json
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "metadata": {
- "author": "ks220y@att.com",
- "vendor": "Juniper",
- "os": "XXX",
- "service-type": "AVPN",
- "vnf-type": "VRR",
- "action": "Base Configuration",
- "sub-action": "Generate Configuration",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0"
- },
- "topology_template": {
- "inputs": {
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "vnf-id": {
- "required": true,
- "type": "string"
- },
- "service": {
- "required": true,
- "type": "string"
- },
- "region": {
- "required": true,
- "type": "string"
- },
- "bundle-id": {
- "required": true,
- "type": "string"
- },
- "bundle-mac": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "generate-configuration": {
- "type": "mock-component-generateConfig",
- "interfaces": {
- "org-onap-ccsdk-features-params-service-MockComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "entity-type": "vnf-type",
- "template-content": "sample-template",
- "entity-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "mergedData": "merged Data",
- "status": "status"
- }
- }
- }
- }
- }
- }
- }
- },
- "node_types": {
- "mock-component-generateConfig": {
- "interfaces": {
- "org-onap-ccsdk-features-params-service-MockComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "entity-type": {
- "required": false,
- "type": "string"
- },
- "template-content": {
- "required": false,
- "type": "string"
- },
- "entity-id": {
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "generated-config": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- }
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json b/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json
deleted file mode 100644
index 809db7dea..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/dictionary/dictionary_schema.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "type": "object",
- "properties": {
- "resource-path": {
- "tags": {
- "type": "string"
- },
- "name": {
- "type": "string",
- "required": true
- },
- "type": "string",
- "required": true
- },
- "property": {
- "type": "object",
- "properties": {
- "default": {
- "type": "any"
- },
- "entry_schema": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string"
- }
- }
- },
- "description": {
- "type": "string"
- },
- "type": {
- "type": "string"
- },
- "constraints": {
- "type": "array",
- "items": {
- "type": "object",
- "additionalProperties": {
- "type": "any"
- }
- }
- },
- "value": {
- "type": "any"
- },
- "required": {
- "type": "boolean"
- },
- "status": {
- "type": "string"
- }
- }
- },
- "resource-type": {
- "type": "string",
- "required": true
- },
- "updated-by": {
- "type": "string"
- },
- "sources": {
- "type": "object",
- "required": true,
- "additionalProperties": {
- "type": "object",
- "properties": {
- "type": {
- "type": "string",
- "required": true
- },
- "properties": {
- "type": "object",
- "required": true,
- "properties": {
- "type": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "key": {
- "type": "string"
- },
- "path": {
- "type": "string"
- },
- "url-path": {
- "type": "string"
- },
- "query": {
- "type": "string"
- },
- "input-key-mapping": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "output-key-mapping": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "key-dependencies": {
- "type": "array",
- "items": {
- "type": "string"
- }
- }
- }
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json
deleted file mode 100644
index cb7d08e44..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/properties/convert.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "type": "sdnc-component-getResourceAssignment",
- "interfaces": {
- "ResourceAssignmentService": {
- "operations": {
- "getResourceAssignment": {
- "inputs": {
- "assignment-mappings": [
- {
- "name": "service-name",
- "mapping-field": "service",
- "mapping-category": "SDN",
- "required": true
- },
- {
- "name": "region-name",
- "mapping-field": "region",
- "mapping-category": "SDN",
- "required": true
- }
- ],
- "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",
- "prifix": "get-resource-assignment"
- },
- "outputs": {
- "resource-assignment-status": "success",
- "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"
- }
- }
- }
- }
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json
deleted file mode 100644
index 335a68759..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/properties/default.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "default": "{ \"get_input\" : \"loopback-default\" }",
- "domain": "ethernet",
- "criteria": [
- {
- "value": "dummy301me1",
- "type": "complex",
- "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
- },
- {
- "value": "{ \"get_input\" : \"host-ip-address\" }",
- "type": "simple",
- "nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
- }
- ]
-}
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json
deleted file mode 100644
index e53f0f6cd..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/default.json
+++ /dev/null
@@ -1,591 +0,0 @@
-{
- "metadata" : {
- "author" : "ks220y@att.com",
- "service-template-name" : "VRR-baseconfiguration",
- "service-template-version" : "1.0.0",
- "release" : "1802",
- "service-type" : "AVPN",
- "vnf-type" : "VRR"
- },
- "tosca_definitions_version" : "sdn_config_1_0_0",
- "topology_template" : {
- "inputs" : {
- "request-id" : {
- "required" : true,
- "type" : "string"
- },
- "service-instance-id" : {
- "required" : true,
- "type" : "string"
- },
- "action-name" : {
- "required" : true,
- "type" : "string"
- },
- "scope-type" : {
- "required" : true,
- "type" : "string"
- },
- "hostname" : {
- "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" : "vnf-id",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "vnf-id",
- "dictionary-source" : "input"
- }, {
- "name" : "group-name",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "group-name",
- "dictionary-source" : "input"
- } ]
- }
- }
- }
- },
- "licence-template" : {
- "type" : "artifact-config-template",
- "properties" : {
- "action-names" : [ "resource-assignment-action" ]
- },
- "capabilities" : {
- "content" : {
- "properties" : {
- "content" : "db://licence-template"
- }
- },
- "mapping" : {
- "properties" : {
- "mapping" : [ {
- "name" : "bundle-id",
- "input-param" : true,
- "property" : {
- "type" : "string"
- },
- "dictionary-name" : "bundle-id",
- "dictionary-source" : "input"
- }, {
- "name" : "bundle-mac",
- "input-param" : true,
- "property" : {
- "type" : "string",
- "required" : true
- },
- "dictionary-name" : "bundle-mac",
- "dictionary-source" : "input"
- } ]
- }
- }
- }
- },
- "resource-assignment-action" : {
- "type" : "dg-resource-assignment",
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "ResourceAssignment" : { }
- }
- }
- },
- "capabilities" : {
- "dg-node" : { }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "resource-assignment",
- "relationship" : "tosca.relationships.DependsOn"
- }
- }
- },
- "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"
- }
- }
- },
- "resource-assignment" : {
- "type" : "component-resource-assignment",
- "interfaces" : {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "resource-type" : "vnf-type",
- "template-names" : [ "base-config-template", "licence-template" ],
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs" : {
- "resource-assignment-params" : "",
- "status" : ""
- }
- }
- }
- }
- },
- "capabilities" : {
- "component-node" : { }
- }
- },
- "generate-configuration" : {
- "type" : "component-config-generator",
- "interfaces" : {
- "org-onap-ccsdk-features-generator-service-ConfigGeneratorNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : "{ \"get_input\" : \"action-name\" }",
- "resource-type" : "vnf-type",
- "request-id" : "{ \"get_input\" : \"request-id\" }",
- "resource-id" : "{ \"get_input\" : \"vnf-id\" }",
- "template-name" : "base-config-template"
- },
- "outputs" : {
- "generated-config" : "",
- "status" : ""
- }
- }
- }
- }
- },
- "capabilities" : {
- "component-node" : { }
- }
- }
- }
- },
- "artifact_types" : {
- "artifact-template-velocity" : {
- "description" : " Velocity Template used for Configuration",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "vtl" ]
- },
- "artifact-mapping-resource" : {
- "description" : " Velocity Template Resource Mapping File used along with Configuration template",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "json" ]
- },
- "artifact-script-python" : {
- "description" : " Python Script Template used for Configuration",
- "version" : "1.0.0",
- "derived_from" : "tosca.artifacts.Implementation",
- "file_ext" : [ "py" ]
- }
- },
- "node_types" : {
- "dg-resource-assignment" : {
- "description" : "This is Resource Assignment 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.capabilities.Content",
- "properties" : {
- "type" : {
- "required" : false,
- "type" : "string",
- "default" : "json"
- },
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
- }
- },
- "requirements" : {
- "component-dependency" : {
- "capability" : "component-node",
- "node" : "component-resource-assignment",
- "relationship" : "tosca.relationships.DependsOn"
- }
- },
- "interfaces" : {
- "CONFIG" : {
- "operations" : {
- "ResourceAssignment" : {
- "inputs" : {
- "params" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.DG"
- },
- "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.capabilities.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"
- },
- "artifact-config-template" : {
- "description" : "This is Configuration Velocity Template",
- "version" : "1.0.0",
- "properties" : {
- "action-names" : {
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "type" : "string"
- }
- },
- "content" : {
- "required" : false,
- "type" : "string"
- },
- "mapping" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-resource-assignment"
- }
- }
- },
- "capabilities" : {
- "content" : {
- "type" : "tosca.capabilities.Content",
- "properties" : {
- "content" : {
- "required" : true,
- "type" : "string"
- }
- }
- },
- "mapping" : {
- "type" : "tosca.capabilities.Mapping",
- "properties" : {
- "mapping" : {
- "required" : false,
- "type" : "list",
- "entry_schema" : {
- "type" : "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.Artifact"
- },
- "component-resource-assignment" : {
- "description" : "This is Resource Assignment Component API",
- "version" : "1.0.0",
- "capabilities" : {
- "component-node" : {
- "type" : "tosca.capabilities.Node"
- }
- },
- "interfaces" : {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode" : {
- "operations" : {
- "process" : {
- "inputs" : {
- "action-name" : {
- "description" : "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"
- },
- "handler-name" : {
- "description" : "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"
- },
- "resource-type" : {
- "required" : false,
- "type" : "string"
- },
- "template-names" : {
- "description" : "Name of the Artifact Node Templates, to get the template Content.",
- "required" : true,
- "type" : "list",
- "entry_schema" : {
- "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" : "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required" : true,
- "type" : "string"
- }
- },
- "outputs" : {
- "resource-assignment-params" : {
- "required" : true,
- "type" : "string"
- },
- "status" : {
- "required" : true,
- "type" : "string"
- }
- }
- }
- }
- }
- },
- "derived_from" : "tosca.nodes.Component"
- },
- "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-features-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"
- },
- "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-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"
- },
- "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.features.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"
- }
- },
- "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"
- }
- }
-} \ No newline at end of file
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json
deleted file mode 100644
index 72332d1b3..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/ra-content-with-mising-value.json
+++ /dev/null
@@ -1,265 +0,0 @@
-[
- {
- "name": "security-manager-resource-key",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "security-manager-resource-key",
- "dictionary-source": "input"
- },
- {
- "name": "security-manager-resource-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "security-manager-resource-name",
- "dictionary-source": "input"
- },
- {
- "name": "snmp-server-ipv4-addresses",
- "input-param": true,
- "property": {
- "type": "list",
- "required": true,
- "entry_schema": {
- "type": "string"
- }
- },
- "dictionary-name": "snmp-server-ipv4-addresses",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "asn-region",
- "complex-code"
- ]
- },
- {
- "name": "snmp-community",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "snmp-community",
- "dictionary-source": "nsm",
- "dependencies": [
- "security-manager-resource-name",
- "security-manager-resource-key"
- ],
- "version": 0
- },
- {
- "name": "lo0-local-ipv4-address",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "lo0-local-ipv4-address",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "adig-urlb-route-reflectors",
- "property": {
- "description": "",
- "required": true,
- "type": "list",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": "dt-adig-urlb-route-reflectors"
- }
- },
- "input-param": false,
- "dictionary-name": "adig-urlb-route-reflectors",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "region"
- ],
- "version": 0
- },
- {
- "name": "bundle-id",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "bundle-id",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "uplink-1-unit",
- "property": {
- "description": "",
- "required": true,
- "type": "integer",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "uplink-1-unit",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "uplink-2-unit",
- "property": {
- "description": "",
- "required": true,
- "type": "integer",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "uplink-2-unit",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "lo10-local-ipv4-address",
- "property": {
- "description": "",
- "required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {
-
- }
- ],
- "value": {
-
- },
- "entry_schema": {
- "type": ""
- }
- },
- "input-param": false,
- "dictionary-name": "lo10-local-ipv4-address",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "complex-code",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "complex-code",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "country-code",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "country-code",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- },
- {
- "name": "hostname",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "hostname",
- "dictionary-source": "input",
- "version": 0
- },
- {
- "name": "region",
- "property": {
- "required": true,
- "type": "string"
- },
- "dictionary-name": "region",
- "dictionary-source": "network-resource-discovery",
- "dependencies": [
- "hostname"
- ],
- "version": 0
- }
-] \ No newline at end of file
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json
deleted file mode 100644
index cbea6a82c..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/resource_assignment.json
+++ /dev/null
@@ -1,407 +0,0 @@
-{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "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": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- },
- "node_types": {
- "dg-resource-assignment": {
- "description": "This is Resource Assignment 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.capabilities.Content",
- "properties": {
- "type": {
- "required": false,
- "type": "string",
- "default": "json"
- },
- "content": {
- "required": true,
- "type": "string"
- }
- }
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "component-resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- },
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
- "inputs": {
- "params": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-property"
- }
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.DG"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "capabilities": {
- "component-node": {
- "type": "tosca.capabilities.Node"
- }
- },
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "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"
- },
- "handler-name": {
- "description": "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"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "template-names": {
- "description": "Name of the Artifact Node Templates, to get the template Content.",
- "required": true,
- "type": "list",
- "entry_schema": {
- "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": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "artifact-config-template": {
- "description": "This is Configuration Velocity Template",
- "version": "1.0.0",
- "properties": {
- "action-names": {
- "required": true,
- "type": "list",
- "entry_schema": {
- "type": "string"
- }
- },
- "content": {
- "required": false,
- "type": "string"
- },
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- },
- "capabilities": {
- "content": {
- "type": "tosca.capabilities.Content",
- "properties": {
- "content": {
- "required": true,
- "type": "string"
- }
- }
- },
- "mapping": {
- "type": "tosca.capabilities.Mapping",
- "properties": {
- "mapping": {
- "required": false,
- "type": "list",
- "entry_schema": {
- "type": "datatype-resource-assignment"
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Artifact"
- }
- },
- "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/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl
deleted file mode 100644
index ce7745bb7..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/base-config-template.vtl
+++ /dev/null
@@ -1 +0,0 @@
-This is sample Base Configuration for ${bundle-id} for ${bundle-mac} \ No newline at end of file
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl
deleted file mode 100644
index e69de29bb..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/velocity/licence-template.vtl
+++ /dev/null
diff --git a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json b/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json
deleted file mode 100644
index 8c87f2d34..000000000
--- a/blueprints-processor/plugin/model-provider/src/test/resources/service_templates/vrr_config.json
+++ /dev/null
@@ -1,171 +0,0 @@
-{
- "metadata": {
- "author": "ks220y@att.com",
- "service-template-name": "VRR-baseconfiguration",
- "service-template-version": "1.0.0",
- "release": "1802",
- "service-type": "AVPN",
- "vnf-type": "VRR"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "service-instance-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "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": "vnf-id",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "vnf-id",
- "dictionary-source": "input"
- },
- {
- "name": "group-name",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "group-name",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment-action": {
- "type": "dg-resource-assignment",
- "interfaces": {
- "CONFIG": {
- "operations": {
- "ResourceAssignment": {
-
- }
- }
- }
- },
- "capabilities": {
- "dg-node": {
-
- }
- },
- "requirements": {
- "component-dependency": {
- "capability": "component-node",
- "node": "resource-assignment",
- "relationship": "tosca.relationships.DependsOn"
- }
- }
- },
- "licence-template": {
- "type": "artifact-config-template",
- "properties": {
- "action-names": [
- "resource-assignment-action"
- ]
- },
- "capabilities": {
- "content": {
- "properties": {
- "content": "db://licence-template"
- }
- },
- "mapping": {
- "properties": {
- "mapping": [
- {
- "name": "bundle-id",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "bundle-id",
- "dictionary-source": "input"
- },
- {
- "name": "bundle-mac",
- "input-param": true,
- "property": {
- "type": "string",
- "required": true
- },
- "dictionary-name": "bundle-mac",
- "dictionary-source": "input"
- }
- ]
- }
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "interfaces": {
- "org-onap-ccsdk-features-assignment-service-ConfigAssignmentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": "{ \"get_input\" : \"action-name\" }",
- "resource-type": "vnf-type",
- "template-names": [
- "base-config-template",
- "licence-template"
- ],
- "request-id": "{ \"get_input\" : \"request-id\" }",
- "resource-id": "{ \"get_input\" : \"vnf-id\" }"
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "capabilities": {
- "component-node": {
-
- }
- }
- }
- }
- }
-} \ No newline at end of file