summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-05-17 10:07:14 -0400
committerSteve Siani <alphonse.steve.siani.djissitchi@ibm.com>2019-05-23 00:15:54 -0400
commitbcc6c4dfe9db06e0dab22472b11a4939255091e5 (patch)
tree62a4bbcf1ec53d9cbc165bcf7dfc9a04211f67de /ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
parent145662ff6a41e0e46a23e8eedf53f30581f8ab64 (diff)
Add cli test blueprints
Change-Id: Ieab385f5e4ae60cca3d86f22c4304e4867e6fa96 Issue-ID: CCSDK-1335 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts')
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts40
1 files changed, 40 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
index 136d01143..18d4a4797 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/scripts/InternalSimpleCli.cba.kts
@@ -18,6 +18,8 @@
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.CliComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.ComponentCliExecutor
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.slf4j.LoggerFactory
open class TestCliScriptFunction : CliComponentFunction() {
@@ -36,3 +38,41 @@ open class TestCliScriptFunction : CliComponentFunction() {
log.info("Executing Recovery")
}
}
+
+
+open class Check : CliComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(CliComponentFunction::class.java)!!
+
+ override fun getName(): String {
+ return "Check"
+ }
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ // Get the Device Information from the DSL Model
+ val deviceInformation = bluePrintRuntimeService.resolveDSLExpression("device-properties")
+
+ // Get the Client Service
+ val sshClientService = bluePrintSshLibPropertyService().blueprintSshClientService(deviceInformation)
+
+ sshClientService.startSessionNB()
+
+ // Read Commands
+ val commands = readCommandLinesFromArtifact("command-template")
+
+ // Execute multiple Commands
+ val responseLog = sshClientService.executeCommandsNB(commands, 5000)
+
+ // Close Session
+ sshClientService.closeSessionNB()
+
+ // Set the Response Data
+ setAttribute(ComponentCliExecutor.RESPONSE_DATA, responseLog.asJsonPrimitive())
+
+ log.info("Executing process")
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Executing Recovery")
+ }
+}