Modify get_input, get_attribute, get_property and get_artifact functions string implementation to Json Implementation.
Change-Id: I6d4aadd370dc23127a176964f84fc9bb5e7ab5ee
Issue-ID: CCSDK-432
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
"component-node": {}\r
},\r
"interfaces": {\r
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
}\r
},\r
"interfaces": {\r
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
{\r
"description": "This is Resource Assignment Component API",\r
"version": "1.0.0",\r
- "properties": {\r
- "type": {\r
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",\r
- "required": false,\r
- "type": "string"\r
- }\r
- },\r
- "interfaces": {\r
- "DefaultOperation": {\r
- "operations": {\r
- "validate": {\r
- "inputs": {\r
- "action-name": {\r
- "description": "validate for action",\r
- "required": false,\r
- "type": "string"\r
- }\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "artifacts" :{\r
- "component-jar": {\r
- "description": "Component Jar",\r
- "type": "artifact-component-jar",\r
- "file": "Component/basecomponent.jar"\r
- }\r
- },\r
- "derived_from": "tosca.nodes.Root"\r
+ "derived_from": "tosca.nodes.Root"\r
}
\ No newline at end of file
"login-key": "sdnc",\r
"login-account": "sndc-local",\r
"source": "local",\r
- "target-ip-address": "{\"get_attribute\":\"lo0-local-ipv4-address\"}",\r
+ "target-ip-address": { "get_attribute": ["SELF", "lo0-local-ipv4-address"]},\r
"port-number": 22,\r
"connection-time-out": 30\r
}\r
}\r
},\r
"interfaces": {\r
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {\r
+ "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
- "action-name": "{ \"get_input\" : \"action-name\" }",\r
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",\r
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",\r
+ "action-name": { "get_input" : "action-name" },\r
+ "service-template-name": { "get_input" : "template_name" },\r
+ "service-template-version": { "get_input" : "service-template-version" },\r
"resource-type": "vnf-type",\r
- "request-id": "{ \"get_input\" : \"request-id\" }",\r
- "resource-id": "{ \"get_input\" : \"hostname\" }",\r
+ "request-id": { "get_input" : "request-id" },\r
+ "resource-id": { "get_input" : "hostname" },\r
"execution-script": "execution-script"\r
},\r
"outputs": {\r
- "response-data": "{ \"get_attribute\" : \"netconf-executor-baseconfig.response-data\" }",\r
- "status": "{ \"get_attribute\" : \"netconf-executor-baseconfig.status\" }"\r
+ "response-data": { "get_input" : ["SELF", "netconf-executor-baseconfig.response-data"] },\r
+ "status": { "get_input" : ["SELF", "netconf-executor-baseconfig.status"] }\r
},\r
"implementation" : {\r
"primary" : "file://netconf_adaptor/DefaultBaseLicenceConfig.py"\r
"component-node": {}\r
},\r
"interfaces": {\r
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
"base-config-template",\r
"licence-template"\r
],\r
- "action-name": "{ \"get_input\" : \"action-name\" }",\r
- "service-template-name": "{ \"get_attribute\" : \"template_name\" }",\r
- "service-template-version": "{ \"get_attribute\" : \"service-template-version\" }",\r
+ "action-name": { "get_input" : "action-name" },\r
+ "service-template-name": { "get_input" : "template_name" },\r
+ "service-template-version": { "get_input" : "service-template-version" },\r
"resource-type": "vnf-type",\r
- "request-id": "{ \"get_input\" : \"request-id\" }",\r
- "resource-id": "{ \"get_input\" : \"hostname\" }"\r
+ "request-id": { "get_input" : "request-id" },\r
+ "resource-id": { "get_input" : "hostname" }\r
},\r
"outputs": {\r
"resource-assignment-params": "success",\r
}\r
},\r
"capabilities": {\r
- "dg-node": {},\r
- "content": {\r
- "properties": {\r
- "type": "json"\r
- }\r
- }\r
+ "dg-node": {}\r
},\r
"interfaces": {\r
"CONFIG": {\r
}\r
},\r
"interfaces": {\r
- "org-openecomp-sdnc-config-generator-service-ConfigGeneratorNode": {\r
+ "org-onap-ccsdk-config-generator-service-ConfigGeneratorNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
}\r
},\r
"interfaces": {\r
- "org-openecomp-sdnc-netconf-adaptor-service-NetconfExecutorNode": {\r
+ "org-onap-ccsdk-netconf-adaptor-service-NetconfExecutorNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
}\r
},\r
"interfaces": {\r
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
\r
const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"\r
\r
- const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"\r
- const val MODEL_TYPE_CAPABILITY_SSH = "tosca.capability.Ssh"\r
- const val MODEL_TYPE_CAPABILITY_SFTP = "tosca.capability.Sftp"\r
- const val MODEL_TYPE_CAPABILITY_CHEF = "tosca.capability.Chef"\r
- const val MODEL_TYPE_CAPABILITY_ANSIBLEF = "tosca.capability.Ansible"\r
-\r
const val CAPABILITY_PROPERTY_MAPPING = "mapping"\r
\r
const val PROPERTY_RECIPE_NAMES = "action-names"\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
*\r
@JvmStatic\r
fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {\r
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode\r
- check(arrayNode.size() >= 3) {\r
+ check(arrayNode.size() >= 2) {\r
throw BluePrintException(String.format("missing attribute expression, " +\r
"it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +\r
" <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))\r
}\r
\r
var reqOrCapEntityName: String? = null\r
- var propertyName = ""\r
- var subProperty: String? = null\r
- if (arrayNode.size() == 2) {\r
- propertyName = arrayNode[1].textValue()\r
- } else if (arrayNode.size() == 3) {\r
- reqOrCapEntityName = arrayNode[1].textValue()\r
- propertyName = arrayNode[2].textValue()\r
- } else if (arrayNode.size() > 3) {\r
- reqOrCapEntityName = arrayNode[1].textValue()\r
- propertyName = arrayNode[2].textValue()\r
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->\r
- index >= 3\r
- }.map { it.textValue() }\r
- subProperty = propertyPaths.joinToString("/")\r
+ var attributeName = ""\r
+ var subAttributeName: String? = null\r
+ when {\r
+ arrayNode.size() == 2 -> attributeName = arrayNode[1].textValue()\r
+ arrayNode.size() == 3 -> {\r
+ reqOrCapEntityName = arrayNode[1].textValue()\r
+ attributeName = arrayNode[2].textValue()\r
+ }\r
+ arrayNode.size() > 3 -> {\r
+ reqOrCapEntityName = arrayNode[1].textValue()\r
+ attributeName = arrayNode[2].textValue()\r
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->\r
+ index >= 3\r
+ }.map { it.textValue() }\r
+ subAttributeName = propertyPaths.joinToString("/")\r
+ }\r
}\r
return AttributeExpression(modelableEntityName = arrayNode[0].asText(),\r
reqOrCapEntityName = reqOrCapEntityName,\r
- attributeName = propertyName,\r
- subAttributeName = subProperty\r
+ attributeName = attributeName,\r
+ subAttributeName = subAttributeName\r
)\r
}\r
\r
\r
@Test\r
fun testAttributeExpression() {\r
- val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")\r
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"resource\"] }")\r
val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)\r
assertNotNull(expressionData, " Failed to populate expression data")\r
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")\r
assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data")\r
assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")\r
- assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
- assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")\r
+ assertEquals("resource", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
+\r
+ val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")\r
+ val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)\r
+ assertNotNull(expressionData1, " Failed to populate expression data")\r
+ assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")\r
+ assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")\r
+ assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")\r
+ assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")\r
+ assertEquals("resource/name",expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")\r
}\r
\r
\r
log.info("Prepared Context {}", context)\r
\r
val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component",\r
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process")\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process")\r
\r
log.info("In Context {}", inContext)\r
\r
\r
val componentContext: MutableMap<String, Any?> = hashMapOf()\r
val successValue: JsonNode = jsonNodeFromObject("Success")\r
- componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue\r
- componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null\r
+ componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue\r
+ componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null\r
\r
bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component",\r
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process", componentContext)\r
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", componentContext)\r
\r
assertEquals(NullNode.instance,\r
- context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),\r
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),\r
"Failed to get operation property resource-assignment-params")\r
\r
assertEquals(successValue,\r
- context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),\r
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),\r
"Failed to get operation property status")\r
\r
\r
"generate-configuration": {\r
"type": "mock-component-generateConfig",\r
"interfaces": {\r
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {\r
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
"entity-type": "vnf-type",\r
"template-content": "sample-template",\r
- "entity-id": "{ \"get_input\" : \"vnf-id\" }"\r
+ "entity-id": { "get_input" : "vnf-id" }\r
},\r
"outputs": {\r
"mergedData": "merged Data",\r
"node_types": {\r
"mock-component-generateConfig": {\r
"interfaces": {\r
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {\r
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {\r
"operations": {\r
"process": {\r
"inputs": {\r
"required": true\r
}\r
],\r
- "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",\r
+ "pre-data": { "get_input" : "get-resource-assignment.config-params" },\r
"prifix": "get-resource-assignment"\r
},\r
"outputs": {\r
"resource-assignment-status": "success",\r
- "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"\r
+ "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params" }\r
}\r
}\r
}\r
{\r
- "default": "{ \"get_input\" : \"loopback-default\" }",\r
+ "default": { "get_input" : "loopback-default" },\r
"domain": "ethernet",\r
"criteria": [\r
{\r
"nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"\r
},\r
{\r
- "value": "{ \"get_input\" : \"host-ip-address\" }",\r
+ "value": { "get_input" : "host-ip-address" },\r
"type": "simple",\r
"nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"\r
}\r