aboutsummaryrefslogtreecommitdiffstats
path: root/components/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'components/core/src')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt6
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionService.kt37
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt14
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt12
-rw-r--r--components/core/src/test/resources/componentnode/default.json6
-rw-r--r--components/core/src/test/resources/properties/convert.json4
-rw-r--r--components/core/src/test/resources/properties/default.json4
7 files changed, 44 insertions, 39 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
index 845922040..8bfa2db7e 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
@@ -31,12 +31,6 @@ object ConfigModelConstant {
const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
- const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"
- const val MODEL_TYPE_CAPABILITY_SSH = "tosca.capability.Ssh"
- const val MODEL_TYPE_CAPABILITY_SFTP = "tosca.capability.Sftp"
- const val MODEL_TYPE_CAPABILITY_CHEF = "tosca.capability.Chef"
- const val MODEL_TYPE_CAPABILITY_ANSIBLEF = "tosca.capability.Ansible"
-
const val CAPABILITY_PROPERTY_MAPPING = "mapping"
const val PROPERTY_RECIPE_NAMES = "action-names"
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 19d515e0e..82e232d0e 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
@@ -25,6 +25,7 @@ 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
+
/**
*
*
@@ -115,32 +116,34 @@ object BluePrintExpressionService {
@JvmStatic
fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
- check(arrayNode.size() >= 3) {
+ check(arrayNode.size() >= 2) {
throw BluePrintException(String.format("missing attribute expression, " +
"it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
" <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))
}
var reqOrCapEntityName: String? = null
- var propertyName = ""
- var subProperty: String? = null
- if (arrayNode.size() == 2) {
- propertyName = arrayNode[1].textValue()
- } else if (arrayNode.size() == 3) {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- } else if (arrayNode.size() > 3) {
- reqOrCapEntityName = arrayNode[1].textValue()
- propertyName = arrayNode[2].textValue()
- val propertyPaths: List<String> = arrayNode.filterIndexed { index, obj ->
- index >= 3
- }.map { it.textValue() }
- subProperty = propertyPaths.joinToString("/")
+ var attributeName = ""
+ var subAttributeName: String? = null
+ when {
+ arrayNode.size() == 2 -> attributeName = arrayNode[1].textValue()
+ arrayNode.size() == 3 -> {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ attributeName = arrayNode[2].textValue()
+ }
+ arrayNode.size() > 3 -> {
+ reqOrCapEntityName = arrayNode[1].textValue()
+ attributeName = arrayNode[2].textValue()
+ val propertyPaths: List<String> = arrayNode.filterIndexed { index, _ ->
+ index >= 3
+ }.map { it.textValue() }
+ subAttributeName = propertyPaths.joinToString("/")
+ }
}
return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
reqOrCapEntityName = reqOrCapEntityName,
- attributeName = propertyName,
- subAttributeName = subProperty
+ attributeName = attributeName,
+ subAttributeName = subAttributeName
)
}
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
index 911a891a8..a0214023e 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
@@ -60,14 +60,22 @@ class BluePrintExpressionServiceTest {
@Test
fun testAttributeExpression() {
- val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
+ val node : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"resource\"] }")
val expressionData : ExpressionData = BluePrintExpressionService.getExpressionData(node)
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
assertNotNull(expressionData.attributeExpression, " Failed to populate attribute expression data")
assertEquals("SELF", expressionData.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
- assertEquals("attribute-name", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
- assertEquals("resource/name",expressionData.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
+ assertEquals("resource", expressionData.attributeExpression?.attributeName, " Failed to get expected attributeName")
+
+ val node1 : JsonNode = jacksonObjectMapper().readTree("{ \"get_attribute\" : [\"SELF\", \"\",\"attribute-name\", \"resource\", \"name\"] }")
+ val expressionData1 : ExpressionData = BluePrintExpressionService.getExpressionData(node1)
+ assertNotNull(expressionData1, " Failed to populate expression data")
+ assertEquals(expressionData1.isExpression, true, "Failed to identify as expression")
+ assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")
+ assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
+ assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")
+ assertEquals("resource/name",expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
}
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 919dc564e..277ec3ac9 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
@@ -87,7 +87,7 @@ class BluePrintRuntimeServiceTest {
log.info("Prepared Context {}", context)
val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component",
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process")
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process")
log.info("In Context {}", inContext)
@@ -110,18 +110,18 @@ class BluePrintRuntimeServiceTest {
val componentContext: MutableMap<String, Any?> = hashMapOf()
val successValue: JsonNode = jsonNodeFromObject("Success")
- componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue
- componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null
+ componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue
+ componentContext["resource-assignment-ra-component.org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null
bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component",
- "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process", componentContext)
+ "org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode", "process", componentContext)
assertEquals(NullNode.instance,
- context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),
"Failed to get operation property resource-assignment-params")
assertEquals(successValue,
- context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-ccsdk-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),
"Failed to get operation property status")
diff --git a/components/core/src/test/resources/componentnode/default.json b/components/core/src/test/resources/componentnode/default.json
index b7265fcd1..184b59881 100644
--- a/components/core/src/test/resources/componentnode/default.json
+++ b/components/core/src/test/resources/componentnode/default.json
@@ -41,13 +41,13 @@
"generate-configuration": {
"type": "mock-component-generateConfig",
"interfaces": {
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {
"operations": {
"process": {
"inputs": {
"entity-type": "vnf-type",
"template-content": "sample-template",
- "entity-id": "{ \"get_input\" : \"vnf-id\" }"
+ "entity-id": { "get_input" : "vnf-id" }
},
"outputs": {
"mergedData": "merged Data",
@@ -63,7 +63,7 @@
"node_types": {
"mock-component-generateConfig": {
"interfaces": {
- "org-openecomp-sdnc-config-params-service-MockComponentNode": {
+ "org-onap-ccsdk-config-params-service-MockComponentNode": {
"operations": {
"process": {
"inputs": {
diff --git a/components/core/src/test/resources/properties/convert.json b/components/core/src/test/resources/properties/convert.json
index cb7d08e44..af79915fa 100644
--- a/components/core/src/test/resources/properties/convert.json
+++ b/components/core/src/test/resources/properties/convert.json
@@ -19,12 +19,12 @@
"required": true
}
],
- "pre-data": "{ \"get_attribute\" : \"get-resource-assignment.config-params\" }",
+ "pre-data": { "get_input" : "get-resource-assignment.config-params" },
"prifix": "get-resource-assignment"
},
"outputs": {
"resource-assignment-status": "success",
- "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params\" }"
+ "resource-assignment-params": "{ \"set_value\" : \"get-resource-assignment.config-params" }
}
}
}
diff --git a/components/core/src/test/resources/properties/default.json b/components/core/src/test/resources/properties/default.json
index 0ac97f907..ec416dc95 100644
--- a/components/core/src/test/resources/properties/default.json
+++ b/components/core/src/test/resources/properties/default.json
@@ -1,5 +1,5 @@
{
- "default": "{ \"get_input\" : \"loopback-default\" }",
+ "default": { "get_input" : "loopback-default" },
"domain": "ethernet",
"criteria": [
{
@@ -8,7 +8,7 @@
"nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
},
{
- "value": "{ \"get_input\" : \"host-ip-address\" }",
+ "value": { "get_input" : "host-ip-address" },
"type": "simple",
"nodeString": "layer3-service-list[].service-data.l3sdn-vnf-fields.vnf-name"
}