aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <bs2796@att.com>2019-01-08 11:17:05 -0500
committerBrinda Santh Muthuramalingam <bs2796@att.com>2019-01-10 19:59:36 +0000
commit07d02ef8e38763d753dbf412a59c0fa7a6fb80e3 (patch)
tree8af51a89494b7a56dcf3bec2de80a876844839b3 /components
parent07603763ab93f4ad57587430e96a3bd82b7eab80 (diff)
Add relationships type files load structure.
Change-Id: I1be3ba493956674b476058094e05d681ce358711 Issue-ID: CCSDK-746 Signed-off-by: Muthuramalingam, Brinda Santh <bs2796@att.com>
Diffstat (limited to 'components')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt22
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt38
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt2
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt14
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json51
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json98
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json44
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json1
-rw-r--r--components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json5
-rw-r--r--components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json5
10 files changed, 214 insertions, 66 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
index 6a50680e6..8caec75fd 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -16,15 +16,15 @@
package org.onap.ccsdk.apps.controllerblueprints.core.service
+import com.att.eelf.configuration.EELFLogger
+import com.att.eelf.configuration.EELFManager
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
/**
*
@@ -35,12 +35,6 @@ object BluePrintExpressionService {
val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
@JvmStatic
- fun getExpressionData(propertyAssignment: Any): ExpressionData {
- val propertyAssignmentNode: JsonNode = JacksonUtils.jsonNodeFromObject(propertyAssignment)
- return getExpressionData(propertyAssignmentNode)
- }
-
- @JvmStatic
fun getExpressionData(propertyAssignmentNode: JsonNode): ExpressionData {
log.trace("Assignment Data/Expression : {}", propertyAssignmentNode)
val expressionData = ExpressionData(valueNode = propertyAssignmentNode)
@@ -53,19 +47,19 @@ object BluePrintExpressionService {
expressionData.expressionNode = propertyAssignmentNode
when (expressionData.command) {
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT -> {
+ BluePrintConstants.EXPRESSION_GET_INPUT -> {
expressionData.inputExpression = populateInputExpression(propertyAssignmentNode)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {
expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
+ BluePrintConstants.EXPRESSION_GET_PROPERTY -> {
expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {
expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode)
}
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {
expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode)
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 5540047c1..bd19ae47e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -67,6 +67,12 @@ interface BluePrintRuntimeService<T> {
*/
fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capability: String): MutableMap<String,
+ JsonNode>
+
+ fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String,
+ JsonNode>
+
fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
@@ -193,17 +199,15 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
- val propertyAssignments: MutableMap<String, JsonNode> =
- nodeTemplate.properties as MutableMap<String, JsonNode>
+ val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
// Get the Node Type Definitions
- val nodeTypeProperties: MutableMap<String, PropertyDefinition> =
- bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!
+ val nodeTypeProperties: MutableMap<String, PropertyDefinition> = bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!
// Iterate Node Type Properties
nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty ->
// Get the Express or Value for the Node Template
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
var resolvedValue: JsonNode = NullNode.getInstance()
if (propertyAssignment != null) {
@@ -223,6 +227,18 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
+ override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
+ MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " +
+ "($capabilityName)")
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateRequirementProperties for node template($nodeTemplateName) requirement ($requirementName)")
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
interfaceName: String, operationName: String): MutableMap<String, JsonNode> {
log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " +
@@ -230,8 +246,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- val propertyAssignments: MutableMap<String, Any> =
- bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
+ val propertyAssignments: MutableMap<String, JsonNode> =
+ bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
@@ -245,7 +261,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Iterate Node Type Properties
nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
// Get the Express or Value for the Node Template
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
var resolvedValue: JsonNode = NullNode.getInstance()
if (propertyAssignment != null) {
@@ -275,8 +291,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- val propertyAssignments: MutableMap<String, Any> =
- bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
+ val propertyAssignments: MutableMap<String, JsonNode> =
+ bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
@@ -289,7 +305,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
// Get the Express or Value for the Node Template
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
var resolvedValue: JsonNode = NullNode.getInstance()
if (propertyAssignment != null) {
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
index 36c141f5e..17380fc0f 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -47,7 +47,7 @@ If Property Assignment is Expression.
*/
fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
- assignment: Any): JsonNode {
+ assignment: JsonNode): JsonNode {
val valueNode: JsonNode
log.trace("Assignment ({})", assignment)
val expressionData = BluePrintExpressionService.getExpressionData(assignment)
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index 7ecf44b69..1dfb89a5d 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -56,6 +56,18 @@ class BluePrintRuntimeServiceTest {
}
@Test
+ fun testResolveNodeTemplateCapabilityProperties() {
+ log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
+ //TODO
+ }
+
+ @Test
+ fun testResolveNodeTemplateRequirementProperties() {
+ log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
+ //TODO
+ }
+
+ @Test
fun testResolveNodeTemplateInterfaceOperationInputs() {
log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
@@ -72,7 +84,7 @@ class BluePrintRuntimeServiceTest {
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- }
+ }
@Test
fun testResolveNodeTemplateInterfaceOperationOutputs() {
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 7d3a17a68..6a446355f 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -205,6 +205,57 @@
"file": "Scripts/SamplePythonComponentNode.py"
}
}
+ },
+ "activate-netconf": {
+ "type": "component-netconf-executor",
+ "interfaces": {
+ "NetconfExecutorComponent": {
+ "operations": {
+ "process": {
+ "implementation": {
+ "primary": "component-script"
+ },
+ "inputs": {
+ "instance-dependencies": [
+ "json-parser-service",
+ "netconf-rpc-service"
+ ]
+ },
+ "outputs": {
+ "response-data": "",
+ "status": ""
+ }
+ }
+ }
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "sample-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "artifacts": {
+ "component-script": {
+ "type": "artifact-script-jython",
+ "file": "Scripts/SamplePythonComponentNode.py"
+ }
+ }
+ },
+ "sample-netconf-device": {
+ "type": "vnf-netconf-device",
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sample-key",
+ "login-account": "sample-account",
+ "target-ip-address": "localhost",
+ "port-number": 830,
+ "connection-time-out": 30
+ }
+ }
+ }
}
},
"workflows": {
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
index 6a156ff16..f7970bfbd 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
@@ -29,11 +29,68 @@
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
},
+ "tosca.nodes.ResourceSource" : {
+ "description" : "TOSCA base type for Resource Sources",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.Vnf" : {
+ "description" : "This is VNF Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"tosca.nodes.component.Jython": {
"description": "This is Resource Assignment Jython Component API",
"version": "1.0.0",
"derived_from": "tosca.nodes.Root"
},
+ "component-netconf-executor": {
+ "description": "This is Netconf Transaction Configuration Component API",
+ "version": "1.0.0",
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
+ }
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vnf-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "NetconfExecutorComponent": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "instance-dependencies": {
+ "description": "Instance Names to Inject to Jython Script.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ }
+ },
+ "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.Jython"
+ },
"component-resource-assignment": {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
@@ -131,6 +188,47 @@
}
},
"derived_from": "tosca.nodes.component.Jython"
+ },
+ "vnf-netconf-device": {
+ "description": "This is VNF Device with Netconf Capability",
+ "version": "1.0.0",
+ "capabilities": {
+ "netconf": {
+ "type": "tosca.capabilities.Netconf",
+ "properties": {
+ "login-key": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc"
+ },
+ "login-account": {
+ "required": true,
+ "type": "string",
+ "default": "sdnc-tacacs"
+ },
+ "source": {
+ "required": true,
+ "type": "string",
+ "default": "npm"
+ },
+ "target-ip-address": {
+ "required": true,
+ "type": "string"
+ },
+ "port-number": {
+ "required": true,
+ "type": "integer",
+ "default": 830
+ },
+ "connection-time-out": {
+ "required": false,
+ "type": "integer",
+ "default": 30
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Vnf"
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
index 7e1d81343..b8ac762e5 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json
@@ -18,45 +18,13 @@
"operations": {
"process": {
"inputs": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "instance-dependencies": {
"required": true,
- "type": "string"
- },
- "template-name": {
- "description": "Service Template Name",
- "required": true,
- "type": "string"
- },
- "template-version": {
- "description": "Service Template Version",
- "required": true,
- "type": "string"
- },
- "action-name": {
- "description": "Action Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "resource-type": {
- "description": "Resource Type to get from Database, Either (message & mask-info ) or( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "resource-id": {
- "description": "Resource Id to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "reservation-id": {
- "description": "Reservation Id used to send to NPM",
- "required": false,
- "type": "string"
- },
- "execution-script": {
- "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",
- "required": true,
- "type": "string"
+ "description": "Instance Names to Inject to Jython Script.",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
}
},
"outputs": {
diff --git a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json
index 246f17706..c6f512dfb 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/vnf-netconf-device.json
@@ -38,5 +38,4 @@
}
},
"derived_from": "tosca.nodes.Vnf"
-
}
diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json
new file mode 100644
index 000000000..4abb94832
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.json
@@ -0,0 +1,5 @@
+{
+ "description": "Relationship tosca.relationships.ConnectsTo",
+ "version": "1.0.0",
+ "derived_from": "tosca.relationships.Root"
+} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json
new file mode 100644
index 000000000..89987ff51
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.DependsOn.json
@@ -0,0 +1,5 @@
+{
+ "description": "Relationship tosca.relationships.DependsOn",
+ "version": "1.0.0",
+ "derived_from": "tosca.relationships.Root"
+} \ No newline at end of file