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.resource.audit
19 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
20 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor
21 import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
22 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
23 import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
24 import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
25 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute
26 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateAttribute
27 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTypeComponent
28 import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
29 import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions
31 class ResourceAuditDefinitions : AbstractBluePrintDefinitions() {
33 override fun serviceTemplate(): ServiceTemplate {
34 return defaultServiceTemplate()
38 fun ResourceAuditDefinitions.defaultServiceTemplate() =
40 name = "resource-audit",
42 author = "Brinda Santh Muthuramalingam",
43 tags = "brinda, tosca"
48 workflow(id = "config-collect", description = "Collect the configuration for Device") {
50 property(id = "device-id", type = BluePrintConstants.DATA_TYPE_STRING, required = true, description = "")
51 property(id = "sources", type = BluePrintConstants.DATA_TYPE_LIST, required = true, description = "") {
52 entrySchema(BluePrintConstants.DATA_TYPE_STRING)
56 property(id = "response-data", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
58 getNodeTemplateAttribute(
59 nodeTemplateId = "config-collector",
60 attributeId = ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA
64 property(id = "status", required = true, type = BluePrintConstants.DATA_TYPE_STRING, description = "") {
65 value(BluePrintConstants.STATUS_SUCCESS)
68 step(id = "config-collector", target = "config-collector", description = "Collect the Configuration")
71 val configCollectorComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(
72 id = "config-collector",
73 description = "Config collector component"
76 definedOperation(description = "Config Collector Operation") {
78 type(BluePrintConstants.SCRIPT_KOTLIN)
79 scriptClassReference("cba.resource.audit.functions.ConfigCollector")
82 status(getAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS))
83 responseData(getAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA))
87 nodeTemplate(configCollectorComponent)
90 nodeType(BluePrintTypes.nodeTypeComponent())
91 nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())