aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/restconf-executor/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src')
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt18
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts24
2 files changed, 18 insertions, 24 deletions
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
index 0ce0edca5..53828d769 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt
@@ -23,7 +23,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
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
@@ -33,8 +32,6 @@ import org.springframework.stereotype.Component
open class ComponentRestconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) :
AbstractComponentFunction() {
- private val log = LoggerFactory.getLogger(ComponentRestconfExecutor::class.java)
-
lateinit var scriptComponent: RestconfComponentFunction
companion object {
@@ -43,7 +40,7 @@ open class ComponentRestconfExecutor(private var componentFunctionScriptingServi
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
}
- override fun process(executionRequest: ExecutionServiceInput) {
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val scriptType = operationInputs.getAsString(SCRIPT_TYPE)
val scriptClassReference = operationInputs.getAsString(SCRIPT_CLASS_REFERENCE)
@@ -59,15 +56,18 @@ open class ComponentRestconfExecutor(private var componentFunctionScriptingServi
/**
* Populate the Script Instance based on the Type
*/
- scriptComponent = componentFunctionScriptingService.scriptInstance<RestconfComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
+ scriptComponent = componentFunctionScriptingService
+ .scriptInstance<RestconfComponentFunction>(this, scriptType,
+ scriptClassReference, scriptDependencies)
checkNotNull(scriptComponent) { "failed to get restconf script component" }
- scriptComponent.process(executionServiceInput)
+ // Handles both script processing and error handling
+ scriptComponent.executeScript(executionServiceInput)
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- scriptComponent.recover(runtimeException, executionRequest)
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ bluePrintRuntimeService.getBluePrintError()
+ .addError("Failed in ComponentRestconfExecutor : ${runtimeException.message}")
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts
index 88feddf49..4ab7ddc4b 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/scripts/InternalSimpleRestconf.cba.kts
@@ -13,15 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-@file:Suppress("unused") //TODO remove this line!
+@file:Suppress("unused")
-
-import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.RestconfComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
open class EditConfigure : RestconfComponentFunction() {
@@ -32,12 +27,12 @@ open class EditConfigure : RestconfComponentFunction() {
return "EditConfigure"
}
- override fun process(executionRequest: ExecutionServiceInput) {
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
//val webClientService = restClientService("odlparent")
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -50,13 +45,12 @@ open class MountNEditConfigure : RestconfComponentFunction() {
return "MountNEditConfigure"
}
- override fun process(executionRequest: ExecutionServiceInput) {
- val webClientService = restClientService("odlparent")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ log.info("Processing Restconf Request : ${executionRequest.payload}")
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ addError("failed in restconf execution : ${runtimeException.message}")
}
}
@@ -72,11 +66,11 @@ open class TestRestconfConfigure : RestconfComponentFunction() {
return "TestRestconfConfigure"
}
- override fun process(executionRequest: ExecutionServiceInput) {
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
log.info("processing request..")
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("recovering..")
}
}