aboutsummaryrefslogtreecommitdiffstats
path: root/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-03-29 13:00:07 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-29 13:00:07 +0000
commit4d2c0fae422489c14350a95f46325da8d9573ecf (patch)
treeeda9056389193e973d3562df56df43442c07c1c9 /components/model-catalog/blueprint-model/test-blueprint/baseconfiguration
parent0dfd513f0210324d8a2c4295b8c6c4746298086f (diff)
parent13a13e62b4c01db42c7488f9b36d4667ad3e2321 (diff)
Merge "Add Restconf Kotlin script sample"
Diffstat (limited to 'components/model-catalog/blueprint-model/test-blueprint/baseconfiguration')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json36
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json139
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json2
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/DefaultRestconf.cba.kts37
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts25
5 files changed, 221 insertions, 18 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index a8329b837..fdc18c56d 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -278,6 +278,29 @@
}
}
},
+ "activate-restconf": {
+ "type": "component-restconf-executor",
+ "interfaces": {
+ "ComponentRestconfExecutor": {
+ "operations": {
+ "process": {
+ "implementation": {
+ "primary": "component-script"
+ },
+ "inputs": {
+ "script-type": "kotlin",
+ "script-class-reference": "DefaultRestconf_cba$MountNEditConfigure",
+ "instance-dependencies": []
+ },
+ "outputs": {
+ "response-data": "",
+ "status": "success"
+ }
+ }
+ }
+ }
+ }
+ },
"sample-netconf-device": {
"type": "vnf-netconf-device",
"capabilities": {
@@ -366,6 +389,19 @@
}
}
},
+ "activate-restconf": {
+ "steps": {
+ "activate-process": {
+ "description": "Activate Restconf flow",
+ "target": "activate-restconf",
+ "activities": [
+ {
+ "call_operation": "ComponentRestconfExecutor.process"
+ }
+ ]
+ }
+ }
+ },
"assign-activate": {
"inputs": {
"assign-activate-properties": {
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
index 3658a260d..07e4df140 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/node_types.json
@@ -136,6 +136,16 @@
"operations": {
"process": {
"inputs": {
+ "resolution-key": {
+ "description": "Key for service instance related correlation.",
+ "required": false,
+ "type": "string"
+ },
+ "store-result": {
+ "description": "Whether or not to store the output.",
+ "required": false,
+ "type": "boolean"
+ },
"resource-type": {
"description": "Request type.",
"required": false,
@@ -186,6 +196,71 @@
},
"derived_from": "tosca.nodes.Component"
},
+ "component-restconf-executor": {
+ "description": "This is Restconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "interfaces": {
+ "ComponentRestconfExecutor": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "script-type": {
+ "description": "Script type, kotlin type is supported",
+ "required": true,
+ "type": "string",
+ "constraints": [
+ {
+ "valid_values": [
+ "kotlin",
+ "jython",
+ "internal"
+ ]
+ }
+ ],
+ "default": "internal"
+ },
+ "script-class-reference": {
+ "description": "Kotlin Script class name or jython script name.",
+ "required": true,
+ "type": "string"
+ },
+ "instance-dependencies": {
+ "description": "Instance names to inject to Jython or Kotlin Script.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "dynamic-properties": {
+ "description": "Dynamic Json Content or DSL Json reference.",
+ "required": false,
+ "type": "json"
+ }
+ },
+ "outputs": {
+ "response-data": {
+ "description": "Execution Response Data in JSON format.",
+ "required": false,
+ "type": "string"
+ },
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+ },
"dg-generic": {
"description": "This is Generic Directed Graph Type",
"version": "1.0.0",
@@ -205,6 +280,48 @@
},
"derived_from": "tosca.nodes.Workflow"
},
+ "source-capability": {
+ "description": "This is Component Resource Source Node Type",
+ "version": "1.0.0",
+ "properties": {
+ "script-type": {
+ "required": true,
+ "type": "string",
+ "constraints": [
+ {
+ "valid_values": [
+ "kotlin",
+ "internal",
+ "jython"
+ ]
+ }
+ ],
+ "default": "kotlin"
+ },
+ "script-class-reference": {
+ "description": "Capability reference name for internal and kotlin, for jython script file path",
+ "required": true,
+ "type": "string"
+ },
+ "instance-dependencies": {
+ "description": "Instance dependency Names to Inject to Kotlin / Jython Script.",
+ "required": false,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "key-dependencies": {
+ "description": "Resource Resolution dependency dictionary names.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.ResourceSource"
+ },
"source-input": {
"description": "This is Input Resource Source Node Type",
"version": "1.0.0",
@@ -223,7 +340,7 @@
},
"derived_from": "tosca.nodes.ResourceSource"
},
- "source-processor-db": {
+ "source-primary-db": {
"description": "This is Database Resource Source Node Type",
"version": "1.0.0",
"properties": {
@@ -287,6 +404,26 @@
],
"default": "JSON"
},
+ "verb": {
+ "required": false,
+ "type": "string",
+ "constraints": [
+ {
+ "valid_values": [
+ "GET",
+ "POST",
+ "DELETE",
+ "PUT"
+ ]
+ }
+ ],
+ "default": "GET"
+ },
+ "payload": {
+ "required": false,
+ "type": "string",
+ "default": ""
+ },
"endpoint-selector": {
"required": false,
"type": "string"
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json
index 6e3d5e94f..d926aa3fc 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/resources_definition_types.json
@@ -27,7 +27,7 @@
"properties": {}
},
"processor-db": {
- "type": "source-processor-db",
+ "type": "source-primary-db",
"properties": {
"endpoint-selector": "dynamic-db-source",
"query": "SELECT artifact_name FROM sdnctl.BLUEPRINT_RUNTIME where artifact_version=\"1.0.0\"",
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/DefaultRestconf.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/DefaultRestconf.cba.kts
new file mode 100644
index 000000000..770c36360
--- /dev/null
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/DefaultRestconf.cba.kts
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.RestconfComponentFunction
+import org.slf4j.LoggerFactory
+
+open class MountNEditConfigure : RestconfComponentFunction() {
+
+ val log = LoggerFactory.getLogger(MountNEditConfigure::class.java)!!
+
+ override fun getName(): String {
+ return "MountNEditConfigure"
+ }
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ log.info("processing request..")
+
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("processing request..")
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts
index a471349ef..de2f15d2e 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Scripts/kotlin/ResourceAssignmentProcessor.cba.kts
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,31 +15,23 @@
* limitations under the License.
*/
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.*
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintScriptsService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.slf4j.LoggerFactory
open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() {
- lateinit var resourceAssignment: ResourceAssignment
+ private val log = LoggerFactory.getLogger(ScriptResourceAssignmentProcessor::class.java)!!
override fun getName(): String {
- return "resource-assignment-processor-custom-capability"
+ return "ScriptResourceAssignmentProcessor"
}
- override fun process(resourceAssignment: ResourceAssignment) {
- this.resourceAssignment = resourceAssignment
+ override fun process(executionRequest: ResourceAssignment) {
+ log.info("Processing input")
}
- override fun prepareResponse(): ResourceAssignment {
- return resourceAssignment
+ override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ log.info("Recovering input")
}
-
- override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- TODO("To Implement")
- }
-
} \ No newline at end of file