From 1d7e5f7f80281823cbfc4a2e2ea9833c6412de8c Mon Sep 17 00:00:00 2001 From: Steve Siani Date: Thu, 12 Sep 2019 15:38:23 -0400 Subject: Add wrapper function for Cli and Netconf executor Issue-ID: CCSDK-1707 Signed-off-by: Steve Siani Change-Id: I2c29d0135b8252cd21ed3d139516ac637c846927 --- .../src/main/kotlin/internal/scripts/InternalSimpleCli.kt | 9 +++++---- .../functions/cli/executor/CliExecutorExtensions.kt | 13 +++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'ms/blueprintsprocessor') diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt index cf27cc2de..15365e176 100644 --- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt +++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt @@ -19,11 +19,12 @@ package internal.scripts import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.cliDeviceInfo +import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.blueprintsprocessor.ssh.sshClientService import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive -import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService + import org.slf4j.LoggerFactory open class TestCliScriptFunction : AbstractScriptComponentFunction() { @@ -54,10 +55,10 @@ open class Check : AbstractScriptComponentFunction() { override suspend fun processNB(executionRequest: ExecutionServiceInput) { // Get the Device Information from the DSL Model - val deviceInformation = bluePrintRuntimeService.resolveDSLExpression("device-properties") + val deviceInformation = cliDeviceInfo("device-properties") // Get the Client Service - val sshClientService = BluePrintDependencyService.sshClientService(deviceInformation) + val sshClientService = getSshClientService(deviceInformation) sshClientService.startSessionNB() diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt index bc9b7103c..ad95759a9 100644 --- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt +++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt @@ -17,7 +17,20 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor +import com.fasterxml.jackson.databind.JsonNode +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BlueprintSshClientService +import org.onap.ccsdk.cds.blueprintsprocessor.ssh.sshClientService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService + /** * Register the CLI module exposed dependency */ +fun AbstractComponentFunction.cliDeviceInfo(requirementName: String): JsonNode { + return bluePrintRuntimeService.resolveDSLExpression(requirementName) +} + +fun AbstractComponentFunction.getSshClientService(cliDeviceInfo: JsonNode): BlueprintSshClientService { + return BluePrintDependencyService.sshClientService(cliDeviceInfo) +} -- cgit 1.2.3-korg