return objectMapper.writeValueAsString(any)\r
}\r
\r
+ @JvmStatic\r
+ fun <T> getListFromJsonNode(node: JsonNode, valueType: Class<T>): List<T>? {\r
+ return getListFromJson(node.toString(), valueType)\r
+ }\r
+\r
@JvmStatic\r
fun <T> getListFromJson(content: String, valueType: Class<T>): List<T>? {\r
val objectMapper = jacksonObjectMapper()\r
return objectMapper.readValue(content, typeRef)\r
}\r
\r
+ @JvmStatic\r
+ fun <T> getMapFromFile(fileName: String, valueType: Class<T>): MutableMap<String, T>? {\r
+ val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset())\r
+ ?: throw BluePrintException(format("Failed to read json file : {}", fileName))\r
+ return getMapFromJson(content, valueType)\r
+ }\r
+\r
@JvmStatic\r
fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {\r
if (BluePrintTypes.validPrimitiveTypes().contains(type)) {\r
"resource-id": {
"get_input": "hostname"
},
+ "artifact-prefix-names": [
+ "baseconfig"
+ ],
"template-content": {
"get_artifact": [
"SELF",
-{
- "assignments": "Sample Assignments"
-}
\ No newline at end of file
+[
+ {
+ "name": "service-instance-id",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "dependencies": [
+ ]
+ },
+ {
+ "name": "vnf-id",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "vnf-id",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "vnf_name",
+ "input-param": false,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "vnf_name",
+ "dictionary-source": "mdsal",
+ "dependencies": [
+ "service-instance-id",
+ "vnf-id"
+ ]
+ }
+]
"required": true,
"type": "string"
},
+ "artifact-prefix-names": {
+ "required": false,
+ "description": "Template , Resource Assignment Artifact Prefix names",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
"template-content": {
"description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
"required": true,
--- /dev/null
+{
+ "service-instance-id": {
+ "name": "service-instance-id",
+ "tags": "service-instance-id, tosca.datatypes.Root, data_type",
+ "updated-by": "Singal, Kapil <ks220y@att.com>",
+ "property": {
+ "description": "To be provided",
+ "type": "string"
+ },
+ "sources": {
+ "input": {
+ "type": "source-input",
+ "properties": {}
+ }
+ }
+ },
+ "vnf-id": {
+ "name": "vnf-id",
+ "tags": "vnf-id",
+ "updated-by": "Singal, Kapil <ks220y@att.com>",
+ "property": {
+ "description": "vnf-id",
+ "type": "string"
+ },
+ "sources": {
+ "input": {
+ "type": "source-input",
+ "properties": {}
+ }
+ }
+ },
+ "vnf_name": {
+ "name": "vnf_name",
+ "tags": "vnf_name",
+ "updated-by": "Singal, Kapil <ks220y@att.com>",
+ "property": {
+ "description": "vnf_name",
+ "type": "string"
+ },
+ "sources": {
+ "mdsal": {
+ "type": "source-rest",
+ "properties": {
+ "type": "JSON",
+ "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name",
+ "path": "/param/0/value",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance-id",
+ "vnf-id": "vnf-id"
+ },
+ "output-key-mapping": {
+ "vnf_name": "value"
+ },
+ "key-dependencies": [
+ "service-instance-id",
+ "vnf-id"
+ ]
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-{
-
-}
\ No newline at end of file
"operations": {\r
"process": {\r
"inputs": {\r
- "template-name": {\r
+ "template-name": {\r
"description": "Service Template Name.",\r
"required": true,\r
"type": "string"\r
},\r
- "template-version": {\r
+ "template-version": {\r
"description": "Service Template Version.",\r
"required": true,\r
"type": "string"\r
"type": "string"\r
}\r
},\r
+ "artifact-prefix-names": {\r
+ "required": false,\r
+ "description": "Template , Resource Assignment Artifact Prefix names",\r
+ "type": "list",\r
+ "entry_schema": {\r
+ "type": "string"\r
+ }\r
+ },\r
"request-id": {\r
"description": "Request Id, Unique Id for the request.",\r
"required": true,\r
+++ /dev/null
-/*
- * Copyright © 2018 IBM.
- * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.resource.dict
-
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
-import org.slf4j.LoggerFactory
-
-abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssignment, ResourceAssignment> {
-
- private val log = LoggerFactory.getLogger(ResourceAssignmentProcessor::class.java)
-
- private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
-
- open fun setBlueprintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
- }
-
- open fun getBlueprintRuntimeService(): BluePrintRuntimeService<*> {
- return this.bluePrintRuntimeService!!
- }
-
- override fun prepareRequest(resourceAssignment: ResourceAssignment): ResourceAssignment {
- log.info("prepareRequest...")
- return resourceAssignment
- }
-
- override fun prepareResponse(): ResourceAssignment {
- log.info("Preparing Response...")
- return ResourceAssignment()
- }
-
- override fun apply(executionServiceInput: ResourceAssignment): ResourceAssignment {
- prepareRequest(executionServiceInput)
- process(executionServiceInput)
- return prepareResponse()
- }
-
- override abstract fun process(executionRequest: ResourceAssignment)
-
- override abstract fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment)
-}
\ No newline at end of file