summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/netconf-executor/src
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-07-18 16:59:19 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-07-23 15:09:32 -0400
commita0140dea9c608d745767574ac621ca0060a2bddc (patch)
treee09a1a3f34b4d5c2c7988385a375d8f3cac64a1d /ms/blueprintsprocessor/functions/netconf-executor/src
parent4e7621ef49d87745df4eb05a4c7279eb2a1356ad (diff)
Refactor Netconf script component parent.
Change-Id: Ibbec8cd5785372a89e14a86d4e6ff7f9fed4aad2 Issue-ID: CCSDK-1499 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com> Signed-off-by: Steve Siani <alphonse.steve.siani.djissitchi@ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/netconf-executor/src')
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt8
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt (renamed from ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt)0
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt17
3 files changed, 20 insertions, 5 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
index 663daf54e..cdee3903b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.controllerblueprints.core.getAsString
import org.springframework.beans.factory.config.ConfigurableBeanFactory
@@ -39,7 +40,7 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
}
- lateinit var scriptComponent: NetconfComponentFunction
+ lateinit var scriptComponent: AbstractScriptComponentFunction
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
@@ -54,8 +55,9 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
scriptDependencies.add(instanceName.textValue())
}
- scriptComponent = componentFunctionScriptingService.scriptInstance<NetconfComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
+ scriptComponent = componentFunctionScriptingService
+ .scriptInstance<AbstractScriptComponentFunction>(this, scriptType,
+ scriptClassReference, scriptDependencies)
checkNotNull(scriptComponent) { "failed to get netconf script component" }
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
index 510621b2e..510621b2e 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ScriptComponentExtensions.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
index 575117b15..8a08268d8 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
@@ -26,7 +26,7 @@ import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -61,8 +61,21 @@ class ComponentNetconfExecutorTest {
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
"./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
- val executionContext = bluePrintRuntimeService.getExecutionContext()
+ val assignmentParams = "{\n" +
+ " \"ipAddress\": \"127.0.0.1\",\n" +
+ " \"hostName\": \"vnf-host\"\n" +
+ " }"
+
+ val json = """{
+ "hostname" : "127.0.0.1"
+ }
+ """.trimIndent()
+ bluePrintRuntimeService.assignInputs(json.asJsonType())
+ bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams))
+
+ val executionContext = bluePrintRuntimeService.getExecutionContext()
componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService