2 * Copyright © 2019 IBM.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package cba.scripts.capability.cli
19 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.componentScriptExecutor
20 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
21 import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
22 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.artifactTypeTemplateVelocity
23 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTypeComponent
24 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
25 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions
27 class CapabilityCliDefinitions : AbstractBluePrintDefinitions() {
29 override fun serviceTemplate(): ServiceTemplate {
30 return defaultServiceTemplate()
34 fun CapabilityCliDefinitions.defaultServiceTemplate() =
35 serviceTemplate(name = "capability-cli",
37 author = "Brinda Santh Muthuramalingam",
38 tags = "brinda, tosca") {
40 dsl("device-properties", """"
43 "host": { "get_input": "hostname" },
44 "username": { "get_input": "username" },
45 "password": { "get_input": "password" }
51 workflow(id = "check", description = "CLI Check Workflow") {
53 property(id = "hostname", type = "string", required = true, description = "")
54 property(id = "username", type = "string", required = true, description = "")
55 property(id = "password", type = "string", required = true, description = "")
56 property(id = "data", type = "json", required = true, description = "")
59 property(id = "status", required = true, type = "string", description = "")
61 step(id = "check", target = "check", description = "Calling check script node")
65 nodeTemplate(id = "check",
66 type = "component-script-executor",
68 operation(interfaceName = "process", description = "") {
70 property(id = "script-type", value = "kotlin")
71 property(id = "script-class-reference", value = "cba.scripts.capability.cli.Check")
74 property(id = "response-data", value = "")
75 property(id = "status", value = "success")
78 artifact(id = "command-template", type = "artifact-template-velocity", file = "Templates/check-command-template.vtl")
82 artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
83 nodeType(BluePrintTypes.nodeTypeComponent())
84 nodeType(BluePrintTypes.componentScriptExecutor())