summaryrefslogtreecommitdiffstats
path: root/components/resource-dict/src
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-13 00:20:34 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-13 00:47:05 +0000
commitd082ba55645cd4765c0189c591db2f2e8f654520 (patch)
tree1b98f0df2f21c5000cb1a18eaf07eccac806baf1 /components/resource-dict/src
parentcb0fe8c1d1ef6962a2e96cea9838454e28adccbe (diff)
Controller Blueprints Microservice
Add resource assignment enhancement and validation to blueprint validation and enhancement. Change-Id: I547760012e7014cfbb7a1e3a1d8ffb77edc9b6a2 Issue-ID: CCSDK-562 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/resource-dict/src')
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt9
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt3
2 files changed, 12 insertions, 0 deletions
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index fae509d25..089fce0b1 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -25,6 +25,8 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
import java.io.Serializable
/**
@@ -65,6 +67,13 @@ open class ResourceAssignmentValidationDefaultService : ResourceAssignmentValida
open fun validateSources(resourceAssignments: List<ResourceAssignment>) {
log.info("validating resource assignment sources")
+ resourceAssignments.forEach { resourceAssignment ->
+ try {
+ ResourceSourceMappingFactory.getRegisterSourceMapping(resourceAssignment.dictionarySource!!)
+ } catch (e: BluePrintException) {
+ validationMessage.appendln(e.message + format(" for resource assignment({})", resourceAssignment.name))
+ }
+ }
}
open fun validateTemplateNDictionaryKeys(resourceAssignments: List<ResourceAssignment>) {
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt
index 370e1ec8c..6c83e5f93 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceDefinitionRepoService.kt
@@ -18,11 +18,13 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoFileService
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRepoService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition
import reactor.core.publisher.Mono
+
/**
* ResourceDefinitionRepoService.
*
@@ -30,6 +32,7 @@ import reactor.core.publisher.Mono
*/
interface ResourceDefinitionRepoService : BluePrintRepoService {
+ @Throws(BluePrintException::class)
fun getResourceDefinition(resourceDefinitionName: String): Mono<ResourceDefinition>
}