summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties18
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties34
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt26
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt34
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt11
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application-test.properties18
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties18
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml14
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/application-test.properties18
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/test/resources/application-test.properties18
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties32
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json)30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json)70
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json)54
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json)52
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json)44
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties16
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt8
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties16
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt28
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/resources/application-test.properties16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties20
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties16
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt9
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt42
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt20
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt12
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application-dev.properties10
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application.properties4
-rwxr-xr-xms/controllerblueprints/application/src/test/resources/application.properties4
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt1
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt16
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt3
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt11
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt67
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt130
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json12
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json (renamed from ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json)8
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt8
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java4
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java11
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java6
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt9
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json12
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json12
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json12
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt)15
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt5
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt4
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/resources/application.properties4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json8
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json8
82 files changed, 719 insertions, 534 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index 16e5b32d3..3405edab7 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -26,7 +26,7 @@ server.port=8081
### START -Controller Blueprints Properties
# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=blueprints/deploy
@@ -67,14 +67,14 @@ blueprintsprocessor.blueprintDeployPath=blueprints/deploy
blueprintsprocessor.blueprintArchivePath=blueprints/archive
blueprintsprocessor.blueprintWorkingPath=blueprints/work
# 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
+blueprintsprocessor.db.url=jdbc:mysql://localhost:3306/sdnctl
+blueprintsprocessor.db.username=sdnctl
+blueprintsprocessor.db.password=sdnctl
+blueprintsprocessor.db.driverClassName=org.mariadb.jdbc.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=update
+blueprintsprocessor.db.hibernateDDLAuto=none
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Python executor
### If testing in docker, use the absolute paths as Docker view of filesystem will not respect relative paths.
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index bc297efb4..3ea588da3 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -16,7 +16,7 @@
# Web server config
### START -Controller Blueprints Properties
# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/opt/app/onap/blueprints/deploy
@@ -48,14 +48,14 @@ blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working
# 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=update
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect
+blueprintsprocessor.db.url=jdbc:mysql://db:3306/sdnctl
+blueprintsprocessor.db.username=sdnctl
+blueprintsprocessor.db.password=sdnctl
+blueprintsprocessor.db.driverClassName=org.mariadb.jdbc.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=update
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Python executor
blueprints.processor.functions.python.executor.executionPath=/opt/app/onap/scripts/jython/ccsdk_blueprints
@@ -85,16 +85,16 @@ blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXB
# Primary Config Data REST client settings
-blueprintsprocessor.restclient.primary-config-data.type=basic-auth
-blueprintsprocessor.restclient.primary-config-data.url=http://sdnc:8282
-blueprintsprocessor.restclient.primary-config-data.username=admin
-blueprintsprocessor.restclient.primary-config-data.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+blueprintsprocessor.restclient.config-data.type=basic-auth
+blueprintsprocessor.restclient.config-data.url=http://sdnc:8282
+blueprintsprocessor.restclient.config-data.username=admin
+blueprintsprocessor.restclient.config-data.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
# Primary AAI Data REST Client settings
-blueprintsprocessor.restclient.primary-aai-data.type=basic-auth
-blueprintsprocessor.restclient.primary-aai-data.url=https://aai.onap:8443
-blueprintsprocessor.restclient.primary-aai-data.username=aai@aai.onap.org
-blueprintsprocessor.restclient.primary-aai-data.password=demo123456!
+blueprintsprocessor.restclient.aai-data.type=basic-auth
+blueprintsprocessor.restclient.aai-data.url=https://aai.onap:8443
+blueprintsprocessor.restclient.aai-data.username=aai@aai.onap.org
+blueprintsprocessor.restclient.aai-data.password=demo123456!
# Kafka-message-lib Configuration
blueprintsprocessor.messageclient.self-service-api.topic=producer.t
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
index ad4173c9e..dfa0a8563 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintsAcceptanceTest.kt
@@ -35,6 +35,7 @@ import org.junit.ClassRule
import org.junit.Rule
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
+import org.mockito.Answers
import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
@@ -105,7 +106,7 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
@JvmField
val springMethodRule = SpringMethodRule()
- @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
+ @MockBean(name = RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY, answer = Answers.RETURNS_SMART_NULLS)
lateinit var restClientFactory: BluePrintRestLibPropertyService
@Autowired
@@ -130,10 +131,10 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
uploadBlueprint(blueprintName)
- // Configure mocked external services
- val expectationPerClient = uat.externalServices.associateBy(
+ // Configure mocked external services and save their expected requests for further validation
+ val requestsPerClient = uat.externalServices.associateBy(
{ service -> createRestClientMock(service.selector, service.expectations) },
- { service -> service.expectations }
+ { service -> service.expectations.map { it.request } }
)
// Run processes
@@ -143,14 +144,14 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec))
}
- // Validate request payloads to external services
- for ((mockClient, expectations) in expectationPerClient) {
- expectations.forEach { expectation ->
+ // Validate requests to external services
+ for ((mockClient, requests) in requestsPerClient) {
+ requests.forEach { request ->
verify(mockClient, atLeastOnce()).exchangeResource(
- eq(expectation.request.method),
- eq(expectation.request.path),
- argThat { assertJsonEqual(expectation.request.body, this) },
- expectation.request.requestHeadersMatcher())
+ eq(request.method),
+ eq(request.path),
+ argThat { assertJsonEqual(request.body, this) },
+ argThat(RequiredMapEntriesMatcher(request.headers)))
}
// Don't mind the invocations to the overloaded exchangeResource(String, String, String)
verify(mockClient, atLeast(0)).exchangeResource(any(), any(), any())
@@ -160,7 +161,8 @@ class BlueprintsAcceptanceTest(private val blueprintName: String, private val fi
private fun createRestClientMock(selector: String, restExpectations: List<ExpectationDefinition>)
: BlueprintWebClientService {
- val restClient = mock<BlueprintWebClientService>(verboseLogging = true)
+ val restClient = mock<BlueprintWebClientService>(verboseLogging = true,
+ defaultAnswer = Answers.RETURNS_SMART_NULLS)
// Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
whenever(restClient.exchangeResource(any(), any(), any()))
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt
new file mode 100644
index 000000000..71e07ab4c
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/MoreMatchers.kt
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.ccsdk.cds.blueprintsprocessor
+
+import com.google.common.collect.Maps
+import org.mockito.ArgumentMatcher
+
+class RequiredMapEntriesMatcher<K, V>(private val requiredEntries: Map<K, V>) : ArgumentMatcher<Map<K, V>> {
+ override fun matches(argument: Map<K, V>?): Boolean {
+ val missingEntries = Maps.difference(requiredEntries, argument).entriesOnlyOnLeft()
+ return missingEntries.isEmpty()
+ }
+
+ override fun toString(): String {
+ return requiredEntries.toString()
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
index ce2061168..abb1dfcd1 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/UatDefinition.kt
@@ -24,8 +24,6 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.node.MissingNode
-import com.nhaarman.mockitokotlin2.any
-import com.nhaarman.mockitokotlin2.eq
import org.yaml.snakeyaml.Yaml
import java.nio.file.Path
@@ -35,13 +33,8 @@ data class ProcessDefinition(val name: String, val request: JsonNode, val expect
data class RequestDefinition(val method: String,
@JsonDeserialize(using = PathDeserializer::class)
val path: String,
- @JsonAlias("content-type")
- val contentType: String? = null,
- val body: JsonNode = MissingNode.getInstance()) {
- fun requestHeadersMatcher(): Map<String, String> {
- return if (contentType != null) eq(mapOf("Content-Type" to contentType)) else any()
- }
-}
+ val headers: Map<String, String> = emptyMap(),
+ val body: JsonNode = MissingNode.getInstance())
data class ResponseDefinition(val status: Int = 200, val body: JsonNode = MissingNode.getInstance()) {
companion object {
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application-test.properties b/ms/blueprintsprocessor/application/src/test/resources/application-test.properties
index b8b80f2dd..74c8a2380 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/application/src/test/resources/application-test.properties
@@ -20,14 +20,14 @@ blueprintsprocessor.httpPort=0
blueprintsprocessor.grpcEnable=true
blueprintsprocessor.grpcPort=0
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# The properties bellow are set programmatically
#blueprintsprocessor.blueprintDeployPath=
@@ -47,4 +47,4 @@ blueprints.processor.functions.python.executor.modulePaths=\
blueprintsprocessor.cliExecutor.enabled=true
blueprintprocessor.netconfExecutor.enabled=true
-blueprintsprocessor.restconfEnabled=true \ No newline at end of file
+blueprintsprocessor.restconfEnabled=true
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
index 06f3e948c..e50ebdefb 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties
@@ -19,7 +19,7 @@
server.port=8080
### START -Controller Blueprints Properties
# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/opt/app/onap/blueprints/deploy
@@ -49,14 +49,14 @@ blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/work
# Primary Database Configuration
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Python executor
blueprints.processor.functions.python.executor.executionPath=/opt/app/onap/scripts/jython/ccsdk_blueprints
blueprints.processor.functions.python.executor.modulePaths=/opt/app/onap/scripts/jython/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
index 1e1974427..848083e63 100755
--- a/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
+++ b/ms/blueprintsprocessor/distribution/src/main/dc/docker-compose.yaml
@@ -14,17 +14,3 @@ services:
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
- 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/functions/ansible-awx-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/application-test.properties
index 527eb8a26..2bbe31b3c 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/resources/application-test.properties
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
@@ -32,4 +32,4 @@ blueprints.processor.functions.python.executor.executionPath=./../../../../compo
blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
# Executor Options
-blueprintprocessor.netconfExecutor.enabled=true \ No newline at end of file
+blueprintprocessor.netconfExecutor.enabled=true
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/config-snapshots/src/test/resources/application-test.properties
index ce5b4e39f..74c478a2a 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/resources/application-test.properties
@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
@@ -29,4 +29,4 @@ blueprints.processor.functions.python.executor.executionPath=./../../../../compo
blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
# Executor Options
-blueprintprocessor.netconfExecutor.enabled=true \ No newline at end of file
+blueprintprocessor.netconfExecutor.enabled=true
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
index 527eb8a26..2bbe31b3c 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/resources/application-test.properties
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
@@ -32,4 +32,4 @@ blueprints.processor.functions.python.executor.executionPath=./../../../../compo
blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
# Executor Options
-blueprintprocessor.netconfExecutor.enabled=true \ No newline at end of file
+blueprintprocessor.netconfExecutor.enabled=true
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
index f8193b7f9..6645a631a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
@@ -123,12 +123,16 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
checkNotEmpty(resourceAssignment.dictionaryName) {
"resource assignment dictionary name is not defined for template key (${resourceAssignment.name})"
}
- check(resourceAssignment.dictionarySource in arrayOf(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, ResourceDictionaryConstants.SOURCE_PRIMARY_DB))
+ check(resourceAssignment.dictionarySource in getListOfDBSources())
{
- "resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
+ "resource assignment source is not ${ResourceDictionaryConstants.PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
}
}
+ //placeholder to get the list of DB sources.
+ //TODO: This will be replaced with a DB
+ private fun getListOfDBSources(): Array<String> = arrayOf(ResourceDictionaryConstants.PROCESSOR_DB)
+
private fun populateNamedParameter(inputKeyMapping: Map<String, String>): Map<String, Any> {
val namedParameters = HashMap<String, Any>()
inputKeyMapping.forEach {
@@ -163,4 +167,4 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
index 7e7e65635..9c6aae250 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
@@ -73,7 +73,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-name"
dictionaryName = "vnf_name"
- dictionarySource = "primary-config-data"
+ dictionarySource = "config-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -106,7 +106,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-aai"
dictionaryName = "aai-get-resource"
- dictionarySource = "primary-aai-data"
+ dictionarySource = "aai-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -139,7 +139,7 @@ class RestResourceResolutionProcessorTest {
val resourceAssignment = ResourceAssignment().apply {
name = "rr-aai"
dictionaryName = "aai-put-resource"
- dictionarySource = "primary-aai-data"
+ dictionarySource = "aai-data"
property = PropertyDefinition().apply {
type = "string"
}
@@ -150,4 +150,4 @@ class RestResourceResolutionProcessorTest {
println(processorName)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties
index 5deea31e1..3218a585d 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/application-test.properties
@@ -14,14 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
@@ -30,12 +30,12 @@ blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
-blueprintsprocessor.restclient.primary-config-data.type=basic-auth
-blueprintsprocessor.restclient.primary-config-data.url=http://127.0.0.1:9911
-blueprintsprocessor.restclient.primary-config-data.username=sampleuser
-blueprintsprocessor.restclient.primary-config-data.password=sampletoken
+blueprintsprocessor.restclient.config-data.type=basic-auth
+blueprintsprocessor.restclient.config-data.url=http://127.0.0.1:9911
+blueprintsprocessor.restclient.config-data.username=sampleuser
+blueprintsprocessor.restclient.config-data.password=sampletoken
-blueprintsprocessor.restclient.primary-aai-data.type=basic-auth
-blueprintsprocessor.restclient.primary-aai-data.url=http://127.0.0.1:30800
-blueprintsprocessor.restclient.primary-aai-data.username=admin
-blueprintsprocessor.restclient.primary-aai-data.password=aaiTest \ No newline at end of file
+blueprintsprocessor.restclient.aai-data.type=basic-auth
+blueprintsprocessor.restclient.aai-data.url=http://127.0.0.1:30800
+blueprintsprocessor.restclient.aai-data.username=admin
+blueprintsprocessor.restclient.aai-data.password=aaiTest
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json
index 52e0a7967..256830ef9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/dt-location.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/dt-location.json
@@ -1,15 +1,15 @@
-{
- "version": "1.0.0",
- "description": "test Data Type",
- "properties": {
- "country": {
- "required": true,
- "type": "string"
- },
- "state": {
- "required": false,
- "type": "string"
- }
- },
- "derived_from": "tosca.datatypes.Root"
-}
+{
+ "version": "1.0.0",
+ "description": "test Data Type",
+ "properties": {
+ "country": {
+ "required": true,
+ "type": "string"
+ },
+ "state": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json
index 7082a4341..16788c3ba 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-array.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-array.json
@@ -1,35 +1,35 @@
-{
- "locations": {
- "name": "locations",
- "data-type": "list",
- "entry-schema": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- },
- "candidate-dependency": {
- "primary-db": {
- "names": [
- "profile_name"
- ]
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "locations": {
+ "name": "locations",
+ "data-type": "list",
+ "entry-schema": "dt-location",
+ "source": {
+ "processor-db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ },
+ "candidate-dependency": {
+ "processor-db": {
+ "names": [
+ "profile_name"
+ ]
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json
index 53e2a11c3..bccf250f1 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-complex.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-complex.json
@@ -1,27 +1,27 @@
-{
- "location": {
- "name": "location",
- "data-type": "dt-location",
- "source": {
- "primary-db": {
- "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "db-country": "country",
- "db-state": "state"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "location": {
+ "name": "location",
+ "data-type": "dt-location",
+ "source": {
+ "processor-db": {
+ "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "db-country": "country",
+ "db-state": "state"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json
index fad088877..843adc1fa 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/primary-db-simple.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/processor-db-simple.json
@@ -1,26 +1,26 @@
-{
- "country": {
- "name": "country",
- "data-type": "string",
- "source": {
- "primary-db": {
- "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
- "input-key-mapping": {
- "profile_name": "profile_name"
- },
- "output-key-mapping": {
- "country": "country"
- }
- }
- }
- },
- "profile_name": {
- "name": "profile_name",
- "data-type": "string",
- "source": {
- "input": {
-
- }
- }
- }
-}
+{
+ "country": {
+ "name": "country",
+ "data-type": "string",
+ "source": {
+ "processor-db": {
+ "query": "SELECT country FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
+ "input-key-mapping": {
+ "profile_name": "profile_name"
+ },
+ "output-key-mapping": {
+ "country": "country"
+ }
+ }
+ }
+ },
+ "profile_name": {
+ "name": "profile_name",
+ "data-type": "string",
+ "source": {
+ "input": {
+
+ }
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json
index bb392d7be..9d7d44c9c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/primary-db/resource-assignments-simple.json
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/mapping/processor-db/resource-assignments-simple.json
@@ -1,22 +1,22 @@
-[
- {
- "name": "country",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "country",
- "dictionary-source": "primary-db",
- "dependencies": ["state"]
- },
- {
- "name": "state",
- "input-param": true,
- "property": {
- "type": "string"
- },
- "dictionary-name": "state",
- "dictionary-source": "input",
- "dependencies": []
- }
-]
+[
+ {
+ "name": "country",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "country",
+ "dictionary-source": "processor-db",
+ "dependencies": ["state"]
+ },
+ {
+ "name": "state",
+ "input-param": true,
+ "property": {
+ "type": "string"
+ },
+ "dictionary-name": "state",
+ "dictionary-source": "input",
+ "dependencies": []
+ }
+]
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties b/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties
index 6d8b62ff9..60c6fef50 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/test/resources/application-test.properties
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
index fd889bfbf..11abf7b2e 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
@@ -32,7 +32,7 @@ open class BluePrintDBLibConfiguration(private var bluePrintProperties: BluePrin
@Bean("primary-database-properties")
open fun getPrimaryProperties(): PrimaryDataSourceProperties {
- return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB_PRIMARY,
+ return bluePrintProperties.propertyBeanType(DBLibConstants.PREFIX_DB,
PrimaryDataSourceProperties::class.java)
}
}
@@ -49,11 +49,11 @@ fun BluePrintDependencyService.primaryDBLibGenericService(): BluePrintDBLibGener
class DBLibConstants {
companion object {
- const val PREFIX_DB_PRIMARY: String = "blueprintsprocessor.db.primary"
+ const val PREFIX_DB: String = "blueprintsprocessor.db"
//list of database
const val MARIA_DB: String = "maria-db"
- const val PRIMARY_DB: String = "primary-db"
+ const val PRIMARY_DB: String = "processor-db"
const val MYSQL_DB: String = "mysql-db"
const val ORACLE_DB: String = "oracle-db"
const val POSTGRES_DB: String = "postgres-db"
@@ -64,4 +64,4 @@ class DBLibConstants {
const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver"
const val DRIVER_POSTGRES_DB = "org.postgresql.Driver"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
index b71287d6e..b1ac5cee4 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
@@ -49,4 +49,3 @@ open class MySqlDataSourceProperties: DBDataSourceProperties() {
lateinit var hibernateDialect: String
override var driverClassName = DBLibConstants.DRIVER_MYSQL_DB
}
-
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
index 9dda71eb2..90cf03517 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
@@ -14,14 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt
new file mode 100644
index 000000000..47b55b018
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright © 2019 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.cds.blueprintsprocessor.core
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.controllerblueprints.core.asType
+import kotlin.reflect.KClass
+
+
+fun <T : Any> ExecutionServiceInput.payloadAsType(clazzType: KClass<T>): T {
+ val actionName = this.actionIdentifiers.actionName
+ val requestJsonNode = this.payload.get("$actionName-request")
+ return requestJsonNode.asType(clazzType.java)
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/resources/application-test.properties
index e02ed89f9..ebd394cc2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/resources/application-test.properties
@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
index d40f0e064..a3361acde 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
@@ -26,6 +26,10 @@
<name>Blueprints Designer API</name>
<description>Blueprints Designer API</description>
+ <properties>
+ <sonar.skip>true</sonar.skip>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
index ebd5dc859..7d74687ab 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/resources/application-test.properties
@@ -1,7 +1,7 @@
#
-# Copyright © 2017-2018 AT&T Intellectual Property.
+# Copyright � 2017-2018 AT&T Intellectual Property.
#
-# Modifications Copyright © 2019 IBM, Bell Canada.
+# 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.
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
index 29d4f48a5..27130a7bc 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
@@ -54,10 +54,10 @@ open class MockResourceSource {
@Bean(name = [
"rr-processor-source-input",
"rr-processor-source-default",
- "rr-processor-source-processor-db",
+ "rr-processor-source-db",
"rr-processor-source-rest"])
open fun sourceInstance(): ResourceAssignmentProcessor {
return mockk<ResourceAssignmentProcessor>()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
index d532b1582..ab3bac88f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
-blueprintsprocessor.db.primary.username=sa
-blueprintsprocessor.db.primary.password=
-blueprintsprocessor.db.primary.driverClassName=org.h2.Driver
-blueprintsprocessor.db.primary.hibernateHbm2ddlAuto=create-drop
-blueprintsprocessor.db.primary.hibernateDDLAuto=update
-blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
-blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 408bb58ed..8759338b7 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
import com.fasterxml.jackson.databind.JsonNode
+import kotlinx.coroutines.withTimeout
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
@@ -47,6 +48,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
lateinit var interfaceName: String
lateinit var operationName: String
lateinit var nodeTemplateName: String
+ var timeout: Int = 180
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun getName(): String {
@@ -87,6 +89,9 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
this.operationInputs.putAll(operationResolvedProperties)
+ val timeout = this.operationInputs.getOptionalAsInt(BluePrintConstants.PROPERTY_CURRENT_TIMEOUT)
+ timeout?.let { this.timeout = timeout }
+
return executionRequest
}
@@ -118,7 +123,9 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
override suspend fun applyNB(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
try {
prepareRequestNB(executionServiceInput)
- processNB(executionServiceInput)
+ withTimeout((timeout * 1000).toLong()) {
+ processNB(executionServiceInput)
+ }
} catch (runtimeException: RuntimeException) {
log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
recoverNB(runtimeException, executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
index 2a14be216..6bee17f4b 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
@@ -44,10 +44,8 @@ class ImperativeWorkflowExecutionService(
val graph = bluePrintContext.workflowByName(workflowName).asGraph()
- val deferredOutput = CompletableDeferred<ExecutionServiceOutput>()
- imperativeBluePrintWorkflowService.executeWorkflow(graph, bluePrintRuntimeService,
- executionServiceInput, deferredOutput)
- return deferredOutput.await()
+ return imperativeBluePrintWorkflowService.executeWorkflow(graph, bluePrintRuntimeService,
+ executionServiceInput)
}
}
@@ -60,35 +58,41 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var executionServiceInput: ExecutionServiceInput
lateinit var workflowName: String
- lateinit var deferredExecutionServiceOutput: CompletableDeferred<ExecutionServiceOutput>
override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: ExecutionServiceInput,
- output: CompletableDeferred<ExecutionServiceOutput>) {
+ input: ExecutionServiceInput): ExecutionServiceOutput {
this.graph = graph
this.bluePrintRuntimeService = bluePrintRuntimeService
this.executionServiceInput = input
this.workflowName = this.executionServiceInput.actionIdentifiers.actionName
- this.deferredExecutionServiceOutput = output
this.workflowId = bluePrintRuntimeService.id()
+ val output = CompletableDeferred<ExecutionServiceOutput>()
val startMessage = WorkflowExecuteMessage(input, output)
- workflowActor().send(startMessage)
+ val workflowActor = workflowActor()
+ if (!workflowActor.isClosedForSend) {
+ workflowActor.send(startMessage)
+ } else {
+ throw BluePrintProcessorException("workflow($workflowActor) actor is closed")
+ }
+ return output.await()
}
override suspend fun initializeWorkflow(input: ExecutionServiceInput): EdgeLabel {
return EdgeLabel.SUCCESS
}
- override suspend fun prepareWorkflowOutput(exception: BluePrintProcessorException?): ExecutionServiceOutput {
- val wfStatus = if (exception != null) {
- val status = Status()
- status.message = BluePrintConstants.STATUS_FAILURE
- status.errorMessage = exception.message
- status
- } else {
- val status = Status()
- status.message = BluePrintConstants.STATUS_SUCCESS
- status
+ override suspend fun prepareWorkflowOutput(): ExecutionServiceOutput {
+ val wfStatus = Status().apply {
+ if (exceptions.isNotEmpty()) {
+ exceptions.forEach {
+ val errorMessage = it.message ?: ""
+ bluePrintRuntimeService.getBluePrintError().addError(errorMessage)
+ log.error("workflow($workflowId) exception :", it)
+ }
+ message = BluePrintConstants.STATUS_FAILURE
+ } else {
+ message = BluePrintConstants.STATUS_SUCCESS
+ }
}
return ExecutionServiceOutput().apply {
commonHeader = executionServiceInput.commonHeader
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
index 89732e300..b64177aab 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
@@ -22,7 +22,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutp
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.slf4j.LoggerFactory
@@ -37,15 +37,22 @@ open class NodeTemplateExecutionService {
executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
// Get the Blueprint Context
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
+
+ val nodeTemplate = blueprintContext.nodeTemplateByName(nodeTemplateName)
// Get the Component Name, NodeTemplate type is mapped to Component Name
- val componentName = blueprintContext.nodeTemplateByName(nodeTemplateName).type
+ val componentName = nodeTemplate.type
val interfaceName = blueprintContext.nodeTemplateFirstInterfaceName(nodeTemplateName)
val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName)
+ val nodeTemplateImplementation = blueprintContext
+ .nodeTemplateOperationImplementation(nodeTemplateName, interfaceName, operationName)
+
+ val timeout: Int = nodeTemplateImplementation?.timeout ?: 180
+
log.info("executing node template($nodeTemplateName) component($componentName) " +
- "interface($interfaceName) operation($operationName)")
+ "interface($interfaceName) operation($operationName) with timeout($timeout) sec.")
// Get the Component Instance
val plugin = BluePrintDependencyService.instance<AbstractComponentFunction>(componentName)
@@ -62,9 +69,10 @@ open class NodeTemplateExecutionService {
// Populate Step Meta Data
val stepInputs: MutableMap<String, JsonNode> = hashMapOf()
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName)
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName)
- stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName)
+ stepInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = nodeTemplateName.asJsonPrimitive()
+ stepInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = interfaceName.asJsonPrimitive()
+ stepInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = operationName.asJsonPrimitive()
+ stepInputs[BluePrintConstants.PROPERTY_CURRENT_TIMEOUT] = timeout.asJsonPrimitive()
val stepInputData = StepData().apply {
name = nodeTemplateName
properties = stepInputs
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
index ac2d7d62c..6e7e3cb8d 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
@@ -18,14 +18,18 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
import kotlinx.coroutines.runBlocking
+import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonReactorUtils
import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertEquals
@@ -36,9 +40,17 @@ import kotlin.test.assertNotNull
class DGWorkflowExecutionServiceTest {
@Autowired
+ lateinit var applicationContext: ApplicationContext
+
+ @Autowired
lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService
+ @Before
+ fun init() {
+ BluePrintDependencyService.inject(applicationContext)
+ }
+
@Test
fun testExecuteDirectedGraph() {
runBlocking {
diff --git a/ms/controllerblueprints/application/src/main/resources/application-dev.properties b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
index 09d10dc69..1ee8e3f54 100755
--- a/ms/controllerblueprints/application/src/main/resources/application-dev.properties
+++ b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
@@ -49,11 +49,11 @@ 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=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
-controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
-controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
-controllerblueprints.blueprintWorkingPath=/etc/blueprints/work
+controllerblueprints.blueprintDeployPath=blueprints/deploy
+controllerblueprints.blueprintArchivePath=blueprints/archive
+controllerblueprints.blueprintWorkingPath=blueprints/work
# Controller Blueprint Load Configurations
controllerblueprints.loadInitialData=true
controllerblueprints.loadBluePrint=false
@@ -67,4 +67,4 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-cat
controllerblueprints.loadCbaExtension=zip
# Web server config
-server.port=8080 \ No newline at end of file
+server.port=8082
diff --git a/ms/controllerblueprints/application/src/main/resources/application.properties b/ms/controllerblueprints/application/src/main/resources/application.properties
index 4be06d81f..0ccec68bb 100755
--- a/ms/controllerblueprints/application/src/main/resources/application.properties
+++ b/ms/controllerblueprints/application/src/main/resources/application.properties
@@ -52,7 +52,7 @@ spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
@@ -72,4 +72,4 @@ controllerblueprints.loadResourceDictionaryPaths=/opt/app/onap//model-catalog/re
controllerblueprints.loadCbaExtension=zip
# Web server config
-server.port=8080 \ No newline at end of file
+server.port=8080
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 0e96343d5..0ccd1cf92 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=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
@@ -55,4 +55,4 @@ controllerblueprints.loadCbaExtension=zip
controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
# Web server config
-server.port=8080 \ No newline at end of file
+server.port=8080
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
index 064c196ed..ba5815bb6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
@@ -180,6 +180,7 @@ object BluePrintConstants {
const val PROPERTY_CURRENT_NODE_TEMPLATE = "current-node-template"
const val PROPERTY_CURRENT_INTERFACE = "current-interface"
const val PROPERTY_CURRENT_OPERATION = "current-operation"
+ const val PROPERTY_CURRENT_TIMEOUT = "current-timeout"
const val PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation"
const val PROPERTY_EXECUTION_REQUEST = "execution-request"
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 93ba15e99..08bc6c3fd 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -242,6 +242,22 @@ fun Map<String, JsonNode>.getAsDouble(key: String): Double {
return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)")
}
+fun Map<String, JsonNode>.getOptionalAsString(key: String): String? {
+ return if (this.containsKey(key)) this[key]!!.asText() else null
+}
+
+fun Map<String, JsonNode>.getOptionalAsBoolean(key: String): Boolean? {
+ return if (this.containsKey(key)) this[key]!!.asBoolean() else null
+}
+
+fun Map<String, JsonNode>.getOptionalAsInt(key: String): Int? {
+ return if (this.containsKey(key)) this[key]!!.asInt() else null
+}
+
+fun Map<String, JsonNode>.getOptionalAsDouble(key: String): Double? {
+ return if (this.containsKey(key)) this[key]!!.asDouble() else null
+}
+
// Checks
inline fun checkEquals(value1: String?, value2: String?, lazyMessage: () -> Any): Boolean {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
index 9e1b7498e..fc796c9ed 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
@@ -33,7 +33,8 @@ enum class NodeStatus(val id: String) {
READY("ready"),
EXECUTING("executing"),
EXECUTED("executed"),
- SKIPPED("skipped")
+ SKIPPED("skipped"),
+ TERMINATED("terminated")
}
class Graph {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
index 066516fcc..99c80f8e6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
@@ -101,12 +101,12 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String {
return workflowStepByName(workFlowName, stepName).activities?.filter { it.callOperation != null }?.single()?.callOperation
- ?: throw BluePrintException("could't get first callOperation for WorkFlow($workFlowName) ")
+ ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
}
// DSL
fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
- ?: throw BluePrintException("could't get policy type for the dsl($name)")
+ ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
// Data Type
fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
@@ -216,6 +216,11 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
}
+ fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String)
+ : Implementation? {
+ return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).implementation
+ }
+
fun nodeTemplateInterfaceOperationInputs(nodeTemplateName: String, interfaceName: String, operationName: String): MutableMap<String, JsonNode>? {
return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).inputs
}
@@ -264,4 +269,4 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
index 905150213..5cec3c947 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
@@ -30,13 +30,12 @@ import kotlin.coroutines.CoroutineContext
interface BluePrintWorkFlowService<In, Out> {
/** Executes imperative workflow graph [graph] for the bluePrintRuntimeService [bluePrintRuntimeService]
- * and workflow input [input], response will be retrieve from output [output]*/
- suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: In, output: CompletableDeferred<Out>)
+ * and workflow input [input]*/
+ suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: In): Out
suspend fun initializeWorkflow(input: In): EdgeLabel
- suspend fun prepareWorkflowOutput(exception: BluePrintProcessorException?): Out
+ suspend fun prepareWorkflowOutput(): Out
/** Prepare the message for the Node */
suspend fun prepareNodeExecutionMessage(node: Graph.Node): NodeExecuteMessage<In, Out>
@@ -91,6 +90,8 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
lateinit var workflowId: String
+ var exceptions: MutableList<Exception> = arrayListOf()
+
final override val coroutineContext: CoroutineContext
get() = job + CoroutineName("Wf")
@@ -100,7 +101,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
throw CancellationException("Workflow($workflowId) cancelled as requested")
}
- fun workflowActor() = actor<WorkflowMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
+ suspend fun workflowActor() = actor<WorkflowMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
/** Process the workflow execution message */
suspend fun executeMessageActor(workflowExecuteMessage: WorkflowExecuteMessage<In, Out>) {
@@ -119,13 +120,11 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
// Wait for workflow completion or Error
nodeActor.invokeOnClose { exception ->
launch {
- log.info("End Node Completed, processing completion message")
- val bluePrintProcessorException: BluePrintProcessorException? =
- if (exception != null) BluePrintProcessorException(exception) else null
-
- val workflowOutput = prepareWorkflowOutput(bluePrintProcessorException)
+ if (exception != null) exceptions.add(BluePrintProcessorException(exception))
+ log.info("workflow($workflowId) nodes completed with (${exceptions.size})exceptions")
+ val workflowOutput = prepareWorkflowOutput()
workflowExecuteMessage.output.complete(workflowOutput)
- channel.close(exception)
+ channel.close()
}
}
}
@@ -135,7 +134,11 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
when (message) {
is WorkflowExecuteMessage<In, Out> -> {
launch {
- executeMessageActor(message)
+ try {
+ executeMessageActor(message)
+ } catch (e: Exception) {
+ exceptions.add(e)
+ }
}
}
is WorkflowRestartMessage<In, Out> -> {
@@ -153,7 +156,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
- private fun nodeActor() = actor<NodeMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
+ private suspend fun nodeActor() = actor<NodeMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
/** Send message to process from one state to other state */
fun sendNodeMessage(nodeMessage: NodeMessage<In, Out>) = launch {
@@ -164,7 +167,6 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
fun processNextNodes(node: Graph.Node, nodeState: EdgeLabel) {
// Process only Next Success Node
val stateEdges = graph.outgoingEdges(node.id, arrayListOf(nodeState))
- log.debug("Next Edges :$stateEdges")
if (stateEdges.isNotEmpty()) {
stateEdges.forEach { stateEdge ->
// Prepare next node ready message and Send NodeReadyMessage
@@ -213,7 +215,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
triggerToExecuteOrSkip(newMessage)
} else {
- log.info("node(${node.id}) waiting for not completed edges($notCompletedEdges)")
+ log.info("node(${node.id}) is waiting for incoming edges($notCompletedEdges)")
}
} else {
triggerToExecuteOrSkip(message)
@@ -233,15 +235,19 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
// Update Node Completed
node.status = NodeStatus.EXECUTED
- log.info("Execute Node($node) -> Executed State($nodeState)")
+ log.info("Execute node(${node.id}) -> executed state($nodeState)")
+ // Check if the Node status edge is there, If not close processing
+ val edgePresent = graph.outgoingEdges(node.id, nodeState).isNotEmpty()
// If End Node, Send End Message
if (graph.isEndNode(node)) {
// Close the current channel
channel.close()
+ } else if (!edgePresent) {
+ throw BluePrintProcessorException("node(${node.id}) outgoing edge($nodeState) is missing.")
} else {
val skippingEdges = graph.outgoingEdgesNotInLabels(node.id, arrayListOf(nodeState))
- log.debug("Skipping node($node) outgoing Edges($skippingEdges)")
+ log.debug("Skipping node($node)'s outgoing edges($skippingEdges)")
// Process Skip Edges
skippingEdges.forEach { skippingEdge ->
// Prepare next node ready message and Send NodeReadyMessage
@@ -266,7 +272,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
log.debug("$$$$$ Skipping workflow($workflowId) node($node) $$$$$")
// Call the Extension Function
val nodeState = skipNode(node, message.nodeInput, message.nodeOutput)
- log.info("Skip Node($node) -> Executed State($nodeState)")
+ log.info("Skip node(${node.id}) -> executed state($nodeState)")
// Mark the Current node as Skipped
node.status = NodeStatus.SKIPPED
// Look for next possible skip nodes
@@ -283,7 +289,7 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
fun cancelNodeWorker(messageWorkflow: WorkflowCancelMessage<In, Out>) = launch {
channel.close()
- throw CancellationException("Workflow($workflowId) actor cancelled as requested ...")
+ throw CancellationException("Workflow($workflowId) actor cancelled as requested.")
}
/** Process each actor message received based on type **/
@@ -294,7 +300,8 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
try {
readyNodeWorker(nodeMessage)
} catch (e: Exception) {
- channel.close(e)
+ exceptions.add(e)
+ channel.close()
}
}
is NodeExecuteMessage<In, Out> -> {
@@ -302,7 +309,9 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
try {
executeNodeWorker(nodeMessage)
} catch (e: Exception) {
- channel.close(e)
+ nodeMessage.node.status = NodeStatus.TERMINATED
+ exceptions.add(e)
+ channel.close()
}
}
}
@@ -311,7 +320,9 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
try {
skipNodeWorker(nodeMessage)
} catch (e: Exception) {
- channel.close(e)
+ nodeMessage.node.status = NodeStatus.TERMINATED
+ exceptions.add(e)
+ channel.close()
}
}
}
@@ -320,20 +331,12 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
try {
restartNodeWorker(nodeMessage)
} catch (e: Exception) {
- channel.close(e)
+ exceptions.add(e)
+ channel.close()
}
}
}
}
}
}
-
- override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: In, output: CompletableDeferred<Out>) {
- log.info("Executing Graph : $graph")
- this.graph = graph
- this.workflowId = bluePrintRuntimeService.id()
- val startMessage = WorkflowExecuteMessage(input, output)
- workflowActor().send(startMessage)
- }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
index b8d8cea3e..4d97f8bc3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
@@ -18,13 +18,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import io.mockk.every
import io.mockk.mockk
-import kotlinx.coroutines.CompletableDeferred
-import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.*
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.toGraph
import kotlin.test.assertNotNull
@@ -36,10 +36,66 @@ class BluePrintWorkflowServiceTest {
.toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
- val deferredOutput = CompletableDeferred<String>()
val input = "123456"
- simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input, deferredOutput)
- val response = deferredOutput.await()
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+ assertNotNull(response, "failed to get response")
+ }
+ }
+
+ @Test
+ fun testMultipleFlows() {
+ runBlocking {
+ coroutineScope {
+ val wfs = listOf("12345", "12346").map {
+ async {
+ val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
+ .toGraph()
+ val simpleWorkflow = TestBluePrintWorkFlowService()
+ simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(it), it)
+ assertNotNull(response, "failed to get response")
+ }
+ }
+ wfs.awaitAll()
+ }
+ }
+ }
+
+ @Test
+ fun testMissingEdgeForBFailureState() {
+ runBlocking {
+ val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
+ .toGraph()
+ val simpleWorkflow = TestBluePrintWorkFlowService()
+ simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), arrayListOf("B"))
+ val input = "123456"
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+ assertNotNull(response, "failed to get response")
+ }
+ }
+
+ @Test
+ fun testBExceptionFlow() {
+ runBlocking {
+ val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
+ .toGraph()
+ val simpleWorkflow = TestBluePrintWorkFlowService()
+ simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), null)
+ val input = "123456"
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
+ assertNotNull(response, "failed to get response")
+ }
+ }
+
+ @Test
+ fun testTimeoutExceptionFlow() {
+ runBlocking {
+ val graph = "[START>A/SUCCESS, A>TO/SUCCESS, TO>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
+ .toGraph()
+ val simpleWorkflow = TestBluePrintWorkFlowService()
+ simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "TO", "C", "D", "E"), null)
+ val input = "123456"
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
assertNotNull(response, "failed to get response")
}
}
@@ -51,10 +107,8 @@ class BluePrintWorkflowServiceTest {
.toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
- val deferredOutput = CompletableDeferred<String>()
val input = "123456"
- simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input, deferredOutput)
- val response = deferredOutput.await()
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
assertNotNull(response, "failed to get response")
}
}
@@ -68,10 +122,8 @@ class BluePrintWorkflowServiceTest {
val failurePathWorkflow = TestBluePrintWorkFlowService()
failurePathWorkflow.simulatedState = prepareSimulation(arrayListOf("B", "C", "D", "E"),
arrayListOf("A"))
- val failurePathWorkflowDeferredOutput = CompletableDeferred<String>()
val failurePathWorkflowInput = "123456"
- failurePathWorkflow.executeWorkflow(failurePatGraph, mockBluePrintRuntimeService(), failurePathWorkflowInput, failurePathWorkflowDeferredOutput)
- val failurePathResponse = failurePathWorkflowDeferredOutput.await()
+ val failurePathResponse = failurePathWorkflow.executeWorkflow(failurePatGraph, mockBluePrintRuntimeService(), failurePathWorkflowInput)
assertNotNull(failurePathResponse, "failed to get response")
}
}
@@ -83,10 +135,8 @@ class BluePrintWorkflowServiceTest {
.toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
- val deferredOutput = CompletableDeferred<String>()
val input = "123456"
- simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input, deferredOutput)
- val response = deferredOutput.await()
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
assertNotNull(response, "failed to get response")
}
}
@@ -98,17 +148,19 @@ class BluePrintWorkflowServiceTest {
.toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
- val deferredOutput = CompletableDeferred<String>()
val input = "123456"
- simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input, deferredOutput)
- val response = deferredOutput.await()
+ val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(), input)
assertNotNull(response, "failed to get response")
}
}
private fun mockBluePrintRuntimeService(): BluePrintRuntimeService<*> {
+ return mockBluePrintRuntimeService("123456")
+ }
+
+ private fun mockBluePrintRuntimeService(id: String): BluePrintRuntimeService<*> {
val bluePrintRuntimeService = mockk<BluePrintRuntimeService<*>>()
- every { bluePrintRuntimeService.id() } returns "123456"
+ every { bluePrintRuntimeService.id() } returns id
return bluePrintRuntimeService
}
@@ -126,6 +178,7 @@ class BluePrintWorkflowServiceTest {
class TestBluePrintWorkFlowService
: AbstractBluePrintWorkFlowService<String, String>() {
+ val log = logger(TestBluePrintWorkFlowService::class)
lateinit var simulatedState: MutableMap<String, EdgeLabel>
@@ -133,6 +186,21 @@ class TestBluePrintWorkFlowService
return EdgeLabel.SUCCESS
}
+ override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>, input: String): String {
+ log.info("Executing Graph : $graph")
+ this.graph = graph
+ this.workflowId = bluePrintRuntimeService.id()
+ val output = CompletableDeferred<String>()
+ val startMessage = WorkflowExecuteMessage(input, output)
+ val workflowActor = workflowActor()
+ if (!workflowActor.isClosedForSend) {
+ workflowActor().send(startMessage)
+ } else {
+ throw BluePrintProcessorException("workflow actor is closed for send $workflowActor")
+ }
+ return startMessage.output.await()
+ }
+
override suspend fun prepareNodeExecutionMessage(node: Graph.Node)
: NodeExecuteMessage<String, String> {
return NodeExecuteMessage(node, "$node Input", "")
@@ -140,23 +208,26 @@ class TestBluePrintWorkFlowService
override suspend fun executeNode(node: Graph.Node, nodeInput: String,
nodeOutput: String): EdgeLabel {
-// val random = (1..10).random() * 1000
-// println("will reply in $random ms")
+// val random = (1..10).random() * 100
+// log.info("workflow($workflowId) node(${node.id}) will reply in $random ms")
// kotlinx.coroutines.delay(random.toLong())
- val status = simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
- return status
+// //Simulation for timeout
+ if (node.id == "TO") {
+ withTimeout(1) {
+ kotlinx.coroutines.delay(2)
+ }
+ }
+ return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
}
override suspend fun prepareNodeSkipMessage(node: Graph.Node): NodeSkipMessage<String, String> {
val nodeOutput = ""
- val nodeSkipMessage = NodeSkipMessage(node, "$node Skip Input", nodeOutput)
- return nodeSkipMessage
+ return NodeSkipMessage(node, "$node Skip Input", nodeOutput)
}
override suspend fun skipNode(node: Graph.Node, nodeInput: String,
nodeOutput: String): EdgeLabel {
- val status = simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
- return status
+ return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
}
override suspend fun cancelNode(node: Graph.Node, nodeInput: String,
@@ -169,7 +240,12 @@ class TestBluePrintWorkFlowService
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
- override suspend fun prepareWorkflowOutput(exception: BluePrintProcessorException?): String {
+ override suspend fun prepareWorkflowOutput(): String {
+ if (exceptions.isNotEmpty()) {
+ exceptions.forEach {
+ log.error("workflow($workflowId) exceptions :", it)
+ }
+ }
return "Final Response"
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
index 0e1f84278..e8394a085 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
@@ -51,7 +51,7 @@
"default": {
"type": "any"
},
- "primary-aai-data": {
+ "aai-data": {
"type": "object",
"properties": {
"verb": {
@@ -92,7 +92,7 @@
}
}
},
- "primary-config-data": {
+ "config-data": {
"type": "object",
"properties": {
"path": {
@@ -142,7 +142,7 @@
}
}
},
- "primary-db": {
+ "processor-db": {
"type": "object",
"properties": {
"query": {
@@ -215,7 +215,7 @@
}
}
},
- "primary-aai-data": {
+ "aai-data": {
"type": "object",
"properties": {
"names": {
@@ -226,7 +226,7 @@
}
}
},
- "primary-config-data": {
+ "config-data": {
"type": "object",
"properties": {
"names": {
@@ -248,7 +248,7 @@
}
}
},
- "primary-db": {
+ "processor-db": {
"type": "object",
"properties": {
"names": {
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
index 67661ecd0..1600dfa01 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
@@ -7,7 +7,7 @@
},
"updated-by": "brindasanth@onap.com",
"sources": {
- "primary-config-data": {
+ "config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
@@ -31,4 +31,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json
index 9b20c1dc5..51c45961b 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nf-role.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.VF_MODEL.nf_role as vf_model_role from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnfmodelcustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json
index 97d591bef..f2450becb 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/nfc-naming-code.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select nfc_naming_code as nfc_naming_code from sdnctl.VFC_MODEL where customization_uuid=:vfccustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
index 87448eb20..15648adc2 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/onap_private_net_cidr.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = private",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json
index 5776b1b06..38e4ae1c6 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/private-prefix-id.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = private",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json
index 0fd436bfb..c946165bf 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/primary-db-source.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/processor-db-source.json
@@ -1,5 +1,5 @@
{
- "name": "primary-db-source",
+ "name": "processor-db-source",
"property" :{
"description": "name of the ",
"type": "string"
@@ -7,8 +7,8 @@
"updated-by": "brindasanth@onap.com",
"tags": "bundle-id, brindasanth@onap.com",
"sources": {
- "primary-db": {
- "type": "source-processor-db",
+ "processor-db": {
+ "type": "source-db",
"properties": {
"query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
"input-key-mapping": {
@@ -21,4 +21,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json
index d291715a8..1ddad0920 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected-prefix-id.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = protected",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
index bea7f25fb..badc9484d 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/protected_private_net_cidr.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = protected",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
index b4bf22e02..2e135679a 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected-prefix-id.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix_id as prefix_id from sdnctl.IPAM_IP_POOL where description = unprotected",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
index 362f627d4..acb379b52 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/unprotected_private_net_cidr.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.IPAM_IP_POOL.prefix as prefix from sdnctl.IPAM_IP_POOL where description = unprotected",
@@ -18,4 +18,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json
index 038921835..95b78aff6 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-label.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.VF_MODULE_MODEL.vf_module_label as vf_module_label from sdnctl.VF_MODULE_MODEL where sdnctl.VF_MODULE_MODEL.customization_uuid=:customizationid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json
index c06e307e2..6aa6db114 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-module-type.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select vf_module_type as vf_module_type from sdnctl.VF_MODULE_MODEL where customization_uuid=:customizationid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json
index e332d3bf1..df00ba2db 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-naming-policy.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.VF_MODEL.naming_policy as vf_naming_policy from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:vnf_model_customization_uuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json
index 52359a41d..1bf36ef39 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vf-nf-code.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.VF_MODEL.nf_code as vf_nf_code from sdnctl.VF_MODEL where sdnctl.VF_MODEL.customization_uuid=:customizationid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
index b87473c73..bf14f74b7 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfccustomizationuuid.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select sdnctl.VF_MODULE_TO_VFC_MAPPING.vfc_customization_uuid as vnf_customid from sdnctl.VF_MODULE_TO_VFC_MAPPING where vm_count = 1 and sdnctl.VF_MODULE_TO_VFC_MAPPING.vf_module_customization_uuid=:vfmodulecustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
index 59f51516d..f1d85fedc 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_0"
}
},
- "primary-config-data" : {
+ "config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
@@ -32,4 +32,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
index 6dda72f7c..de2d81b4b 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vfw_private_ip_1.json
@@ -13,7 +13,7 @@
"key" : "vfw_private_ip_1"
}
},
- "primary-config-data" : {
+ "config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
@@ -32,4 +32,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json
index b0d2a01da..d67ab1a25 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vm-type.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select vfc_model.vm_type as vm_type from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
index bcfea9f24..991c45fd9 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "primary-config-data": {
+ "config-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
@@ -26,7 +26,7 @@
]
}
},
- "primary-aai-data": {
+ "aai-data": {
"type": "source-rest",
"properties": {
"type": "JSON",
@@ -45,4 +45,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json
index c90f5b8a7..ae7413e0c 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf_name.json
@@ -7,7 +7,7 @@
"type" : "string"
},
"sources" : {
- "primary-config-data" : {
+ "config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
@@ -25,4 +25,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
index 44a5c99a7..022face08 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-invariant-uuid.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select vfc_model.invariant_uuid as vfc_invariant_uuid from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json
index 267dea39b..02c487cc9 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnfc-model-version.json
@@ -7,8 +7,8 @@
"type" : "string"
},
"sources" : {
- "primary-db" : {
- "type" : "source-processor-db",
+ "processor-db" : {
+ "type" : "source-db",
"properties" : {
"type" : "SQL",
"query" : "select vfc_model.version as vnfc_model_version from VFC_MODEL where customization_uuid=:vfccustomizationuuid",
@@ -22,4 +22,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
index 9bef3c791..bb8b7da2e 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vpg_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vpg_private_ip_0"
}
},
- "primary-config-data" : {
+ "config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
@@ -32,4 +32,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
index 52a4542c5..4dd09557a 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vsn_private_ip_0.json
@@ -13,7 +13,7 @@
"key" : "vsn_private_ip_0"
}
},
- "primary-config-data" : {
+ "config-data" : {
"type" : "source-rest",
"properties" : {
"type" : "JSON",
@@ -32,4 +32,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
index f83bdaece..25b161e47 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -24,11 +24,7 @@ package org.onap.ccsdk.cds.controllerblueprints.resource.dict
object ResourceDictionaryConstants {
const val SOURCE_INPUT = "input"
const val SOURCE_DEFAULT = "default"
- //const val SOURCE_PRIMARY_CONFIG_DATA = "rest"
- const val SOURCE_PROCESSOR_DB = "processor-db"
- const val SOURCE_PRIMARY_CONFIG_DATA = "primary-config-data"
- const val SOURCE_PRIMARY_DB = "primary-db"
- const val SOURCE_PRIMARY_AAI_DATA = "primary-aai-data"
+ const val PROCESSOR_DB = "processor-db"
const val MODEL_DIR_RESOURCE_DEFINITION: String = "resource_dictionary"
@@ -38,4 +34,4 @@ object ResourceDictionaryConstants {
const val PROPERTY_KEY_DEPENDENCIES = "key-dependencies"
const val PATH_RESOURCE_DEFINITION_TYPE = "resources_definition_types"
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
index b8185c46a..26a3a2871 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
@@ -46,9 +46,9 @@ public class ResourceDefinitionTest {
@Test
public void testDictionaryDefinitionDBSource(){
- String fileName = basePath + "/primary-db-source.json";
+ String fileName = basePath + "/processor-db-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
- Assert.assertNotNull("Failed to populate dictionaryDefinition for primary-db type", resourceDefinition);
+ Assert.assertNotNull("Failed to populate dictionaryDefinition for processor-db type", resourceDefinition);
}
@Test
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
index 8c4173182..cb7ff88a3 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
@@ -25,15 +25,14 @@ public class ResourceSourceMappingFactoryTest {
@Test
public void testRegisterResourceMapping() {
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-db", "source-processor-db");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("processor-db", "source-processor-db");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("processor-db", "source-db");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("input", "source-input");
ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("default", "source-default");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-config-data", "source-rest");
- ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("primary-aai-data", "source-rest");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("config-data", "source-rest");
+ ResourceSourceMappingFactory.INSTANCE.registerSourceMapping("aai-data", "source-rest");
- String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("primary-db");
- Assert.notNull(nodeTypeName, "Failed to get primary-db mapping");
+ String nodeTypeName = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping("processor-db");
+ Assert.notNull(nodeTypeName, "Failed to get processor-db mapping");
ResourceSourceMapping resourceSourceMapping = ResourceSourceMappingFactory.INSTANCE.getRegisterSourceMapping();
Assert.notNull(resourceSourceMapping, "Failed to get resource source mapping");
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index 93c42445f..ce479d6df 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -60,9 +60,9 @@ public class ResourceDictionaryUtilsTest {
Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
// To Check Assigned Source
- resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB);
+ resourceAssignment.setDictionarySource(ResourceDictionaryConstants.PROCESSOR_DB);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, resourceAssignment.getDictionarySource());
+ Assert.assertEquals("Expected Assigned source DB, but.", ResourceDictionaryConstants.PROCESSOR_DB, resourceAssignment.getDictionarySource());
}
@@ -79,7 +79,7 @@ public class ResourceDictionaryUtilsTest {
Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, inputFirstSource);
// TO check the multiple Source
- sources.put(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, new NodeTemplate());
+ sources.put(ResourceDictionaryConstants.PROCESSOR_DB, new NodeTemplate());
String multipleFirstSource = ResourceDictionaryUtils.findFirstSource(sources);
Assert.assertEquals("Expected source Input, but.", ResourceDictionaryConstants.SOURCE_INPUT, multipleFirstSource);
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
index 57394173b..fa82f839b 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
@@ -22,11 +22,10 @@ object ResourceDictionaryTestUtils {
@JvmStatic
fun setUpResourceSourceMapping() {
- ResourceSourceMappingFactory.registerSourceMapping("primary-db", "source-processor-db")
- ResourceSourceMappingFactory.registerSourceMapping("processor-db", "source-processor-db")
+ ResourceSourceMappingFactory.registerSourceMapping("processor-db", "source-db")
ResourceSourceMappingFactory.registerSourceMapping("input", "source-input")
ResourceSourceMappingFactory.registerSourceMapping("default", "source-default")
- ResourceSourceMappingFactory.registerSourceMapping("primary-config-data", "source-rest")
- ResourceSourceMappingFactory.registerSourceMapping("primary-aai-data", "source-rest")
+ ResourceSourceMappingFactory.registerSourceMapping("config-data", "source-rest")
+ ResourceSourceMappingFactory.registerSourceMapping("aai-data", "source-rest")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
index 3bfa4167d..fb2637e1f 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -102,7 +102,7 @@
"type": "string"
},
"dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"bundle-mac",
"managed-ip1"
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
index 473920d6d..9bef60d2d 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -102,7 +102,7 @@
"type": "string"
},
"dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"bundle-mac"
]
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
index f8fe623fd..8a212abe4 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
+++ b/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
@@ -29,7 +29,7 @@
"required": true
},
"dictionary-name": "bundle-id",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -42,7 +42,7 @@
"required": true
},
"dictionary-name": "bundle-ip",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id"
]
@@ -54,7 +54,7 @@
"type": "string"
},
"dictionary-name": "bundle-mac",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"vnf-id",
"bundle-id"
@@ -67,7 +67,7 @@
"type": "string"
},
"dictionary-name": "managed-ip",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -90,7 +90,7 @@
"type": "string"
},
"dictionary-name": "managed-ip1",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"loopback-ip"
]
@@ -102,7 +102,7 @@
"type": "string"
},
"dictionary-name": "loopback-ip",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"bundle-mac"
]
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt
index de8ba93e3..4537dbb9d 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/ControllerBlueprintExceptionHandler.kt
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage
+import org.slf4j.LoggerFactory
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -32,19 +33,25 @@ import org.springframework.web.bind.annotation.ExceptionHandler
* @version 1.0
*/
@RestControllerAdvice("org.onap.ccsdk.cds.controllerblueprints")
-open class ControllerBlueprintExeptionHandler {
+open class ControllerBlueprintExceptionHandler {
+
+ companion object ControllerBlueprintExceptionHandler {
+ val LOG = LoggerFactory.getLogger(ControllerBlueprintExceptionHandler::class.java)
+ }
@ExceptionHandler
- fun ControllerBlueprintException(e: BluePrintException): ResponseEntity<ErrorMessage> {
+ fun ControllerBlueprintExceptionHandler(e: BluePrintException): ResponseEntity<ErrorMessage> {
var errorCode = ErrorCode.valueOf(e.code)
val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
+ LOG.error("Error: $errorCode ${e.message}")
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
}
@ExceptionHandler
- fun ControllerBlueprintException(e: Exception): ResponseEntity<ErrorMessage> {
+ fun ControllerBlueprintExceptionHandler(e: Exception): ResponseEntity<ErrorMessage> {
var errorCode = ErrorCode.GENERIC_FAILURE
val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
+ LOG.error("Error: $errorCode ${e.message}")
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
index a0f8ca9c5..97b9a813a 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
@@ -107,8 +107,9 @@ class BluePrintEnhancerUtils {
return filePartFile.deCompress(deCompressFileName)
}
- suspend fun compressToFilePart(enhanceDir: String, archiveDir: String): ResponseEntity<Resource> {
- val compressedFile = normalizedFile(archiveDir, "enhanced-cba.zip")
+ suspend fun compressToFilePart(enhanceDir: String, archiveDir: String,
+ outputFileName:String="enhanced-cba.zip"): ResponseEntity<Resource> {
+ val compressedFile = normalizedFile(archiveDir, outputFileName)
BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
return prepareResourceEntity(compressedFile.name, compressedFile.readBytes())
}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt
index b35a86b37..3f52d9183 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/repository/ResourceDictionaryRepositoryTest.kt
@@ -46,7 +46,7 @@ class ResourceDictionaryReactRepositoryTest {
@Test
@Commit
fun test01Save() {
- val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-primary-db-source.json", ResourceDefinition::class.java)
+ val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", ResourceDefinition::class.java)
Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition)
resourceDefinition!!.name = sourceName
@@ -91,4 +91,4 @@ class ResourceDictionaryReactRepositoryTest {
resourceDictionary.definition = resourceDefinition
return resourceDictionary
}
-} \ 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 2b16fc05e..5ddc8a60f 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=processor-db=source-processor-db,primary-db=source-processor-db,input=source-input,default=source-default,primary-config-data=source-rest,primary-aai-data=source-rest,capability=source-capability
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,config-data=source-rest,aai-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
controllerblueprints.blueprintArchivePath=./target/blueprints/archive
@@ -38,4 +38,4 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-
controllerblueprints.loadCbaExtension=zip
# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint \ No newline at end of file
+controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprint
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 3ed188b9a..31f729da8 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
@@ -7,7 +7,7 @@
"required": true
},
"dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"input-source"
]
@@ -56,7 +56,7 @@
"required": true
},
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "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 2e48b6d8b..c9351237d 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
@@ -225,7 +225,7 @@
},
"input-param": false,
"dictionary-name": "sample-db-source",
- "dictionary-source": "primary-db",
+ "dictionary-source": "processor-db",
"dependencies": [
"hostname"
],
@@ -243,7 +243,7 @@
},
"input-param": false,
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"service-instance-id"
],
@@ -314,7 +314,7 @@
},
"input-param": false,
"dictionary-name": "sample-licenses",
- "dictionary-source": "primary-config-data",
+ "dictionary-source": "config-data",
"dependencies": [
"service-instance-id"
],
@@ -348,4 +348,4 @@
},
"data_types": {
}
-} \ No newline at end of file
+}
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 6937c719b..b0a6e0979 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
@@ -227,7 +227,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-db-source",
- "dictionary-source" : "primary-db",
+ "dictionary-source" : "processor-db",
"dependencies" : [ "hostname" ],
"version" : 0
}, {
@@ -242,7 +242,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-mdsal-source",
- "dictionary-source" : "primary-config-data",
+ "dictionary-source" : "config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
@@ -304,7 +304,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-licenses",
- "dictionary-source" : "primary-config-data",
+ "dictionary-source" : "config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
@@ -324,4 +324,4 @@
}
}
}
-} \ No newline at end of file
+}