summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org
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/org
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/org')
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt15
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt1
2 files changed, 16 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
index 6dcffca09..c7f35f7c8 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliComponentFunction.kt
@@ -22,6 +22,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.Reso
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.SshLibConstants
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.service.BluePrintSshLibPropertyService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
abstract class CliComponentFunction : AbstractScriptComponentFunction() {
@@ -32,6 +35,18 @@ abstract class CliComponentFunction : AbstractScriptComponentFunction() {
functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
+ open suspend fun readCommandLinesFromArtifact(artifactName: String): List<String> {
+ val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ val file = normalizedFile(bluePrintRuntimeService.bluePrintContext().rootPath, artifactDefinition.file)
+ return file.readNBLines()
+ }
+
+ suspend fun generateMessage(artifactName: String, json: String): String {
+ val templateService = BluePrintTemplateService()
+ return templateService.generateContent(bluePrintRuntimeService, nodeTemplateName, artifactName, json, true)
+ }
+
+
fun generateMessage(artifactName: String): String {
return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
}
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
index 8c58272f1..0c1c52320 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutor.kt
@@ -35,6 +35,7 @@ open class ComponentCliExecutor(private var componentFunctionScriptingService: C
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
+ const val RESPONSE_DATA = "response-data"
}
private lateinit var scriptComponent: CliComponentFunction