summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-20 15:55:29 -0500
committerBrinda Santh Muthuramalingam <bs2796@att.com>2018-11-30 20:45:33 +0000
commitdf2a3d8a475d02ec842c1ca612567b106bb21843 (patch)
tree2b4d9b5ef654eaf351f074f6e7971a7899295f63 /components
parent358090593a21cb73668a53cfc3e69c1b4a761953 (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')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt16
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt28
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json6
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml34
4 files changed, 76 insertions, 8 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 4764479a..f73fb727 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 9da5b0ee..84ba1047 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()
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 269fd0cf..9d1172fc 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -60,7 +60,7 @@
"artifacts": {
"dg-activate-process": {
"type": "artifact-directed-graph",
- "file": "Plans/ActivateProcess.bpmn"
+ "file": "Plans/CONFIG_ActivateNetconf_1.0.0.xml"
}
}
},
@@ -230,9 +230,9 @@
}
},
"steps": {
- "call-resource-assignment": {
+ "activate-process": {
"description": "Netconf Activation Workflow",
- "target": "resource-assignment",
+ "target": "activate-process",
"activities": [
{
"call_operation": "ResourceAssignmentComponent.process"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml
new file mode 100644
index 00000000..d256bbd2
--- /dev/null
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.
+ -->
+
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
+ <method rpc='ActivateNetconf' mode='sync'>
+ <block atomic="true">
+ <execute plugin="resource-assignment" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <return status='success'>
+ </return>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file