From ea84b36447601d0d6a633ae708b72c6aaae6dc67 Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Tue, 3 Dec 2019 16:15:20 -0500 Subject: Refractor controller blueprint modules Move controller blueprints modules to blueprints processor and change the maven group name. Fix test cba and model type paths Fix dependencies issues. Issue-ID: CCSDK-1663 Signed-off-by: Brinda Santh Change-Id: I3654e6f04811470327acba90e8a452b66e3e189b --- .../modules/resource-dict/pom.xml | 43 ------- .../resource/dict/ResourceDefinition.kt | 108 ---------------- .../resource/dict/ResourceDictionaryConstants.kt | 38 ------ .../dict/factory/ResourceSourceMappingFactory.kt | 46 ------- .../service/ResourceAssignmentValidationService.kt | 142 --------------------- .../dict/utils/BulkResourceSequencingUtils.kt | 119 ----------------- .../resource/dict/utils/ResourceDictionaryUtils.kt | 99 -------------- .../resource/dict/ResourceDefinitionTest.java | 61 --------- .../factory/ResourceSourceMappingFactoryTest.java | 43 ------- .../ResourceAssignmentValidationServiceTest.kt | 66 ---------- .../utils/BulkResourceSequencingUtilsTest.java | 40 ------ .../dict/utils/ResourceDictionaryUtilsTest.java | 100 --------------- .../dict/utils/ResourceDictionaryTestUtils.kt | 31 ----- .../resources/data/resource-assignment-input.json | 10 -- .../src/test/resources/validation/cyclic.json | 111 ---------------- .../src/test/resources/validation/duplicate.json | 110 ---------------- .../src/test/resources/validation/success.json | 110 ---------------- 17 files changed, 1277 deletions(-) delete mode 100644 ms/controllerblueprints/modules/resource-dict/pom.xml delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json (limited to 'ms/controllerblueprints/modules/resource-dict') diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml deleted file mode 100644 index b6803d4be..000000000 --- a/ms/controllerblueprints/modules/resource-dict/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - 4.0.0 - - - org.onap.ccsdk.cds.controllerblueprints - modules - 0.7.0-SNAPSHOT - - - resource-dict - - Controller Blueprints Resource Dictionary - - - - org.onap.ccsdk.cds.controllerblueprints - blueprint-core - - - org.jetbrains.kotlin - kotlin-test-junit - test - - - diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt deleted file mode 100644 index 10930ffab..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright © 2018 IBM. - * Modifications Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict - -import com.fasterxml.jackson.annotation.JsonFormat -import com.fasterxml.jackson.annotation.JsonProperty -import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate -import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition -import java.io.Serializable -import java.util.Date - -open class ResourceDefinition { - - @JsonProperty(value = "name", required = true) - lateinit var name: String - - @JsonProperty(value = "property", required = true) - lateinit var property: PropertyDefinition - - var tags: String? = null - - @JsonProperty(value = "updated-by") - lateinit var updatedBy: String - - @JsonProperty(value = "sources", required = true) - lateinit var sources: MutableMap -} - -open class ResourceAssignment { - - @JsonProperty(value = "name", required = true) - lateinit var name: String - - @JsonProperty(value = "property") - var property: PropertyDefinition? = null - - @JsonProperty("input-param") - var inputParameter: Boolean = false - - @JsonProperty("dictionary-name") - var dictionaryName: String? = null - - @JsonProperty("dictionary-source") - var dictionarySource: String? = null - - /** Modified Source definition, Capability Source will use for script reference changes, - * Rest Source will use for extra headers etc **/ - @JsonProperty("dictionary-source-definition") - var dictionarySourceDefinition: NodeTemplate? = null - - /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/ - @JsonProperty("dependencies") - var dependencies: MutableList? = null - - @JsonProperty("version") - var version: Int = 0 - - @JsonProperty("status") - var status: String? = null - - @JsonProperty("message") - var message: String? = null - - @JsonProperty("updated-date") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - var updatedDate: Date? = null - - @JsonProperty("updated-by") - var updatedBy: String? = null - - override fun toString(): String { - return """ - [ - name = $name - status = $status - required = ${property?.required} - dependencies = $dependencies - dictionaryName = $dictionaryName - dictionarySource = $dictionarySource - ] - """.trimIndent() - } -} - -/** - * Interface for Source Definitions (ex Input Source, - * Default Source, Database Source, Rest Sources, etc) - */ -interface ResourceSource : Serializable - -open class ResourceSourceMapping { - lateinit var resourceSourceMappings: MutableMap -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt deleted file mode 100644 index 366a4dcd4..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.cds.controllerblueprints.resource.dict - -/** - * ResourceDictionaryConstants - * - * @author Brinda Santh - */ -object ResourceDictionaryConstants { - - const val SOURCE_INPUT = "input" - const val SOURCE_DEFAULT = "default" - const val PROCESSOR_DB = "processor-db" - - const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary" - - const val PROPERTY_TYPE = "type" - const val PROPERTY_INPUT_KEY_MAPPING = "input-key-mapping" - const val PROPERTY_OUTPUT_KEY_MAPPING = "output-key-mapping" - const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies" - - const val PATH_RESOURCE_DEFINITION_TYPE = "resources_definition_types" -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt deleted file mode 100644 index f8dea9871..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.factory - -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.format -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping - -/** - * ResourceSourceMappingFactory. - * - * @author Brinda Santh - */ -object ResourceSourceMappingFactory { - - private val resourceSourceMappings: MutableMap = hashMapOf() - - fun registerSourceMapping(sourceInstance: String, nodeTypeName: String) { - resourceSourceMappings[sourceInstance] = nodeTypeName - } - - fun getRegisterSourceMapping(sourceInstance: String): String { - return resourceSourceMappings[sourceInstance] - ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance)) - } - - fun getRegisterSourceMapping(): ResourceSourceMapping { - val resourceSourceMapping = ResourceSourceMapping() - resourceSourceMapping.resourceSourceMappings = resourceSourceMappings - return resourceSourceMapping - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt deleted file mode 100644 index a5171d25c..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt +++ /dev/null @@ -1,142 +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.cds.controllerblueprints.resource.dict.service - -import org.apache.commons.collections.CollectionUtils -import org.apache.commons.lang3.StringUtils -import org.apache.commons.lang3.text.StrBuilder -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.slf4j.LoggerFactory -import java.io.Serializable - -/** - * ResourceAssignmentValidationService. - * - * @author Brinda Santh - */ -interface ResourceAssignmentValidationService : Serializable { - - @Throws(BluePrintException::class) - fun validate(resourceAssignments: List): Boolean -} - -/** - * ResourceAssignmentValidationServiceImpl. - * - * @author Brinda Santh - */ -open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService { - - private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceImpl::class.java) - - open var resourceAssignmentMap: Map = hashMapOf() - open val validationMessage = StrBuilder() - - override fun validate(resourceAssignments: List): Boolean { - try { - validateTemplateNDictionaryKeys(resourceAssignments) - validateCyclicDependency(resourceAssignments) - if (StringUtils.isNotBlank(validationMessage)) { - throw BluePrintException("Resource Assignment Validation Failure") - } - } catch (e: Exception) { - throw BluePrintException("Resource Assignment Validation :" + validationMessage.toString(), e) - } - return true - } - - open fun validateTemplateNDictionaryKeys(resourceAssignments: List) { - - resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap() - - // Check the Resource Assignment has Duplicate Key Names - val duplicateKeyNames = resourceAssignments.groupBy { it.name } - .filter { it.value.size > 1 } - .map { it.key } - - if (duplicateKeyNames.isNotEmpty()) { - validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames)) - } - - // Collect all the dependencies as a single list - val dependenciesNames = resourceAssignments.mapNotNull { it.dependencies }.flatten() - - // Check all the dependencies keys have Resource Assignment mappings. - val notPresentDictionaries = dependenciesNames.filter { !resourceAssignmentMap.containsKey(it) }.distinct() - if (notPresentDictionaries.isNotEmpty()) { - validationMessage.appendln(String.format("No assignments for Dictionary Keys (%s)", notPresentDictionaries)) - } - - if (StringUtils.isNotBlank(validationMessage)) { - throw BluePrintException("Resource Assignment Validation Failure") - } - } - - open fun validateCyclicDependency(resourceAssignments: List) { - val startResourceAssignment = ResourceAssignment() - startResourceAssignment.name = "*" - - val topologySorting = TopologicalSortingUtils() - - resourceAssignmentMap.map { it.value }.map { resourceAssignment -> - if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { - resourceAssignment.dependencies!!.map { - log.trace("Topological Graph link from {} to {}", it, resourceAssignment.name) - topologySorting.add(resourceAssignmentMap[it]!!, resourceAssignment) - } - } else { - topologySorting.add(startResourceAssignment, resourceAssignment) - } - } - - if (!topologySorting.isDag) { - val graph = getTopologicalGraph(topologySorting) - validationMessage.appendln("Cyclic Dependency :$graph") - } - } - - open fun getTopologicalGraph(topologySorting: TopologicalSortingUtils): String { - val s = StringBuilder() - val neighbors = topologySorting.getNeighbors() - - neighbors.forEach { v, vs -> - if (v.name == "*") { - s.append("\n * -> [") - for (resourceAssignment in vs) { - s.append( - "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name + - ")," - ) - } - s.append("]") - } else { - s.append("\n (" + v.dictionaryName + ":" + v.name + ") -> [") - for (resourceAssignment in vs) { - s.append( - "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name + - ")," - ) - } - s.append("]") - } - } - return s.toString() - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt deleted file mode 100644 index 9a5523113..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.utils - -import org.apache.commons.collections.CollectionUtils -import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString -import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.slf4j.LoggerFactory -import java.util.ArrayList - -/** - * BulkResourceSequencingUtils. - * - * @author Brinda Santh - */ -object BulkResourceSequencingUtils { - - private val log = LoggerFactory.getLogger(BulkResourceSequencingUtils::class.java) - - @JvmStatic - fun process(resourceAssignments: MutableList): List> { - val resourceAssignmentMap: MutableMap = hashMapOf() - val sequenceBatchResourceAssignment = ArrayList>() - log.trace("Assignments ({})", resourceAssignments) - // Prepare Map - resourceAssignments.forEach { resourceAssignment -> - log.trace("Processing Key ({})", resourceAssignment.name) - resourceAssignmentMap.put(resourceAssignment.name, resourceAssignment) - } - - val startResourceAssignment = ResourceAssignment() - startResourceAssignment.name = "*" - - // Preepare Sorting Map - val topologySorting = TopologicalSortingUtils() - resourceAssignmentMap.forEach { _, resourceAssignment -> - // Get the dependencies from the assignment sources, if not get from the Resource Assignment dependencies - if (resourceAssignment.dictionarySourceDefinition != null) { - val dependencies = resourceAssignment.dictionarySourceDefinition?.properties?.get("key-dependencies")?.asListOfString() - dependencies?.forEach { dependency -> - topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment) - } - } else if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { - for (dependency in resourceAssignment.dependencies!!) { - topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment) - } - } else { - topologySorting.add(startResourceAssignment, resourceAssignment) - } - } - - val sequencedResourceAssignments: MutableList = topologySorting.topSort()!! as MutableList - log.trace("Sorted Sequenced Assignments ({})", sequencedResourceAssignments) - - var batchResourceAssignment: MutableList? = null - var batchAssignmentName: MutableList? = null - - // Prepare Sorting - sequencedResourceAssignments.forEachIndexed { index, resourceAssignment -> - - var previousResourceAssignment: ResourceAssignment? = null - - if (index > 0) { - previousResourceAssignment = sequencedResourceAssignments[index - 1] - } - - var dependencyPresence = false - if (batchAssignmentName != null && resourceAssignment.dependencies != null) { - dependencyPresence = CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.dependencies) - } - - log.trace( - "({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name, - batchAssignmentName, resourceAssignment.dependencies, dependencyPresence - ) - - if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null && - resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true) && - !dependencyPresence - ) { - batchResourceAssignment!!.add(resourceAssignment) - batchAssignmentName!!.add(resourceAssignment.name) - } else { - if (batchResourceAssignment != null) { - sequenceBatchResourceAssignment.add(batchResourceAssignment!!) - log.trace("Created old Set ({})", batchAssignmentName) - } - batchResourceAssignment = arrayListOf() - batchResourceAssignment!!.add(resourceAssignment) - - batchAssignmentName = arrayListOf() - batchAssignmentName!!.add(resourceAssignment.name) - } - - if (index == sequencedResourceAssignments.size - 1) { - log.trace("Created old Set ({})", batchAssignmentName) - sequenceBatchResourceAssignment.add(batchResourceAssignment!!) - } - } - log.info("Batched Sequence : ({})", sequenceBatchResourceAssignment) - - return sequenceBatchResourceAssignment - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt deleted file mode 100644 index f26c5098f..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.cds.controllerblueprints.resource.dict.utils - -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.node.NullNode -import org.apache.commons.collections.MapUtils -import org.apache.commons.lang3.StringUtils -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate -import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants -import org.slf4j.LoggerFactory -import java.io.File - -object ResourceDictionaryUtils { - private val log = LoggerFactory.getLogger(ResourceDictionaryUtils::class.java) - - @JvmStatic - fun populateSourceMapping( - resourceAssignment: ResourceAssignment, - resourceDefinition: ResourceDefinition - ) { - - if (StringUtils.isBlank(resourceAssignment.dictionarySource)) { - - if (MapUtils.isNotEmpty(resourceDefinition.sources)) { - val source = findFirstSource(resourceDefinition.sources) - - // Populate and Assign First Source - if (StringUtils.isNotBlank(source)) { - // Set Dictionary Source - resourceAssignment.dictionarySource = source - } else { - resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT - } - log.info("auto map resourceAssignment : {}", resourceAssignment) - } else { - resourceAssignment.dictionarySource = ResourceDictionaryConstants.SOURCE_INPUT - } - } - } - - @JvmStatic - fun findFirstSource(sources: Map): String? { - var source: String? = null - if (MapUtils.isNotEmpty(sources)) { - source = sources.keys.stream().findFirst().get() - } - return source - } - - @JvmStatic - fun assignInputs(data: JsonNode, context: MutableMap) { - log.trace("assignInputs from input JSON ({})", data.toString()) - data.fields().forEach { field -> - val valueNode: JsonNode = data.at("/".plus(field.key)) ?: NullNode.getInstance() - - val path = BluePrintConstants.PATH_INPUTS.plus(BluePrintConstants.PATH_DIVIDER).plus(field.key) - log.trace("setting path ({}), values ({})", path, valueNode) - context[path] = valueNode - } - } - - fun getResourceAssignmentFromFile(filePath: String): List { - return JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java) - ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)") - } - - fun writeResourceDefinitionTypes(basePath: String, resourceDefinitions: List) { - val resourceDefinitionMap = resourceDefinitions.map { it.name to it }.toMap() - writeResourceDefinitionTypes(basePath, resourceDefinitionMap) - } - - fun writeResourceDefinitionTypes(basePath: String, resourceDefinitionMap: Map) { - val typePath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR) - .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json") - val resourceDefinitionContent = JacksonUtils.getJson(resourceDefinitionMap.toSortedMap(), true) - BluePrintFileUtils.writeDefinitionFile(typePath, resourceDefinitionContent) - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java deleted file mode 100644 index 111476b5e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java +++ /dev/null @@ -1,61 +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.cds.controllerblueprints.resource.dict; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ResourceDefinitionTest { - private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class); - private String basePath = "./../../../../components/model-catalog/resource-dictionary/starter-dictionary"; - - @Test - public void testDictionaryDefinitionInputSource() { - - String fileName = basePath + "/input-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionDefaultSource() { - - String fileName = basePath + "/default-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionDBSource() { - - String fileName = basePath + "/db-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for processor-db type", resourceDefinition); - } - - @Test - public void testDictionaryDefinitionMDSALSource() { - String fileName = basePath + "/mdsal-source.json"; - ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class); - Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition); - } - -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java deleted file mode 100644 index eae944ad9..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.factory; - -import org.junit.Test; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping; -import org.springframework.util.Assert; - -public class ResourceSourceMappingFactoryTest { - - @Test - public void testRegisterResourceMapping() { - - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("processor-db", "source-db"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("sdnc", "source-rest"); - ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("aai-data", "source-rest"); - - String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("processor-db"); - Assert.notNull(nodeTypeName, "Failed to get processor-db mapping"); - - ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping(); - Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping"); - Assert.notNull(resourceSourceMapping.getResourceSourceMappings(), "Failed to get resource source mappings"); - - } - -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt deleted file mode 100644 index 77af5dbe0..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.service - -import org.junit.Assert -import org.junit.Before -import org.junit.Test -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils -import org.slf4j.LoggerFactory - -/** - * ResourceAssignmentValidationServiceTest. - * - * @author Brinda Santh - */ -class ResourceAssignmentValidationServiceTest { - - private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceTest::class.java) - @Before - fun setUp() { - // Setup dummy Source Instance Mapping - ResourceDictionaryTestUtils.setUpResourceSourceMapping() - } - - @Test - fun testValidateSuccess() { - log.info("**************** testValidateSuccess *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/success.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - val result = resourceAssignmentValidator.validate(assignments!!) - Assert.assertTrue("Failed to Validate", result) - } - - @Test(expected = BluePrintException::class) - fun testValidateDuplicate() { - log.info(" **************** testValidateDuplicate *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/duplicate.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - resourceAssignmentValidator.validate(assignments!!) - } - - @Test(expected = BluePrintException::class) - fun testValidateCyclic() { - log.info(" **************** testValidateCyclic *****************") - val assignments = JacksonUtils.getListFromClassPathFile("validation/cyclic.json", ResourceAssignment::class.java) - val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl() - resourceAssignmentValidator.validate(assignments!!) - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java deleted file mode 100644 index 30b4d4544..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.utils; - -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment; - -import java.util.List; - -/** - * BulkResourceSequencingUtils. - * - * @author Brinda Santh - */ -public class BulkResourceSequencingUtilsTest { - - @Test - public void testProcess() { - List assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class); - Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments); - BulkResourceSequencingUtils.process(assignments); - } - -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java deleted file mode 100644 index 8004d2ca2..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java +++ /dev/null @@ -1,100 +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.cds.controllerblueprints.resource.dict.utils; - -import com.fasterxml.jackson.databind.JsonNode; -import org.junit.Assert; -import org.junit.Test; -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants; -import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate; -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition; -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.HashMap; -import java.util.Map; - -/** - * ResourceDictionaryUtilsTest. - * - * @author Brinda Santh - */ -public class ResourceDictionaryUtilsTest { - private static final Logger log = LoggerFactory.getLogger(ResourceDictionaryUtilsTest.class); - - @Test - public void testPopulateSourceMapping() { - - ResourceAssignment resourceAssignment = new ResourceAssignment(); - resourceAssignment.setName("sample-assignment"); - ResourceDefinition resourceDefinition = new ResourceDefinition(); - Map sources = new HashMap<>(); - resourceDefinition.setSources(sources); - // To Check Empty Source - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Empty source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, resourceAssignment.getDictionarySource()); - - // To Check First Source - resourceAssignment.setDictionarySource(null); - sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate()); - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected First source Default, but.", - ResourceDictionaryConstants.SOURCE_DEFAULT, - resourceAssignment.getDictionarySource()); - - // To Check Assigned Source - resourceAssignment.setDictionarySource(ResourceDictionaryConstants.PROCESSOR_DB); - ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition); - Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.PROCESSOR_DB, resourceAssignment.getDictionarySource()); - - } - - @Test - public void testFindFirstSource() { - //To check if Empty Source - Map sources = new HashMap<>(); - String firstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertNull("Source populated, which is not expected.", firstSource); - - // TO check the first Source - sources.put(ResourceDictionaryConstants.SOURCE_INPUT, new NodeTemplate()); - String inputFirstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource); - - // TO check the multiple Source - sources.put(ResourceDictionaryConstants.PROCESSOR_DB, new NodeTemplate()); - String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources); - Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource); - - } - - @Test - public void testAssignInputs() { - JsonNode data = JacksonUtils.Companion.jsonNodeFromClassPathFile("data/resource-assignment-input.json"); - Map context = new HashMap<>(); - ResourceDictionaryUtils.assignInputs(data, context); - String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue"); - log.info("populated context {}", context); - Assert.assertTrue(String.format("failed to get variable : %s", path), context.containsKey(path)); - - } - -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt deleted file mode 100644 index 639ed05d3..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.cds.controllerblueprints.resource.dict.utils - -import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory - -object ResourceDictionaryTestUtils { - - @JvmStatic - fun setUpResourceSourceMapping() { - ResourceSourceMappingFactory.registerSourceMapping("processor-db", "source-db") - ResourceSourceMappingFactory.registerSourceMapping("input", "source-input") - ResourceSourceMappingFactory.registerSourceMapping("default", "source-default") - ResourceSourceMappingFactory.registerSourceMapping("sdnc", "source-rest") - ResourceSourceMappingFactory.registerSourceMapping("aai-data", "source-rest") - } -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json deleted file mode 100644 index d79c90682..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "intValue" : 1, - "floatValue" : 1.34, - "booleanValue" : true, - "stringValue" : "sample-String", - "timeValue" : "2018-09-29", - "arrayStringValue" : ["one", "two"], - "mapValue" : {"profile_name1":"profile_name1", - "profile_name2":"profile_name2"} -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json deleted file mode 100644 index f58c7a705..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json +++ /dev/null @@ -1,111 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "managed-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "processor-db", - "dependencies": [ - "bundle-mac", - "managed-ip1" - ] - } -] diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json deleted file mode 100644 index 13a4c9f3e..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "processor-db", - "dependencies": [ - "bundle-mac" - ] - } -] diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json deleted file mode 100644 index 79925bfac..000000000 --- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json +++ /dev/null @@ -1,110 +0,0 @@ -[ - { - "name": "vnf-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "service-instance-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "service-instance-id", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "bundle-id", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-id", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-ip", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "bundle-ip", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id" - ] - }, - { - "name": "bundle-mac", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "bundle-mac", - "dictionary-source": "sdnc", - "dependencies": [ - "vnf-id", - "bundle-id" - ] - }, - { - "name": "managed-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "vnf-name", - "input-param": true, - "property": { - "type": "string", - "required": true - }, - "dictionary-name": "vnf-name", - "dictionary-source": "input", - "dependencies": [] - }, - { - "name": "managed-ip1", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "managed-ip1", - "dictionary-source": "sdnc", - "dependencies": [ - "loopback-ip" - ] - }, - { - "name": "loopback-ip", - "input-param": true, - "property": { - "type": "string" - }, - "dictionary-name": "loopback-ip", - "dictionary-source": "processor-db", - "dependencies": [ - "bundle-mac" - ] - } -] -- cgit 1.2.3-korg