summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt86
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt78
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt271
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt49
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt37
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt4
-rw-r--r--components/core/src/test/resources/dictionary/dictionary_schema.json4
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json46
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json2
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json2
-rw-r--r--components/model-catalog/proto-definition/pom.xml12
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintCommon.proto31
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintManagement.proto21
-rw-r--r--components/model-catalog/proto-definition/proto/BluePrintProcessing.proto45
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/image_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/key_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/pub_key.json2
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json2
-rw-r--r--components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json2
-rwxr-xr-xcomponents/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json2
-rw-r--r--components/parent/pom.xml33
-rw-r--r--components/resource-dict/load/resource_dictionary/mdsal-source.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vnf-name.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vnf_name.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json2
-rw-r--r--components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json2
-rw-r--r--components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt2
-rw-r--r--components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java2
-rw-r--r--components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt2
-rw-r--r--components/resource-dict/src/test/resources/validation/cyclic.json10
-rw-r--r--components/resource-dict/src/test/resources/validation/duplicate.json10
-rw-r--r--components/resource-dict/src/test/resources/validation/success.json10
-rw-r--r--docs/index.rst49
-rw-r--r--docs/microservices/bluePrintsProcessor.rst10
-rw-r--r--docs/microservices/controllerBlueprintStudioProcessor.rst10
-rw-r--r--docs/microservices/neng.rst10
-rw-r--r--docs/microservices/vlanTag.rst10
-rw-r--r--docs/release-notes.rst14
-rw-r--r--ms/blueprintsprocessor/.gitignore3
-rwxr-xr-xms/blueprintsprocessor/application/etc/logback.xml36
-rwxr-xr-xms/blueprintsprocessor/application/etc/run.source12
-rwxr-xr-xms/blueprintsprocessor/application/opt/app/onap/config/application.properties36
-rwxr-xr-xms/blueprintsprocessor/application/opt/app/onap/config/logback.xml36
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/application/pom.xml85
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties36
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/application/src/main/resources/application.properties7
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties2
-rwxr-xr-xms/blueprintsprocessor/distribution/pom.xml196
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml33
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/Dockerfile20
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/distribution.xml69
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/startService.sh9
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/functions/pom.xml0
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json (renamed from ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json)0
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt32
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt87
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt134
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt26
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml4
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/modules/commons/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml20
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt18
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt22
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt168
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt34
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt55
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt172
-rw-r--r--ms/blueprintsprocessor/modules/outbounds/pom.xml20
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml4
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/modules/services/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml4
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/parent/pom.xml37
-rwxr-xr-x[-rw-r--r--]ms/blueprintsprocessor/pom.xml56
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/application/etc/run.source5
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application-dev.properties7
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application.properties24
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/logback.xml44
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java2
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java (renamed from ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java)6
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application-dev.properties70
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application.properties74
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java (renamed from ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java)2
-rwxr-xr-xms/controllerblueprints/application/src/test/resources/application.properties7
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/pom.xml89
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml70
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/Dockerfile3
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/distribution.xml6
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/startService.sh1
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/pom.xml59
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt56
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt150
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt61
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt (renamed from components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt)37
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt88
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/pom.xml1
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml6
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java293
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java97
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt100
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt283
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java30
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt192
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/resources/application.properties2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json4
-rw-r--r--ms/controllerblueprints/parent/pom.xml45
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java10
-rw-r--r--ms/vlantag-api/pom.xml476
-rwxr-xr-xpom.xml170
129 files changed, 3531 insertions, 1568 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt
deleted file mode 100644
index f7bfb857..00000000
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptConfiguration.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.script
-
-import org.jetbrains.kotlin.script.util.LocalFilesResolver
-import java.io.File
-import kotlin.script.dependencies.ScriptContents
-import kotlin.script.dependencies.ScriptDependenciesResolver
-import kotlin.script.experimental.annotations.KotlinScript
-import kotlin.script.experimental.api.*
-import kotlin.script.experimental.jvm.JvmDependency
-import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
-import kotlin.script.experimental.jvm.jvm
-
-
-@KotlinScript(fileExtension = "kts",
- compilationConfiguration = ComponentScriptConfiguration::class)
-abstract class ComponentScript {
-
-}
-
-object ComponentScriptConfiguration : ScriptCompilationConfiguration(
- {
- // defaultImports(DependsOn::class, Repository::class)
- jvm {
- dependenciesFromCurrentContext(
- wholeClasspath = true
- )
- }
-// refineConfiguration {
-// onAnnotations(DependsOn::class, Repository::class, handler = ::configureLocalFileDepsOnAnnotations)
-// }
- }
-)
-
-
-private val resolver = LocalFilesResolver()
-
-fun configureLocalFileDepsOnAnnotations(context: ScriptConfigurationRefinementContext):
- ResultWithDiagnostics<ScriptCompilationConfiguration> {
-
- val annotations = context.collectedData?.get(ScriptCollectedData.foundAnnotations)?.takeIf { it.isNotEmpty() }
- ?: return context.compilationConfiguration.asSuccess()
-
- val scriptContents = object : ScriptContents {
- override val annotations: Iterable<Annotation> = annotations
- override val file: File? = null
- override val text: CharSequence? = null
- }
-
- val diagnostics = arrayListOf<ScriptDiagnostic>()
-
- fun report(severity: ScriptDependenciesResolver.ReportSeverity, message: String, position: ScriptContents.Position?) {
- //TODO
- }
-
- return try {
- val newDepsFromResolver = resolver.resolve(scriptContents, emptyMap(), ::report, null).get()
- ?: return context.compilationConfiguration.asSuccess(diagnostics)
-
- val resolvedClasspath = newDepsFromResolver.classpath.toList().takeIf { it.isNotEmpty() }
- ?: return context.compilationConfiguration.asSuccess(diagnostics)
-
- ScriptCompilationConfiguration(context.compilationConfiguration) {
- dependencies.append(JvmDependency(resolvedClasspath))
-
- }.asSuccess(diagnostics)
-
- } catch (e: Throwable) {
- ResultWithDiagnostics.Failure(*diagnostics.toTypedArray(), e.asDiagnostics())
- }
-} \ No newline at end of file
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt
deleted file mode 100644
index 8ae09151..00000000
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptService.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.script
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
-import java.io.File
-import java.io.InputStream
-import java.io.Reader
-import javax.script.ScriptEngineManager
-import kotlin.script.experimental.api.ResultValue
-import kotlin.script.experimental.api.ResultWithDiagnostics
-import kotlin.script.experimental.api.resultOrNull
-import kotlin.script.experimental.host.toScriptSource
-import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-
-
-open class BluePrintScriptService(classLoader: ClassLoader? = Thread.currentThread().contextClassLoader) {
-
- /**
- * Get the Script Class instance
- */
- inline fun <reified T> scriptClassNewInstance(scriptFile: File, scriptClassName: String): T {
-
- val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<ComponentScript>()
-
- val scriptEvaluator = BluePrintScriptEvaluator(scriptClassName)
-
- val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptFile.toScriptSource(), compilationConfiguration,
- null)
-
- when (evalResponse) {
- is ResultWithDiagnostics.Success -> {
- val returnValue = evalResponse.resultOrNull()?.returnValue as ResultValue.Value
- return returnValue.value.castOrError()
- }
- is ResultWithDiagnostics.Failure -> {
- throw BluePrintProcessorException(evalResponse.reports.joinToString("\n"))
- }
- else -> {
- throw BluePrintProcessorException("Failed to process script ${scriptFile.absolutePath}")
- }
- }
-
- }
-
- val engine = ScriptEngineManager(classLoader).getEngineByExtension("kts")
-
- inline fun <R> safeEval(evaluation: () -> R?) = try {
- evaluation()
- } catch (e: Exception) {
- throw BluePrintProcessorException("Cannot load script", e)
- }
-
- inline fun <reified T> Any?.castOrError() = takeIf { it is T }?.let { it as T }
- ?: throw IllegalArgumentException("Cannot cast $this to expected type ${T::class}")
-
- inline fun <reified T> load(script: String): T = safeEval { engine.eval(script) }.castOrError()
-
- inline fun <reified T> load(reader: Reader): T = safeEval { engine.eval(reader) }.castOrError()
-
- inline fun <reified T> load(inputStream: InputStream): T = load(inputStream.reader())
-
- inline fun <reified T> loadAll(vararg inputStream: InputStream): List<T> = inputStream.map(::load)
-}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index bd19ae47..60318659 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -62,20 +62,20 @@ interface BluePrintRuntimeService<T> {
fun setBluePrintError(bluePrintError: BluePrintError)
- /*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
- fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
+ propertyDefinitions: MutableMap<String, PropertyDefinition>,
+ propertyAssignments: MutableMap<String, JsonNode>): MutableMap<String, JsonNode>
- fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capability: String): MutableMap<String,
- JsonNode>
+ fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
- fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String,
+ fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String): MutableMap<String,
JsonNode>
- fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode>
- fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>
+ fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String, interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode>
fun resolveNodeTemplateArtifact(nodeTemplateName: String, artifactName: String): String
@@ -89,24 +89,24 @@ interface BluePrintRuntimeService<T> {
fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode)
- fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
- fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
- fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String, value: JsonNode)
+ fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String, value: JsonNode)
fun getInputValue(propertyName: String): JsonNode
- fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode
+ fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String): JsonNode
fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode?
fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode?
- fun getNodeTemplateRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName: String): JsonNode?
-
- fun getNodeTemplateCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName: String): JsonNode?
-
fun assignInputs(jsonNode: JsonNode)
fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode)
@@ -190,22 +190,17 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
this.bluePrintError = bluePrintError
}
- /*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
- override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ /**
+ * Resolve any property assignments for the node
+ */
+ override fun resolveNodeTemplatePropertyAssignments(nodeTemplateName: String,
+ propertyDefinitions: MutableMap<String, PropertyDefinition>,
+ propertyAssignments: MutableMap<String, JsonNode>)
+ : MutableMap<String, JsonNode> {
- val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
-
- val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
-
- // Get the Node Type Definitions
- val nodeTypeProperties: MutableMap<String, PropertyDefinition> = bluePrintContext.nodeTypeChainedProperties(nodeTemplate.type)!!
+ val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
- // Iterate Node Type Properties
- nodeTypeProperties.forEach { nodeTypePropertyName, nodeTypeProperty ->
+ propertyDefinitions.forEach { nodeTypePropertyName, nodeTypeProperty ->
// Get the Express or Value for the Node Template
val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
@@ -213,38 +208,61 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
if (propertyAssignment != null) {
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
+ resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName,
+ nodeTypePropertyName, propertyAssignment)
} else {
// Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let { defaultValue ->
- resolvedValue = defaultValue
+ nodeTypeProperty.defaultValue?.let {
+ resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
}
}
// Set for Return of method
propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
}
- log.info("resolved property definition for node template ({}), values ({})", nodeTemplateName, propertyAssignmentValue)
return propertyAssignmentValue
}
+ override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
+
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val propertyAssignments: MutableMap<String, JsonNode> = nodeTemplate.properties!!
+
+ // Get the Node Type Definitions
+ val nodeTypePropertieDefinitions: MutableMap<String, PropertyDefinition> = bluePrintContext
+ .nodeTypeChainedProperties(nodeTemplate.type)!!
+
+ /**
+ * Resolve the NodeTemplate Property Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypePropertieDefinitions,
+ propertyAssignments)
+ }
+
override fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String):
MutableMap<String, JsonNode> {
log.info("resolveNodeTemplateCapabilityProperties for node template($nodeTemplateName) capability " +
"($capabilityName)")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
+ val nodeTemplate: NodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
+
+ val propertyAssignments = nodeTemplate.capabilities?.get(capabilityName)?.properties ?: hashMapOf()
- override fun resolveNodeTemplateRequirementProperties(nodeTemplateName: String, requirementName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateRequirementProperties for node template($nodeTemplateName) requirement ($requirementName)")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ val propertyDefinitions = bluePrintContext.nodeTemplateNodeType(nodeTemplateName)
+ .capabilities?.get(capabilityName)?.properties ?: hashMapOf()
+
+ /**
+ * Resolve the Capability Property Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, propertyDefinitions,
+ propertyAssignments)
}
override fun resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName: String,
- interfaceName: String, operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationInputs for node template ({}),interface name ({}), " +
- "operationName({})", nodeTemplateName, interfaceName, operationName)
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName),interface name " +
+ "($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
@@ -256,40 +274,22 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
?: hashMapOf()
- log.info("input definition for node template ({}), values ({})", nodeTemplateName, propertyAssignments)
+ log.info("input definition for node template ($nodeTemplateName), values ($propertyAssignments)")
- // Iterate Node Type Properties
- nodeTypeInterfaceOperationInputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
- // Get the Express or Value for the Node Template
- val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
+ /**
+ * Resolve the Property Input Assignment Values.
+ */
+ return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs,
+ propertyAssignments)
- var resolvedValue: JsonNode = NullNode.getInstance()
- if (propertyAssignment != null) {
- // Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
- }
- }
- // Set for Return of method
- propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
- }
- log.trace("resolved input assignments for node template ({}), values ({})", nodeTemplateName,
- propertyAssignmentValue)
-
- return propertyAssignmentValue
}
override fun resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName: String,
- interfaceName: String, operationName: String): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ({}),interface name ({}), " +
- "operationName({})", nodeTemplateName, interfaceName, operationName)
-
- val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+ interfaceName: String,
+ operationName: String): MutableMap<String, JsonNode> {
+ log.info("resolveNodeTemplateInterfaceOperationOutputs for node template ($nodeTemplateName),interface name " +
+ "($interfaceName), operationName($operationName)")
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
@@ -300,30 +300,15 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
?: hashMapOf()
-
- // Iterate Node Type Properties
- nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
-
- // Get the Express or Value for the Node Template
- val propertyAssignment: JsonNode? = propertyAssignments[nodeTypePropertyName]
-
- var resolvedValue: JsonNode = NullNode.getInstance()
- if (propertyAssignment != null) {
- // Resolve the Expressing
- val propertyAssignmentExpression = PropertyAssignmentService(this)
- resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(nodeTemplateName, nodeTypePropertyName, propertyAssignment)
- } else {
- // Assign default value to the Operation
- nodeTypeProperty.defaultValue?.let {
- resolvedValue = JacksonUtils.jsonNodeFromObject(nodeTypeProperty.defaultValue!!)
- }
- }
- // Set for Return of method
- propertyAssignmentValue[nodeTypePropertyName] = resolvedValue
-
- // Store operation output values into context
- setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, nodeTypePropertyName, resolvedValue)
- log.trace("resolved output assignments for node template ({}), property name ({}), value ({})", nodeTemplateName, nodeTypePropertyName, resolvedValue)
+ /**
+ * Resolve the Property Output Assignment Values.
+ */
+ val propertyAssignmentValue = resolveNodeTemplatePropertyAssignments(nodeTemplateName,
+ nodeTypeInterfaceOperationOutputs, propertyAssignments)
+
+ // Store operation output values into context
+ propertyAssignmentValue.forEach { key, value ->
+ setNodeTemplateOperationOutputValue(nodeTemplateName, interfaceName, operationName, key, value)
}
return propertyAssignmentValue
}
@@ -338,12 +323,11 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val nodeTemplate = bluePrintContext.nodeTemplateByName(nodeTemplateName)
return nodeTemplate.artifacts?.get(artifactName)
- ?: throw BluePrintProcessorException(String.format("failed to get artifat definition {} from the node template"
- , artifactName))
+ ?: throw BluePrintProcessorException("failed to get artifat definition($artifactName) from the node " +
+ "template")
}
-
override fun setInputValue(propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -351,8 +335,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
put(path, value)
}
- override fun setWorkflowInputValue(workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS).append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
+ override fun setWorkflowInputValue(workflowName: String, propertyName: String,
+ propertyDefinition: PropertyDefinition, value: JsonNode) {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -361,7 +347,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
@@ -369,7 +356,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
put(path, value)
@@ -377,31 +365,42 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun setNodeTemplateOperationPropertyValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
log.trace("setting operation property path ({}), values ({})", path, value)
put(path, value)
}
- override fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ override fun setNodeTemplateOperationInputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
put(path, value)
}
- override fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String,
+ override fun setNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String,
value: JsonNode) {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -415,47 +414,36 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return getJsonNode(path)
}
- override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String, operationName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES).append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS).append(BluePrintConstants.PATH_DIVIDER).append(operationName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS).append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
+ override fun getNodeTemplateOperationOutputValue(nodeTemplateName: String, interfaceName: String,
+ operationName: String, propertyName: String): JsonNode {
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_INTERFACES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(interfaceName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OPERATIONS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(operationName)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_OUTPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
return getJsonNode(path)
}
override fun getNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).append(attributeName).toString()
return getJsonNode(path)
}
- override fun getNodeTemplateRequirementPropertyValue(nodeTemplateName: String, requirementName: String, propertyName:
- String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_REQUIREMENTS).append(requirementName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
- override fun getNodeTemplateCapabilityPropertyValue(nodeTemplateName: String, capabilityName: String, propertyName:
- String): JsonNode {
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_CAPABILITIES).append(capabilityName)
- .append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_PROPERTIES)
- .append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
- return getJsonNode(path)
- }
-
override fun assignInputs(jsonNode: JsonNode) {
log.info("assignInputs from input JSON ({})", jsonNode.toString())
bluePrintContext.inputs?.forEach { propertyName, property ->
@@ -493,7 +481,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode {
val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
- val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES).append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
+ val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
+ .append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
.append(BluePrintConstants.PATH_DIVIDER).append(BluePrintConstants.PATH_ATTRIBUTES)
.append(BluePrintConstants.PATH_DIVIDER).toString()
store.keys.filter {
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt
deleted file mode 100644
index 5c5ad3ba..00000000
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BluePrintScriptServiceTest.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.core.script
-
-import org.junit.Ignore
-import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
-import java.io.File
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-
-class BluePrintScriptServiceTest {
-
- @Test
- fun `invoke script`() {
- val scriptContent = "11 + 11"
- val value = BluePrintScriptService()
- .load<Int>(scriptContent)
- assertEquals(22, value, "failed to execute command")
- }
-
- @Test
- @Ignore
- fun `invoke script component node`() {
-
- //println(classpathFromClasspathProperty()?.joinToString("\n"))
-
- val scriptFile = File("src/test/resources/scripts/SampleBlueprintFunctionNode.kts")
-
- val functionNode = BluePrintScriptService()
- .scriptClassNewInstance<BlueprintFunctionNode<String, String>>(scriptFile,
- "SampleBlueprintFunctionNode")
- assertNotNull(functionNode, "failed to get instance from script")
- }
-} \ No newline at end of file
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 c01b14b3..02148f08 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
@@ -39,7 +39,7 @@ class BluePrintRuntimeServiceTest {
private val log: EELFLogger = EELFManager.getInstance().getLogger(this::class.toString())
@Test
- fun testResolveNodeTemplateProperties() {
+ fun `test Resolve NodeTemplate Properties`() {
log.info("************************ testResolveNodeTemplateProperties **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -49,25 +49,31 @@ class BluePrintRuntimeServiceTest {
val inputNode: JsonNode = JacksonUtils.jsonNodeFromFile(inputDataPath)
bluePrintRuntimeService.assignInputs(inputNode)
- val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
+ val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
+ .resolveNodeTemplateProperties("activate-process")
assertNotNull(propContext, "Failed to populate interface property values")
}
@Test
- fun testResolveNodeTemplateCapabilityProperties() {
+ fun `test resolve NodeTemplate Capability Properties`() {
log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- //TODO
- }
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
- @Test
- fun testResolveNodeTemplateRequirementProperties() {
- log.info("************************ testResolveNodeTemplateRequirementProperties **********************")
- //TODO
+ val executionContext = bluePrintRuntimeService.getExecutionContext()
+
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext)
+
+ val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device",
+ "netconf")
+ assertNotNull(capProperties, "Failed to populate capability property values")
+ assertEquals(capProperties["target-ip-address"], JacksonUtils.jsonNodeFromObject("localhost"), "Failed to populate parameter target-ip-address")
+ assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
}
@Test
- fun testResolveNodeTemplateInterfaceOperationInputs() {
+ fun `test Resolve NodeTemplate Interface Operation Inputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationInputs **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -77,16 +83,17 @@ class BluePrintRuntimeServiceTest {
BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
"data/default-context.json", executionContext)
- val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "ResourceAssignmentComponent", "process")
+ val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
+ .resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
+ "ResourceAssignmentComponent", "process")
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext["request-id"], JacksonUtils.jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- }
+ }
@Test
- fun testResolveNodeTemplateInterfaceOperationOutputs() {
+ fun `test Resolve NodeTemplate Interface Operation Outputs`() {
log.info("************************ testResolveNodeTemplateInterfaceOperationOutputs **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
@@ -107,7 +114,7 @@ class BluePrintRuntimeServiceTest {
}
@Test
- fun testNodeTemplateContextProperty() {
+ fun `test NodeTemplate Context Property`() {
log.info("************************ testNodeTemplateContextProperty **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
index 143c4a84..59a03719 100644
--- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
+++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
@@ -27,7 +27,7 @@ class BluePrintFileUtilsTest {
@Test
fun testNewBlueprint() = runBlocking {
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-new-test")
+ val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test")
BluePrintFileUtils.createEmptyBluePrint(targetPath)
}
@@ -36,7 +36,7 @@ class BluePrintFileUtilsTest {
fun testBlueprintCopy() = runBlocking {
val sourcePath: String = "./../model-catalog/blueprint-model/starter-blueprint/baseconfiguration"
- val targetPath: String = Paths.get("target").toUri().toURL().path.plus("bp-copy-test")
+ val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-copy-test")
val targetDir = File(targetPath)
targetDir.deleteOnExit()
diff --git a/components/core/src/test/resources/dictionary/dictionary_schema.json b/components/core/src/test/resources/dictionary/dictionary_schema.json
index f9ef9eee..51db5f51 100644
--- a/components/core/src/test/resources/dictionary/dictionary_schema.json
+++ b/components/core/src/test/resources/dictionary/dictionary_schema.json
@@ -54,7 +54,7 @@
"aai": {
"type": "any"
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"path": {
@@ -188,7 +188,7 @@
}
}
},
- "mdsal": {
+ "primary-config-data": {
"type": "object",
"properties": {
"names": {
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
index 13847bbb..4484d550 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
+++ b/components/model-catalog/blueprint-model/service-blueprint/vFW/Definitions/vFW_spinup.json
@@ -667,7 +667,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -982,7 +982,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1007,7 +1007,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1032,7 +1032,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1057,7 +1057,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1082,7 +1082,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1462,7 +1462,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1777,7 +1777,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1802,7 +1802,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1827,7 +1827,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1852,7 +1852,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1877,7 +1877,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1950,7 +1950,7 @@
},
"input-param": false,
"dictionary-name": "vfw_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -1975,7 +1975,7 @@
},
"input-param": false,
"dictionary-name": "vsn_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2050,7 +2050,7 @@
},
"input-param": false,
"dictionary-name": "vpg_private_ip_0",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2284,7 +2284,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2574,7 +2574,7 @@
},
"input-param": false,
"dictionary-name": "image_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2625,7 +2625,7 @@
},
"input-param": false,
"dictionary-name": "key_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2650,7 +2650,7 @@
},
"input-param": false,
"dictionary-name": "pub_key",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2675,7 +2675,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_net_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2700,7 +2700,7 @@
},
"input-param": false,
"dictionary-name": "onap_private_subnet_id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -2848,7 +2848,7 @@
},
"input-param": false,
"dictionary-name": "vfw_private_ip_1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
@@ -3250,7 +3250,7 @@
},
"input-param": false,
"dictionary-name": "vnf-name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
index c457086c..67d2a914 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/baseconfig-mapping.json
@@ -27,7 +27,7 @@
"type": "string"
},
"dictionary-name": "vnf_name",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id",
"vnf-id"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
index 557f6efc..c8871214 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/resources_definition_types.json
@@ -38,7 +38,7 @@
"type": "string"
},
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml
index c1f77922..c9289392 100644
--- a/components/model-catalog/proto-definition/pom.xml
+++ b/components/model-catalog/proto-definition/pom.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (C) 2019 Bell Canada
-*
+ * Modifications Copyright © 2017-2018 AT&T Intellectual Property.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -18,9 +19,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.components</groupId>
+ <artifactId>parent</artifactId>
<version>0.4.1-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
</parent>
<artifactId>proto-definition</artifactId>
@@ -59,11 +61,11 @@
<version>0.6.1</version>
<configuration>
<protocArtifact>
- com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>
- io.grpc:protoc-gen-grpc-java:1.16.1:exe:${os.detected.classifier}
+ io.grpc:protoc-gen-grpc-java:1.18.0:exe:${os.detected.classifier}
</pluginArtifact>
<protoSourceRoot>proto</protoSourceRoot>
</configuration>
diff --git a/components/model-catalog/proto-definition/proto/BluePrintCommon.proto b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto
new file mode 100644
index 00000000..0f17783a
--- /dev/null
+++ b/components/model-catalog/proto-definition/proto/BluePrintCommon.proto
@@ -0,0 +1,31 @@
+syntax = "proto3";
+option java_multiple_files = true;
+package org.onap.ccsdk.apps.controllerblueprints.common.api;
+
+message CommonHeader {
+ string timestamp = 1;
+ string originatorId = 23;
+ string requestId = 3;
+ string subRequestId = 4;
+ Flag flag = 5;
+}
+
+message Flag {
+ bool isForce = 1;
+ int32 ttl = 2;
+}
+
+message ActionIdentifiers {
+ string blueprintName = 1;
+ string blueprintVersion = 2;
+ string actionName = 3;
+ string mode = 4;
+}
+
+message Status {
+ int32 code = 1;
+ string errorMessage = 2;
+ string message = 3;
+ string eventType = 4;
+ string timestamp = 5;
+} \ No newline at end of file
diff --git a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
index dc0680d5..658cbbbd 100644
--- a/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
+++ b/components/model-catalog/proto-definition/proto/BluePrintManagement.proto
@@ -1,37 +1,24 @@
syntax = "proto3";
+import "BluePrintCommon.proto";
option java_multiple_files = true;
package org.onap.ccsdk.apps.controllerblueprints.management.api;
message BluePrintManagementInput {
- CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
string blueprintName = 2;
string blueprintVersion = 3;
FileChunk fileChunk = 4;
}
message BluePrintManagementOutput {
- CommonHeader commonHeader = 1;
- Status status = 3;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3;
}
message FileChunk {
bytes chunk = 1;
}
-message CommonHeader {
- string timestamp = 1;
- string originatorId = 23;
- string requestId = 3;
- string subRequestId = 4;
-}
-
-message Status {
- string timestamp = 1;
- int32 code = 2;
- string message = 3;
- string errorMessage = 4;
-}
-
service BluePrintManagementService {
rpc uploadBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput);
rpc removeBlueprint (BluePrintManagementInput) returns (BluePrintManagementOutput);
diff --git a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto
index d8ad571b..5b91f46b 100644
--- a/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto
+++ b/components/model-catalog/proto-definition/proto/BluePrintProcessing.proto
@@ -1,49 +1,24 @@
syntax = "proto3";
import "google/protobuf/struct.proto";
+import "BluePrintCommon.proto";
option java_multiple_files = true;
package org.onap.ccsdk.apps.controllerblueprints.processing.api;
+
message ExecutionServiceInput {
- CommonHeader commonHeader = 1;
- ActionIdentifiers actionIdentifiers = 2;
- google.protobuf.Struct payload = 3;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2;
+ google.protobuf.Struct payload = 3;
}
message ExecutionServiceOutput {
- CommonHeader commonHeader = 1;
- ActionIdentifiers actionIdentifiers = 2;
- Status status = 3;
- google.protobuf.Struct payload = 4;
-}
-
-message CommonHeader {
- string timestamp = 1;
- string originatorId = 23;
- string requestId = 3;
- string subRequestId = 4;
- Flag flag = 5;
-}
-
-message Flag {
- bool isForce = 1;
- int32 ttl = 2;
-}
-
-message ActionIdentifiers {
- string blueprintName = 1;
- string blueprintVersion = 2;
- string actionName = 3;
- string mode = 4;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader commonHeader = 1;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers actionIdentifiers = 2;
+ org.onap.ccsdk.apps.controllerblueprints.common.api.Status status = 3;
+ google.protobuf.Struct payload = 4;
}
-message Status {
- int32 code = 1;
- string errorMessage = 2;
- string message = 3;
- string eventType = 4;
- string timestamp = 5;
-}
service BluePrintProcessingService {
- rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput);
+ rpc process (stream ExecutionServiceInput) returns (stream ExecutionServiceOutput);
}
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
index 37ef5ae1..57a0ef39 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/image_name.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
index 1f1b3e65..6eb8d929 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/key_name.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
index 300a71f1..67661ecd 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
index bb70fe3c..3dd74f7d 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_net_id.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
index d38ceb49..6cb22c3d 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/onap_private_subnet_id.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
index ce6c2f2a..fe172caf 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/pub_key.json
@@ -10,7 +10,7 @@
"input": {
"type": "source-input"
},
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
index 5834dd49..c0f78ac5 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-licenses.json
@@ -11,7 +11,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
index 25464d3f..75d7ca05 100644
--- a/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/sample-mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
index 71a4df2c..4c227f91 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
index 481edae8..0df08c00 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vfw_private_ip_1.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
index 89b3dc1c..4c0320ac 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf-name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
index c55f1c18..e9d8a3b4 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vnf_name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
index 13d89993..586aa0c9 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vpg_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
index fcd6d8d5..1fe47971 100755
--- a/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
+++ b/components/model-catalog/resource-dictionary/starter-dictionary/vsn_private_ip_0.json
@@ -12,7 +12,7 @@
"properties" : {
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index 365515aa..6d5c2c14 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -29,12 +29,12 @@
<name>Components Parent</name>
<packaging>pom</packaging>
<properties>
- <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
- <spring.version>5.1.3.RELEASE</spring.version>
- <kotlin.version>1.3.11</kotlin.version>
- <kotlin.maven.version>1.3.11</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
- <grpc.version>1.17.1</grpc.version>
+ <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
+ <spring.version>5.1.4.RELEASE</spring.version>
+ <kotlin.version>1.3.20</kotlin.version>
+ <kotlin.maven.version>1.3.20</kotlin.maven.version>
+ <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
+ <grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
@@ -117,6 +117,11 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-common</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jvm-host</artifactId>
<version>${kotlin.version}</version>
</dependency>
@@ -302,22 +307,6 @@
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <!--Use kotlin-compiler-embeddable as koltin-compiler wrap-->
- <!--guava dependency creating classpath issues at runtime-->
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<!-- GRPC Dependencies -->
<dependency>
<groupId>io.grpc</groupId>
diff --git a/components/resource-dict/load/resource_dictionary/mdsal-source.json b/components/resource-dict/load/resource_dictionary/mdsal-source.json
index b38986a4..fa72e5dc 100644
--- a/components/resource-dict/load/resource_dictionary/mdsal-source.json
+++ b/components/resource-dict/load/resource_dictionary/mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "mdsal": {
+ "primary-config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
index 7c8d4f4e..59f51516 100644
--- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
index 0553b8c3..6dda72f7 100644
--- a/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
+++ b/components/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_1"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vnf-name.json b/components/resource-dict/load/resource_dictionary/vnf-name.json
index 47371d18..708030ee 100644
--- a/components/resource-dict/load/resource_dictionary/vnf-name.json
+++ b/components/resource-dict/load/resource_dictionary/vnf-name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vnf_name.json b/components/resource-dict/load/resource_dictionary/vnf_name.json
index 4617a264..3164367c 100644
--- a/components/resource-dict/load/resource_dictionary/vnf_name.json
+++ b/components/resource-dict/load/resource_dictionary/vnf_name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
index 912cfb9a..9bef3c79 100644
--- a/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vpg_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
index bf987382..52a4542c 100644
--- a/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
+++ b/components/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vsn_private_ip_0"
}
},
- "mdsal" : {
+ "primary-config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
diff --git a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
index 0004b02f..aa06c9da 100644
--- a/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ b/components/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -24,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict
object ResourceDictionaryConstants {
const val SOURCE_INPUT = "input"
const val SOURCE_DEFAULT = "default"
- const val SOURCE_MDSAL = "mdsal"
+ const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data"
const val SOURCE_PRIMARY_DB = "primary-db"
const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary"
diff --git a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
index 3f5aef43..f11638e3 100644
--- a/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
+++ b/components/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
@@ -28,7 +28,7 @@ public class ResourceSourceMappingFactoryTest {
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-primary-db");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("mdsal", "source-rest");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest");
String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");
Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");
diff --git a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
index 50e5c329..74ef6d6d 100644
--- a/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
+++ b/components/resource-dict/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
@@ -25,6 +25,6 @@ object ResourceDictionaryTestUtils {
ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-primary-db")
ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
- ResourceSourceMappingFactory.registerSourceMapping("mdsal", "source-rest")
+ ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest")
}
} \ No newline at end of file
diff --git a/components/resource-dict/src/test/resources/validation/cyclic.json b/components/resource-dict/src/test/resources/validation/cyclic.json
index 7e6472f5..98cd1444 100644
--- a/components/resource-dict/src/test/resources/validation/cyclic.json
+++ b/components/resource-dict/src/test/resources/validation/cyclic.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/duplicate.json b/components/resource-dict/src/test/resources/validation/duplicate.json
index 28ab71fc..7581ff64 100644
--- a/components/resource-dict/src/test/resources/validation/duplicate.json
+++ b/components/resource-dict/src/test/resources/validation/duplicate.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/components/resource-dict/src/test/resources/validation/success.json b/components/resource-dict/src/test/resources/validation/success.json
index 5d0e8980..486251d6 100644
--- a/components/resource-dict/src/test/resources/validation/success.json
+++ b/components/resource-dict/src/test/resources/validation/success.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"loopback-ip"
]
diff --git a/docs/index.rst b/docs/index.rst
index 16f86845..2c7d9ab9 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,13 +1,50 @@
.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+.. Copyright (C) 2019 IBM.
CCSDK APPS DOCUMENTATION REPOSITORY
------------------------------------------------
.. toctree::
:maxdepth: 1
- Architecture
- Installation
- Configuration
- Development
- Logging
- Release Notes
+Introduction:
+=============
+APPS repository which contains all micro services for CCSDK module.
+Also these are application that are intended to run outside of OpenDaylight
+container.Modular feature implementation that is reusable across all controllers.
+
+Microservices:
+=============
+
+Controller BluePrints Studio Processor
+Blueprints processor
+NetworkElementNameGen (NENG)
+Vlan Tag API
+
+
+Installation:
+=============
+
+Steps
+-----
+To compile this code:
+
+1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains
+references to the ONAP repositories and OpenDaylight repositories.
+
+2. To compile all of CCSDK apps code
+ - git clone https://(LFID)@gerrit.onap.org/r/a/ccsdk/apps
+ - cd apps ; mvn clean install ; cd ..
+
+
+
+Logging:
+=============
+CCSDK uses slf4j to log messages to the standard OpenDaylight karaf.log
+log file.
+
+Where to Access Information
+---------------------------
+Logs are found within the SDNC docker container, in the directory
+/opt/opendaylight/current/data/logs.
+Release Notes
diff --git a/docs/microservices/bluePrintsProcessor.rst b/docs/microservices/bluePrintsProcessor.rst
new file mode 100644
index 00000000..adde1107
--- /dev/null
+++ b/docs/microservices/bluePrintsProcessor.rst
@@ -0,0 +1,10 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.
+.. Copyright (C) 2019 IBM.
+
+Blueprints Processor
+====================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly: \ No newline at end of file
diff --git a/docs/microservices/controllerBlueprintStudioProcessor.rst b/docs/microservices/controllerBlueprintStudioProcessor.rst
new file mode 100644
index 00000000..fc911229
--- /dev/null
+++ b/docs/microservices/controllerBlueprintStudioProcessor.rst
@@ -0,0 +1,10 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.
+.. Copyright (C) 2019 IBM.
+
+Controller Blueprints Studio Processor
+======================================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly: \ No newline at end of file
diff --git a/docs/microservices/neng.rst b/docs/microservices/neng.rst
new file mode 100644
index 00000000..b5461988
--- /dev/null
+++ b/docs/microservices/neng.rst
@@ -0,0 +1,10 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.
+.. Copyright (C) 2019 IBM.
+
+NetworkElementNameGen (NENG)
+============================
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly: \ No newline at end of file
diff --git a/docs/microservices/vlanTag.rst b/docs/microservices/vlanTag.rst
new file mode 100644
index 00000000..c1d2fbef
--- /dev/null
+++ b/docs/microservices/vlanTag.rst
@@ -0,0 +1,10 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.
+.. Copyright (C) 2019 IBM.
+
+Vlan Tag API
+============
+
+.. toctree::
+ :maxdepth: 1
+ :titlesonly: \ No newline at end of file
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
new file mode 100644
index 00000000..174c4422
--- /dev/null
+++ b/docs/release-notes.rst
@@ -0,0 +1,14 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. Copyright (C) 2019 IBM.
+
+Release Notes
+#############
+
+Version: 0.4.1
+**************
+
+:Release Date: 2018-11-30
+
+Quick Links:
+
+ Wiki Release note<https://wiki.onap.org/display/DW/CCSDK+%3A+Dublin%3A+Release+Planning+Template> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/.gitignore b/ms/blueprintsprocessor/.gitignore
index f72f78ad..04f991d1 100644
--- a/ms/blueprintsprocessor/.gitignore
+++ b/ms/blueprintsprocessor/.gitignore
@@ -28,4 +28,5 @@
**/transaction.log
**/*versionsBackup
**/blackDuckHub*
-**/*.jsonld \ No newline at end of file
+**/*.jsonld
+/target-ide/
diff --git a/ms/blueprintsprocessor/application/etc/logback.xml b/ms/blueprintsprocessor/application/etc/logback.xml
new file mode 100755
index 00000000..a97bb8c3
--- /dev/null
+++ b/ms/blueprintsprocessor/application/etc/logback.xml
@@ -0,0 +1,36 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/application/etc/run.source b/ms/blueprintsprocessor/application/etc/run.source
new file mode 100755
index 00000000..7557ab12
--- /dev/null
+++ b/ms/blueprintsprocessor/application/etc/run.source
@@ -0,0 +1,12 @@
+java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \
+-DappName=${APPLICATIONNAME} -DappVersion=${BUNDLEVERSION} \
+-DrouteOffer=${ROUTEOFFER} \
+-DVERSION_ROUTEOFFER_ENVCONTEXT=${BUNDLEVERSION}/${STICKYSELECTORKEY}/${ENVCONTEXT} \
+-DSecurityFilePath=/etc \
+-DREST_NAME_NORMALIZER_PATTERN_FILE=/etc/PatternInputs.txt \
+-Dms_name=org.onap.ccsdk.apps.blueprintsprocessor \
+-Dlogging.config=${APP_CONFIG_HOME}/logback.xml \
+-Djava.security.egd=file:/dev/./urandom \
+-DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
+-Dspring.config.location=${APP_CONFIG_HOME}/ \
+org.onap.ccsdk.apps.blueprintsprocessor.BlueprintProcessorApplication
diff --git a/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties b/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties
new file mode 100755
index 00000000..c4880b67
--- /dev/null
+++ b/ms/blueprintsprocessor/application/opt/app/onap/config/application.properties
@@ -0,0 +1,36 @@
+#
+# Copyright � 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright © 2019 Bell Canada.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#logging.level.web=DEBUG
+
+# Web server config
+server.port=8080
+
+blueprintsprocessor.grpcEnable=false
+blueprintsprocessor.httpPort=8080
+blueprintsprocessor.grpcPort=9111
+# Blueprint Processor File Execution and Handling Properties
+blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
+# Primary Database Configuration
+blueprintsprocessor.db.primary.url=jdbc:mysql://db:3306/sdnctl
+blueprintsprocessor.db.primary.username=sdnctl
+blueprintsprocessor.db.primary.password=sdnctl
+blueprintsprocessor.db.primary.driverClassName=org.mariadb.jdbc.Driver
+blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=validate
+blueprintsprocessor.db.primary.hibernateDDLAuto=none
+blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/opt/app/onap/config/logback.xml b/ms/blueprintsprocessor/application/opt/app/onap/config/logback.xml
new file mode 100755
index 00000000..a97bb8c3
--- /dev/null
+++ b/ms/blueprintsprocessor/application/opt/app/onap/config/logback.xml
@@ -0,0 +1,36 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index 679a8b90..06752b79 100644..100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -3,6 +3,7 @@
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
~ Modifications Copyright © 2018 IBM.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -31,6 +32,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
@@ -69,13 +74,91 @@
<scope>test</scope>
</dependency>
</dependencies>
-
<build>
+ <resources>
+ <resource>
+ <!--config and resource files -->
+ <directory>${basedir}/etc</directory>
+ <targetPath>${basedir}/target/etc</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <!--config and resource files -->
+ <directory>${basedir}/src/main/resources</directory>
+ <targetPath>${basedir}/target/src/main/resources</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ant-test</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <!-- <skip>${skip.compile}</skip>-->
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
new file mode 100755
index 00000000..6bfa2407
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -0,0 +1,36 @@
+#
+# Copyright � 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright © 2019 IBM, Bell Canada.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#logging.level.web=DEBUG
+
+# Web server config
+server.port=8080
+
+blueprintsprocessor.grpcEnable=false
+blueprintsprocessor.httpPort=8080
+blueprintsprocessor.grpcPort=9111
+# Blueprint Processor File Execution and Handling Properties
+blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
+# Primary Database Configuration
+blueprintsprocessor.db.primary.url=jdbc:mysql://localhost:3306/sdnctl
+blueprintsprocessor.db.primary.username=sdnctl
+blueprintsprocessor.db.primary.password=sdnctl
+blueprintsprocessor.db.primary.driverClassName=org.mariadb.jdbc.Driver
+blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=update
+blueprintsprocessor.db.primary.hibernateDDLAuto=none
+blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect \ No newline at end of file
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index fa1a1e6e..62695207 100644..100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -1,5 +1,6 @@
#
# Copyright � 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright © 2019 IBM, Bell Canada.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,6 +15,10 @@
# limitations under the License.
#
#logging.level.web=DEBUG
+
+# Web server config
+server.port=8080
+
blueprintsprocessor.grpcEnable=false
blueprintsprocessor.httpPort=8080
blueprintsprocessor.grpcPort=9111
@@ -21,7 +26,7 @@ blueprintsprocessor.grpcPort=9111
blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
# Primary Database Configuration
-blueprintsprocessor.db.primary.url=jdbc:mysql://localhost:3306/sdnctl
+blueprintsprocessor.db.primary.url=jdbc:mysql://db:3306/sdnctl
blueprintsprocessor.db.primary.username=sdnctl
blueprintsprocessor.db.primary.password=sdnctl
blueprintsprocessor.db.primary.driverClassName=org.mariadb.jdbc.Driver
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
index f896ee05..d21264c0 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# Web server config
+server.port=8080
# Blueprint Processor File Execution and Handling Properties
blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
diff --git a/ms/blueprintsprocessor/distribution/pom.xml b/ms/blueprintsprocessor/distribution/pom.xml
new file mode 100755
index 00000000..fb5e3c12
--- /dev/null
+++ b/ms/blueprintsprocessor/distribution/pom.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2019 IBM, Bell Canada.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <artifactId>distribution</artifactId>
+ <packaging>pom</packaging>
+ <name>Blueprints Processor Distribution</name>
+ <properties>
+ <assembly.id>maven</assembly.id>
+ <name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
+ <serviceArtifactName>blueprintsprocessor</serviceArtifactName>
+ <image.name>onap/ccsdk-blueprintsprocessor</image.name>
+ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.verbose>true</docker.verbose>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>application</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ant-test</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!--build the final artifact for docker deployment -->
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.1.0</version>
+ <configuration>
+ <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <descriptors>
+ <descriptor>src/main/docker/distribution.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>posix</tarLongFileMode>
+ </configuration>
+ <executions>
+ <execution>
+ <id>${assembly.id}</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ println project.properties['ccsdk.project.version']
+ def versionArray
+ if (project.properties['ccsdk.project.version'] != null ) {
+ versionArray = project.properties['ccsdk.project.version'].split('\\.')
+ }
+
+ if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
+ {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest"
+ }
+
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version']
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.1</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>${docker.push.phase}</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+</project> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
new file mode 100755
index 00000000..c0eade50
--- /dev/null
+++ b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
@@ -0,0 +1,33 @@
+version: '3.3'
+
+services:
+ db:
+ image: mariadb:latest
+ container_name: ccsdk-mariadb
+ ports:
+ - "3306:3306"
+ volumes:
+ - ~/vm_mysql:/var/lib/mysql
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: sdnctl
+ MYSQL_DATABASE: sdnctl
+ MYSQL_USER: sdnctl
+ MYSQL_PASSWORD: sdnctl
+ blueprints-processor:
+ depends_on:
+ - db
+ image: onap/ccsdk-blueprintsprocessor:latest
+ container_name: bp-rest
+ ports:
+ - "8000:8080"
+ restart: always
+ volumes:
+ - ~/share/vm_ms/blueprintsprocessor/config:/opt/app/onap/config
+ - ~/share/vm_ms/blueprintsprocessor/logs:/logs
+ environment:
+ APPLICATIONNAME: BlueprintsProcessor
+ BUNDLEVERSION: 1.0.0
+ APP_CONFIG_HOME: /opt/app/onap/config
+ STICKYSELECTORKEY:
+ ENVCONTEXT: dev \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile b/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile
new file mode 100755
index 00000000..21362329
--- /dev/null
+++ b/ms/blueprintsprocessor/distribution/src/main/docker/Dockerfile
@@ -0,0 +1,20 @@
+FROM anapsix/alpine-java:8_jdk
+
+ENV HTTP_PROXY ${HTTP_PROXY}
+ENV HTTPS_PROXY ${HTTPS_PROXY}
+
+RUN apk add --no-cache curl
+
+COPY startService.sh /startService.sh
+RUN chmod 777 /startService.sh && dos2unix /startService.sh
+
+COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz
+
+RUN (mkdir -p /source /opt/app/onap) && (tar -xzf /source.tar.gz -C /source) \
+&& (mv /source/@project.build.finalName@ /source/app) \
+&& (cp -rf /source/app/opt/app/onap/lib /opt/app/onap/) \
+&& (cp -rf /source/app/etc /) \
+&& (cp -rf /source/app/config /) \
+&& (rm -rf /source)
+
+ENTRYPOINT /startService.sh \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml b/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
new file mode 100755
index 00000000..b538b73b
--- /dev/null
+++ b/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2018-2019 Bell Canada.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+ <!-- create a tar.gz file containing the projects dependencies -->
+ <id>${assembly.id}</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/opt/app/onap/lib</outputDirectory>
+ <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <excludes>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>${project.basedir}/../application/src/main/resources</directory>
+ <includes>
+ <include>application.properties</include>
+ <include>logback.xml</include>
+ </includes>
+ <outputDirectory>./</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/src/main/docker</directory>
+ <includes>
+ <include>Dockerfile</include>
+ <include>startService.sh</include>
+ </includes>
+ <outputDirectory>./</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/../application/src/main/resources</directory>
+ <outputDirectory>src/main/resources</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/../application/opt/app/onap/config</directory>
+ <outputDirectory>./config</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.basedir}/../application/etc</directory>
+ <outputDirectory>./etc</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ </fileSets>
+</assembly> \ No newline at end of file
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh b/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh
new file mode 100755
index 00000000..79bcbc06
--- /dev/null
+++ b/ms/blueprintsprocessor/distribution/src/main/docker/startService.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+nodeName=BlueprintsProcessor_1.0.0_$(cat /proc/self/cgroup | grep docker | sed s/\\//\\n/g | tail -1)
+
+echo "APP Config HOME : ${APP_CONFIG_HOME}"
+export APP_HOME=/opt/app/onap
+
+cp -rf /config /opt/app/onap/
+source /etc/run.source
diff --git a/ms/blueprintsprocessor/functions/pom.xml b/ms/blueprintsprocessor/functions/pom.xml
index 2a952f88..2a952f88 100644..100755
--- a/ms/blueprintsprocessor/functions/pom.xml
+++ b/ms/blueprintsprocessor/functions/pom.xml
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 7684b2b0..83cf59c2 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -27,6 +27,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
@@ -44,6 +45,7 @@ class ComponentJythonExecutorTest {
@Test
fun testPythonComponentInjection() {
+ /*
val executionServiceInput = ExecutionServiceInput()
executionServiceInput.payload = JsonNodeFactory.instance.objectNode()
@@ -57,8 +59,12 @@ class ComponentJythonExecutorTest {
actionIdentifiers.actionName = "activate"
executionServiceInput.actionIdentifiers = actionIdentifiers
+ */
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(commonHeader.requestId,
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
+ ExecutionServiceInput::class.java)!!
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
"./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
index 7142f045..7142f045 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/requests/sample-activate-request.json
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-activate-request.json
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
index 1c5455fd..e389f362 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceAssignmentProcessor.kt
@@ -17,24 +17,50 @@
package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
+import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
/**
* DefaultResourceAssignmentProcessor
*
- * @author Brinda Santh
+ * @author Kapil Singal
*/
@Service("resource-assignment-processor-default")
open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+ private val logger = LoggerFactory.getLogger(DefaultResourceAssignmentProcessor::class.java)
+
override fun getName(): String {
return "resource-assignment-processor-default"
}
- override fun process(executionRequest: ResourceAssignment) {
+ override fun process(resourceAssignment: ResourceAssignment) {
+ try {
+ // Check if It has Input
+ var value: Any? = raRuntimeService.getInputValue(resourceAssignment.name)
+
+ // If value is null get it from default source
+ if (value == null || value is NullNode) {
+ logger.info("Looking for defaultValue as couldn't find value in input For template key (${resourceAssignment.name})")
+ value = resourceAssignment.property?.defaultValue
+ }
+
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($value)")
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
+
+ // Check the value has populated for mandatory case
+ ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
+ } catch (e: Exception) {
+ ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
+ throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
+ }
+
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
index 2b3270e6..94271830 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt
@@ -33,7 +33,7 @@ import java.util.*
/**
* PrimaryDataResourceAssignmentProcessor
*
- * @author Brinda Santh
+ * @author Kapil Singal
*/
@Service("resource-assignment-processor-primary-db")
open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGenericService: PrimaryDBLibGenericService)
@@ -54,27 +54,27 @@ open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGeneri
if (value != null && value !is NullNode) {
logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)")
ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
- return
- }
-
- val dName = resourceAssignment.dictionaryName
- val dSource = resourceAssignment.dictionarySource
- val resourceDefinition = resourceDictionaries[dName]
- ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
- val resourceSource = resourceDefinition.sources[dSource]
- ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
- val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
- val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
- val sql = checkNotNull(sourceProperties.query) { "failed to get request query for $dName under $dSource properties" }
- val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
-
- logger.info("$dSource dictionary information : ($sql), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
-
- val rows = primaryDBLibGenericService.query(sql, populateNamedParameter(inputKeyMapping))
- if (rows.isNullOrEmpty()) {
- logger.warn("Failed to get $dSource result for dictionary name ($dName) the query ($sql)")
} else {
- processDBResults(resourceAssignment, sourceProperties, rows)
+ val dName = resourceAssignment.dictionaryName
+ val dSource = resourceAssignment.dictionarySource
+ val resourceDefinition = resourceDictionaries[dName]
+ ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
+ val resourceSource = resourceDefinition.sources[dSource]
+ ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
+ val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
+ val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
+
+ val sql = checkNotNull(sourceProperties.query) { "failed to get request query for $dName under $dSource properties" }
+ val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
+
+ logger.info("$dSource dictionary information : ($sql), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
+
+ val rows = primaryDBLibGenericService.query(sql, populateNamedParameter(inputKeyMapping))
+ if (rows.isNullOrEmpty()) {
+ logger.warn("Failed to get $dSource result for dictionary name ($dName) the query ($sql)")
+ } else {
+ populateResource(resourceAssignment, sourceProperties, rows)
+ }
}
// Check the value has populated for mandatory case
@@ -106,7 +106,7 @@ open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGeneri
}
@Throws(BluePrintProcessorException::class)
- private fun processDBResults(resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, rows: List<Map<String, Any>>) {
+ private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: DatabaseResourceSource, rows: List<Map<String, Any>>) {
val dName = resourceAssignment.dictionaryName
val dSource = resourceAssignment.dictionarySource
val type = nullToEmpty(resourceAssignment.property?.type)
@@ -115,21 +115,17 @@ open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGeneri
logger.info("Response processing type($type)")
// Primitive Types
- if (BluePrintTypes.validPrimitiveTypes().contains(type)) {
- val dbColumnValue = rows[0][outputKeyMapping[dName]]
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, dbColumnValue)
- }
- // Array Types
- else if (BluePrintTypes.validCollectionTypes().contains(type)) {
- lateinit var entrySchemaType: String
- if (resourceAssignment.property?.entrySchema != null) {
- entrySchemaType = nullToEmpty(resourceAssignment.property?.entrySchema?.type)
+ when(type) {
+ in BluePrintTypes.validPrimitiveTypes() -> {
+ val dbColumnValue = rows[0][outputKeyMapping[dName]]
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($dbColumnValue)")
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, dbColumnValue)
}
-
- if (checkNotEmptyOrThrow(entrySchemaType, "Entry schema is not defined for dictionary ($dName) info")) {
- val arrayNode = JsonNodeFactory.instance.arrayNode()
+ in BluePrintTypes.validCollectionTypes() -> {
+ val entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
+ var arrayNode = JsonNodeFactory.instance.arrayNode()
rows.forEach {
- if (BluePrintTypes.validPrimitiveTypes().contains(entrySchemaType)) {
+ if (entrySchemaType in BluePrintTypes.validPrimitiveTypes()) {
val dbColumnValue = it[outputKeyMapping[dName]]
// Add Array JSON
JacksonUtils.populatePrimitiveValues(dbColumnValue!!, entrySchemaType, arrayNode)
@@ -143,19 +139,22 @@ open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGeneri
arrayNode.add(arrayChildNode)
}
}
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
// Set the List of Complex Values
ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
}
- } else {
- // Complex Types
- val row = rows[0]
- val objectNode = JsonNodeFactory.instance.objectNode()
- for (mapping in outputKeyMapping.entries) {
- val dbColumnValue = checkNotNull(row[mapping.key])
- val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, type, mapping.key)
- JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, objectNode)
+ else -> {
+ // Complex Types
+ val row = rows[0]
+ var objectNode = JsonNodeFactory.instance.objectNode()
+ for (mapping in outputKeyMapping.entries) {
+ val dbColumnValue = checkNotNull(row[mapping.key])
+ val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, type, mapping.key)
+ JacksonUtils.populatePrimitiveValues(mapping.key, dbColumnValue, propertyTypeForDataType, objectNode)
+ }
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
}
- ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
index e05261d8..f1a4dbb0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/SimpleRestResourceAssignmentProcessor.kt
@@ -17,24 +17,146 @@
package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.JsonNodeFactory
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.RestResourceSource
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.apps.controllerblueprints.core.*
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
/**
* SimpleRestResourceAssignmentProcessor
*
- * @author Brinda Santh
+ * @author Kapil Singal
*/
-@Service("resource-assignment-processor-mdsal")
-open class SimpleRestResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+@Service("resource-assignment-processor-primary-config-data")
+open class SimpleRestResourceAssignmentProcessor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService)
+ : ResourceAssignmentProcessor() {
+
+ private val logger = LoggerFactory.getLogger(SimpleRestResourceAssignmentProcessor::class.java)
override fun getName(): String {
- return "resource-assignment-processor-mdsal"
+ return "resource-assignment-processor-primary-config-data"
}
- override fun process(executionRequest: ResourceAssignment) {
+ override fun process(resourceAssignment: ResourceAssignment) {
+ try {
+ validate(resourceAssignment)
+
+ // Check if It has Input
+ val value = raRuntimeService.getInputValue(resourceAssignment.name)
+ if (value != null && value !is NullNode) {
+ logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)")
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
+ } else {
+ val dName = resourceAssignment.dictionaryName
+ val dSource = resourceAssignment.dictionarySource
+ val resourceDefinition = resourceDictionaries[dName]
+ ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dName")
+ val resourceSource = resourceDefinition.sources[dSource]
+ ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
+ val resourceSourceProperties = checkNotNull(resourceSource.properties) { "failed to get source properties for $dName " }
+ val sourceProperties = JacksonUtils.getInstanceFromMap(resourceSourceProperties, RestResourceSource::class.java)
+
+ val urlPath = checkNotNull(sourceProperties.urlPath) { "failed to get request urlPath for $dName under $dSource properties" }
+ val path = nullToEmpty(sourceProperties.path)
+ val inputKeyMapping = checkNotNull(sourceProperties.inputKeyMapping) { "failed to get input-key-mappings for $dName under $dSource properties" }
+
+ logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
+
+ val restClientService = blueprintRestLibPropertyService.blueprintWebClientService("primary-config-data")
+ val response = restClientService.getResource(urlPath, String::class.java)
+ if (response.isNotBlank()) {
+ logger.warn("Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath)")
+ } else {
+ populateResource(resourceAssignment, sourceProperties, response, path)
+ }
+ }
+ // Check the value has populated for mandatory case
+ ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
+ } catch (e: Exception) {
+ ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
+ throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
+ }
}
- override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ @Throws(BluePrintProcessorException::class)
+ private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource, restResponse: String, path: String) {
+ val dName = resourceAssignment.dictionaryName
+ val dSource = resourceAssignment.dictionarySource
+ val type = nullToEmpty(resourceAssignment.property?.type)
+ lateinit var entrySchemaType: String
+
+ val outputKeyMapping = checkNotNull(sourceProperties.outputKeyMapping) { "failed to get output-key-mappings for $dName under $dSource properties" }
+ logger.info("Response processing type($type)")
+
+ val responseNode = checkNotNull(JacksonUtils.jsonNode(restResponse).at(path)) { "Failed to find path ($path) in response ($restResponse)" }
+ logger.info("populating value for output mapping ($outputKeyMapping), from json ($responseNode)")
+
+
+ when (type) {
+ in BluePrintTypes.validPrimitiveTypes() -> {
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($responseNode)")
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, responseNode)
+ }
+ in BluePrintTypes.validCollectionTypes() -> {
+ // Array Types
+ entrySchemaType = returnNotEmptyOrThrow(resourceAssignment.property?.entrySchema?.type) { "Entry schema is not defined for dictionary ($dName) info" }
+ val arrayNode = responseNode as ArrayNode
+
+ if (entrySchemaType !in BluePrintTypes.validPrimitiveTypes()) {
+ val responseArrayNode = responseNode.toList()
+ for (responseSingleJsonNode in responseArrayNode) {
+ val arrayChildNode = JsonNodeFactory.instance.objectNode()
+ outputKeyMapping.map {
+ val responseKeyValue = responseSingleJsonNode.get(it.key)
+ val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
+ logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})")
+ JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, arrayChildNode)
+ }
+ arrayNode.add(arrayChildNode)
+ }
+ }
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($arrayNode)")
+ // Set the List of Complex Values
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, arrayNode)
+ }
+ else -> {
+ // Complex Types
+ val objectNode = responseNode as ObjectNode
+ outputKeyMapping.map {
+ val responseKeyValue = responseNode.get(it.key)
+ val propertyTypeForDataType = ResourceAssignmentUtils.getPropertyType(raRuntimeService, entrySchemaType, it.key)
+ logger.info("For List Type Resource: key (${it.key}), value ($responseKeyValue), type ({$propertyTypeForDataType})")
+ JacksonUtils.populateJsonNodeValues(it.value, responseKeyValue, propertyTypeForDataType, objectNode)
+ }
+
+ logger.info("For template key (${resourceAssignment.name}) setting value as ($objectNode)")
+ // Set the List of Complex Values
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, objectNode)
+ }
+ }
+ }
+
+ @Throws(BluePrintProcessorException::class)
+ private fun validate(resourceAssignment: ResourceAssignment) {
+ checkNotEmptyOrThrow(resourceAssignment.name, "resource assignment template key is not defined")
+ checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
+ checkEqualsOrThrow(ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA, resourceAssignment.dictionarySource) {
+ "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PRIMARY_CONFIG_DATA} but it is ${resourceAssignment.dictionarySource}"
+ }
+ checkNotEmptyOrThrow(resourceAssignment.dictionaryName, "resource assignment dictionary name is not defined for template key (${resourceAssignment.name})")
}
+
+ override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
+ }
+
+
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index 9a846d69..ef69eb51 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -65,7 +65,7 @@ class ResourceResolutionServiceTest {
fun testRegisteredSource() {
val sources = resourceResolutionService.registeredResourceSources()
assertNotNull(sources, "failed to get registered sources")
- assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "mdsal")), "failed to get registered sources")
+ assertTrue(sources.containsAll(arrayListOf("input", "default", "primary-db", "primary-config-data")), "failed to get registered sources")
}
@Test
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
index 438e755c..41bbd1df 100644
--- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
@@ -95,3 +95,29 @@ open class Status {
@get:ApiModelProperty(required = true)
var message: String = "success"
}
+
+open class BluePrintManagementInput {
+ @get:ApiModelProperty(required = true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required = false)
+ lateinit var blueprintName: String
+ @get:ApiModelProperty(required = false)
+ lateinit var blueprintVersion: String
+ @get:ApiModelProperty(required = true)
+ lateinit var fileChunk: FileChunk
+}
+
+open class FileChunk {
+ @get:ApiModelProperty(required = true)
+ lateinit var chunk: ByteArray
+}
+
+open class BluePrintManagementOutput {
+ @get:ApiModelProperty(required = true)
+ lateinit var commonHeader: CommonHeader
+ @get:ApiModelProperty(required = true)
+ var status: Status = Status()
+}
+
+
+
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index 53c9b185..590c87f0 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -30,6 +30,10 @@
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
<artifactId>db-resources</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
index 4df89857..8d900a89 100644..100755
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/pom.xml
@@ -2,6 +2,8 @@
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
+ ~ Modifications Copyright © 2019 Bell Canada.
+ ~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
index 82e8cd73..773746b4 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
@@ -28,6 +28,10 @@
<description>Blueprints Processor Rest Lib</description>
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
<artifactId>core</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index 6395963b..dcf42c20 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -15,16 +15,16 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>inbounds</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>inbounds</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
- <artifactId>resource-api</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor Resource API</name>
- <description>Blueprints Processor Resource API</description>
+ <artifactId>resource-api</artifactId>
+ <packaging>jar</packaging>
+ <name>Blueprints Processor Resource API</name>
+ <description>Blueprints Processor Resource API</description>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index c510734d..818adf9d 100644..100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -2,6 +2,8 @@
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
+ ~ Modifications Copyright © 2019 Bell Canada.
+ ~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
@@ -30,11 +32,16 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.apps.components</groupId>
<artifactId>proto-definition</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <version>${project.version}</version>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
index aa01f220..fb0bc567 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
@@ -19,15 +19,14 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import io.grpc.StatusException
import io.grpc.stub.StreamObserver
-import org.apache.commons.io.FileUtils
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.currentTimestamp
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.apps.controllerblueprints.common.api.Status
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementInput
import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementOutput
import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.management.api.CommonHeader
-import org.onap.ccsdk.apps.controllerblueprints.management.api.Status
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
@@ -79,15 +78,18 @@ class BluePrintManagementGRPCHandler(private val bluePrintCoreConfiguration: Blu
}
private fun saveToDisk(request: BluePrintManagementInput, blueprintDir: File) {
- log.debug("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
+ log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
if (blueprintDir.exists()) {
- log.debug("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
- FileUtils.deleteDirectory(blueprintDir.parentFile)
+ log.info("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
+ //FileUtils.deleteDirectory(blueprintDir.parentFile)
+ blueprintDir.parentFile.deleteRecursively()
}
- FileUtils.forceMkdir(blueprintDir.parentFile)
+ blueprintDir.parentFile.mkdirs()
+ //FileUtils.forceMkdir(blueprintDir.parentFile)
blueprintDir.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
- log.debug("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
+ log.info("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
}
+
}
private fun successStatus(message: String, header: CommonHeader): BluePrintManagementOutput =
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
index 4ca0cfa9..453306de 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
@@ -18,6 +18,8 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import io.grpc.stub.StreamObserver
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.toJava
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils.toProto
import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
@@ -30,27 +32,29 @@ class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: Blu
: BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
-
override fun process(responseObserver: StreamObserver<ExecutionServiceOutput>?): StreamObserver<ExecutionServiceInput> {
return object : StreamObserver<ExecutionServiceInput> {
-
override fun onNext(executionServiceInput: ExecutionServiceInput) {
- TODO("Handle Processing Response")
-// executionServiceHandler.process(executionServiceInput)
-// responseObserver.onNext(executionServiceOuput)
+ try {
+ val output = executionServiceHandler.process(executionServiceInput.toJava())
+ .toProto(executionServiceInput.payload)
+ responseObserver?.onNext(output)
+ } catch (e: Exception) {
+ onError(e)
+ }
}
override fun onError(error: Throwable) {
- log.warn("Fail to process message", error)
+ log.debug("Fail to process message", error)
+ responseObserver?.onError(io.grpc.Status.INTERNAL
+ .withDescription(error.message)
+ .asException())
}
override fun onCompleted() {
responseObserver?.onCompleted()
}
}
-
}
-
-
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index 0b361d8a..ec605c1d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -66,11 +66,11 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC
response(executionServiceInput)
}
executionServiceInput.actionIdentifiers.mode == ACTION_MODE_SYNC -> doProcess(executionServiceInput)
- else -> response(executionServiceInput, true)
+ else -> response(executionServiceInput, "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.", true)
}
}
- fun doProcess(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ private fun doProcess(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
val requestId = executionServiceInput.commonHeader.requestId
log.info("processing request id $requestId")
@@ -87,13 +87,14 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC
return blueprintDGExecutionService.executeDirectedGraph(blueprintRuntimeService, executionServiceInput)
}
- fun response(executionServiceInput: ExecutionServiceInput, failure: Boolean = false): ExecutionServiceOutput {
+ fun response(executionServiceInput: ExecutionServiceInput, errorMessage: String = "", failure: Boolean = false): ExecutionServiceOutput {
val executionServiceOutput = ExecutionServiceOutput()
executionServiceOutput.commonHeader = executionServiceInput.commonHeader
executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
executionServiceOutput.payload = executionServiceInput.payload
val status = Status()
+ status.errorMessage = errorMessage
if (failure) {
status.eventType = "EVENT-COMPONENT-FAILURE"
status.code = 500
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt
new file mode 100644
index 00000000..220a6fd6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappings.kt
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.google.common.base.Strings
+import com.google.protobuf.Struct
+import com.google.protobuf.Value
+import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag
+import org.onap.ccsdk.apps.controllerblueprints.common.api.Status
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
+import java.text.SimpleDateFormat
+import java.util.*
+
+private val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+
+// STRUCT
+
+fun Struct.toJava(): ObjectNode {
+ val objectNode = JsonNodeFactory.instance.objectNode()
+ return getNode(objectNode)
+}
+
+fun Struct.getNode(objectNode: ObjectNode): ObjectNode {
+ this.fieldsMap.forEach {
+ when (it.value.kindCase.name) {
+ "BOOL_VALUE" -> objectNode.put(it.key, it.value.boolValue)
+ "KIND_NOT_SET" -> objectNode.put(it.key, it.value.toByteArray())
+ "LIST_VALUE" -> {
+ val arrayNode = JsonNodeFactory.instance.arrayNode()
+ it.value.listValue.valuesList.forEach { arrayNode.addPOJO(it.getValue()) }
+ objectNode.put(it.key, arrayNode)
+ }
+ "NULL_VALUE" -> objectNode.put(it.key, JsonNodeFactory.instance.nullNode())
+ "NUMBER_VALUE" -> objectNode.put(it.key, it.value.numberValue)
+ "STRING_VALUE" -> objectNode.put(it.key, it.value.stringValue)
+ "STRUCT_VALUE" -> objectNode.put(it.key, it.value.structValue.getNode(JsonNodeFactory.instance.objectNode()))
+ }
+ }
+ return objectNode
+}
+
+fun Value.getValue(): Any {
+ return when (this.kindCase.name) {
+ "BOOL_VALUE" -> this.boolValue
+ "KIND_NOT_SET" -> this.toByteArray()
+ "LIST_VALUE" -> listOf(this.listValue.valuesList.forEach { it.getValue() })
+ "NULL_VALUE" -> JsonNodeFactory.instance.nullNode()
+ "NUMBER_VALUE" -> this.numberValue
+ "STRING_VALUE" -> this.stringValue
+ "STRUCT_VALUE" -> this.structValue.getNode(JsonNodeFactory.instance.objectNode())
+ else -> {
+ "undefined"
+ }
+ }
+}
+
+// ACTION IDENTIFIER
+
+fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers.toProto(): ActionIdentifiers {
+ val actionIdentifier = ActionIdentifiers.newBuilder()
+ actionIdentifier.actionName = this.actionName
+ actionIdentifier.blueprintName = this.blueprintName
+ actionIdentifier.blueprintVersion = this.blueprintVersion
+ actionIdentifier.mode = this.mode
+ return actionIdentifier.build()
+}
+
+fun ActionIdentifiers.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers {
+ val actionIdentifier = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers()
+ actionIdentifier.actionName = this.actionName
+ actionIdentifier.blueprintName = this.blueprintName
+ actionIdentifier.blueprintVersion = this.blueprintVersion
+ actionIdentifier.mode = this.mode
+ return actionIdentifier
+}
+
+// COMMON HEADER
+
+fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader.toProto(): CommonHeader {
+ val commonHeader = CommonHeader.newBuilder()
+ commonHeader.originatorId = this.originatorId
+ commonHeader.requestId = this.requestId
+ commonHeader.subRequestId = this.subRequestId
+ commonHeader.timestamp = this.timestamp.toString()
+ commonHeader.flag = this.flags?.toProto()
+ return commonHeader.build()
+}
+
+fun CommonHeader.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader {
+ val commonHeader = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader()
+ commonHeader.originatorId = this.originatorId
+ commonHeader.requestId = this.requestId
+ commonHeader.subRequestId = this.subRequestId
+ commonHeader.timestamp = if (!Strings.isNullOrEmpty(this.timestamp)) {
+ formatter.parse(this.timestamp)
+ } else {
+ Date()
+ }
+ commonHeader.flags = this.flag?.toJava()
+ return commonHeader
+}
+
+// FLAG
+
+fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags.toProto(): Flag {
+ val flag = Flag.newBuilder()
+ flag.isForce = this.isForce
+ flag.ttl = this.ttl
+ return flag.build()
+}
+
+fun Flag.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags {
+ val flag = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags()
+ flag.isForce = this.isForce
+ flag.ttl = this.ttl
+ return flag
+}
+
+// STATUS
+
+fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status.toProto(): Status {
+ val status = Status.newBuilder()
+ status.code = this.code
+ status.errorMessage = this.errorMessage
+ status.message = this.message
+ status.timestamp = this.timestamp.toString()
+ status.eventType = this.eventType
+ return status.build()
+}
+
+// EXECUTION INPUT
+
+fun ExecutionServiceInput.toJava(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput {
+ val executionServiceInput = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput()
+ executionServiceInput.actionIdentifiers = this.actionIdentifiers.toJava()
+ executionServiceInput.commonHeader = this.commonHeader.toJava()
+ executionServiceInput.payload = this.payload.toJava()
+ return executionServiceInput
+}
+
+// EXECUTION OUPUT
+
+fun org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput.toProto(payload: Struct): ExecutionServiceOutput {
+ val executionServiceOuput = ExecutionServiceOutput.newBuilder()
+ executionServiceOuput.actionIdentifiers = this.actionIdentifiers.toProto()
+ executionServiceOuput.commonHeader = this.commonHeader.toProto()
+ executionServiceOuput.status = this.status.toProto()
+ executionServiceOuput.payload = payload
+ return executionServiceOuput.build()
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
index a48e699c..264e2aea 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
@@ -19,13 +19,12 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import com.google.protobuf.ByteString
import io.grpc.testing.GrpcServerRule
-import org.apache.commons.io.FileUtils
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementInput
import org.onap.ccsdk.apps.controllerblueprints.management.api.BluePrintManagementServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.management.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.management.api.FileChunk
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
@@ -34,7 +33,6 @@ import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import java.io.File
-import java.nio.file.Paths
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
@@ -61,14 +59,19 @@ class BluePrintManagementGRPCHandlerTest {
@AfterTest
fun cleanDir() {
- FileUtils.deleteDirectory(File("./target/blueprints"))
+ //TODO It's giving fluctuating results, need to look for another way to cleanup
+ // works sometimes otherwise results IO Exception
+ // Most probably bufferReader stream is not getting closed when cleanDir is getting invoked
+ File("./target/blueprints").deleteRecursively()
}
@Test
fun `test upload blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123"
- val output = blockingStub.uploadBlueprint(createInputRequest(id))
+ val id = "123_upload"
+ val req = createInputRequest(id)
+ val output = blockingStub.uploadBlueprint(req)
+
assertEquals(200, output.status.code)
assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
assertEquals(id, output.commonHeader.requestId)
@@ -77,17 +80,24 @@ class BluePrintManagementGRPCHandlerTest {
@Test
fun `test delete blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
- val id = "123"
+ val id = "123_delete"
val req = createInputRequest(id)
- blockingStub.uploadBlueprint(req)
- blockingStub.removeBlueprint(req)
+
+ var output = blockingStub.uploadBlueprint(req)
+ assertEquals(200, output.status.code)
+ assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
+ assertEquals(id, output.commonHeader.requestId)
+
+ output = blockingStub.removeBlueprint(req)
+ assertEquals(200, output.status.code)
}
private fun createInputRequest(id: String): BluePrintManagementInput {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
+ val file = File("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
- val commonHeader = CommonHeader.newBuilder()
+ val commonHeader = CommonHeader
+ .newBuilder()
.setTimestamp("2012-04-23T18:25:43.511Z")
.setOriginatorId("System")
.setRequestId(id)
@@ -103,4 +113,4 @@ class BluePrintManagementGRPCHandlerTest {
.setFileChunk(fileChunk)
.build()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index 280227d0..01984b21 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -19,15 +19,20 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
import com.google.protobuf.util.JsonFormat
+import io.grpc.stub.StreamObserver
import io.grpc.testing.GrpcServerRule
+import org.junit.Assert
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceOutput
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
@@ -43,6 +48,7 @@ import kotlin.test.BeforeTest
@ComponentScan(basePackages = ["org.onap.ccsdk.apps.blueprintsprocessor", "org.onap.ccsdk.apps.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
+ private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
@get:Rule
val grpcServerRule = GrpcServerRule().directExecutor()
@@ -50,17 +56,35 @@ class BluePrintProcessingGRPCHandlerTest {
@Autowired
lateinit var bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler
+ lateinit var requestObs: StreamObserver<ExecutionServiceInput>
+
@BeforeTest
fun init() {
- // Create a server, add service, start, and register for automatic graceful shutdown.
grpcServerRule.serviceRegistry.addService(bluePrintProcessingGRPCHandler)
+
+ val blockingStub = BluePrintProcessingServiceGrpc.newStub(grpcServerRule.channel)
+
+ requestObs = blockingStub.process(object : StreamObserver<ExecutionServiceOutput> {
+ override fun onNext(executionServiceOuput: ExecutionServiceOutput) {
+ log.debug("onNext {}", executionServiceOuput)
+ if ("1234".equals(executionServiceOuput.commonHeader.requestId)) {
+ Assert.assertEquals("Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.", executionServiceOuput.status.errorMessage)
+ }
+ }
+
+ override fun onError(error: Throwable) {
+ log.debug("Fail to process message", error)
+ Assert.assertEquals("INTERNAL: Could not find blueprint : from database", error.message)
+ }
+
+ override fun onCompleted() {
+ log.info("Done")
+ }
+ })
}
@Test
fun testSelfServiceGRPCHandler() {
-
- val blockingStub = BluePrintProcessingServiceGrpc.newBlockingStub(grpcServerRule.channel)
-
val commonHeader = CommonHeader.newBuilder()
.setTimestamp("2012-04-23T18:25:43.511Z")
.setOriginatorId("System")
@@ -76,8 +100,25 @@ class BluePrintProcessingGRPCHandlerTest {
.setPayload(payloadBuilder.build())
.build()
-// val response = blockingStub.process(input)
-// assertNotNull(response, "Response is null")
+ requestObs.onNext(input)
+
+ val commonHeader2 = CommonHeader.newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId("2345")
+ .setSubRequestId("1234-56").build()
+
+ val actionIdentifier = ActionIdentifiers.newBuilder().setMode("sync").build()
+
+ val input2 = ExecutionServiceInput.newBuilder()
+ .setCommonHeader(commonHeader2)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
+
+ requestObs.onNext(input2)
+
+ requestObs.onCompleted()
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
new file mode 100644
index 00000000..2e4ba275
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/utils/BluePrintMappingTests.kt
@@ -0,0 +1,172 @@
+package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.utils
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.protobuf.ListValue
+import com.google.protobuf.NullValue
+import com.google.protobuf.Struct
+import com.google.protobuf.Value
+import com.google.protobuf.util.JsonFormat
+import org.junit.Assert
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Flags
+import org.onap.ccsdk.apps.controllerblueprints.common.api.ActionIdentifiers
+import org.onap.ccsdk.apps.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.apps.controllerblueprints.common.api.Flag
+import org.springframework.test.context.junit4.SpringRunner
+import java.text.SimpleDateFormat
+
+@RunWith(SpringRunner::class)
+class BluePrintMappingsTest {
+
+ val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ val dateString = "2019-01-16T18:25:43.511Z"
+ val dateForTest = formatter.parse(dateString)
+
+ val flag = Flag.newBuilder().setIsForce(false).setTtl(1).build()
+
+ fun createFlag(): Flags {
+ val flag = Flags()
+ flag.isForce = false
+ flag.ttl = 1
+ return flag
+ }
+
+ @Test
+ fun flagToJavaTest() {
+ val flag2 = flag.toJava()
+
+ Assert.assertEquals(flag.isForce, flag2.isForce)
+ Assert.assertEquals(flag.ttl, flag2.ttl)
+ }
+
+ @Test
+ fun flagToProtoTest() {
+ val flag = createFlag()
+ val flag2 = flag.toProto()
+
+ Assert.assertEquals(flag.isForce, flag2.isForce)
+ Assert.assertEquals(flag.ttl, flag2.ttl)
+ }
+
+ fun createStatus(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status {
+ val status = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status()
+ status.code = 400
+ status.errorMessage = "Concurrent modification exception"
+ status.eventType = "Update"
+ status.message = "Error uploading data"
+ status.timestamp = dateForTest
+ return status
+ }
+
+ @Test
+ fun statusToProtoTest() {
+ val status = createStatus()
+ val status2 = status.toProto()
+
+ Assert.assertEquals(status.code, status2.code)
+ Assert.assertEquals(status.errorMessage, status2.errorMessage)
+ Assert.assertEquals(status.eventType, status2.eventType)
+ Assert.assertEquals(status.message, status2.message)
+ Assert.assertEquals(status.timestamp.toString(), status2.timestamp)
+ }
+
+ @Test
+ fun commonHeaderToJavaTest() {
+ val flag = Flag.newBuilder().setIsForce(true).setTtl(2).build()
+
+ val commonHeader = CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString).setFlag(flag).build()
+ val commonHeader2 = commonHeader.toJava()
+
+ Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
+ Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
+ Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
+ Assert.assertEquals(commonHeader.timestamp, formatter.format(commonHeader2.timestamp))
+ }
+
+ fun createCommonHeader(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader {
+ val commonHeader = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader()
+ commonHeader.flags = createFlag()
+ commonHeader.originatorId = "1234"
+ commonHeader.requestId = "2345"
+ commonHeader.subRequestId = "0123"
+ commonHeader.timestamp = dateForTest
+ return commonHeader
+ }
+
+ @Test
+ fun commonHeaderToProtoTest() {
+ val commonHeader = createCommonHeader()
+ val commonHeader2 = commonHeader.toProto()
+ Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
+ Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
+ Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
+ Assert.assertEquals(commonHeader.timestamp.toString(), commonHeader2.timestamp)
+ }
+
+ @Test
+ fun actionIdentifierToJavaTest() {
+ val actionIdentifiers = ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0").setMode("Execution").build()
+ val actionIdentifiers2 = actionIdentifiers.toJava()
+
+ Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
+ Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
+ Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
+ Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
+ }
+
+ fun createActionIdentifier(): org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers {
+ val ac = org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers()
+ ac.mode = "mode"
+ ac.blueprintVersion = "version"
+ ac.blueprintName = "name"
+ ac.actionName = "action"
+ return ac
+ }
+
+ @Test
+ fun actionIdentifierToProtoTest() {
+ val actionIdentifiers = createActionIdentifier()
+ val actionIdentifiers2 = actionIdentifiers.toProto()
+
+ Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
+ Assert.assertEquals(actionIdentifiers.blueprintName, actionIdentifiers2.blueprintName)
+ Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
+ Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
+ }
+
+ @Test
+ fun testStructToJava() {
+ val struct = Struct.newBuilder().putAllFields(createValues()).build()
+ val struct2 = struct.toJava()
+
+ val mapper = ObjectMapper()
+
+ Assert.assertEquals(JsonFormat.printer().print(struct).replace(" ", "").replace("\r",""),
+ mapper.writerWithDefaultPrettyPrinter().writeValueAsString(struct2).replace(" ", "").replace("\r",""))
+ }
+
+ fun createValues(): Map<String, Value> {
+ val map = mutableMapOf<String, Value>()
+
+ val boolValue = Value.newBuilder().setBoolValue(true).build()
+ val stringValue = Value.newBuilder().setStringValue("string").build()
+ val doubleValue = Value.newBuilder().setNumberValue(Double.MAX_VALUE).build()
+ val jsonValue = Value.newBuilder().setStringValue("{\"bblah\": \"bbblo\"}").build()
+ val listValue = Value.newBuilder().setListValue(ListValue.newBuilder().addValues(boolValue).addValues(boolValue).build()).build()
+ val nullValue = Value.newBuilder().setNullValue(NullValue.NULL_VALUE).build()
+
+ map.put("bool", boolValue)
+ map.put("string", stringValue)
+ map.put("doublbe", doubleValue)
+ map.put("json", jsonValue)
+ map.put("list", listValue)
+ map.put("null", nullValue)
+
+ val structValue = Value.newBuilder().setStructValue(Struct.newBuilder().putAllFields(map).build()).build()
+
+ map.put("struct", structValue)
+
+ return map
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml
index e957c881..b6c26e67 100644
--- a/ms/blueprintsprocessor/modules/outbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml
@@ -15,16 +15,16 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>modules</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
- <artifactId>outbounds</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Outbounds POM</name>
- <description>Blueprints Processor Outbounds</description>
+ <artifactId>outbounds</artifactId>
+ <packaging>pom</packaging>
+ <name>Blueprints Processor Outbounds POM</name>
+ <description>Blueprints Processor Outbounds</description>
</project>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index 035f14d9..96bb09f2 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -29,6 +29,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
<artifactId>core</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml
index 8cb3c6f1..469899d0 100644..100755
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/pom.xml
@@ -2,6 +2,8 @@
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
+ ~ Modifications Copyright © 2019 Bell Canada.
+ ~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index 6e3dade6..cc2a0e66 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -28,6 +28,10 @@
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
<artifactId>execution-service</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index f694ac12..472b466b 100644..100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -3,6 +3,7 @@
~ Copyright © 2017-2018 AT&T Intellectual Property.
~
~ Modifications Copyright © 2018 IBM.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -30,12 +31,12 @@
<name>Blueprints Processor Parent</name>
<description>Blueprints Processor Parent</description>
<properties>
- <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
- <spring.version>5.1.3.RELEASE</spring.version>
- <kotlin.version>1.3.11</kotlin.version>
- <kotlin.maven.version>1.3.11</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
- <grpc.version>1.17.1</grpc.version>
+ <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
+ <spring.version>5.1.4.RELEASE</spring.version>
+ <kotlin.version>1.3.20</kotlin.version>
+ <kotlin.maven.version>1.3.20</kotlin.maven.version>
+ <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
+ <grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
<sli.version>0.4.1-SNAPSHOT</sli.version>
@@ -126,14 +127,26 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-common</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
+ <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jvm-host</artifactId>
<version>${kotlin.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compile</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
<version>${kotlin.version}</version>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -247,6 +260,11 @@
<!-- Application Module Dependencies -->
<dependency>
<groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>application</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
<artifactId>db-lib</artifactId>
<version>${project.version}</version>
</dependency>
@@ -304,6 +322,11 @@
<artifactId>resource-dict</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Database -->
<dependency>
diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml
index df4932cd..774e177e 100644..100755
--- a/ms/blueprintsprocessor/pom.xml
+++ b/ms/blueprintsprocessor/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -15,34 +16,35 @@
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>ccsdk-apps-ms</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
- <artifactId>blueprintsprocessor</artifactId>
- <packaging>pom</packaging>
- <name>Blueprints Processor Root</name>
- <description>Blueprints Processor Root</description>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>ccsdk-apps-ms</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>blueprintsprocessor</artifactId>
+ <packaging>pom</packaging>
+ <name>Blueprints Processor Root</name>
+ <description>Blueprints Processor Root</description>
- <properties>
- <service.name>BlueprintsProcessor</service.name>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <java.version>1.8</java.version>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- </properties>
+ <properties>
+ <service.name>BlueprintsProcessor</service.name>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <build.number>${maven.build.timestamp}</build.number>
+ <java.version>1.8</java.version>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ </properties>
- <modules>
- <module>parent</module>
- <module>modules</module>
- <module>functions</module>
- <module>application</module>
- </modules>
+ <modules>
+ <module>parent</module>
+ <module>modules</module>
+ <module>functions</module>
+ <module>application</module>
+ <module>distribution</module>
+ </modules>
</project>
diff --git a/ms/controllerblueprints/application/etc/run.source b/ms/controllerblueprints/application/etc/run.source
index fc1b4e55..1d0ac070 100644..100755
--- a/ms/controllerblueprints/application/etc/run.source
+++ b/ms/controllerblueprints/application/etc/run.source
@@ -9,8 +9,5 @@ java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:$
-Djava.security.egd=file:/dev/./urandom \
-DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
-Dspring.config.location=${APP_CONFIG_HOME}/ \
--Dspring.datasource.url=${DB_URL} \
--Dspring.datasource.username=${DB_USER} \
--Dspring.datasource.password=${DB_PASSWORD} \
-Dblueprints.load.initial-data=${INIT_DATA_LOAD} \
-org.onap.ccsdk.apps.controllerblueprints.ControllerBluprintsApplication
+org.onap.ccsdk.apps.controllerblueprints.ControllerBlueprintsApplication
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
index e574778e..81b3061a 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
@@ -49,7 +49,7 @@ spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
@@ -64,4 +64,7 @@ controllerblueprints.loadResourceDictionary=true
controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
# CBA file extension
-controllerblueprints.loadCbaExtension=zip \ No newline at end of file
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
index 91792394..5b651e66 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
@@ -1,6 +1,7 @@
#
# Copyright © 2017-2018 AT&T Intellectual Property.
# Modifications Copyright © 2018 IBM.
+# Modifications Copyright © 2019 Bell Canada.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -41,17 +42,17 @@ spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true
# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
-spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.url=jdbc:mysql://db:3306/sdnctl
spring.datasource.username=sdnctl
spring.datasource.password=sdnctl
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
-spring.jpa.show-sql = true
-spring.jpa.hibernate.ddl-auto = none
-spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
-spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
@@ -61,11 +62,14 @@ controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
# blueprints.load.initial-data may be overridden by ENV variables
controllerblueprints.loadInitialData=true
controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadBluePrintPaths=/model-catalog/blueprint-model/starter-blueprint
controllerblueprints.loadModelType=true
-controllerblueprints.loadModeTypePaths=model-catalog/definition-type/starter-type
+controllerblueprints.loadModeTypePaths=/model-catalog/definition-type/starter-type
controllerblueprints.loadResourceDictionary=true
-controllerblueprints.loadResourceDictionaryPaths=model-catalog/resource-dictionary/starter-dictionary
+controllerblueprints.loadResourceDictionaryPaths=/model-catalog/resource-dictionary/starter-dictionary
# CBA file extension
-controllerblueprints.loadCbaExtension=zip \ No newline at end of file
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/logback.xml b/ms/controllerblueprints/application/opt/app/onap/config/logback.xml
new file mode 100755
index 00000000..01ae4f6c
--- /dev/null
+++ b/ms/controllerblueprints/application/opt/app/onap/config/logback.xml
@@ -0,0 +1,44 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<configuration>
+
+ <property name="localPattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{100} - %msg%n" />
+
+ <property name="defaultPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}| %msg%n" />
+
+ <property name="debugLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|[%caller{3}]| %msg%n" />
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.springframework.security.web.authentication" level="warn"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
index 2471bd5b..c4759b56 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
@@ -17,7 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints;
/**
- * ApplicationConstants.java Purpose: Provide ControllerBluprintsApplication Constant Information
+ * ApplicationConstants.java Purpose: Provide ControllerBlueprintsApplication Constant Information
*
* @author Brinda Santh
* @version 1.0
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
index 6b0efd87..e925c69c 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
@@ -31,12 +31,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
@EnableWebFlux
@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
@EnableAutoConfiguration
-public class ControllerBluprintsApplication {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBluprintsApplication.class);
+public class ControllerBlueprintsApplication {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBlueprintsApplication.class);
public static void main(String[] args) {
log.info("****** Starting Controlled Blueprints Application ******");
- SpringApplication.run(ControllerBluprintsApplication.class, args);
+ SpringApplication.run(ControllerBlueprintsApplication.class, args);
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application-dev.properties b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
new file mode 100755
index 00000000..30b71fb4
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
@@ -0,0 +1,70 @@
+#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+appName=ControllerBluePrints
+ms_name=org.onap.ccsdk.apps.controllerblueprints
+appVersion=1.0.0
+
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
+#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
+
+logging.level.org.springframework.web=INFO
+logging.level.org.hibernate.SQL=warn
+logging.level.org.hibernate.type.descriptor.sql=debug
+
+#To Remove Null in JSON API Response
+spring.jackson.default-property-inclusion=non_null
+
+#Swagger Configuration
+swagger.contact.name=Brinda Santh Muthuramalingam
+swagger.contact.url=www.onap.com
+swagger.contact.email=brindasanth@onap.com
+
+spring.jpa.properties.hibernate.show_sql=true
+spring.jpa.properties.hibernate.use_sql_comments=true
+spring.jpa.properties.hibernate.format_sql=true
+
+# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
+spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.username=sdnctl
+spring.datasource.password=sdnctl
+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+# Controller Blueprints Core Configuration
+controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
+controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
+controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
+# Controller Blueprint Load Configurations
+controllerblueprints.loadInitialData=true
+controllerblueprints.loadBluePrint=false
+controllerblueprints.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadModelType=true
+controllerblueprints.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type
+controllerblueprints.loadResourceDictionary=true
+controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
+
+# CBA file extension
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application.properties b/ms/controllerblueprints/application/src/main/resources/application.properties
new file mode 100755
index 00000000..ec61be48
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/resources/application.properties
@@ -0,0 +1,74 @@
+#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright © 2019 Bell Canada.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+appName=ControllerBluePrints
+ms_name=org.onap.ccsdk.apps.controllerblueprints
+appVersion=1.0.0
+
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
+#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
+
+logging.level.org.springframework.web=INFO
+logging.level.org.hibernate.SQL=warn
+logging.level.org.hibernate.type.descriptor.sql=debug
+
+#To Remove Null in JSON API Response
+spring.jackson.default-property-inclusion=non_null
+
+#Swagger Configuration
+swagger.contact.name=Brinda Santh Muthuramalingam
+swagger.contact.url=www.onap.com
+swagger.contact.email=brindasanth@onap.com
+
+spring.jpa.properties.hibernate.show_sql=true
+spring.jpa.properties.hibernate.use_sql_comments=true
+spring.jpa.properties.hibernate.format_sql=true
+
+# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
+spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.username=sdnctl
+spring.datasource.password=sdnctl
+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
+
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+
+# Controller Blueprints Core Configuration
+controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
+controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
+controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
+# Controller Blueprint Load Configurations
+# blueprints.load.initial-data may be overridden by ENV variables
+controllerblueprints.loadInitialData=true
+controllerblueprints.loadBluePrint=false
+controllerblueprints.loadBluePrintPaths=/model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadModelType=true
+controllerblueprints.loadModeTypePaths=/model-catalog/definition-type/starter-type
+controllerblueprints.loadResourceDictionary=true
+controllerblueprints.loadResourceDictionaryPaths=/model-catalog/resource-dictionary/starter-dictionary
+
+# CBA file extension
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
index 969f8042..cf9b3e71 100644
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
@@ -30,7 +30,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ControllerBluprintsApplicationTest {
+public class ControllerBlueprintsApplicationTest {
@Autowired
private TestRestTemplate restTemplate;
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 1fafd8bc..9aebd793 100755
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -33,7 +33,7 @@ swagger.contact.url=www.onap.com
swagger.contact.email=brindasanth@onap.com
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
@@ -52,4 +52,7 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-
controllerblueprints.loadCbaExtension=zip
# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints \ No newline at end of file
+controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml
index 30571293..91d4bbca 100644..100755
--- a/ms/controllerblueprints/distribution/pom.xml
+++ b/ms/controllerblueprints/distribution/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -30,10 +31,10 @@
<name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
<serviceArtifactName>controllerblueprints</serviceArtifactName>
<image.name>onap/ccsdk-controllerblueprints</image.name>
- <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.verbose>true</docker.verbose>
- </properties>
+ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.verbose>true</docker.verbose>
+ </properties>
<dependencies>
<dependency>
@@ -120,20 +121,20 @@
</goals>
<configuration>
<source>
- println project.properties['ccsdk.project.version'];
- def versionArray;
+ println project.properties['ccsdk.project.version']
+ def versionArray
if (project.properties['ccsdk.project.version'] != null ) {
- versionArray = project.properties['ccsdk.project.version'].split('\\.');
+ versionArray = project.properties['ccsdk.project.version'].split('\\.')
}
if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
{
- project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"
} else {
- project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
+ project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest"
}
- println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version']
</source>
</configuration>
</execution>
@@ -143,34 +144,34 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.26.1</version>
- <inherited>false</inherited>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- </build>
- </image>
- </images>
- <verbose>true</verbose>
- </configuration>
- <executions>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.1</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
<execution>
<id>generate-images</id>
<phase>package</phase>
@@ -186,11 +187,11 @@
<goal>push</goal>
</goals>
</execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- </profiles>
+ </profiles>
</project>
diff --git a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
index eae24703..232bfc01 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
+++ b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
@@ -1,37 +1,33 @@
-version: '3.3'
-
-services:
- db:
- image: mariadb:latest
- container_name: cb-mariadb
- ports:
- - "3306:3306"
- volumes:
- - ~/vm_mysql:/var/lib/mysql
- restart: always
- environment:
- MYSQL_ROOT_PASSWORD: sdnctl
- MYSQL_DATABASE: sdnctl
- MYSQL_USER: sdnctl
- MYSQL_PASSWORD: sdnctl
- controller-blueprints:
- depends_on:
- - db
- image: onap/ccsdk-controllerblueprints:latest
- container_name: cb-rest
- ports:
- - "8080:8080"
- restart: always
- volumes:
- - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config
- - ~/share/vm_ms/controllerblueprints/logs:/logs
- environment:
- APPLICATIONNAME : ControllerBluePrints
- BUNDLEVERSION: 1.0.0
- APP_CONFIG_HOME: /opt/app/onap/config
- DB_URL: jdbc:mysql://db:3306/sdnctl
- DB_USER: sdnctl
- DB_PASSWORD: sdnctl
- INIT_DATA_LOAD: "true"
- STICKYSELECTORKEY:
- ENVCONTEXT: DEV \ No newline at end of file
+version: '3.3'
+
+services:
+ db:
+ image: mariadb:latest
+ container_name: ccsdk-mariadb
+ ports:
+ - "3306:3306"
+ volumes:
+ - ~/vm_mysql:/var/lib/mysql
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: sdnctl
+ MYSQL_DATABASE: sdnctl
+ MYSQL_USER: sdnctl
+ MYSQL_PASSWORD: sdnctl
+ controller-blueprints:
+ depends_on:
+ - db
+ image: onap/ccsdk-controllerblueprints:latest
+ container_name: cb-rest
+ ports:
+ - "8080:8080"
+ restart: always
+ volumes:
+ - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config
+ - ~/share/vm_ms/controllerblueprints/logs:/logs
+ environment:
+ APPLICATIONNAME: ControllerBluePrints
+ BUNDLEVERSION: 1.0.0
+ APP_CONFIG_HOME: /opt/app/onap/config
+ STICKYSELECTORKEY:
+ ENVCONTEXT: dev \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
index 6de589da..88577f5a 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
+++ b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
@@ -15,6 +15,7 @@ RUN (mkdir -p /source /opt/app/onap) && (tar -xzf /source.tar.gz -C /source) \
&& (cp -rf /source/app/opt/app/onap/lib /opt/app/onap/) \
&& (cp -rf /source/app/etc /) \
&& (cp -rf /source/app/model-catalog /) \
+&& (cp -rf /source/app/config /) \
&& (rm -rf /source)
-ENTRYPOINT /startService.sh
+ENTRYPOINT /startService.sh \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
index c929f98e..1555b43e 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
+++ b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -59,6 +60,11 @@
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
+ <directory>${project.basedir}/../application/opt/app/onap/config</directory>
+ <outputDirectory>./config</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
<directory>${project.basedir}/../../../components/model-catalog</directory>
<outputDirectory>./model-catalog</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
diff --git a/ms/controllerblueprints/distribution/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh
index 7077c224..84b2e5ac 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/startService.sh
+++ b/ms/controllerblueprints/distribution/src/main/docker/startService.sh
@@ -5,4 +5,5 @@ nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed
echo "APP Config HOME : ${APP_CONFIG_HOME}"
export APP_HOME=/opt/app/onap
+cp -rf /config /opt/app/onap/
source /etc/run.source
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
new file mode 100644
index 00000000..46c88b4c
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>blueprint-scripts</artifactId>
+ <name>Controller Blueprints Scripts</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>resource-dict</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler-embeddable</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-scripting-jvm-host</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-runtime</artifactId>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
new file mode 100644
index 00000000..8ac915bd
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.scripts
+
+import java.io.File
+import java.io.Serializable
+import java.net.URL
+import java.net.URLClassLoader
+import kotlin.reflect.KClass
+import kotlin.script.experimental.api.*
+
+open class BluePrintCompiledScript<out JarFile : File>(
+ private val scriptCompilationConfiguration: ScriptCompilationConfiguration,
+ private val compiledJar: File) :
+ CompiledScript<JarFile>, Serializable {
+
+ lateinit var scriptClassFQName: String
+
+ override val compilationConfiguration: ScriptCompilationConfiguration
+ get() = scriptCompilationConfiguration
+
+ override suspend fun getClass(scriptEvaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<KClass<*>> = try {
+
+ val baseClassLoader = Thread.currentThread().contextClassLoader
+
+ val urls = arrayListOf<URL>()
+ urls.add(compiledJar.toURI().toURL())
+ val classLoaderWithDependencies = URLClassLoader(urls.toTypedArray(), baseClassLoader)
+
+ val clazz = classLoaderWithDependencies.loadClass(scriptClassFQName).kotlin
+ clazz.asSuccess()
+ } catch (e: Throwable) {
+ ResultWithDiagnostics.Failure(
+ ScriptDiagnostic(
+ "Unable to instantiate class $scriptClassFQName",
+ exception = e
+ )
+ )
+ }
+
+}
+
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
new file mode 100644
index 00000000..7e9e8688
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.scripts
+
+import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer
+import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
+import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
+import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
+import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
+import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
+import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
+import org.jetbrains.kotlin.cli.common.messages.MessageCollector
+import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
+import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
+import org.jetbrains.kotlin.config.*
+import org.slf4j.LoggerFactory
+import java.io.File
+import kotlin.script.experimental.api.*
+import kotlin.script.experimental.host.ScriptingHostConfiguration
+import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
+import kotlin.script.experimental.jvmhost.KJvmCompilerProxy
+
+open class BluePrintsCompilerProxy(private val hostConfiguration: ScriptingHostConfiguration) : KJvmCompilerProxy {
+
+ private val log = LoggerFactory.getLogger(BluePrintsCompilerProxy::class.java)!!
+
+ override fun compile(script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration)
+ : ResultWithDiagnostics<CompiledScript<*>> {
+
+ val messageCollector = ScriptDiagnosticsMessageCollector()
+
+ fun failure(vararg diagnostics: ScriptDiagnostic): ResultWithDiagnostics.Failure =
+ ResultWithDiagnostics.Failure(*messageCollector.diagnostics.toTypedArray(), *diagnostics)
+
+ // Compile the Code
+ try {
+
+ log.trace("Scripting Host Configuration : $hostConfiguration")
+
+ setIdeaIoUseFallback()
+
+ val blueprintSourceCode = script as BluePrintSourceCode
+
+ val compiledJarFile = blueprintSourceCode.targetJarFile
+
+ if (!compiledJarFile.exists() || blueprintSourceCode.regenerate) {
+
+ var environment: KotlinCoreEnvironment? = null
+
+ val rootDisposable = Disposer.newDisposable()
+
+ val compilerConfiguration = CompilerConfiguration().apply {
+
+ put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
+ put(CommonConfigurationKeys.MODULE_NAME, blueprintSourceCode.moduleName)
+ put(JVMConfigurationKeys.OUTPUT_JAR, compiledJarFile)
+ put(JVMConfigurationKeys.RETAIN_OUTPUT_IN_MEMORY, false)
+
+ // Load Current Class loader to Compilation Class loader
+ val currentClassLoader = classpathFromClasspathProperty()
+ currentClassLoader?.forEach {
+ add(CLIConfigurationKeys.CONTENT_ROOTS, JvmClasspathRoot(it))
+ }
+
+ // Add all Kotlin Sources
+ addKotlinSourceRoots(blueprintSourceCode.blueprintKotlinSources)
+
+ languageVersionSettings = LanguageVersionSettingsImpl(
+ LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE, mapOf(AnalysisFlags.skipMetadataVersionCheck to true)
+ )
+ }
+
+ //log.info("Executing with compiler configuration : $compilerConfiguration")
+
+ environment = KotlinCoreEnvironment.createForProduction(rootDisposable, compilerConfiguration,
+ EnvironmentConfigFiles.JVM_CONFIG_FILES)
+
+ // Compile Kotlin Sources
+ val compiled = KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment)
+
+ log.info("Generated jar(${compiledJarFile.absolutePath}) status : $compiled}")
+
+ val analyzerWithCompilerReport = AnalyzerWithCompilerReport(messageCollector,
+ environment.configuration.languageVersionSettings)
+
+ if (analyzerWithCompilerReport.hasErrors()) {
+ return failure()
+ }
+ }
+
+ val res = BluePrintCompiledScript<File>(scriptCompilationConfiguration, compiledJarFile)
+
+ return ResultWithDiagnostics.Success(res, messageCollector.diagnostics)
+
+ } catch (ex: Throwable) {
+ return failure(ex.asDiagnostics())
+ }
+ }
+}
+
+class ScriptDiagnosticsMessageCollector : MessageCollector {
+
+ private val _diagnostics = arrayListOf<ScriptDiagnostic>()
+
+ val diagnostics: List<ScriptDiagnostic> get() = _diagnostics
+
+ override fun clear() {
+ _diagnostics.clear()
+ }
+
+ override fun hasErrors(): Boolean =
+ _diagnostics.any { it.severity == ScriptDiagnostic.Severity.ERROR }
+
+
+ override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
+ val mappedSeverity = when (severity) {
+ CompilerMessageSeverity.EXCEPTION,
+ CompilerMessageSeverity.ERROR -> ScriptDiagnostic.Severity.ERROR
+ CompilerMessageSeverity.STRONG_WARNING,
+ CompilerMessageSeverity.WARNING -> ScriptDiagnostic.Severity.WARNING
+ CompilerMessageSeverity.INFO -> ScriptDiagnostic.Severity.INFO
+ CompilerMessageSeverity.LOGGING -> ScriptDiagnostic.Severity.DEBUG
+ else -> null
+ }
+ if (mappedSeverity != null) {
+ val mappedLocation = location?.let {
+ if (it.line < 0 && it.column < 0) null // special location created by CompilerMessageLocation.create
+ else SourceCode.Location(SourceCode.Position(it.line, it.column))
+ }
+ _diagnostics.add(ScriptDiagnostic(message, mappedSeverity, location?.path, mappedLocation))
+ }
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt
new file mode 100644
index 00000000..3b3a5907
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.scripts
+
+import java.io.File
+import kotlin.script.experimental.annotations.KotlinScript
+import kotlin.script.experimental.api.ScriptCompilationConfiguration
+import kotlin.script.experimental.api.SourceCode
+import kotlin.script.experimental.api.defaultImports
+import kotlin.script.experimental.jvm.jvm
+import kotlin.script.experimental.jvm.util.classpathFromClassloader
+
+@KotlinScript(
+ fileExtension = "cba.kts",
+ compilationConfiguration = BluePrintScripCompilationConfiguration::class,
+ displayName = "Controller Blueprint Archive Kotlin Scripts"
+)
+abstract class BluePrintKotlinScript
+
+object BluePrintScripCompilationConfiguration : ScriptCompilationConfiguration(
+ {
+ defaultImports(
+ "org.onap.ccsdk.apps.controllerblueprints.core.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.data.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.services.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.utils.*")
+ jvm {
+ classpathFromClassloader(BluePrintScripCompilationConfiguration::class.java.classLoader)
+ }
+ }
+)
+
+open class BluePrintSourceCode : SourceCode {
+ lateinit var blueprintKotlinSources: MutableList<String>
+ lateinit var moduleName: String
+ lateinit var targetJarFile: File
+ var regenerate: Boolean = false
+
+ override val text: String
+ get() = ""
+
+ override val locationId: String? = null
+
+ override val name: String?
+ get() = moduleName
+}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt
index bda20a44..59ce4abb 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/script/BlueprintScriptingHost.kt
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt
@@ -14,19 +14,21 @@
* limitations under the License.
*/
-package org.onap.ccsdk.apps.controllerblueprints.core.script
+package org.onap.ccsdk.apps.controllerblueprints.scripts
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
+import java.util.*
import kotlin.script.experimental.api.*
import kotlin.script.experimental.host.BasicScriptingHost
import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
import kotlin.script.experimental.jvmhost.JvmScriptCompiler
+import kotlin.script.experimental.jvmhost.impl.withDefaults
-val defaultBlueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration)
+val blueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration,
+ BluePrintsCompilerProxy(defaultJvmScriptingHostConfiguration.withDefaults()))
-open class BlueprintScriptingHost(evaluator: ScriptEvaluator
-) : BasicScriptingHost(defaultBlueprintScriptCompiler, evaluator) {
+open class BlueprintScriptingHost(evaluator: ScriptEvaluator) : BasicScriptingHost(blueprintScriptCompiler, evaluator) {
override fun eval(
script: SourceCode,
@@ -44,19 +46,24 @@ open class BlueprintScriptingHost(evaluator: ScriptEvaluator
}
-open class BluePrintScriptEvaluator(private val scriptClassName: String) : ScriptEvaluator {
+open class BluePrintScriptEvaluator<T>(private val scriptClassName: String) : ScriptEvaluator {
- val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
+ private val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
override suspend operator fun invoke(
compiledScript: CompiledScript<*>,
scriptEvaluationConfiguration: ScriptEvaluationConfiguration?
): ResultWithDiagnostics<EvaluationResult> =
try {
+ log.info("Getting class name($scriptClassName) of type() from the compiled sources ")
+ val bluePrintCompiledScript = compiledScript as BluePrintCompiledScript
+ bluePrintCompiledScript.scriptClassFQName = scriptClassName
+
val res = compiledScript.getClass(scriptEvaluationConfiguration)
when (res) {
is ResultWithDiagnostics.Failure -> res
is ResultWithDiagnostics.Success -> {
+
val scriptClass = res.value
val args = ArrayList<Any?>()
scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
@@ -69,21 +76,13 @@ open class BluePrintScriptEvaluator(private val scriptClassName: String) : Scrip
args.addAll(it)
}
- val completeScriptClass = "Script\$$scriptClassName"
- log.info("Searching for class type($completeScriptClass)")
- /**
- * Search for Class Name
- */
- val instanceClass = scriptClass.java.classes
- .single { it.name == completeScriptClass }
- //.single { it.name == "Script\$SampleBlueprintsFunctionNode" }
-
-
- val instance = instanceClass.newInstance()
+ val instance = scriptClass.java.newInstance() as? T
?: throw BluePrintProcessorException("failed to create instance from the script")
- ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(completeScriptClass,
- instance, instance.javaClass.typeName),
+ log.info("Created script instance successfully....")
+
+ ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(scriptClass.qualifiedName!!,
+ instance, "", instance),
scriptEvaluationConfiguration))
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
new file mode 100644
index 00000000..4b6f2a47
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.scripts
+
+
+import org.apache.commons.io.FileUtils
+import org.junit.Ignore
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import java.io.File
+import kotlin.script.experimental.jvm.util.classpathFromClass
+import kotlin.script.experimental.jvm.util.classpathFromClassloader
+import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
+import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
+
+class BlueprintScriptingHostTest {
+
+ @Test
+ @Ignore
+ fun `test classpaths`() {
+
+ println(" *********** classpathFromClass *********** ")
+ classpathFromClass(BlueprintScriptingHostTest::class.java.classLoader,
+ BlueprintScriptingHostTest::class)!!
+ .forEach(::println)
+
+ println(" *********** classpathFromClassloader *********** ")
+ classpathFromClassloader(BlueprintScriptingHostTest::class.java.classLoader)!!
+ .forEach(::println)
+
+ println(" *********** classpathFromClasspathProperty *********** ")
+ classpathFromClasspathProperty()!!
+ .forEach(::println)
+ }
+
+ @Test
+ fun `test same script two folders`() {
+
+ FileUtils.forceMkdir(File("target/scripts1/"))
+ FileUtils.forceMkdir(File("target/scripts2/"))
+
+ val scriptSource1 = BluePrintSourceCode()
+ scriptSource1.moduleName = "blueprint-test-script"
+
+ scriptSource1.targetJarFile = File("target/scripts1/blueprint-script-generated.jar")
+ val sources1: MutableList<String> = arrayListOf()
+ sources1.add("src/test/resources/scripts1")
+ scriptSource1.blueprintKotlinSources = sources1
+
+ val scriptClassName = "Simple_cba\$SampleComponentFunction"
+
+ val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<BluePrintKotlinScript>()
+
+ val scriptEvaluator = BluePrintScriptEvaluator<BlueprintFunctionNode<String, String>>(scriptClassName)
+
+ val scriptSource2 = BluePrintSourceCode()
+ scriptSource2.moduleName = "blueprint-test-script"
+
+ scriptSource2.targetJarFile = File("target/scripts2/blueprint-script-generated.jar")
+ val sources2: MutableList<String> = arrayListOf()
+ sources2.add("src/test/resources/scripts2")
+ scriptSource2.blueprintKotlinSources = sources2
+
+ for (i in 1..2) {
+ val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource1, compilationConfiguration,
+ null)
+ }
+
+ for (i in 1..2) {
+ val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource2, compilationConfiguration,
+ null)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
new file mode 100644
index 00000000..9f61c649
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.springframework.stereotype.Service
+
+@Service
+open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
+
+ override fun getName(): String {
+ println("Printing Name....." + "sample".asJsonPrimitive())
+ return "my Name"
+ }
+
+ override fun prepareRequest(executionRequest: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun process(executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareResponse(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun apply(t: String): String {
+ return "Script 1 response - $t"
+ }
+}
+
+val blueprintFunction = SampleComponentFunction()
+
+val serviceTemplate = ServiceTemplate()
+
+println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
new file mode 100644
index 00000000..84517254
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.springframework.stereotype.Service
+
+@Service
+open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
+
+ override fun getName(): String {
+ println("Printing Name....." + "sample".asJsonPrimitive())
+ return "my Name"
+ }
+
+ override fun prepareRequest(executionRequest: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun process(executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareResponse(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun apply(t: String): String {
+ return "Script 2 response - $t"
+ }
+}
+
+val blueprintFunction = SampleComponentFunction()
+
+val serviceTemplate = ServiceTemplate()
+
+println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index 3857ef5d..834db24e 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -30,6 +30,7 @@
<module>service</module>
<module>blueprint-validation</module>
<module>db-resources</module>
+ <module>blueprint-scripts</module>
</modules>
<build>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 9868b17b..73fe0739 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -32,10 +32,6 @@
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
<artifactId>db-resources</artifactId>
</dependency>
<dependency>
@@ -44,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <artifactId>blueprint-scripts</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
deleted file mode 100644
index 3cf144f1..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Optional;
-import org.jetbrains.annotations.NotNull;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants;
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode;
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.Resource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.codec.multipart.FilePart;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import reactor.core.publisher.Mono;
-
-/**
- * BlueprintModelService.java Purpose: Provide Service Template Service processing BlueprintModelService
- *
- * @author Brinda Santh
- * @version 1.0
- */
-
-@Service
-public class BlueprintModelService {
-
- @Autowired
- private BluePrintLoadConfiguration bluePrintLoadConfiguration;
-
- @Autowired
- private BluePrintCatalogService bluePrintCatalogService;
-
- @Autowired
- private ControllerBlueprintModelSearchRepository blueprintModelSearchRepository;
-
- @Autowired
- private ControllerBlueprintModelRepository blueprintModelRepository;
-
- @Autowired
- private ControllerBlueprintModelContentRepository blueprintModelContentRepository;
-
- private static final String BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%s) from repo";
- private static final String BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%s)" +
- " and version(%s) from repo";
-
- /**
- * This is a saveBlueprintModel method
- *
- * @param filePart filePart
- * @return Mono<BlueprintModelSearch>
- * @throws BluePrintException BluePrintException
- */
- public Mono<BlueprintModelSearch> saveBlueprintModel(FilePart filePart) throws BluePrintException {
- try {
- Path cbaLocation = BluePrintFileUtils.Companion
- .getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath);
- return BluePrintEnhancerUtils.Companion.saveCBAFile(filePart, cbaLocation).map(fileName -> {
- String blueprintId = null;
- try {
- blueprintId = bluePrintCatalogService
- .saveToDatabase(cbaLocation.toFile(), false);
- } catch (BluePrintException e) {
- // FIXME handle expection
- }
- return blueprintModelSearchRepository.findById(blueprintId).get();
- });
- } catch (IOException e) {
- throw new BluePrintException(ErrorCode.IO_FILE_INTERRUPT.getValue(),
- String.format("I/O Error while uploading the CBA file: %s", e.getMessage()), e);
- }
- }
-
- /**
- * This is a publishBlueprintModel method to change the status published to YES
- *
- * @param id id
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch publishBlueprintModel(String id) throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- blueprintModelSearch.setPublished(ApplicationConstants.ACTIVE_Y);
- return blueprintModelSearchRepository.saveAndFlush(blueprintModelSearch);
- }
-
- /**
- * This is a searchBlueprintModels method
- *
- * @param tags tags
- * @return List<BlueprintModelSearch>
- */
- public List<BlueprintModelSearch> searchBlueprintModels(String tags) {
- return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags);
- }
-
- /**
- * This is a getBlueprintModelSearchByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch getBlueprintModelSearchByNameAndVersion(@NotNull String name, @NotNull String version)
- throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository
- .findByArtifactNameAndArtifactVersion(name, version);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(),
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version));
- }
- return blueprintModelSearch;
- }
-
- /**
- * This is a downloadBlueprintModelFileByNameAndVersion method to download a Blueprint by Name and Version
- *
- * @param name name
- * @param version version
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- */
- public ResponseEntity<Resource> downloadBlueprintModelFileByNameAndVersion(@NotNull String name,
- @NotNull String version)
- throws BluePrintException {
- BlueprintModel blueprintModel;
- try {
- blueprintModel = getBlueprintModelByNameAndVersion(name, version);
- } catch (BluePrintException e) {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), String.format("Error while " +
- "downloading the CBA file: %s", e.getMessage()), e);
- }
- String fileName = blueprintModel.getId() + ".zip";
- byte[] file = blueprintModel.getBlueprintModelContent().getContent();
- return prepareResourceEntity(fileName, file);
- }
-
- /**
- * This is a downloadBlueprintModelFile method to find the target file to download and return a file resource
- *
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- */
- public ResponseEntity<Resource> downloadBlueprintModelFile(@NotNull String id) throws BluePrintException {
- BlueprintModel blueprintModel;
- try {
- blueprintModel = getBlueprintModel(id);
- } catch (BluePrintException e) {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), String.format("Error while " +
- "downloading the CBA file: %s", e.getMessage()), e);
- }
- String fileName = blueprintModel.getId() + ".zip";
- byte[] file = blueprintModel.getBlueprintModelContent().getContent();
- return prepareResourceEntity(fileName, file);
- }
-
- /**
- * @return ResponseEntity<Resource>
- */
- private ResponseEntity<Resource> prepareResourceEntity(String fileName, byte[] file) {
- return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"")
- .body(new ByteArrayResource(file));
- }
-
- /**
- * This is a getBlueprintModel method
- *
- * @param id id
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- private BlueprintModel getBlueprintModel(@NotNull String id) throws BluePrintException {
- BlueprintModel blueprintModel;
- Optional<BlueprintModel> dbBlueprintModel = blueprintModelRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModel = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- return blueprintModel;
- }
-
- /**
- * This is a getBlueprintModelByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- private BlueprintModel getBlueprintModelByNameAndVersion(@NotNull String name, @NotNull String version)
- throws BluePrintException {
- BlueprintModel blueprintModel = blueprintModelRepository
- .findByArtifactNameAndArtifactVersion(name, version);
- if (blueprintModel != null) {
- return blueprintModel;
- } else {
- String msg = String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- }
-
- /**
- * This is a getBlueprintModelSearch method
- *
- * @param id id
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch getBlueprintModelSearch(@NotNull String id) throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
-
- return blueprintModelSearch;
- }
-
- /**
- * This is a deleteBlueprintModel method
- *
- * @param id id
- * @throws BluePrintException BluePrintException
- */
- @Transactional
- public void deleteBlueprintModel(@NotNull String id) throws BluePrintException {
- Optional<BlueprintModel> dbBlueprintModel = blueprintModelRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get());
- blueprintModelRepository.delete(dbBlueprintModel.get());
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- }
-
- /**
- * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
- *
- * @return List<BlueprintModelSearch> list of the controller blueprint archives
- */
- public List<BlueprintModelSearch> getAllBlueprintModel() {
- return blueprintModelSearchRepository.findAll();
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java
deleted file mode 100644
index 255137bf..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.BlueprintModelService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.codec.multipart.FilePart;
-import org.springframework.web.bind.annotation.*;
-import reactor.core.publisher.Mono;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@RestController
-@RequestMapping(value = "/api/v1/blueprint-model")
-public class BlueprintModelRest {
-
- @Autowired
- private BlueprintModelService blueprintModelService;
-
- @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
- public @ResponseBody
- Mono<BlueprintModelSearch> saveBlueprint(@RequestPart("file") FilePart file) throws BluePrintException{
- return blueprintModelService.saveBlueprintModel(file);
- }
-
- @DeleteMapping(path = "/{id}")
- public void deleteBlueprint(@PathVariable(value = "id") String id) throws BluePrintException {
- this.blueprintModelService.deleteBlueprintModel(id);
- }
-
- @GetMapping(path = "/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch getBlueprintByNameAndVersion(@PathVariable(value = "name") String name,
- @PathVariable(value = "version") String version) throws BluePrintException {
- return this.blueprintModelService.getBlueprintModelSearchByNameAndVersion(name, version);
- }
-
- @GetMapping(path = "/download/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResponseEntity<Resource> downloadBlueprintByNameAndVersion(@PathVariable(value = "name") String name,
- @PathVariable(value = "version") String version) throws BluePrintException {
- return this.blueprintModelService.downloadBlueprintModelFileByNameAndVersion(name, version);
- }
-
- @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch getBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.getBlueprintModelSearch(id);
- }
-
- @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<BlueprintModelSearch> getAllBlueprintModel() {
- return this.blueprintModelService.getAllBlueprintModel();
- }
-
- @GetMapping(path = "/download/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResponseEntity<Resource> downloadBluePrint(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.downloadBlueprintModelFile(id);
- }
-
- @PutMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch publishBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.publishBlueprintModel(id);
- }
-
- @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<BlueprintModelSearch> searchBlueprintModels(@PathVariable(value = "tags") String tags) {
- return this.blueprintModelService.searchBlueprintModels(tags);
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt
new file mode 100644
index 00000000..0fca07b0
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt
@@ -0,0 +1,100 @@
+/*
+ * Copyright © 2019 Bell Canada Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.controller
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.onap.ccsdk.apps.controllerblueprints.service.handler.BluePrintModelHandler
+import org.springframework.core.io.Resource
+import org.springframework.http.MediaType
+import org.springframework.http.ResponseEntity
+import org.springframework.http.codec.multipart.FilePart
+import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
+
+/**
+ * BlueprintModelRest Purpose: Handle controllerBlueprint API request
+ *
+ * @author Vinal Patel
+ * @version 1.0
+ */
+@RestController
+@RequestMapping("/api/v1/blueprint-model")
+open class BlueprintModelRest(private val bluePrintModelHandler: BluePrintModelHandler) {
+
+ @PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun saveBlueprint(@RequestPart("file") file: FilePart): Mono<BlueprintModelSearch> {
+ return bluePrintModelHandler.saveBlueprintModel(file)
+ }
+
+ @GetMapping("", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ fun allBlueprintModel(): List<BlueprintModelSearch> {
+ return this.bluePrintModelHandler.allBlueprintModel()
+ }
+
+ @DeleteMapping("/{id}")
+ @Throws(BluePrintException::class)
+ fun deleteBlueprint(@PathVariable(value = "id") id: String) {
+ this.bluePrintModelHandler.deleteBlueprintModel(id)
+ }
+
+ @GetMapping("/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun getBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.getBlueprintModelSearchByNameAndVersion(name, version)
+ }
+
+ @GetMapping("/download/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun downloadBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String): ResponseEntity<Resource> {
+ return this.bluePrintModelHandler.downloadBlueprintModelFileByNameAndVersion(name, version)
+ }
+
+ @GetMapping("/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun getBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.getBlueprintModelSearch(id)
+ }
+
+ @GetMapping("/download/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun downloadBluePrint(@PathVariable(value = "id") id: String): ResponseEntity<Resource> {
+ return this.bluePrintModelHandler.downloadBlueprintModelFile(id)
+ }
+
+ @PutMapping("/publish/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun publishBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.publishBlueprintModel(id)
+ }
+
+ @GetMapping("/search/{tags}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ fun searchBlueprintModels(@PathVariable(value = "tags") tags: String): List<BlueprintModelSearch> {
+ return this.bluePrintModelHandler.searchBlueprintModels(tags)
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
index a0e47d72..04753391 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
@@ -25,7 +25,7 @@ import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
/**
- * ControllerBlueprintExceptionHandler.java Purpose: Handle exceptions in controllerBlueprint API and provide the wright
+ * ControllerBlueprintExceptionHandler Purpose: Handle exceptions in controllerBlueprint API and provide the right
* HTTP code status
*
* @author Vinal Patel
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
new file mode 100644
index 00000000..907566c3
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
@@ -0,0 +1,283 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.handler
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.core.io.Resource
+import org.springframework.http.HttpHeaders
+import org.springframework.http.MediaType
+import org.springframework.http.ResponseEntity
+import org.springframework.http.codec.multipart.FilePart
+import org.springframework.stereotype.Service
+import org.springframework.transaction.annotation.Transactional
+import reactor.core.publisher.Mono
+import java.io.IOException
+
+/**
+ * BlueprintModelHandler Purpose: Handler service to handle the request from BlurPrintModelRest
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintCatalogService, private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository,
+ private val blueprintModelRepository: ControllerBlueprintModelRepository,
+ private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository) {
+
+ /**
+ * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
+ *
+ * @return List<BlueprintModelSearch> list of the controller blueprint archives
+ </BlueprintModelSearch> */
+ open fun allBlueprintModel(): List<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.findAll()
+ }
+
+ /**
+ * This is a saveBlueprintModel method
+ *
+ * @param filePart filePart
+ * @return Mono<BlueprintModelSearch>
+ * @throws BluePrintException BluePrintException
+ </BlueprintModelSearch> */
+ @Throws(BluePrintException::class)
+ open fun saveBlueprintModel(filePart: FilePart): Mono<BlueprintModelSearch> {
+ try {
+ val cbaLocation = BluePrintFileUtils.getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath)
+ return BluePrintEnhancerUtils.saveCBAFile(filePart, cbaLocation).map { fileName ->
+ var blueprintId: String? = null
+ try {
+ blueprintId = bluePrintCatalogService.saveToDatabase(cbaLocation.resolve(fileName).toFile(), false)
+ } catch (e: BluePrintException) {
+ // FIXME handle expection
+ }
+ blueprintModelSearchRepository.findById(blueprintId!!).get()
+ }
+ } catch (e: IOException) {
+ throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
+ String.format("I/O Error while uploading the CBA file: %s", e.message), e)
+ }
+
+ }
+
+ /**
+ * This is a publishBlueprintModel method to change the status published to YES
+ *
+ * @param id id
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun publishBlueprintModel(id: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ blueprintModelSearch.published = ApplicationConstants.ACTIVE_Y
+ return blueprintModelSearchRepository.saveAndFlush(blueprintModelSearch)
+ }
+
+ /**
+ * This is a searchBlueprintModels method
+ *
+ * @param tags tags
+ * @return List<BlueprintModelSearch>
+ </BlueprintModelSearch> */
+ open fun searchBlueprintModels(tags: String): List<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags)
+ }
+
+ /**
+ * This is a getBlueprintModelSearchByNameAndVersion method
+ *
+ * @param name name
+ * @param version version
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository
+ .findByArtifactNameAndArtifactVersion(name, version)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version))
+ }
+ return blueprintModelSearch
+ }
+
+ /**
+ * This is a downloadBlueprintModelFileByNameAndVersion method to download a Blueprint by Name and Version
+ *
+ * @param name name
+ * @param version version
+ * @return ResponseEntity<Resource>
+ * @throws BluePrintException BluePrintException
+ </Resource> */
+ @Throws(BluePrintException::class)
+ open fun downloadBlueprintModelFileByNameAndVersion(name: String,
+ version: String): ResponseEntity<Resource> {
+ val blueprintModel: BlueprintModel
+ try {
+ blueprintModel = getBlueprintModelByNameAndVersion(name, version)
+ } catch (e: BluePrintException) {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ }
+
+ val fileName = blueprintModel.id + ".zip"
+ val file = blueprintModel.blueprintModelContent.content
+ return prepareResourceEntity(fileName, file)
+ }
+
+ /**
+ * This is a downloadBlueprintModelFile method to find the target file to download and return a file resource
+ *
+ * @return ResponseEntity<Resource>
+ * @throws BluePrintException BluePrintException
+ </Resource> */
+ @Throws(BluePrintException::class)
+ open fun downloadBlueprintModelFile(id: String): ResponseEntity<Resource> {
+ val blueprintModel: BlueprintModel
+ try {
+ blueprintModel = getBlueprintModel(id)
+ } catch (e: BluePrintException) {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ }
+
+ val fileName = blueprintModel.id + ".zip"
+ val file = blueprintModel.blueprintModelContent.content
+ return prepareResourceEntity(fileName, file)
+ }
+
+ /**
+ * @return ResponseEntity<Resource>
+ </Resource> */
+ private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
+ return ResponseEntity.ok()
+ .contentType(MediaType.parseMediaType("text/plain"))
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
+ .body(ByteArrayResource(file))
+ }
+
+ /**
+ * This is a getBlueprintModel method
+ *
+ * @param id id
+ * @return BlueprintModel
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModel(id: String): BlueprintModel {
+ val blueprintModel: BlueprintModel
+ val dbBlueprintModel = blueprintModelRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModel = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ return blueprintModel
+ }
+
+ /**
+ * This is a getBlueprintModelByNameAndVersion method
+ *
+ * @param name name
+ * @param version version
+ * @return BlueprintModel
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelByNameAndVersion(name: String, version: String): BlueprintModel {
+ val blueprintModel = blueprintModelRepository
+ .findByArtifactNameAndArtifactVersion(name, version)
+ if (blueprintModel != null) {
+ return blueprintModel
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ }
+
+ /**
+ * This is a getBlueprintModelSearch method
+ *
+ * @param id id
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+
+ return blueprintModelSearch
+ }
+
+ /**
+ * This is a deleteBlueprintModel method
+ *
+ * @param id id
+ * @throws BluePrintException BluePrintException
+ */
+ @Transactional
+ @Throws(BluePrintException::class)
+ open fun deleteBlueprintModel(id: String) {
+ val dbBlueprintModel = blueprintModelRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get())
+ blueprintModelRepository.delete(dbBlueprintModel.get())
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ }
+
+ companion object {
+
+ private const val BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%s) from repo"
+ private const val BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%s)" + " and version(%s) from repo"
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
index 04071dd2..779be65d 100755
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
@@ -97,6 +97,8 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintValidatorService: BluePrint
blueprintModelContent.description = "$artifactName:$artifactVersion CBA Zip Content"
blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath())
blueprintModelContent.blueprintModel = blueprintModel
+ // Set the Blueprint Model Content into blueprintModel
+ blueprintModel.blueprintModelContent = blueprintModelContent
try {
blueprintModelRepository.saveAndFlush(blueprintModel)
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
deleted file mode 100644
index 0ce93b18..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service;
-
-import org.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class BlueprintModelServiceTest {
- @Autowired
- private BlueprintModelService blueprintModelService;
-
- @Test
- public void testGetInitialConfigModel() throws BluePrintException {
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt
new file mode 100644
index 00000000..f82aace4
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt
@@ -0,0 +1,192 @@
+/*
+ * Copyright © 2019 Bell Canada Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service.controller
+
+import com.google.gson.Gson
+import org.json.JSONException
+import org.json.JSONObject
+import org.junit.After
+import org.junit.Before
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+import org.onap.ccsdk.apps.controllerblueprints.TestApplication
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.http.HttpMethod
+import org.springframework.http.HttpStatus
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.test.web.reactive.server.WebTestClient
+import org.springframework.util.Base64Utils
+import org.springframework.web.reactive.function.BodyInserters
+import java.io.File
+import java.io.IOException
+import java.nio.charset.StandardCharsets.UTF_8
+import java.nio.file.Files
+import java.nio.file.Paths
+
+/**
+ * BlueprintModelRestTest Purpose: Integration test at API level
+ *
+ * @author Vinal Patel
+ * @version 1.0
+ */
+
+@RunWith(SpringRunner::class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = [TestApplication::class])
+@ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@EnableAutoConfiguration
+class BlueprintModelRestTest {
+
+ companion object {
+
+ private var id: String? = null
+ private var name: String? = null
+ private var version: String? = null
+ private var tag: String? = null
+ private var result: String? = null
+ }
+
+ @Value("\${controllerblueprints.loadBluePrintPaths}")
+ private val loadBluePrintPaths: String? = null
+
+ @Autowired
+ private val webTestClient: WebTestClient? = null
+
+ @Value("\${controllerblueprints.loadBlueprintsExamplesPath}")
+ private val blueprintArchivePath: String? = null
+
+ private val filename = "test.zip"
+ private var blueprintFile: File? = null
+ private var zipBlueprintFile: File? = null
+
+ @Before
+ @Throws(Exception::class)
+ fun setUp() {
+ blueprintFile = File(loadBluePrintPaths+"/baseconfiguration")
+ if (blueprintFile!!.isDirectory) {
+ zipBlueprintFile = File(Paths.get(blueprintArchivePath).resolve(filename).toString())
+ BluePrintArchiveUtils.compress(blueprintFile!!, zipBlueprintFile!!, true)
+ }
+ }
+
+ @After
+ @Throws(Exception::class)
+ fun tearDown() {
+ zipBlueprintFile!!.delete()
+ }
+
+ @Test
+ @Throws(IOException::class, JSONException::class)
+ fun test1_saveBluePrint() {
+ webTestClient(HttpMethod.POST,
+ BodyInserters.fromMultipartData("file", object : ByteArrayResource(Files.readAllBytes(zipBlueprintFile!!.toPath())) {
+ override fun getFilename(): String? {
+ return "test.zip"
+ }
+ }),
+ "/api/v1/blueprint-model",
+ HttpStatus.OK, true)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test2_getBluePrintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/by-name/$name/version/$version", HttpStatus.OK, false)
+ }
+
+
+ @Test
+ @Throws(JSONException::class)
+ fun test3_getBlueprintModel() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/$id", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test4_getAllBlueprintModel() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test5_downloadBluePrint() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/$id", HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test6_publishBlueprintModel() {
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test7_searchBlueprintModels() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/search/$name", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test8_downloadBlueprintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/by-name/$name/version/$version", HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test9_deleteBluePrint() {
+ //TODO: Use webTestClient function
+ //webTestClient(HttpMethod.DELETE, null, "/api/v1/blueprint-model/" + id, HttpStatus.OK, false);
+ webTestClient!!.delete().uri("/api/v1/blueprint-model/$id")
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ }
+
+ @Throws(JSONException::class)
+ private fun webTestClient(requestMethod: HttpMethod, body: BodyInserters.MultipartInserter?, uri: String, expectedResponceStatus: HttpStatus, setParam: Boolean) {
+
+ result = String(webTestClient!!.method(requestMethod).uri(uri)
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .body(body)
+ .exchange()
+ .expectStatus().isEqualTo(expectedResponceStatus)
+ .expectBody()
+ .returnResult().responseBody!!)
+
+ if (setParam) {
+ val jsonResponse = JSONObject(result)
+ val blueprintModelSearchJSON = jsonResponse.getJSONObject("blueprintModel")
+ val gson = Gson()
+ val blueprintModelSearch = gson.fromJson(blueprintModelSearchJSON.toString(), BlueprintModelSearch::class.java)
+ id = blueprintModelSearch.id
+ name = blueprintModelSearch.artifactName
+ version = blueprintModelSearch.artifactVersion
+ tag = blueprintModelSearch.tags
+ }
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
index 24cb23a1..1c2c1c08 100755
--- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties
+++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
@@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=warn
logging.level.org.hibernate.type.descriptor.sql=debug
# Load Resource Source Mappings
-resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
controllerblueprints.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
index 1c81b74d..3ed188b9 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
@@ -56,7 +56,7 @@
"required": true
},
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": []
}
]
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
index 42978f84..2e48b6d8 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
@@ -243,7 +243,7 @@
},
"input-param": false,
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
@@ -314,7 +314,7 @@
},
"input-param": false,
"dictionary-name": "sample-licenses",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
index 66f18f89..6937c719 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
@@ -242,7 +242,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-mdsal-source",
- "dictionary-source" : "mdsal",
+ "dictionary-source" : "primary-config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
@@ -304,7 +304,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-licenses",
- "dictionary-source" : "mdsal",
+ "dictionary-source" : "primary-config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 9042318d..8cbc98e0 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -28,12 +28,12 @@
<name>Controller Blueprints Parent</name>
<packaging>pom</packaging>
<properties>
- <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
- <spring.version>5.1.3.RELEASE</spring.version>
- <kotlin.version>1.3.11</kotlin.version>
- <kotlin.maven.version>1.3.11</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
- <grpc.version>1.17.1</grpc.version>
+ <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
+ <spring.version>5.1.4.RELEASE</spring.version>
+ <kotlin.version>1.3.20</kotlin.version>
+ <kotlin.maven.version>1.3.20</kotlin.maven.version>
+ <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
+ <grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
@@ -110,14 +110,26 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-common</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
+ <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jvm-host</artifactId>
<version>${kotlin.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compile</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
<version>${kotlin.version}</version>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -198,27 +210,32 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>service</artifactId>
+ <artifactId>resource-dict</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>application</artifactId>
+ <artifactId>db-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <artifactId>blueprint-validation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
+ <artifactId>blueprint-scripts</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
+ <artifactId>service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>application</artifactId>
<version>${project.version}</version>
</dependency>
@@ -270,6 +287,10 @@
<artifactId>json-path</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
index 8507bf65..f7d0bc28 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/service/extinf/impl/AaiServiceImplTest.java
@@ -48,14 +48,18 @@ public class AaiServiceImplTest {
AaiResponse aaiResponse = aaiServiceImpl.buildResponse(true);
Assert.assertEquals(aaiResponse.isRecFound(), true);
}
-
+
@Test(expected= Exception.class)
public void testValidate() throws Exception {
AaiProps aaiProps=new AaiProps();
aaiProps.setUriBase("http://");
aaiServiceImpl.setAaiProps(aaiProps);
aaiServiceImpl.setRestTemplate(new RestTemplate());
- aaiServiceImpl.validate("testUrl/","testName");
-
+ Assert.assertTrue(aaiServiceImpl.validate("testUrl/","testName"));
+ }
+ @Test(expected= Exception.class)
+ public void testGetRestTemplate_Null() throws Exception {
+ aaiServiceImpl.setRestTemplate(null);
+ Assert.assertNotNull(aaiServiceImpl.getRestTemplate());
}
}
diff --git a/ms/vlantag-api/pom.xml b/ms/vlantag-api/pom.xml
index f5da9a6b..ea461056 100644
--- a/ms/vlantag-api/pom.xml
+++ b/ms/vlantag-api/pom.xml
@@ -1,110 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.onap.ccsdk.apps.ms.vlantagapi</groupId>
- <artifactId>vlantag-api</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>jar</packaging>
+ <groupId>org.onap.ccsdk.apps.ms.vlantagapi</groupId>
+ <artifactId>vlantag-api</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
- <name>Vlantag API</name>
- <description>Vlantag Api Service for Vlantag management of VNFs</description>
+ <name>Vlantag API</name>
+ <description>Vlantag Api Service for Vlantag management of VNFs</description>
- <properties>
- <swagger.directory>${basedir}/target/main/resources/META-INF/resources/swagger-ui/dist</swagger.directory>
- <swagger.annotations.version>1.5.8</swagger.annotations.version>
- <java.version>1.8</java.version>
- <springboot.version>2.0.4.RELEASE</springboot.version>
- <mariadb.connector.version>2.1.1</mariadb.connector.version>
- <docker.registry>TBD:5100</docker.registry>
- <serviceArtifactName>vlantagapi</serviceArtifactName>
+ <properties>
+ <swagger.directory>${basedir}/target/main/resources/META-INF/resources/swagger-ui/dist</swagger.directory>
+ <swagger.annotations.version>1.5.8</swagger.annotations.version>
+ <java.version>1.8</java.version>
+ <springboot.version>2.0.4.RELEASE</springboot.version>
+ <mariadb.connector.version>2.1.1</mariadb.connector.version>
+ <docker.registry>TBD:5100</docker.registry>
+ <serviceArtifactName>vlantagapi</serviceArtifactName>
- <!-- Sonar -->
- <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
- <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
- <sonar.surefire.reportsPath>${basedir}/target/surefire-reports</sonar.surefire.reportsPath>
- <sonar.failsafe.reportsPath>${basedir}/target/failsafe-reports</sonar.failsafe.reportsPath>
- <jacoco.path>${basedir}/target/jacoco_report</jacoco.path>
- <jacoco.itPath>${basedir}/target/jacoco_itReport</jacoco.itPath>
- <sonar.jacoco.reportPath>${basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath>
- <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
- <sonar.language>java</sonar.language>
- <ilib.version>2.0.7</ilib.version>
- <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.verbose>true</docker.verbose>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- </properties>
+ <!-- Sonar -->
+ <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
+ <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
+ <sonar.surefire.reportsPath>${basedir}/target/surefire-reports</sonar.surefire.reportsPath>
+ <sonar.failsafe.reportsPath>${basedir}/target/failsafe-reports</sonar.failsafe.reportsPath>
+ <jacoco.path>${basedir}/target/jacoco_report</jacoco.path>
+ <jacoco.itPath>${basedir}/target/jacoco_itReport</jacoco.itPath>
+ <sonar.jacoco.reportPath>${basedir}/target/jacoco-ut.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.language>java</sonar.language>
+ <ilib.version>2.0.7</ilib.version>
+ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.verbose>true</docker.verbose>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ </properties>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>1.2.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-jersey</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-actuator</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-security</artifactId>
- <version>2.0.1.RELEASE</version>
- </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <version>2.0.1.RELEASE</version>
+ </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-common</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.adaptors</groupId>
- <artifactId>resource-assignment-provider</artifactId>
- <version>${ccsdk.sli.adaptors.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${ccsdk.sli.core.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.adaptors</groupId>
+ <artifactId>resource-assignment-provider</artifactId>
+ <version>${ccsdk.sli.adaptors.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <version>${mariadb.connector.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>${mariadb.connector.version}</version>
+ </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>1.5.8</version>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
+ <build>
+ <plugins>
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
@@ -136,7 +136,7 @@
</execution>
</executions>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -147,154 +147,154 @@
</excludes>
</configuration>
</plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>0.7.5.201505241946</version>
- <executions>
- <!-- Prepares the property pointing to the JaCoCo runtime agent which
- is passed as VM argument when Maven the Surefire plugin is executed. -->
- <execution>
- <id>pre-unit-test</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- <configuration>
- <!-- Sets the path to the file which contains the execution data. -->
- <destFile>${sonar.jacoco.reportPath}</destFile>
- <propertyName>surefireArgLine</propertyName>
- </configuration>
- </execution>
- <!-- Ensures that the code coverage report for unit tests is created
- after unit tests have been run. -->
- <execution>
- <id>post-unit-test</id>
- <phase>test</phase>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <!-- Sets the path to the file which contains the execution data. -->
- <dataFile>${sonar.jacoco.reportPath}</dataFile>
- <!-- Sets the output directory for the code coverage report. -->
- <outputDirectory>${jacoco.path}</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.github.kongchen</groupId>
- <artifactId>swagger-maven-plugin</artifactId>
- <version>3.1.7</version>
- <configuration>
- <apiSources>
- <apiSource>
- <schemes>
- <scheme>http</scheme>
- <scheme>https</scheme>
- </schemes>
- <host>localhost:9091</host>
- <locations>
- <location>org.onap.ccsdk.apps.ms.vlantagapi.core.service</location>
- <location>org.onap.ccsdk.apps.ms.vlantagapi.core.model</location>
- </locations>
- <!-- <locations>org.onap.ccsdk.apps.ms.vlantagapi.core.service</locations> -->
- <basePath>/vlantagapi</basePath>
- <info>
- <title>${project.artifactId} Service</title>
- <version>${project.version}</version>
- </info>
- <securityDefinitions>
- <securityDefinition>
- <name>basicAuth</name>
- <type>basic</type>
- </securityDefinition>
- </securityDefinitions>
- <swaggerDirectory>${swagger.directory}</swaggerDirectory>
- </apiSource>
- </apiSources>
- </configuration>
- <executions>
- <execution>
- <!-- <phase>compile</phase> -->
- <phase>package</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.4.11</version>
- <configuration>
- <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
- <dockerDirectory>src/main/docker</dockerDirectory>
- <serverId>docker-hub</serverId>
- <registryUrl>https://${docker.registry}</registryUrl>
- <imageTags>
- <imageTag>${project.version}</imageTag>
- <imageTag>latest</imageTag>
- </imageTags>
- <forceTags>true</forceTags>
- <resources>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>${project.build.finalName}.jar</include>
- </resource>
- </resources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- <version>${springboot.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.5.201505241946</version>
+ <executions>
+ <!-- Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Surefire plugin is executed. -->
+ <execution>
+ <id>pre-unit-test</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${sonar.jacoco.reportPath}</destFile>
+ <propertyName>surefireArgLine</propertyName>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for unit tests is created
+ after unit tests have been run. -->
+ <execution>
+ <id>post-unit-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${jacoco.path}</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.github.kongchen</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>3.1.7</version>
+ <configuration>
+ <apiSources>
+ <apiSource>
+ <schemes>
+ <scheme>http</scheme>
+ <scheme>https</scheme>
+ </schemes>
+ <host>localhost:9091</host>
+ <locations>
+ <location>org.onap.ccsdk.apps.ms.vlantagapi.core.service</location>
+ <location>org.onap.ccsdk.apps.ms.vlantagapi.core.model</location>
+ </locations>
+ <!-- <locations>org.onap.ccsdk.apps.ms.vlantagapi.core.service</locations> -->
+ <basePath>/vlantagapi</basePath>
+ <info>
+ <title>${project.artifactId} Service</title>
+ <version>${project.version}</version>
+ </info>
+ <securityDefinitions>
+ <securityDefinition>
+ <name>basicAuth</name>
+ <type>basic</type>
+ </securityDefinition>
+ </securityDefinitions>
+ <swaggerDirectory>${swagger.directory}</swaggerDirectory>
+ </apiSource>
+ </apiSources>
+ </configuration>
+ <executions>
+ <execution>
+ <!-- <phase>compile</phase> -->
+ <phase>package</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.4.11</version>
+ <configuration>
+ <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
+ <dockerDirectory>src/main/docker</dockerDirectory>
+ <serverId>docker-hub</serverId>
+ <registryUrl>https://${docker.registry}</registryUrl>
+ <imageTags>
+ <imageTag>${project.version}</imageTag>
+ <imageTag>latest</imageTag>
+ </imageTags>
+ <forceTags>true</forceTags>
+ <resources>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>${project.build.finalName}.jar</include>
+ </resource>
+ </resources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${springboot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.4.11</version>
- <configuration>
- <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
- <dockerDirectory>src/main/docker</dockerDirectory>
- <serverId>docker-hub</serverId>
- <registryUrl>https://${docker.registry}</registryUrl>
- <imageTags>
- <imageTag>${project.version}</imageTag>
- <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag>
- <imageTag>${project.docker.latesttag.version}</imageTag>
- </imageTags>
- <forceTags>true</forceTags>
- <resources>
- <resource>
- <targetPath>/</targetPath>
- <directory>${project.build.directory}</directory>
- <include>${project.build.finalName}.jar</include>
- </resource>
- </resources>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.4.11</version>
+ <configuration>
+ <imageName>${docker.registry}/org.onap.ccsdk.apps/${serviceArtifactName}</imageName>
+ <dockerDirectory>src/main/docker</dockerDirectory>
+ <serverId>docker-hub</serverId>
+ <registryUrl>https://${docker.registry}</registryUrl>
+ <imageTags>
+ <imageTag>${project.version}</imageTag>
+ <imageTag>${project.version}-STAGING-${maven.build.timestamp}</imageTag>
+ <imageTag>${project.docker.latesttag.version}</imageTag>
+ </imageTags>
+ <forceTags>true</forceTags>
+ <resources>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>${project.build.finalName}.jar</include>
+ </resource>
+ </resources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/pom.xml b/pom.xml
index 54fd6f2b..b1addce0 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,102 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.2.1-SNAPSHOT</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>ccsdk-apps</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <groupId>org.onap.ccsdk.apps</groupId>
+ <artifactId>ccsdk-apps</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
- <name>ccsdk-apps</name>
- <description>CCSDK applications</description>
- <url>https://wiki.onap.org</url>
- <organization>
- <name>ONAP</name>
- </organization>
+ <name>ccsdk-apps</name>
+ <description>CCSDK applications</description>
+ <url>https://wiki.onap.org</url>
+ <organization>
+ <name>ONAP</name>
+ </organization>
- <properties>
- <!--Don't set any language to let sonar enable multi-language support-->
- <sonar.language/>
- <!--Provide src/main as source path so both src/main/java and src/main/kotlin are scanned-->
- <sonar.sources>src/main</sonar.sources>
- <!--Provide src/test as source path for test so both src/test/java and src/test/kotlin are scanned-->
- <sonar.tests>src/test</sonar.tests>
- <!--Only include java and kt files to the scan-->
- <sonar.inclusions>**/*.java,**/*.kt</sonar.inclusions>
- <!--Specify path to load jacoco XLM report, as Sonar can't load Kotlin coverage from binary report.
- Note: coverage for now is invalid and is failing to load because of:
- "Cannot import coverage information for file '{file}', coverage data is invalid."
- see https://github.com/jacoco/jacoco/issues/763
- That issue has been fixed in 0.8.3 but haven't yet been release. -->
- <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
- </properties>
+ <properties>
+ <!--Don't set any language to let sonar enable multi-language support-->
+ <sonar.language/>
+ <!--Provide src/main as source path so both src/main/java and src/main/kotlin are scanned-->
+ <sonar.sources>src/main</sonar.sources>
+ <!--Provide src/test as source path for test so both src/test/java and src/test/kotlin are scanned-->
+ <sonar.tests>src/test</sonar.tests>
+ <!--Only include java and kt files to the scan-->
+ <sonar.inclusions>**/*.java,**/*.kt</sonar.inclusions>
+ <!--Specify path to load jacoco XLM report, as Sonar can't load Kotlin coverage from binary report.
+ Note: coverage for now is invalid and is failing to load because of:
+ "Cannot import coverage information for file '{file}', coverage data is invalid."
+ see https://github.com/jacoco/jacoco/issues/763
+ That issue has been fixed in 0.8.3 but haven't yet been release. -->
+ <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
+ </properties>
- <modules>
- <module>components</module>
- <module>ms</module>
- </modules>
+ <modules>
+ <module>components</module>
+ <module>ms</module>
+ </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <!--Change version to 0.8.3 when released-->
- <version>${jacoco.version}</version>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <!--Change version to 0.8.3 when released-->
+ <version>${jacoco.version}</version>
+ </plugin>
+ </plugins>
+ </build>
- <scm>
- <connection>scm:git:ssh://git@${onap.git.host}/apps.git</connection>
- <developerConnection>scm:git:ssh://${onap.git.host}:${onap.git.port}/${onap.git.project}/apps.git</developerConnection>
- <url>${onap.git.protocol}://${onap.git.host}/projects/${onap.git.project}/repos/apps/browse</url>
- </scm>
+ <scm>
+ <connection>scm:git:ssh://git@${onap.git.host}/apps.git</connection>
+ <developerConnection>scm:git:ssh://${onap.git.host}:${onap.git.port}/${onap.git.project}/apps.git</developerConnection>
+ <url>${onap.git.protocol}://${onap.git.host}/projects/${onap.git.project}/repos/apps/browse</url>
+ </scm>
- <profiles>
- <profile>
- <id>blackduck</id>
- <activation>
- <property>
- <name>blackduck-scan</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.blackducksoftware.integration</groupId>
- <artifactId>hub-maven-plugin</artifactId>
- <version>1.4.0</version>
- <inherited>false</inherited>
- <configuration>
- <hubProjectName>${project.name}</hubProjectName>
- <outputDirectory>${project.basedir}</outputDirectory>
- </configuration>
- <executions>
- <execution>
- <id>create-bdio-file</id>
- <phase>package</phase>
- <goals>
- <goal>createHubOutput</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
+ <profiles>
+ <profile>
+ <id>blackduck</id>
+ <activation>
+ <property>
+ <name>blackduck-scan</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
- </build>
+ </build>
- </profile>
+ </profile>
- </profiles>
+ </profiles>
</project>