aboutsummaryrefslogtreecommitdiffstats
path: root/components/core/src/main
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-07 22:43:20 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-07 22:43:20 +0000
commit9e1736c88644486172b7bca7f22914d22a390bed (patch)
tree9406a4b7c4f2ae62d31e76db1558cfefd75f460d /components/core/src/main
parent83808703f4c1379c331f71d670b5610e2ca395b0 (diff)
Controller Blueprints Microservice
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>
Diffstat (limited to 'components/core/src/main')
-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
2 files changed, 20 insertions, 23 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 84592204..8bfa2db7 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 19d515e0..82e232d0 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
)
}