diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-11-20 15:55:29 -0500 |
---|---|---|
committer | Brinda Santh Muthuramalingam <bs2796@att.com> | 2018-11-30 20:45:33 +0000 |
commit | 6af718b8552503a7dfce2e4e1f61a12eb0837921 (patch) | |
tree | ec017ba99713c2f07b7bcb944e61d343df3a44aa /components/core | |
parent | 7af6a923ef993bed14d0fc5f769c3766c94b88b3 (diff) |
Add directed graph reterive and execution service.
Change-Id: Ia31af4d14e38e6229166cda0f39fa090764ef1cb
Issue-ID: CCSDK-672
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/core')
2 files changed, 39 insertions, 5 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt index 4764479ad..f73fb727d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt @@ -57,10 +57,15 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
}
- fun workflowStepNodeTemplate(workFlowName: String, stepName: String): NodeTemplate {
- val nodeTemplateName = workflowStepByName(workFlowName, stepName).target
+ fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String {
+ return workflowStepByName(workFlowName, stepName).target
?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
- return nodeTemplateByName(nodeTemplateName)
+ }
+
+ fun workflowFirstStepNodeTemplate(workFlowName: String): String {
+ val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
+ ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
+ return workflowStepNodeTemplate(workFlowName, firstStepName)
}
fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String {
@@ -156,6 +161,11 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) { ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
}
+ fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition {
+ return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0)
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
+ }
+
fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment {
return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt index 9da5b0ee4..84ba10473 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt @@ -48,6 +48,14 @@ interface BluePrintRuntimeService<T> { fun cleanRuntime()
+ fun getAsString(key: String): String?
+
+ fun getAsBoolean(key: String): Boolean?
+
+ fun getAsInt(key: String): Int?
+
+ fun getAsDouble(key: String): Double?
+
/*
Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
*/
@@ -139,9 +147,25 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl return get(key)
}
+ override fun getAsString(key: String): String? {
+ return get(key).asText()
+ }
+
+ override fun getAsBoolean(key: String): Boolean? {
+ return get(key).asBoolean()
+ }
+
+ override fun getAsInt(key: String): Int? {
+ return get(key).asInt()
+ }
+
+ override fun getAsDouble(key: String): Double? {
+ return get(key).asDouble()
+ }
+
/*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
+ Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
+ */
override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
|