aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/core
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2018-08-26 22:10:50 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2018-08-26 22:10:50 -0400
commit380790370ba573e0b0e0829b4fa1b38a79581a0e (patch)
tree451873185f9d51b8770342d5c55a120235787d51 /ms/controllerblueprints/modules/core
parentca395c635569bc70c16397a25dc46d7a9f0629a4 (diff)
Controller Blueprints Microservice
Add resource dictionary validation implementation services, validation repository services and Junit Test cases. Change-Id: Ia746b86b7d9098eabe5e643dcba558ef9aa7160f Issue-ID: CCSDK-487 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/core')
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt10
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt5
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt9
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt (renamed from ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt)7
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt4
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt3
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt (renamed from ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt)11
7 files changed, 30 insertions, 19 deletions
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
index 1bdd5307..85f1579e 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,12 +74,21 @@ object BluePrintConstants {
const val MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo"
const val MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo"
+ const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG"
+ const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component"
+ const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf"
+ @Deprecated("Artifacts will be attached to Node Template")
+ const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
+ const val MODEL_TYPE_NODE_RESOURCE_SOURCE = "tosca.nodes.ResourceSource"
+
const val MODEL_TYPE_NODES_COMPONENT_JAVA: String = "tosca.nodes.component.Java"
const val MODEL_TYPE_NODES_COMPONENT_BUNDLE: String = "tosca.nodes.component.Bundle"
const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"
const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"
const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"
+ const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
+
const val EXPRESSION_GET_INPUT: String = "get_input"
const val EXPRESSION_GET_ATTRIBUTE: String = "get_attribute"
const val EXPRESSION_GET_ARTIFACT: String = "get_artifact"
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
index 97826912..84592204 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +27,8 @@ object ConfigModelConstant {
const val MODEL_CONTENT_TYPE_TOSCA_JSON = "TOSCA_JSON"
const val MODEL_CONTENT_TYPE_TEMPLATE = "TEMPLATE"
- const val MODEL_TYPE_DATA_TYPE = "tosca.datatypes.Root"
const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
- const val MODEL_TYPE_NODE_DG = "tosca.nodes.DG"
- const val MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component"
- const val MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf"
const val MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact"
const val MODEL_TYPE_CAPABILITY_NETCONF = "tosca.capability.Netconf"
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt
index 8f172876..64fc57fc 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +45,7 @@ interface BluePrintEnhancerService : Serializable {
fun enhance(fileName: String, basePath: String): ServiceTemplate
}
-open class BluePrintEnhancerDefaultService(val bluePrintEnhancerRepoService: BluePrintEnhancerRepoService) : BluePrintEnhancerService {
+open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRepoService) : BluePrintEnhancerService {
private val log: Logger = LoggerFactory.getLogger(BluePrintEnhancerDefaultService::class.java)
@@ -216,21 +217,21 @@ open class BluePrintEnhancerDefaultService(val bluePrintEnhancerRepoService: Blu
}
open fun populateNodeType(nodeTypeName: String): NodeType {
- val nodeType = bluePrintEnhancerRepoService.getNodeType(nodeTypeName)
+ val nodeType = bluePrintRepoService.getNodeType(nodeTypeName)
?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
}
open fun populateArtifactType(artifactTypeName: String): ArtifactType {
- val artifactType = bluePrintEnhancerRepoService.getArtifactType(artifactTypeName)
+ val artifactType = bluePrintRepoService.getArtifactType(artifactTypeName)
?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
}
open fun populateDataTypes(dataTypeName: String): DataType {
- val dataType = bluePrintEnhancerRepoService.getDataType(dataTypeName)
+ val dataType = bluePrintRepoService.getDataType(dataTypeName)
?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt
index 5369d509..a529a85f 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +27,12 @@ import java.io.Serializable
import java.nio.charset.Charset
/**
- * BluePrintEnhancerRepoFileService
+ * BluePrintRepoFileService
* @author Brinda Santh
*
*/
-interface BluePrintEnhancerRepoService : Serializable {
+interface BluePrintRepoService : Serializable {
@Throws(BluePrintException::class)
fun getNodeType(nodeTypeName: String): NodeType?
@@ -51,7 +52,7 @@ interface BluePrintEnhancerRepoService : Serializable {
}
-class BluePrintEnhancerRepoFileService(val basePath: String) : BluePrintEnhancerRepoService {
+class BluePrintRepoFileService(val basePath: String) : BluePrintRepoService {
val dataTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
val nodeTypePath = basePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 08152313..b03fdf92 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -65,8 +65,8 @@ class BluePrintRuntimeService(var bluePrintContext: BluePrintContext, var contex
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
} else {
// Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
+ nodeTypeProperty.defaultValue?.let { defaultValue ->
+ resolvedValue = defaultValue
}
}
// Set for Return of method
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
index 6fc18532..8e6d5efd 100644
--- a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerServiceTest.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +31,7 @@ class BluePrintEnhancerServiceTest {
@Test
fun testEnrichBlueprint() {
- val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
val bluePrintEnhancerService: BluePrintEnhancerService = BluePrintEnhancerDefaultService(bluePrintEnhancerRepoFileService)
val serviceTemplate = ServiceTemplateUtils.getServiceTemplate("load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json")
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
index ef4384ff..574eae6d 100644
--- a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerRepoFileServiceTest.kt
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,31 +21,31 @@ import org.junit.Test
import kotlin.test.assertNotNull
/**
- * BluePrintEnhancerRepoFileServiceTest
+ * BluePrintRepoFileServiceTest
* @author Brinda Santh
*
*/
-class BluePrintEnhancerRepoFileServiceTest {
+class BluePrintRepoFileServiceTest {
val basePath = "load/model_type"
@Test
fun testGetDataType() {
- val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
val dataType = bluePrintEnhancerRepoFileService.getDataType("dt-v4-aggregate")
assertNotNull(dataType, "Failed to get DataType from repo")
}
@Test
fun testGetNodeType() {
- val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
val nodeType = bluePrintEnhancerRepoFileService.getNodeType("component-resource-assignment")
assertNotNull(nodeType, "Failed to get NodeType from repo")
}
@Test
fun testGetArtifactType() {
- val bluePrintEnhancerRepoFileService = BluePrintEnhancerRepoFileService(basePath)
+ val bluePrintEnhancerRepoFileService = BluePrintRepoFileService(basePath)
val nodeType = bluePrintEnhancerRepoFileService.getArtifactType("artifact-template-velocity")
assertNotNull(nodeType, "Failed to get ArtifactType from repo")
}