\r
package org.onap.ccsdk.apps.controllerblueprints.core.service\r
\r
+import com.att.eelf.configuration.EELFLogger\r
+import com.att.eelf.configuration.EELFManager\r
import com.fasterxml.jackson.databind.JsonNode\r
import com.fasterxml.jackson.databind.node.ArrayNode\r
import com.fasterxml.jackson.databind.node.ObjectNode\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes\r
import org.onap.ccsdk.apps.controllerblueprints.core.data.*\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
-import com.att.eelf.configuration.EELFLogger\r
-import com.att.eelf.configuration.EELFManager\r
\r
/**\r
*\r
object BluePrintExpressionService {\r
val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())\r
\r
- @JvmStatic\r
- fun getExpressionData(propertyAssignment: Any): ExpressionData {\r
- val propertyAssignmentNode: JsonNode = JacksonUtils.jsonNodeFromObject(propertyAssignment)\r
- return getExpressionData(propertyAssignmentNode)\r
- }\r
-\r
@JvmStatic\r
fun getExpressionData(propertyAssignmentNode: JsonNode): ExpressionData {\r
log.trace("Assignment Data/Expression : {}", propertyAssignmentNode)\r
expressionData.expressionNode = propertyAssignmentNode\r
\r
when (expressionData.command) {\r
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_INPUT -> {\r
+ BluePrintConstants.EXPRESSION_GET_INPUT -> {\r
expressionData.inputExpression = populateInputExpression(propertyAssignmentNode)\r
}\r
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {\r
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE -> {\r
expressionData.attributeExpression = populateAttributeExpression(propertyAssignmentNode)\r
}\r
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_PROPERTY -> {\r
+ BluePrintConstants.EXPRESSION_GET_PROPERTY -> {\r
expressionData.propertyExpression = populatePropertyExpression(propertyAssignmentNode)\r
}\r
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {\r
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT -> {\r
expressionData.operationOutputExpression = populateOperationOutputExpression(propertyAssignmentNode)\r
}\r
- org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {\r
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT -> {\r
expressionData.artifactExpression = populateArtifactExpression(propertyAssignmentNode)\r
}\r
}\r
*/\r
fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>\r
\r
+ fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capability: String): MutableMap<String,\r
+ JsonNode>\r
+\r
+ fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String,\r
+ JsonNode>\r
+\r
fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>\r
\r
fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>\r
\r
val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)\r
\r
- val propertyAssignments: MutableMap<String, JsonNode> =\r
- nodeTemplate.properties as MutableMap<String, JsonNode>\r
+ val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!\r
\r
// Get the Node Type Definitions\r
- val nodeTypeProperties: MutableMap<String, PropertyDefinition> =\r
- bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!\r
+ val nodeTypeProperties: MutableMap<String, PropertyDefinition> = bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!\r
\r
// Iterate Node Type Properties\r
nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty ->\r
// Get the Express or Value for the Node Template\r
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]\r
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]\r
\r
var resolvedValue: JsonNode = NullNode.getInstance()\r
if (propertyAssignment != null) {\r
return propertyAssignmentValue\r
}\r
\r
+ override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):\r
+ MutableMap<String, JsonNode> {\r
+ log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " +\r
+ "($capabilityName)")\r
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+ }\r
+\r
+ override fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String, JsonNode> {\r
+ log.info("resolveNodeTemplateRequirementProperties for node template($nodeTemplateName) requirement ($requirementName)")\r
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.\r
+ }\r
+\r
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,\r
interfaceName: String, operationName: String): MutableMap<String, JsonNode> {\r
log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " +\r
\r
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()\r
\r
- val propertyAssignments: MutableMap<String, Any> =\r
- bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>\r
+ val propertyAssignments: MutableMap<String, JsonNode> =\r
+ bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)\r
?: hashMapOf()\r
\r
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type\r
// Iterate Node Type Properties\r
nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty ->\r
// Get the Express or Value for the Node Template\r
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]\r
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]\r
\r
var resolvedValue: JsonNode = NullNode.getInstance()\r
if (propertyAssignment != null) {\r
\r
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()\r
\r
- val propertyAssignments: MutableMap<String, Any> =\r
- bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>\r
+ val propertyAssignments: MutableMap<String, JsonNode> =\r
+ bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)\r
?: hashMapOf()\r
\r
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type\r
nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->\r
\r
// Get the Express or Value for the Node Template\r
- val propertyAssignment: Any? = propertyAssignments[nodeTypePropertyName]\r
+ val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]\r
\r
var resolvedValue: JsonNode = NullNode.getInstance()\r
if (propertyAssignment != null) {\r
*/\r
\r
fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,\r
- assignment: Any): JsonNode {\r
+ assignment: JsonNode): JsonNode {\r
val valueNode: JsonNode\r
log.trace("Assignment ({})", assignment)\r
val expressionData = BluePrintExpressionService.getExpressionData(assignment)\r
assertNotNull(propContext, "Failed to populate interface property values")\r
}\r
\r
+ @Test\r
+ fun testResolveNodeTemplateCapabilityProperties() {\r
+ log.info("************************ testResolveNodeTemplateRequirementProperties **********************")\r
+ //TODO\r
+ }\r
+\r
+ @Test\r
+ fun testResolveNodeTemplateRequirementProperties() {\r
+ log.info("************************ testResolveNodeTemplateRequirementProperties **********************")\r
+ //TODO\r
+ }\r
+\r
@Test\r
fun testResolveNodeTemplateInterfaceOperationInputs() {\r
log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")\r
assertNotNull(inContext, "Failed to populate interface input property values")\r
assertEquals(inContext["action-name"], jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")\r
assertEquals(inContext["request-id"], jsonNodeFromObject("12345"), "Failed to populate parameter action-name")\r
- }\r
+ }\r
\r
@Test\r
fun testResolveNodeTemplateInterfaceOperationOutputs() {\r
"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": {
"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",
}
},
"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
"operations": {\r
"process": {\r
"inputs": {\r
- "request-id": {\r
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",\r
+ "instance-dependencies": {\r
"required": true,\r
- "type": "string"\r
- },\r
- "template-name": {\r
- "description": "Service Template Name",\r
- "required": true,\r
- "type": "string"\r
- },\r
- "template-version": {\r
- "description": "Service Template Version",\r
- "required": true,\r
- "type": "string"\r
- },\r
- "action-name": {\r
- "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",\r
- "required": false,\r
- "type": "string"\r
- },\r
- "resource-type": {\r
- "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",\r
- "required": false,\r
- "type": "string"\r
- },\r
- "resource-id": {\r
- "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",\r
- "required": false,\r
- "type": "string"\r
- },\r
- "reservation-id": {\r
- "description": "Reservation Id used to send to NPM",\r
- "required": false,\r
- "type": "string"\r
- },\r
- "execution-script": {\r
- "description": "Python Script to Execute for this Component action, It should refer any one of Prython Artifact Definition for this Node Template.",\r
- "required": true,\r
- "type": "string"\r
+ "description": "Instance Names to Inject to Jython Script.",\r
+ "type": "list",\r
+ "entry_schema": {\r
+ "type": "string"\r
+ }\r
}\r
},\r
"outputs": {\r
}\r
},\r
"derived_from": "tosca.nodes.Vnf"\r
- \r
}\r
--- /dev/null
+{
+ "description": "Relationship tosca.relationships.ConnectsTo",
+ "version": "1.0.0",
+ "derived_from": "tosca.relationships.Root"
+}
\ No newline at end of file
--- /dev/null
+{
+ "description": "Relationship tosca.relationships.DependsOn",
+ "version": "1.0.0",
+ "derived_from": "tosca.relationships.Root"
+}
\ No newline at end of file