aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/netconf-executor
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-27 13:22:51 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-04-01 10:43:53 -0400
commit40072d3dcc1d0193bba1ea9432c13ac24857be55 (patch)
tree2fe78015e772c4cbab4fd52184530b9e52c8c3af /ms/blueprintsprocessor/functions/netconf-executor
parent38300292cbce3bb0500593f3cc44fe129cf5c877 (diff)
Improve function interfaces
Change-Id: I24f45d39ac05491a4217101e00bcbf8d122e4e1a Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/netconf-executor')
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt17
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml2
2 files changed, 9 insertions, 10 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 2980de98a..663daf54e 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
@@ -24,7 +24,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.controllerblueprints.core.getAsString
-import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Component
@@ -34,18 +33,15 @@ import org.springframework.stereotype.Component
open class ComponentNetconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
: AbstractComponentFunction() {
- private val log = LoggerFactory.getLogger(ComponentNetconfExecutor::class.java)
-
companion object {
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
}
-
lateinit var scriptComponent: NetconfComponentFunction
- override fun process(executionRequest: ExecutionServiceInput) {
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
@@ -64,12 +60,13 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
checkNotNull(scriptComponent) { "failed to get netconf script component" }
- scriptComponent.process(executionServiceInput)
- }
-
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- scriptComponent.recover(runtimeException, executionRequest)
+ // Handles both script processing and error handling
+ scriptComponent.executeScript(executionServiceInput)
}
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ bluePrintRuntimeService.getBluePrintError()
+ .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
index 355cd3ace..cc7ac83ad 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/logback-test.xml
@@ -26,7 +26,9 @@
<logger name="org.springframework.test" level="warn"/>
<logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="info"/>
+ <logger name="org.apache.sshd" level="warn"/>
<logger name="org.onap.ccsdk.cds.blueprintsprocessor" level="info"/>
+ <logger name="org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core" level="warn"/>
<root level="warn">
<appender-ref ref="STDOUT"/>