summaryrefslogtreecommitdiffstats
path: root/components/resource-dict/src/main
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
commit5eebfaa6ac0d4cb4fdf20d19ead7cd0303fc6f29 (patch)
treeb6d19d00518737a74ca27689ac818b33eb1c915e /components/resource-dict/src/main
parent04d5531c0e299b8ea99cb22a8058b88cb3385cb2 (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/main')
-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 fae509d2..089fce0b 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 370e1ec8..6c83e5f9 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>
}