aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-09-22 19:05:47 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-22 19:05:47 +0000
commite515a85125e5487ecd3f7127b6af0b192d4a0993 (patch)
tree1fe08a7d54c28419a44845634037d77f8c434a4b /ms/blueprintsprocessor/functions
parent85d8f7f7701570fb745c3d6360d500f97bdf1b25 (diff)
parent1072867dfac0df993cbd3e44bcc11a5cac7465fd (diff)
Merge "Enabling Code Formatter"
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt5
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt1
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt6
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt5
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt4
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt63
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt1
-rw-r--r--ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt8
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt74
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt1
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt5
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt11
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt30
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt54
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt68
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt7
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt8
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt11
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt7
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt18
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt21
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt90
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt28
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt8
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt26
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt7
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt201
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt23
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt41
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt8
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt18
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt121
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt71
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt90
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt45
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt12
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt9
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt16
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt6
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt48
85 files changed, 902 insertions, 666 deletions
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
index 1e70cdd9e..504757104 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
@@ -69,6 +69,7 @@ open class ComponentRemoteAnsibleExecutor(
var checkDelay: Long = 15_000
companion object {
+
private val log = LoggerFactory.getLogger(ComponentRemoteAnsibleExecutor::class.java)
// input fields names accepted by this executor
@@ -222,7 +223,7 @@ open class ComponentRemoteAnsibleExecutor(
// provide more information via the response, like the ignored_fields, or variables_needed_to_start,
// or resources_needed_to_start, in order to help user pinpoint the problems with the request.
val message = "Execution of job template $job_template_name could not be started for requestId $processId." +
- " (Response: ${response.body}) "
+ " (Response: ${response.body}) "
log.error(message)
setNodeOutputErrors(ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
}
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
index db7128394..c45f5140b 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
@@ -46,6 +46,7 @@ class ComponentRemoteAnsibleExecutorTest {
private val webClientService = mockk<BlueprintWebClientService>()
companion object {
+
private const val jtId = 9
private const val jobId = 223
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
index 50268d39b..3cefa3274 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
@@ -49,10 +49,12 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [CliExecutorConfiguration::class,
+ classes = [
+ CliExecutorConfiguration::class,
ExecutionServiceConfiguration::class,
BluePrintSshLibConfiguration::class, BluePrintScriptsServiceImpl::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class]
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class
+ ]
)
@DirtiesContext
@TestPropertySource(properties = [], locations = ["classpath:application-test.properties"])
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
index 311e95bc2..af3753e1a 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
@@ -56,6 +56,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
AbstractComponentFunction() {
companion object {
+
private val log = LoggerFactory.getLogger(ComponentConfigSnapshotsExecutor::class.java)
// input fields names accepted by this executor
@@ -128,7 +129,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotValue)
} catch (er: NoSuchElementException) {
val message = "No Resource config snapshot identified by resourceId={$resourceId}, " +
- "resourceType={$resourceType} does not exists"
+ "resourceType={$resourceType} does not exists"
setNodeOutputErrors(OUTPUT_STATUS_ERROR, message)
}
}
@@ -217,7 +218,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
val output = StringBuilder()
output.append(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<diff>"
+ "<diff>"
)
val diffIterator = differences.getDifferences().iterator()
while (diffIterator.hasNext()) {
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
index 73c9e22f3..31d84e60d 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
@@ -75,6 +75,7 @@ class ResourceConfigSnapshot : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
index 2383f2c64..06146c200 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
@@ -97,7 +97,7 @@ open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepos
?.let {
log.info(
"Overwriting configuration snapshot entry for resourceId=($resId), " +
- "resourceType=($resType), status=($status)"
+ "resourceType=($resType), status=($status)"
)
resourceConfigSnapshotRepository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
}
@@ -107,8 +107,8 @@ open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepos
storedSnapshot = resourceConfigSnapshotRepository.saveAndFlush(resourceConfigSnapshotEntry)
log.info(
"Stored configuration snapshot for resourceId=($resId), " +
- "resourceType=($resType), status=($status), " +
- "dated=(${storedSnapshot.createdDate})"
+ "resourceType=($resType), status=($status), " +
+ "dated=(${storedSnapshot.createdDate})"
)
} catch (ex: DataIntegrityViolationException) {
throw BluePrintException("Failed to store configuration snapshot entry.", ex)
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
index dab977db0..d00c47b7f 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sPluginApi.kt
@@ -19,13 +19,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
-import org.springframework.http.HttpMethod
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import java.nio.file.Path
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
+import org.springframework.http.HttpMethod
+import java.nio.file.Path
class K8sPluginApi(
val username: String,
@@ -34,6 +34,7 @@ class K8sPluginApi(
val definition: String?,
val definitionVersion: String?
) {
+
private val service: K8sUploadFileRestClientService // BasicAuthRestClientService
private val log = LoggerFactory.getLogger(K8sPluginApi::class.java)!!
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
index 87836428e..c9ddf4846 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfile.kt
@@ -22,12 +22,16 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
import com.fasterxml.jackson.annotation.JsonProperty
class K8sProfile {
+
@get:JsonProperty("rb-name")
var rbName: String? = null
+
@get:JsonProperty("rb-version")
var rbVersion: String? = null
+
@get:JsonProperty("profile-name")
var profileName: String? = null
+
@get:JsonProperty("namespace")
var namespace: String? = "default"
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
index 337104551..6b575a60a 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadComponent.kt
@@ -46,7 +46,6 @@ import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
-import kotlin.collections.ArrayList
@Component("component-k8s-profile-upload")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@@ -58,6 +57,7 @@ open class K8sProfileUploadComponent(
AbstractComponentFunction() {
companion object {
+
const val INPUT_K8S_PROFILE_NAME = "k8s-rb-profile-name"
const val INPUT_K8S_DEFINITION_NAME = "k8s-rb-definition-name"
const val INPUT_K8S_DEFINITION_VERSION = "k8s-rb-definition-version"
@@ -152,8 +152,10 @@ open class K8sProfileUploadComponent(
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val artifact: ArtifactDefinition = bluePrintContext.nodeTemplateArtifact(nodeTemplateName, profileSource)
if (artifact.type != BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE)
- throw BluePrintProcessorException("Unexpected profile artifact type for profile source " +
- "$profileSource. Expecting: $artifact.type")
+ throw BluePrintProcessorException(
+ "Unexpected profile artifact type for profile source " +
+ "$profileSource. Expecting: $artifact.type"
+ )
var profile = K8sProfile()
profile.profileName = profileName
profile.rbName = definitionName
@@ -197,7 +199,7 @@ open class K8sProfileUploadComponent(
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val bluePrintBasePath: String = bluePrintContext.rootPath
val profileSourceFileFolderPath: String = bluePrintBasePath.plus(File.separator)
- .plus(ks8ProfileLocation)
+ .plus(ks8ProfileLocation)
val profileFilePathTarGz: String = profileSourceFileFolderPath.plus(".tar.gz")
val profileFilePathTgz: String = profileSourceFileFolderPath.plus(".tgz")
@@ -215,26 +217,37 @@ open class K8sProfileUploadComponent(
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = 1
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY] = false
val resolutionResult: Pair<String, JsonNode> = resourceResolutionService.resolveResources(
- bluePrintRuntimeService,
- nodeTemplateName,
- ks8ProfileSource,
- properties)
+ bluePrintRuntimeService,
+ nodeTemplateName,
+ ks8ProfileSource,
+ properties
+ )
val tempMainPath: File = createTempDir("k8s-profile-", "")
val tempProfilePath: File = createTempDir("content-", "", tempMainPath)
try {
- val manifestFiles: ArrayList<File>? = readManifestFiles(Paths.get(profileSourceFileFolderPath).toFile(),
- tempProfilePath)
+ val manifestFiles: ArrayList<File>? = readManifestFiles(
+ Paths.get(profileSourceFileFolderPath).toFile(),
+ tempProfilePath
+ )
if (manifestFiles != null) {
- templateLocation(Paths.get(profileSourceFileFolderPath).toFile(), resolutionResult.second,
- tempProfilePath, manifestFiles)
+ templateLocation(
+ Paths.get(profileSourceFileFolderPath).toFile(), resolutionResult.second,
+ tempProfilePath, manifestFiles
+ )
} else
throw BluePrintProcessorException("Manifest file is missing")
// Preparation of the final profile content
- val finalProfileFilePath = Paths.get(tempMainPath.toString().plus(File.separator).plus(
- "$k8sRbProfileName.tar.gz"))
- if (!BluePrintArchiveUtils.compress(tempProfilePath, finalProfileFilePath.toFile(),
- ArchiveType.TarGz)) {
+ val finalProfileFilePath = Paths.get(
+ tempMainPath.toString().plus(File.separator).plus(
+ "$k8sRbProfileName.tar.gz"
+ )
+ )
+ if (!BluePrintArchiveUtils.compress(
+ tempProfilePath, finalProfileFilePath.toFile(),
+ ArchiveType.TarGz
+ )
+ ) {
throw BluePrintProcessorException("Profile compression has failed")
}
FileUtils.deleteDirectory(tempProfilePath)
@@ -303,8 +316,10 @@ open class K8sProfileUploadComponent(
if (location.extension.toLowerCase() == "vtl") {
templateFile(location, params, destinationFolder, manifestFiles)
} else {
- val finalFilePath = Paths.get(destinationFolder.path.plus(File.separator)
- .plus(location.name)).toFile()
+ val finalFilePath = Paths.get(
+ destinationFolder.path.plus(File.separator)
+ .plus(location.name)
+ ).toFile()
if (isFileInTheManifestFiles(finalFilePath, manifestFiles)) {
if (!destinationFolder.exists())
Files.createDirectories(destinationFolder.toPath())
@@ -328,13 +343,17 @@ open class K8sProfileUploadComponent(
destinationFolder: File,
manifestFiles: ArrayList<File>
) {
- val finalFile = File(destinationFolder.path.plus(File.separator)
- .plus(templatedFile.nameWithoutExtension))
+ val finalFile = File(
+ destinationFolder.path.plus(File.separator)
+ .plus(templatedFile.nameWithoutExtension)
+ )
if (!isFileInTheManifestFiles(finalFile, manifestFiles))
return
val fileContent = templatedFile.bufferedReader().readText()
- val finalFileContent = BluePrintVelocityTemplateService.generateContent(fileContent,
- params, true)
+ val finalFileContent = BluePrintVelocityTemplateService.generateContent(
+ fileContent,
+ params, true
+ )
if (!destinationFolder.exists())
Files.createDirectories(destinationFolder.toPath())
finalFile.bufferedWriter().use { out -> out.write(finalFileContent) }
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
index 193fdda6d..542be8cab 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadConfiguration.kt
@@ -45,6 +45,7 @@ open class K8sProfileUploadConfiguration(private var bluePrintPropertiesService:
class K8sProfileUploadConstants {
companion object {
+
const val PREFIX_K8S_PLUGIN: String = "blueprintprocessor.k8s.plugin"
}
}
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
index b023a5355..ae277e360 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sProfileUploadProperties.kt
@@ -18,6 +18,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
open class K8sProfileUploadProperties {
+
var type: String = K8sProfileUploadConstants.PREFIX_K8S_PLUGIN
lateinit var url: String
lateinit var username: String
diff --git a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
index 2cd87ad20..5e6a6d7c8 100644
--- a/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
+++ b/ms/blueprintsprocessor/functions/k8s-profile-upload/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/profile/upload/K8sUploadFileRestClientService.kt
@@ -19,21 +19,21 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.k8s.profile.upload
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.RestLoggerService
import org.apache.commons.io.IOUtils
+import org.apache.http.client.ClientProtocolException
import org.apache.http.client.entity.EntityBuilder
-import org.apache.http.message.BasicHeader
import org.apache.http.client.methods.HttpPost
import org.apache.http.client.methods.HttpUriRequest
-import org.apache.http.client.ClientProtocolException
-import java.io.IOException
-import java.nio.file.Files
-import java.nio.file.Path
+import org.apache.http.message.BasicHeader
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.RestLoggerService
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
+import java.io.IOException
import java.nio.charset.Charset
+import java.nio.file.Files
+import java.nio.file.Path
import java.util.Base64
class K8sUploadFileRestClientService(
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
index 424929b82..65b7644a8 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization
import java.io.Serializable
object MessageActionConstants {
+
const val PRIORITIZE = "prioritize"
}
@@ -33,6 +34,7 @@ enum class MessageState(val id: String) {
}
open class PrioritizationConfiguration : Serializable {
+
lateinit var expiryConfiguration: ExpiryConfiguration
lateinit var shutDownConfiguration: ShutDownConfiguration
lateinit var cleanConfiguration: CleanConfiguration
@@ -41,12 +43,14 @@ open class PrioritizationConfiguration : Serializable {
}
open class KafkaConfiguration : Serializable {
+
lateinit var inputTopicSelector: String // Consumer Configuration Selector
lateinit var expiredTopic: String // Publish Configuration Selector
lateinit var outputTopic: String // Publish Configuration Selector
}
open class NatsConfiguration : Serializable {
+
lateinit var connectionSelector: String // Consumer Configuration Selector
lateinit var inputSubject: String // Publish Configuration Selector
lateinit var expiredSubject: String // Publish Configuration Selector
@@ -54,20 +58,24 @@ open class NatsConfiguration : Serializable {
}
open class ExpiryConfiguration : Serializable {
+
var frequencyMilli: Long = 30000L
var maxPollRecord: Int = 1000
}
open class ShutDownConfiguration : Serializable {
+
var waitMill: Long = 30000L
}
open class CleanConfiguration : Serializable {
+
var frequencyMilli: Long = 30000L
var expiredRecordsHoldDays: Int = 5
}
open class UpdateStateRequest : Serializable {
+
lateinit var id: String
var group: String? = null
var state: String? = null
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
index d5ec0233a..4ab399f54 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/kafka/KafkaMessagePrioritizationConsumer.kt
@@ -47,46 +47,46 @@ open class KafkaMessagePrioritizationConsumer(
open fun kafkaStreamConsumerFunction(prioritizationConfiguration: PrioritizationConfiguration):
KafkaStreamConsumerFunction {
- return object : KafkaStreamConsumerFunction {
-
- val kafkaConsumerConfiguration = prioritizationConfiguration.kafkaConfiguration
- ?: throw BluePrintProcessorException("failed to get kafka consumer configuration")
-
- override suspend fun createTopology(
- messageConsumerProperties: MessageConsumerProperties,
- additionalConfig: Map<String, Any>?
- ): Topology {
-
- val topology = Topology()
- val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
- as KafkaStreamsBasicAuthConsumerProperties
-
- val topics = kafkaStreamsBasicAuthConsumerProperties.topic.splitCommaAsList()
- log.info("Consuming prioritization topics($topics)")
-
- topology.addSource(MessagePrioritizationConstants.SOURCE_INPUT, *topics.toTypedArray())
-
- topology.addProcessor(
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
- bluePrintProcessorSupplier<ByteArray, ByteArray>(
+ return object : KafkaStreamConsumerFunction {
+
+ val kafkaConsumerConfiguration = prioritizationConfiguration.kafkaConfiguration
+ ?: throw BluePrintProcessorException("failed to get kafka consumer configuration")
+
+ override suspend fun createTopology(
+ messageConsumerProperties: MessageConsumerProperties,
+ additionalConfig: Map<String, Any>?
+ ): Topology {
+
+ val topology = Topology()
+ val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
+ as KafkaStreamsBasicAuthConsumerProperties
+
+ val topics = kafkaStreamsBasicAuthConsumerProperties.topic.splitCommaAsList()
+ log.info("Consuming prioritization topics($topics)")
+
+ topology.addSource(MessagePrioritizationConstants.SOURCE_INPUT, *topics.toTypedArray())
+
+ topology.addProcessor(
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
+ bluePrintProcessorSupplier<ByteArray, ByteArray>(
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
+ ),
+ MessagePrioritizationConstants.SOURCE_INPUT
+ )
+
+ /** To receive completed and error messages */
+ topology.addSink(
+ MessagePrioritizationConstants.SINK_OUTPUT,
+ kafkaConsumerConfiguration.outputTopic,
+ Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
- ),
- MessagePrioritizationConstants.SOURCE_INPUT
- )
-
- /** To receive completed and error messages */
- topology.addSink(
- MessagePrioritizationConstants.SINK_OUTPUT,
- kafkaConsumerConfiguration.outputTopic,
- Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
- )
-
- // Output will be sent to the group-output topic from Processor API
- return topology
+ )
+
+ // Output will be sent to the group-output topic from Processor API
+ return topology
+ }
}
}
- }
suspend fun startConsuming(prioritizationConfiguration: PrioritizationConfiguration) {
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
index 20da2c28c..a0b2cf462 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/nats/NatsMessagePrioritizationConsumer.kt
@@ -35,6 +35,7 @@ open class NatsMessagePrioritizationConsumer(
private val bluePrintNatsLibPropertyService: BluePrintNatsLibPropertyService,
private val natsMessagePrioritizationService: MessagePrioritizationService
) {
+
private val log = logger(NatsMessagePrioritizationConsumer::class)
lateinit var bluePrintNatsService: BluePrintNatsService
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
index a6963d83f..f4602a810 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/AbstractMessagePrioritizationService.kt
@@ -165,7 +165,7 @@ abstract class AbstractMessagePrioritizationService(
if (!messages.isNullOrEmpty()) {
try {
/** Implement Aggregation logic in overridden class, If necessary,
- Populate New Message and Update status with Prioritized, Forward the message to next processor */
+ Populate New Message and Update status with Prioritized, Forward the message to next processor */
handleAggregation(messages)
} catch (e: Exception) {
val error = "failed in aggregate message(${messages.ids()}) : ${e.message}"
@@ -180,7 +180,8 @@ abstract class AbstractMessagePrioritizationService(
} catch (sendException: Exception) {
log.error(
"failed to update/publish error message(${messagePrioritization.id}) : " +
- "${sendException.message}", e
+ "${sendException.message}",
+ e
)
}
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
index aaefcc773..529d773a4 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt
@@ -30,17 +30,18 @@ import org.springframework.stereotype.Service
open class MessagePrioritizationSchedulerService(
private val messagePrioritizationService: MessagePrioritizationService
) {
+
private val log = logger(MessagePrioritizationSchedulerService::class)
@Volatile
var keepGoing = true
/** This is sample scheduler implementation used during starting application with configuration.
- @EventListener(ApplicationReadyEvent::class)
- open fun init() = runBlocking {
- log.info("Starting PrioritizationListeners...")
- startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration())
- }
+ @EventListener(ApplicationReadyEvent::class)
+ open fun init() = runBlocking {
+ log.info("Starting PrioritizationListeners...")
+ startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration())
+ }
*/
open suspend fun startScheduling() {
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
index dde8d95e0..ed16fd44f 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateServiceImpl.kt
@@ -65,19 +65,19 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(
- group,
- states, Date(), PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
override suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(
- group,
- states, Date(), PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
override suspend fun getExpiredMessages(expiryDate: Date, count: Int): List<MessagePrioritization>? {
return prioritizationMessageRepository.findByExpiredDate(
@@ -87,11 +87,11 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int):
List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndExpiredDate(
- group,
- expiryDate, PageRequest.of(0, count)
- )
- }
+ return prioritizationMessageRepository.findByGroupAndExpiredDate(
+ group,
+ expiryDate, PageRequest.of(0, count)
+ )
+ }
override suspend fun getCorrelatedMessages(
group: String,
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
index fb35df75b..7ab0be098 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
@@ -44,39 +44,39 @@ object MessageCorrelationUtils {
/** Assumption is message is of same group and checking for required types **/
fun correlatedMessagesWithTypes(collectedMessages: List<MessagePrioritization>, types: List<String>?):
- CorrelationCheckResponse {
+ CorrelationCheckResponse {
- return if (!types.isNullOrEmpty() && collectedMessages.size > 1) {
+ return if (!types.isNullOrEmpty() && collectedMessages.size > 1) {
- val unknownMessageTypes = collectedMessages.filter { !types.contains(it.type) }.map { it.id }
- if (!unknownMessageTypes.isNullOrEmpty()) {
- throw BluePrintProcessorException("Messages($unknownMessageTypes) is not in type of($types)")
- }
+ val unknownMessageTypes = collectedMessages.filter { !types.contains(it.type) }.map { it.id }
+ if (!unknownMessageTypes.isNullOrEmpty()) {
+ throw BluePrintProcessorException("Messages($unknownMessageTypes) is not in type of($types)")
+ }
- val copyTypes = types.toTypedArray().copyOf().toMutableList()
+ val copyTypes = types.toTypedArray().copyOf().toMutableList()
- val filteredMessage = collectedMessages.filter {
- !it.correlationId.isNullOrBlank() &&
+ val filteredMessage = collectedMessages.filter {
+ !it.correlationId.isNullOrBlank() &&
types.contains(it.type)
- }
- var correlatedKeys: MutableSet<String> = mutableSetOf()
- if (filteredMessage.isNotEmpty()) {
- val correlatedMap = filteredMessage.groupBy { it.toTypeNCorrelation() }
- val foundType = correlatedMap.keys.map { it.type }
- copyTypes.removeAll(foundType)
- correlatedKeys = correlatedMap.keys.map {
- it.correlationId
- }.toMutableSet()
- }
- /** Check if any Types missing and same correlation id for all types */
- return if (copyTypes.isEmpty()) {
- if (correlatedKeys.size == 1) CorrelationCheckResponse(correlated = true)
- else CorrelationCheckResponse(message = "not matching correlation keys($correlatedKeys)")
+ }
+ var correlatedKeys: MutableSet<String> = mutableSetOf()
+ if (filteredMessage.isNotEmpty()) {
+ val correlatedMap = filteredMessage.groupBy { it.toTypeNCorrelation() }
+ val foundType = correlatedMap.keys.map { it.type }
+ copyTypes.removeAll(foundType)
+ correlatedKeys = correlatedMap.keys.map {
+ it.correlationId
+ }.toMutableSet()
+ }
+ /** Check if any Types missing and same correlation id for all types */
+ return if (copyTypes.isEmpty()) {
+ if (correlatedKeys.size == 1) CorrelationCheckResponse(correlated = true)
+ else CorrelationCheckResponse(message = "not matching correlation keys($correlatedKeys)")
+ } else {
+ CorrelationCheckResponse(message = "couldn't find types($copyTypes)")
+ }
} else {
- CorrelationCheckResponse(message = "couldn't find types($copyTypes)")
+ return correlatedMessages(collectedMessages)
}
- } else {
- return correlatedMessages(collectedMessages)
}
- }
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
index af8d902cd..286a9b5c1 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
@@ -61,43 +61,45 @@ import kotlin.test.assertNotNull
@DataJpaTest
@DirtiesContext
@ContextConfiguration(
- classes = [BluePrintMessageLibConfiguration::class, BluePrintNatsLibConfiguration::class,
+ classes = [
+ BluePrintMessageLibConfiguration::class, BluePrintNatsLibConfiguration::class,
BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class]
+ MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class
+ ]
)
@TestPropertySource(
properties =
- [
- "spring.jpa.show-sql=false",
- "spring.jpa.properties.hibernate.show_sql=false",
- "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
-
- "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-scram-ssl-auth",
- "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
- "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
- "blueprintsprocessor.messageconsumer.prioritize-input.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageconsumer.prioritize-input.truststorePassword=truststorePassword",
- "blueprintsprocessor.messageconsumer.prioritize-input.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageconsumer.prioritize-input.keystorePassword=keystorePassword",
- "blueprintsprocessor.messageconsumer.prioritize-input.scramUsername=test-user",
- "blueprintsprocessor.messageconsumer.prioritize-input.scramPassword=testUserPassword",
-
- // To send initial test message
- "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-scram-ssl-auth",
- "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic",
- "blueprintsprocessor.messageproducer.prioritize-input.truststore=/path/to/truststore.jks",
- "blueprintsprocessor.messageproducer.prioritize-input.truststorePassword=truststorePassword",
- "blueprintsprocessor.messageproducer.prioritize-input.keystore=/path/to/keystore.jks",
- "blueprintsprocessor.messageproducer.prioritize-input.keystorePassword=keystorePassword",
- "blueprintsprocessor.messageproducer.prioritize-input.scramUsername=test-user",
- "blueprintsprocessor.messageproducer.prioritize-input.scramPassword=testUserPassword",
-
- "blueprintsprocessor.nats.cds-controller.type=token-auth",
- "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
- "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
- ]
+ [
+ "spring.jpa.show-sql=false",
+ "spring.jpa.properties.hibernate.show_sql=false",
+ "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
+
+ "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-scram-ssl-auth",
+ "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
+ "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
+ "blueprintsprocessor.messageconsumer.prioritize-input.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageconsumer.prioritize-input.truststorePassword=truststorePassword",
+ "blueprintsprocessor.messageconsumer.prioritize-input.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageconsumer.prioritize-input.keystorePassword=keystorePassword",
+ "blueprintsprocessor.messageconsumer.prioritize-input.scramUsername=test-user",
+ "blueprintsprocessor.messageconsumer.prioritize-input.scramPassword=testUserPassword",
+
+ // To send initial test message
+ "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-scram-ssl-auth",
+ "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic",
+ "blueprintsprocessor.messageproducer.prioritize-input.truststore=/path/to/truststore.jks",
+ "blueprintsprocessor.messageproducer.prioritize-input.truststorePassword=truststorePassword",
+ "blueprintsprocessor.messageproducer.prioritize-input.keystore=/path/to/keystore.jks",
+ "blueprintsprocessor.messageproducer.prioritize-input.keystorePassword=keystorePassword",
+ "blueprintsprocessor.messageproducer.prioritize-input.scramUsername=test-user",
+ "blueprintsprocessor.messageproducer.prioritize-input.scramPassword=testUserPassword",
+
+ "blueprintsprocessor.nats.cds-controller.type=token-auth",
+ "blueprintsprocessor.nats.cds-controller.host=nats://localhost:4222",
+ "blueprintsprocessor.nats.cds-controller.token=tokenAuth"
+ ]
)
open class MessagePrioritizationConsumerTest {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
index 307e73e6b..b64790065 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
@@ -35,6 +35,7 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
AbstractComponentFunction() {
companion object {
+
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
@@ -66,8 +67,10 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
// Handles both script processing and error handling
scriptComponent.executeScript(executionServiceInput)
- componentFunctionScriptingService.cleanupInstance(bluePrintRuntimeService.bluePrintContext(),
- scriptType)
+ componentFunctionScriptingService.cleanupInstance(
+ bluePrintRuntimeService.bluePrintContext(),
+ scriptType
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
index a69e4d9d6..d1855cb62 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
@@ -21,6 +21,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core.Ne
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core.NetconfSessionImpl
data class NetconfDevice(val deviceInfo: DeviceInfo) {
+
val netconfRpcService = NetconfRpcServiceImpl(deviceInfo)
val netconfSession: NetconfSession
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
index f52cb0a62..b964388cb 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
@@ -44,7 +44,8 @@ fun AbstractComponentFunction.netconfDeviceInfo(requirementName: String): Device
val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(
requirement
- .node!!, requirement.capability!!
+ .node!!,
+ requirement.capability!!
)
return netconfDeviceInfo(capabilityProperties)
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
index 4456cb0de..25cfb3392 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
@@ -20,20 +20,28 @@ import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
class DeviceInfo {
+
@get:JsonProperty("login-account")
var username: String? = null
+
@get:JsonProperty("login-key")
var password: String? = null
+
@get:JsonProperty("target-ip-address")
var ipAddress: String? = null
+
@get:JsonProperty("port-number")
var port: Int = 0
+
@get:JsonProperty("connection-time-out")
var connectTimeout: Long = 30
+
@get:JsonIgnore
var source: String? = null
+
@get:JsonProperty("reply-time-out")
var replyTimeout: Int = 30
+
@get:JsonIgnore
var idleTimeout: Int = 99999
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
index 23982dcb5..1cb4b3732 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSessionListener.kt
@@ -16,5 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api
interface NetconfSessionListener {
+
fun accept(event: NetconfReceivedEvent)
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
index 8f8fc1463..b2d4d98fe 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
@@ -120,6 +120,7 @@ class NetconfDeviceCommunicator(
internal enum class NetconfMessageState {
NO_MATCHING_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> FIRST_BRACKET
@@ -129,6 +130,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> SECOND_BRACKET
@@ -137,6 +139,7 @@ class NetconfDeviceCommunicator(
}
},
SECOND_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'>' -> FIRST_BIGGER
@@ -145,6 +148,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_BIGGER {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> THIRD_BRACKET
@@ -153,6 +157,7 @@ class NetconfDeviceCommunicator(
}
},
THIRD_BRACKET {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
']' -> ENDING_BIGGER
@@ -161,6 +166,7 @@ class NetconfDeviceCommunicator(
}
},
ENDING_BIGGER {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'>' -> END_PATTERN
@@ -169,6 +175,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_LF {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'#' -> FIRST_HASH
@@ -179,6 +186,7 @@ class NetconfDeviceCommunicator(
}
},
FIRST_HASH {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'#' -> SECOND_HASH
@@ -187,6 +195,7 @@ class NetconfDeviceCommunicator(
}
},
SECOND_HASH {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
'\n' -> END_CHUNKED_PATTERN
@@ -195,11 +204,13 @@ class NetconfDeviceCommunicator(
}
},
END_CHUNKED_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return NO_MATCHING_PATTERN
}
},
END_PATTERN {
+
override fun evaluateChar(c: Char): NetconfMessageState {
return NO_MATCHING_PATTERN
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
index 3d3eee8f0..7aefbb0d6 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
@@ -65,7 +65,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
try {
log.info(
"$deviceInfo: Connecting to Netconf Device with timeouts C:${deviceInfo.connectTimeout}, " +
- "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}"
+ "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}"
)
startConnection()
log.info("$deviceInfo: Connected to Netconf Device")
@@ -78,7 +78,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
override fun disconnect() {
var retryNum = 3
while (rpcService.closeSession(false).status
- .equals(RpcStatus.FAILURE, true) && retryNum > 0
+ .equals(RpcStatus.FAILURE, true) && retryNum > 0
) {
log.error("disconnect: graceful disconnect failed, retrying $retryNum times...")
retryNum--
@@ -228,7 +228,8 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
ImmutableSet.of(
ClientSession.ClientSessionEvent.WAIT_AUTH,
ClientSession.ClientSessionEvent.CLOSED, ClientSession.ClientSessionEvent.AUTHED
- ), 0
+ ),
+ 0
)
if (!event.contains(ClientSession.ClientSessionEvent.AUTHED)) {
throw NetconfException("$deviceInfo: Failed to authenticate session.")
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
index 03177e8ec..54877d5eb 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
@@ -27,11 +27,13 @@ enum class ModifyAction(val action: String) {
}
object RpcStatus {
+
const val SUCCESS = "success"
const val FAILURE = "failure"
}
object RpcMessageUtils {
+
const val OPEN = "<"
const val CLOSE = ">"
const val EQUAL = "="
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
index 232dca621..32d7dcadc 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
@@ -31,6 +31,7 @@ import kotlin.text.Charsets.UTF_8
class NetconfMessageUtils {
companion object {
+
val log = LoggerFactory.getLogger(NetconfMessageUtils::class.java)
const val NEW_LINE = "\n"
@@ -141,13 +142,13 @@ class NetconfMessageUtils {
if (!persist.isEmpty() && !persistId.isEmpty()) {
throw NetconfException(
"Can't proceed <commit> with both persist($persist) and " +
- "persistId($persistId) specified. Only one should be specified."
+ "persistId($persistId) specified. Only one should be specified."
)
}
if (confirmed && !persistId.isEmpty()) {
throw NetconfException(
"Can't proceed <commit> with both confirmed flag and " +
- "persistId($persistId) specified. Only one should be specified."
+ "persistId($persistId) specified. Only one should be specified."
)
}
@@ -366,8 +367,10 @@ class NetconfMessageUtils {
if (!message.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
// chunk encode message
message =
- (RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH +
- RpcMessageUtils.NEW_LINE)
+ (
+ RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH +
+ RpcMessageUtils.NEW_LINE
+ )
}
return message
}
@@ -383,9 +386,10 @@ class NetconfMessageUtils {
if (!request.contains(RpcMessageUtils.XML_HEADER)) {
if (request.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
request =
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length
- )
+ request.split("<".toRegex()).dropLastWhile { it.isEmpty() }
+ .toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
+ request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length
+ )
} else {
request = RpcMessageUtils.XML_HEADER + "\n" + request
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
index ab051597b..930fb1276 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
@@ -20,6 +20,7 @@ import org.junit.Test
import kotlin.test.assertEquals
class DeviceInfoTest {
+
@Test
fun testToString() {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
index e5bacc547..f4e352165 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
@@ -22,6 +22,7 @@ import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
class NetconfMessageTest {
+
@Test
fun testSuccessfulDeviceResponse() {
val dr: DeviceResponse = genSuccessfulEmptyDeviceResponse()
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
index 1991fc4f6..c70a43e49 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
@@ -42,6 +42,7 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
class NetconfDeviceCommunicatorTest {
+
private lateinit var netconfSession: NetconfSession
private lateinit var netconfSessionListener: NetconfSessionListener
private lateinit var mockInputStream: InputStream
@@ -51,7 +52,9 @@ class NetconfDeviceCommunicatorTest {
private val endPatternCharArray: List<Int> = stringToCharArray(RpcMessageUtils.END_PATTERN)
companion object {
+
private val chunkedEnding = "\n##\n"
+
// using example from section 4.2 of RFC6242 (https://tools.ietf.org/html/rfc6242#section-4.2)
private val validChunkedEncodedMsg = """
|
@@ -197,7 +200,8 @@ class NetconfDeviceCommunicatorTest {
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<close-session/>
</rpc>
- """.trimIndent(), eventSlot.captured.messagePayload
+ """.trimIndent(),
+ eventSlot.captured.messagePayload
)
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
index 9a3652aa1..b119d26f0 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
@@ -33,9 +33,11 @@ import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
class NetconfRpcServiceImplTest {
+
private lateinit var mockNetconfSession: NetconfSessionImpl
companion object {
+
private const val someString = "someString"
private const val replyStr = "this is a reply"
private val failedDeviceResponse = DeviceResponse(
@@ -46,6 +48,7 @@ class NetconfRpcServiceImplTest {
status = RpcStatus.SUCCESS,
requestMessage = "request message", responseMessage = replyStr
) // responseMessage will be null in this POJO
+
// but will be set later from mockSession
private const val msgId = "100"
private const val timeout = 5
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
index b94c092e3..41e4f8290 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
@@ -53,6 +53,7 @@ import kotlin.test.assertTrue
class NetconfSessionImplTest {
companion object {
+
val SUCCESSFUL_DEVICE_RESPONSE = DeviceResponse().apply {
status = RpcStatus.SUCCESS
errorMessage = ""
@@ -150,7 +151,7 @@ class NetconfSessionImplTest {
// rpcService.closeSession succeeds with status not RpcStatus.FAILURE
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { rpcService.closeSession(any()) } returns
- FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
+ FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
every { mockClientSession.close() } just Runs
every { mockSshClient.close() } just Runs
every { mockClientChannel.close() } just Runs
@@ -247,7 +248,7 @@ class NetconfSessionImplTest {
// make sure the replies didn't change
assertTrue {
netconfSessionSpy.getReplies().size == 1 &&
- netconfSessionSpy.getReplies().containsKey("somekey")
+ netconfSessionSpy.getReplies().containsKey("somekey")
}
verify(exactly = 0) { netconfSessionSpy.clearReplies() }
}
@@ -312,7 +313,7 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } just Runs
every { netconfSessionSpy.checkAndReestablish() } just Runs
netconfSessionSpy.setSession(mockClientSession)
@@ -329,7 +330,7 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } throws IOException("got an IO exception")
every { netconfSessionSpy.checkAndReestablish() } just Runs
// call the method
@@ -429,7 +430,7 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
+ setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
@@ -451,11 +452,11 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(
- ClientSession.ClientSessionEvent.WAIT_AUTH,
- ClientSession.ClientSessionEvent.CLOSED,
- ClientSession.ClientSessionEvent.AUTHED
- )
+ setOf(
+ ClientSession.ClientSessionEvent.WAIT_AUTH,
+ ClientSession.ClientSessionEvent.CLOSED,
+ ClientSession.ClientSessionEvent.AUTHED
+ )
every { mockClientSession.createSubsystemChannel(any()) } returns mockSubsystem
every { mockClientChannel.invertedOut } returns sampleInputStream
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
index ab762e821..abb3a8c4c 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
@@ -25,6 +25,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.Dev
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfReceivedEvent
class NetconfSessionListenerImplTest {
+
// Note: mockk's verifyAll is akin to verify with verifyNoMoreInteractions in Mockito
private val netconSession = mockk<NetconfSessionImpl>()
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
index 0d791c2a6..98d17e38b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
@@ -27,10 +27,12 @@ class RpcMessageUtilsTest {
@Test
fun getConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<get-config><source><candidate/></source><filter type=\"subtree\">Test-Filter-Content</filter>" +
- "</get-config></rpc>")
+ "</get-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -45,10 +47,12 @@ class RpcMessageUtilsTest {
@Test
fun editConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<edit-config><target><candidate/></target><default-operation>Test-Default-Operation</default-operation>" +
- "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>")
+ "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -64,9 +68,11 @@ class RpcMessageUtilsTest {
@Test
fun validate() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<validate><source><candidate/></source></validate></rpc>")
+ "<validate><source><candidate/></source></validate></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -80,11 +86,13 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommit() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<cancel-commit>" +
"<persist-id>1234</persist-id>" +
- "</cancel-commit></rpc>")
+ "</cancel-commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -98,10 +106,12 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommitNoPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<cancel-commit>" +
- "</cancel-commit></rpc>")
+ "</cancel-commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -113,9 +123,11 @@ class RpcMessageUtilsTest {
@Test
fun commit() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit></commit></rpc>")
+ "<commit></commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -132,11 +144,13 @@ class RpcMessageUtilsTest {
@Test
fun commitPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<commit>" +
"<persist-id>1234</persist-id>" +
- "</commit></rpc>")
+ "</commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -160,13 +174,15 @@ class RpcMessageUtilsTest {
@Test
fun commitPersist() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
"<commit>" +
"<confirmed/>" +
"<confirm-timeout>30</confirm-timeout>" +
"<persist>1234</persist>" +
- "</commit></rpc>")
+ "</commit></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -189,9 +205,11 @@ class RpcMessageUtilsTest {
@Test
fun unlock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<unlock><target><candidate/></target></unlock></rpc>")
+ "<unlock><target><candidate/></target></unlock></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -204,9 +222,11 @@ class RpcMessageUtilsTest {
@Test
fun deleteConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<delete-config><target><candidate/></target></delete-config></rpc>")
+ "<delete-config><target><candidate/></target></delete-config></rpc>"
+ )
val messageId = "Test-Message-ID"
val netconfTargetConfig = NetconfDatastore.CANDIDATE.datastore
@@ -228,9 +248,11 @@ class RpcMessageUtilsTest {
@Test
fun discardChanges() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<discard-changes/></rpc>")
+ "<discard-changes/></rpc>"
+ )
val messageId = "Test-Message-ID"
@@ -242,9 +264,11 @@ class RpcMessageUtilsTest {
@Test
fun lock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<lock><target><candidate/></target></lock></rpc>")
+ "<lock><target><candidate/></target></lock></rpc>"
+ )
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -273,8 +297,10 @@ class RpcMessageUtilsTest {
@Test
fun createHelloString() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
- "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val checkString = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>"
+ )
val capability = listOf<String>("hi", "hello")
@@ -306,12 +332,16 @@ class RpcMessageUtilsTest {
@Test
fun formatRPCRequest() {
- val checkString = ("#199" +
+ val checkString = (
+ "#199" +
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>" +
- "##")
+ "##"
+ )
- val request = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
- "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val request = (
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>"
+ )
val messageId = "Test-Message-ID"
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
index 03daf2aa9..bd7227744 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
@@ -57,22 +57,22 @@ open class ComponentJythonExecutor(
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
private suspend fun populateJythonComponentInstance() {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
+ .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
+ ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
+ ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
@@ -81,7 +81,7 @@ open class ComponentJythonExecutor(
checkNotEmpty(content) { "artifact ($artifactName) content is empty" }
val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
+ ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
val jythonInstance: MutableMap<String, Any> = hashMapOf()
jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName)
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index b06da3810..ce51bd9ee 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -57,6 +57,7 @@ open class ComponentRemotePythonExecutor(
private val log = LoggerFactory.getLogger(ComponentRemotePythonExecutor::class.java)!!
companion object {
+
const val SELECTOR_CMD_EXEC = "blueprintsprocessor.remote-script-command"
const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
@@ -151,7 +152,8 @@ open class ComponentRemotePythonExecutor(
subRequestId = executionServiceInput.commonHeader.subRequestId,
remoteIdentifier = RemoteIdentifier(
blueprintName = blueprintName,
- blueprintVersion = blueprintVersion),
+ blueprintVersion = blueprintVersion
+ ),
packages = packages,
timeOut = envPrepTimeout.toLong()
@@ -175,8 +177,10 @@ open class ComponentRemotePythonExecutor(
// in cases where the exception is caught in BP side due to timeout, we do not have `err_msg` returned by cmd-exec (inside `payload`),
// hence `artifact` field will be empty
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val componentLevelWarningMsg = if (timeout < envPrepTimeout) "Note: component-level timeout ($timeout) is shorter than env-prepare timeout ($envPrepTimeout). " else ""
- val grpcErrMsg = "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId).$componentLevelWarningMsg grpcError: (${grpcEx.cause?.message})"
+ val componentLevelWarningMsg =
+ if (timeout < envPrepTimeout) "Note: component-level timeout ($timeout) is shorter than env-prepare timeout ($envPrepTimeout). " else ""
+ val grpcErrMsg =
+ "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId).$componentLevelWarningMsg grpcError: (${grpcEx.cause?.message})"
// no execution log in case of timeout (as cmd-exec side hasn't finished to transfer output)
// set prepare-env-log to the error msg, and cmd-exec-log to empty
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, grpcErrMsg.asJsonPrimitive())
@@ -184,7 +188,8 @@ open class ComponentRemotePythonExecutor(
addError(StatusType.FAILURE.name, STEP_PREPARE_ENV, grpcErrMsg)
log.error(grpcErrMsg, grpcEx)
} catch (e: Exception) {
- val catchallErrMsg = "Command executor failed during env. preparation.. catch-all case. timeout($envPrepTimeout) requestId ($processId). exception msg: ${e.message}"
+ val catchallErrMsg =
+ "Command executor failed during env. preparation.. catch-all case. timeout($envPrepTimeout) requestId ($processId). exception msg: ${e.message}"
// no environment prepare log from executor in case of timeout (as cmd-exec side hasn't finished to transfer output), set it to error msg. Execution logs is empty.
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, catchallErrMsg.asJsonPrimitive())
setNodeOutputErrors(STEP_PREPARE_ENV, "[]".asJsonPrimitive(), "{}".asJsonPrimitive(), isLogResponseEnabled)
@@ -204,7 +209,8 @@ open class ComponentRemotePythonExecutor(
remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
command = scriptCommand,
properties = properties,
- timeOut = executionTimeout.toLong())
+ timeOut = executionTimeout.toLong()
+ )
val remoteExecutionOutputDeferred = GlobalScope.async {
remoteScriptExecutionService.executeCommand(remoteExecutionInput)
@@ -228,18 +234,22 @@ open class ComponentRemotePythonExecutor(
setNodeOutputProperties(remoteExecutionOutput.status, STEP_EXEC_CMD, logs, returnedPayload, isLogResponseEnabled)
} // In timeout exception cases, we don't have payload, hence `payload` is empty value.
} catch (timeoutEx: TimeoutCancellationException) {
- val componentLevelWarningMsg = if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
- val timeoutErrMsg = "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
+ val componentLevelWarningMsg =
+ if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
+ val timeoutErrMsg =
+ "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, timeoutEx)
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val timeoutErrMsg = "Command executor timed out executing after $executionTimeout seconds requestId ($processId) grpcErr: ${grpcEx.status}"
+ val timeoutErrMsg =
+ "Command executor timed out executing after $executionTimeout seconds requestId ($processId) grpcErr: ${grpcEx.status}"
setNodeOutputErrors(STEP_EXEC_CMD, listOf(timeoutErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, timeoutErrMsg)
log.error(timeoutErrMsg, grpcEx)
} catch (e: Exception) {
- val catchAllErrMsg = "Command executor failed during process catch-all case requestId ($processId) timeout($envPrepTimeout) exception msg: ${e.message}"
+ val catchAllErrMsg =
+ "Command executor failed during process catch-all case requestId ($processId) timeout($envPrepTimeout) exception msg: ${e.message}"
setNodeOutputErrors(STEP_PREPARE_ENV, listOf(catchAllErrMsg).asJsonPrimitive(), logging = isLogResponseEnabled)
addError(StatusType.FAILURE.name, STEP_EXEC_CMD, catchAllErrMsg)
log.error(catchAllErrMsg, e)
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
index 6998f0229..3df25c402 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
@@ -112,9 +112,9 @@ fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(
description: String,
block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit
):
- NodeTemplate {
- return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build()
-}
+ NodeTemplate {
+ return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build()
+ }
class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() {
@@ -135,7 +135,7 @@ class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() {
class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description: String) :
AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorNodeTemplateBuilder.InputsBuilder,
- ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(
+ ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(
id, "component-remote-python-executor",
"ComponentRemotePythonExecutor", description
) {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
index 9000d65d8..b0ce73588 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintJythonServiceImpl.kt
@@ -67,23 +67,23 @@ class BlueprintJythonServiceImpl(
override fun jythonComponentInstance(bluePrintContext: BluePrintContext, scriptClassReference: String):
BlueprintFunctionNode<*, *> {
- val pythonFileName = bluePrintContext.rootPath
- .plus(File.separator)
- .plus(scriptClassReference)
+ val pythonFileName = bluePrintContext.rootPath
+ .plus(File.separator)
+ .plus(scriptClassReference)
- val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
- log.info("Getting Jython Script Class($pythonClassName)")
+ val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
+ log.info("Getting Jython Script Class($pythonClassName)")
- val content: String = JacksonUtils.getContent(pythonFileName)
+ val content: String = JacksonUtils.getContent(pythonFileName)
- val jythonInstances: MutableMap<String, Any> = hashMapOf()
- jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
+ val jythonInstances: MutableMap<String, Any> = hashMapOf()
+ jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
- return jythonInstance<BlueprintFunctionNode<*, *>>(
- bluePrintContext, pythonClassName,
- content, jythonInstances
- )
- }
+ return jythonInstance<BlueprintFunctionNode<*, *>>(
+ bluePrintContext, pythonClassName,
+ content, jythonInstances
+ )
+ }
suspend fun jythonComponentInstance(abstractComponentFunction: AbstractComponentFunction): AbstractComponentFunction {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
index 3d2f10ec0..f8f0e7e32 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHost.kt
@@ -23,6 +23,7 @@ import org.python.util.PythonInterpreter
@Deprecated("CDS won't support JythonService")
open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) {
+
private val blueprintPythonInterpreterProxy: BlueprintPythonInterpreterProxy
init {
@@ -46,8 +47,10 @@ open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) {
return blueprintPythonInterpreterProxy.getPythonInstance(properties)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to get python instance."
- throw e.updateErrorMessage(ExecutionServiceDomains.PYTHON_EXECUTOR, errorMsg,
- "Error in environment properties")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.PYTHON_EXECUTOR, errorMsg,
+ "Error in environment properties"
+ )
} catch (e: Exception) {
throw BluePrintProcessorException("Failed to execute Jython component $e", e)
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
index 8951e3e7b..593c0552b 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/PythonExecutorConfiguration.kt
@@ -37,13 +37,16 @@ open class PythonExecutorProperty {
@Value("\${blueprints.processor.functions.python.executor.executionPath}")
lateinit var executionPath: String
+
@Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
lateinit var modulePaths: List<String>
}
@Deprecated("CDS won't support JythonService")
class PythonExecutorConstants {
+
companion object {
+
const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 784c6b7ff..d5fa0b20c 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -37,13 +37,17 @@ import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
- ComponentJythonExecutor::class, MockInstanceConfiguration::class]
+ classes = [
+ PythonExecutorConfiguration::class, PythonExecutorProperty::class,
+ ComponentJythonExecutor::class, MockInstanceConfiguration::class
+ ]
)
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class ComponentJythonExecutorTest {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
index 5e77937bc..46a3120d5 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
@@ -44,7 +44,8 @@ class ComponentRemotePythonExecutorDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
argumentProperties("""["one", "two"]""")
packages {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index d4edf4bb2..0a0d1659e 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -49,8 +49,8 @@ class ComponentRemotePythonExecutorTest {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val executionServiceInput =
@@ -93,8 +93,8 @@ class ComponentRemotePythonExecutorTest {
runBlocking {
val remoteScriptExecutionService = MockRemoteScriptExecutionService()
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
- remoteScriptExecutionService,
- mockk<BluePrintPropertiesService>()
+ remoteScriptExecutionService,
+ mockk<BluePrintPropertiesService>()
)
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("123456-1000")
@@ -112,113 +112,114 @@ class ComponentRemotePythonExecutorTest {
*/
fun getMockedOutput(svc: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
- val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
-
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
-
- val mapper = ObjectMapper()
- val rootNode = mapper.createObjectNode()
- rootNode.put("ip-address", "0.0.0.0")
- rootNode.put("type", "rest")
-
- val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor"
- )
- operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
- )
- operationalInputs.putJsonElement("endpoint-selector", "aai")
- operationalInputs.putJsonElement("dynamic-properties", rootNode)
- operationalInputs.putJsonElement("command", "./run.sh")
- operationalInputs.putJsonElement("packages", "py")
-
- every {
- svc.resolveNodeTemplateInterfaceOperationInputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
- )
- } returns operationalInputs
-
- val stepInputData = StepData().apply {
- name = "execute-remote-python"
- properties = stepMetaData
- }
-
- val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile(
- "payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java
- )!!
- executionServiceInput.stepData = stepInputData
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
- val operationOutputs = hashMapOf<String, JsonNode>()
- every {
- svc.resolveNodeTemplateInterfaceOperationOutputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns operationOutputs
- val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
- "123456-1000",
- "./../../../../components/model-" +
- "catalog/blueprint-model/test-blueprint/" +
- "remote_scripts"
- )
- every {
- svc.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script"
- )
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python", "prepare-environment-logs",
- "prepared successfully".asJsonPrimitive()
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs", "N/A".asJsonPrimitive()
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
)
- } returns Unit
- every {
- svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs",
- "processed successfully".asJsonPrimitive()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
)
- } returns Unit
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
+ )
+ operationalInputs.putJsonElement("endpoint-selector", "aai")
+ operationalInputs.putJsonElement("dynamic-properties", rootNode)
+ operationalInputs.putJsonElement("command", "./run.sh")
+ operationalInputs.putJsonElement("packages", "py")
+
+ every {
+ svc.resolveNodeTemplateInterfaceOperationInputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
+ } returns operationalInputs
- every {
- svc.resolveDSLExpression("aai")
- } returns """{"url" : "http://xxx.com"}""".asJsonType()
+ val stepInputData = StepData().apply {
+ name = "execute-remote-python"
+ properties = stepMetaData
+ }
- every {
- svc.bluePrintContext()
- } returns bluePrintRuntimeService.bluePrintContext()
- return executionServiceInput
- }
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java
+ )!!
+ executionServiceInput.stepData = stepInputData
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ svc.resolveNodeTemplateInterfaceOperationOutputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
+ } returns operationOutputs
+ val bluePrintRuntimeService = BluePrintMetadataUtils.bluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts"
+ )
+ every {
+ svc.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script"
+ )
+ } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script"
+ )
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive()
+ )
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive()
+ )
+ } returns Unit
+
+ every {
+ svc.resolveDSLExpression("aai")
+ } returns """{"url" : "http://xxx.com"}""".asJsonType()
+
+ every {
+ svc.bluePrintContext()
+ } returns bluePrintRuntimeService.bluePrintContext()
+ return executionServiceInput
+ }
}
class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
+
override suspend fun init(selector: Any) {
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
index bec8ccae7..0efaaa113 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/scripts/BlueprintPythonHostTest.kt
@@ -29,8 +29,10 @@ import kotlin.test.assertNotNull
@ContextConfiguration(classes = [BluePrintPython::class, PythonExecutorProperty::class, String::class])
@TestPropertySource(
properties =
- ["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"]
+ [
+ "blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"
+ ]
)
class BlueprintPythonHostTest {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
index 7c6ba603b..c755e89bf 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
@@ -25,9 +25,9 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
/** Resource Definition DSL **/
fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit):
- MutableMap<String, ResourceDefinition> {
- return ResourceDefinitionsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceDefinition> {
+ return ResourceDefinitionsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceDefinition(
name: String,
@@ -39,9 +39,9 @@ fun BluePrintTypes.resourceDefinition(
/** Resource Mapping DSL **/
fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit):
- MutableMap<String, ResourceAssignment> {
- return ResourceAssignmentsBuilder().apply(block).build()
-}
+ MutableMap<String, ResourceAssignment> {
+ return ResourceAssignmentsBuilder().apply(block).build()
+ }
fun BluePrintTypes.resourceAssignment(
name: String,
@@ -53,6 +53,7 @@ fun BluePrintTypes.resourceAssignment(
}
class ResourceDefinitionsBuilder() {
+
private val resourceDefinitions: MutableMap<String, ResourceDefinition> = hashMapOf()
fun resourceDefinition(
@@ -74,6 +75,7 @@ class ResourceDefinitionsBuilder() {
}
class ResourceDefinitionBuilder(private val name: String, private val description: String) {
+
private val resourceDefinition = ResourceDefinition()
fun updatedBy(updatedBy: String) {
@@ -115,6 +117,7 @@ class ResourceDefinitionBuilder(private val name: String, private val descriptio
}
class ResourceDefinitionSourcesBuilder {
+
var sources: MutableMap<String, NodeTemplate> = hashMapOf()
fun source(source: NodeTemplate) {
@@ -147,6 +150,7 @@ class ResourceDefinitionSourcesBuilder {
}
class ResourceAssignmentsBuilder() {
+
private val resourceAssignments: MutableMap<String, ResourceAssignment> = hashMapOf()
fun resourceAssignment(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index 3ebd2f893..dac237fc5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -37,6 +37,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
AbstractComponentFunction() {
companion object {
+
const val INPUT_REQUEST_ID = "request-id"
const val INPUT_RESOURCE_ID = "resource-id"
const val INPUT_ACTION_NAME = "action-name"
@@ -68,7 +69,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val resourceType =
getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
val resolutionSummary =
- getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY)?.asBoolean() ?: false
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult
@@ -99,7 +100,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
} else if (resourceType.isEmpty() && resourceId.isEmpty() && resolutionKey.isEmpty()) {
throw BluePrintProcessorException(
"Can't proceed with the resolution: can't persist resolution without a correlation key. " +
- "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false."
+ "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false."
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index 8c854b840..774873a43 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -83,7 +83,7 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
property(
ResourceResolutionComponent.INPUT_RESOLUTION_SUMMARY, BluePrintConstants.DATA_TYPE_BOOLEAN,
- false, "Enables ResolutionSummary output"
+ false, "Enables ResolutionSummary output"
)
property(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
index 0f04ea38e..6451b8fc8 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
@@ -48,9 +48,9 @@ suspend fun AbstractComponentFunction.contentFromResolvedArtifactNB(artifactPref
*/
fun AbstractComponentFunction.storedContentFromResolvedArtifact(resolutionKey: String, artifactName: String):
- String = runBlocking {
- storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
-}
+ String = runBlocking {
+ storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
+ }
fun AbstractComponentFunction.contentFromResolvedArtifact(artifactPrefix: String): String = runBlocking {
contentFromResolvedArtifactNB(artifactPrefix)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 836db4c70..07eb15dda 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -197,8 +197,8 @@ open class ResourceResolutionServiceImpl(
false
) as Boolean
val assignmentMap = resourceAssignments
- .associateBy({ it.name }, { it.property?.value })
- .asJsonNode()
+ .associateBy({ it.name }, { it.property?.value })
+ .asJsonNode()
val resolvedParamJsonContent =
ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
val artifactTemplateDefinition =
@@ -213,7 +213,7 @@ open class ResourceResolutionServiceImpl(
ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE]
.asJsonPrimitive()
- )
+ )
)
}
resolutionSummary -> {
@@ -443,10 +443,12 @@ open class ResourceResolutionServiceImpl(
// Comparision between what we have in the database vs what we have to assign.
private fun compareOne(resourceResolution: ResourceResolution, resourceAssignment: ResourceAssignment): Boolean {
- return (resourceResolution.name == resourceAssignment.name &&
- resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
- resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
- resourceResolution.dictionaryVersion == resourceAssignment.version)
+ return (
+ resourceResolution.name == resourceAssignment.name &&
+ resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
+ resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
+ resourceResolution.dictionaryVersion == resourceAssignment.version
+ )
}
private fun exposeOccurrencePropertyInResourceAssignments(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
index d541fe60c..62ec2bdf4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
@@ -247,6 +247,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -286,6 +287,7 @@ class SourceDbNodeTemplateBuilder(id: String, description: String) :
}
class KeyMappingBuilder() {
+
val map: MutableMap<String, String> = hashMapOf()
fun map(key: String, value: String) {
map[key] = value
@@ -312,6 +314,7 @@ class SourceRestNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
@@ -390,6 +393,7 @@ class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
+
fun type(type: String) = type(type.asJsonPrimitive())
fun type(type: JsonNode) {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
index 7a7edc92b..e2fef746b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
@@ -23,61 +23,84 @@ import com.fasterxml.jackson.annotation.JsonProperty
open class ResourceSourceProperties
open class InputResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DefaultResourceSource : ResourceSourceProperties() {
+
lateinit var key: String
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class DatabaseResourceSource : ResourceSourceProperties() {
+
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
lateinit var query: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class RestResourceSource : ResourceSourceProperties() {
+
lateinit var verb: String
+
@get:JsonProperty("payload")
var payload: String? = null
+
@get:JsonProperty("resolved-payload")
var resolvedPayload: String? = null
lateinit var type: String
+
@get:JsonProperty("endpoint-selector")
var endpointSelector: String? = null
+
@get:JsonProperty("url-path")
lateinit var urlPath: String
lateinit var path: String
+
@get:JsonProperty("expression-type")
lateinit var expressionType: String
+
@get:JsonProperty("input-key-mapping")
var inputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("output-key-mapping")
var outputKeyMapping: MutableMap<String, String>? = null
+
@get:JsonProperty("headers")
var headers: Map<String, String> = emptyMap()
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
open class CapabilityResourceSource : ResourceSourceProperties() {
+
@get:JsonProperty("script-type")
lateinit var scriptType: String
+
@get:JsonProperty("script-class-reference")
lateinit var scriptClassReference: String
+
@get:JsonProperty("instance-dependencies")
var instanceDependencies: List<String>? = null
+
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
index b38c32056..03a90d134 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
@@ -122,21 +122,21 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() {
/** Generates aggregated request payload for Ip Assign mS. Parses the resourceassignments of
* sourceCapability "ipassign-ms". It generates below sample payload
* {
- "requests": [{
- "name": "fixed_ipv4_Address_01",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }, {
- "name": "fixed_ipv4_Address_02",
- "property": {
- "CloudRegionId": "abcd123",
- "IpServiceName": "MobilityPlan",
- }
- }
- ]
- } */
+ "requests": [{
+ "name": "fixed_ipv4_Address_01",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }, {
+ "name": "fixed_ipv4_Address_02",
+ "property": {
+ "CloudRegionId": "abcd123",
+ "IpServiceName": "MobilityPlan",
+ }
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
index dbac70a39..7a5986aa6 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
@@ -125,25 +125,25 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
* sourceCapability "naming-ms". "naming-type" should be provides as property metadata for
* each resourceassigment of sourceCapability "naming-ms". It generates below sample payload
* {
- "elements": [{
- "vf-module-name": "${vf-module-name}",
- "naming-type": "VF-MODULE",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }, {
- "vnfc-name": "${vnfc-name}",
- "naming-type": "VNFC",
- "naming-code": "dbc",
- "vf-module-label": "adsf",
- "policy-instance-name": "SDNC_Policy.Config_Json.xml",
- "vnf-name": "vnf-123",
- "vf-module-type": "base"
- }
- ]
- } */
+ "elements": [{
+ "vf-module-name": "${vf-module-name}",
+ "naming-type": "VF-MODULE",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }, {
+ "vnfc-name": "${vnfc-name}",
+ "naming-type": "VNFC",
+ "naming-code": "dbc",
+ "vf-module-label": "adsf",
+ "policy-instance-name": "SDNC_Policy.Config_Json.xml",
+ "vnf-name": "vnf-123",
+ "vf-module-type": "base"
+ }
+ ]
+ } */
private fun generatePayload(
input: Map<String, Any>,
groupResourceAssignments: MutableList<ResourceAssignment>
@@ -158,7 +158,8 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
val moduleValue = "\${".plus(moduleName.plus("}"))
val request: MutableMap<String, String> = input.mapValues {
- it.value.toString().removeSurrounding("\"") } as MutableMap<String, String>
+ it.value.toString().removeSurrounding("\"")
+ } as MutableMap<String, String>
if (namingType != null) {
request["naming-type"] = namingType
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
index db023acfb..55a4d1120 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
@@ -112,6 +112,7 @@ class ResourceResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
index 1a5d062a3..5958c7899 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
@@ -215,10 +215,10 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
resolutionKey: String
) {
resourceResolutionRepository.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName,
- blueprintVersion,
- artifactName,
- resolutionKey
+ blueprintName,
+ blueprintVersion,
+ artifactName,
+ resolutionKey
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index 8b235925b..971caa338 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -89,6 +89,7 @@ class TemplateResolution : Serializable {
var createdDate = Date()
companion object {
+
private const val serialVersionUID = 1L
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
index 895bc993f..4bdd5d985 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
@@ -147,7 +147,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
+ "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
)
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resolutionKey,
@@ -163,7 +163,7 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
)?.let {
log.info(
"Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
+ "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
)
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resourceId,
@@ -178,13 +178,14 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
try {
log.info(
"Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
)
templateResolutionRepository.saveAndFlush(resourceResolutionResult)
} catch (ex: DataIntegrityViolationException) {
log.error(
"Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}",
+ ex.message
)
throw BluePrintException("Failed to store resource api result.", ex)
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
index 42e086137..b1dc14091 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
@@ -97,14 +97,14 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>):
ResourceAssignmentProcessor {
- log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
+ log.info("creating resource resolution of script type($scriptType), reference name($scriptClassReference)")
- val scriptComponent = componentFunctionScriptingService
- .scriptInstance<ResourceAssignmentProcessor>(
- raRuntimeService.bluePrintContext(), scriptType,
- scriptClassReference
- )
+ val scriptComponent = componentFunctionScriptingService
+ .scriptInstance<ResourceAssignmentProcessor>(
+ raRuntimeService.bluePrintContext(), scriptType,
+ scriptClassReference
+ )
- return scriptComponent
- }
+ return scriptComponent
+ }
}
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 2640b5b85..0417024d3 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
@@ -18,15 +18,15 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -68,8 +68,10 @@ open class DatabaseResourceAssignmentProcessor(
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process Database resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or DB resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or DB resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
@@ -99,13 +101,13 @@ open class DatabaseResourceAssignmentProcessor(
}
sourceProperties.inputKeyMapping
- ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
logger.info(
"DatabaseResource ($dSource) dictionary information: " +
- "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val jdbcTemplate = blueprintDBLibService(sourceProperties, dSource)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
index 2921cb6fb..892d8fbc9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
@@ -53,8 +53,10 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process default resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong default value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong default value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
index d078a2d70..131e2ae9a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
@@ -52,8 +52,10 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process input resource resolution in template key ($resourceAssignment) assignments."
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong input value was set.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong input value was set."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with : (${e.message})", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index 0c0735ff0..cffc5e3bf 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -106,12 +106,12 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
open suspend fun resolveFromInputKeyMapping(valueToResolve: String, keyMapping: MutableMap<String, JsonNode>):
String {
- if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
- return valueToResolve
+ if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
+ return valueToResolve
+ }
+ // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
+ return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
}
- // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
- return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
- }
final override suspend fun applyNB(resourceAssignment: ResourceAssignment): Boolean {
try {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index c60bc7648..c2cf30247 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -23,10 +23,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.util
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceDomains
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.updateErrorMessage
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -80,8 +80,8 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
val resolvedInputKeyMapping = resolveInputKeyMappingVariables(inputKeyMapping).toMutableMap()
inputKeyMapping?.mapValues { raRuntimeService.getDictionaryStore(it.value) }
- ?.map { KeyIdentifier(it.key, it.value) }
- ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
+ ?.map { KeyIdentifier(it.key, it.value) }
+ ?.let { resourceAssignment.keyIdentifiers.addAll(it) }
// Resolving content Variables
val payload = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.payload), resolvedInputKeyMapping)
@@ -92,7 +92,7 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
logger.info(
"RestResource ($dSource) dictionary information: " +
- "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
)
val requestHeaders = sourceProperties.headers
logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
@@ -120,8 +120,10 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
} catch (e: BluePrintProcessorException) {
val errorMsg = "Failed to process REST resource resolution in template key ($resourceAssignment) assignments."
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, errorMsg)
- throw e.updateErrorMessage(ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
- "Wrong resource definition or resolution failed.")
+ throw e.updateErrorMessage(
+ ExecutionServiceDomains.RESOURCE_RESOLUTION, errorMsg,
+ "Wrong resource definition or resolution failed."
+ )
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 1be9649b9..54231da61 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
@@ -93,7 +93,7 @@ class ResourceAssignmentUtils {
resourceAssignment.dictionaryName = resourceAssignment.name
logger.warn(
"Missing dictionary key, setting with template key (${resourceAssignment.name}) " +
- "as dictionary key (${resourceAssignment.dictionaryName})"
+ "as dictionary key (${resourceAssignment.dictionaryName})"
)
}
@@ -103,8 +103,8 @@ class ResourceAssignmentUtils {
val valueToPrint = getValueToLog(metadata, value)
logger.info(
"Setting Resource Value ($valueToPrint) for Resource Name " +
- "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
- "of type (${resourceProp.type})"
+ "(${resourceAssignment.name}), definition(${resourceAssignment.dictionaryName}) " +
+ "of type (${resourceProp.type})"
)
setResourceValue(resourceAssignment, raRuntimeService, value)
resourceAssignment.updatedDate = Date()
@@ -114,8 +114,9 @@ class ResourceAssignmentUtils {
} catch (e: Exception) {
throw BluePrintProcessorException(
"Failed in setting value for template key " +
- "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " +
- "type (${resourceProp.type}) with error message (${e.message})", e
+ "(${resourceAssignment.name}) and dictionary key (${resourceAssignment.dictionaryName}) of " +
+ "type (${resourceProp.type}) with error message (${e.message})",
+ e
)
}
}
@@ -132,29 +133,32 @@ class ResourceAssignmentUtils {
val metadata = resourceAssignment.property?.metadata
metadata?.get(ResourceResolutionConstants.METADATA_TRANSFORM_TEMPLATE)
- ?.let { if (it.contains("$")) it else null }
- ?.let { template ->
- val resolutionStore = raRuntimeService.getResolutionStore()
- .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
- val newValue: JsonNode
- try {
- newValue = BluePrintVelocityTemplateService
- .generateContent(template, null, true, resolutionStore)
- .also { if (hasLogProtect(metadata))
- logger.info("Transformed value: $resourceAssignment.name")
- else
- logger.info("Transformed value: $value -> $it") }
- .let { v -> v.asJsonType() }
- } catch (e: Exception) {
- throw BluePrintProcessorException(
- "transform-template failed: $template", e)
- }
- with(resourceAssignment) {
- raRuntimeService.putResolutionStore(this.name, newValue)
- raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
- this.property!!.value = newValue
- }
+ ?.let { if (it.contains("$")) it else null }
+ ?.let { template ->
+ val resolutionStore = raRuntimeService.getResolutionStore()
+ .mapValues { e -> e.value.asText() } as MutableMap<String, Any>
+ val newValue: JsonNode
+ try {
+ newValue = BluePrintVelocityTemplateService
+ .generateContent(template, null, true, resolutionStore)
+ .also {
+ if (hasLogProtect(metadata))
+ logger.info("Transformed value: $resourceAssignment.name")
+ else
+ logger.info("Transformed value: $value -> $it")
+ }
+ .let { v -> v.asJsonType() }
+ } catch (e: Exception) {
+ throw BluePrintProcessorException(
+ "transform-template failed: $template", e
+ )
}
+ with(resourceAssignment) {
+ raRuntimeService.putResolutionStore(this.name, newValue)
+ raRuntimeService.putDictionaryStore(this.dictionaryName!!, newValue)
+ this.property!!.value = newValue
+ }
+ }
}
fun setFailedResourceDataValue(resourceAssignment: ResourceAssignment, message: String?) {
@@ -199,7 +203,7 @@ class ResourceAssignmentUtils {
}
}
result = mapper.writerWithDefaultPrettyPrinter()
- .writeValueAsString(mapper.treeToValue(root, Object::class.java))
+ .writeValueAsString(mapper.treeToValue(root, Object::class.java))
if (!containsLogProtected) {
logger.info("Generated Resource Param Data ($result)")
@@ -238,35 +242,35 @@ class ResourceAssignmentUtils {
val definition = resourceDefinitions[it.name]
val description = definition?.property?.description ?: ""
val value = it.property?.value
- ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
- ?: emptyTextNode
+ ?.let { v -> if (v.isNullOrMissing()) emptyTextNode else v }
+ ?: emptyTextNode
var payload: JsonNode = definition?.sources?.get(it.dictionarySource)
- ?.properties?.get("resolved-payload")
- ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
- ?: emptyTextNode
+ ?.properties?.get("resolved-payload")
+ ?.let { p -> if (p.isNullOrMissing()) emptyTextNode else p }
+ ?: emptyTextNode
val metadata = definition?.property?.metadata
- ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
- ?.toMutableList() ?: mutableListOf()
+ ?.map { e -> DictionaryMetadataEntry(e.key, e.value) }
+ ?.toMutableList() ?: mutableListOf()
val keyIdentifiers: MutableList<KeyIdentifier> = it.keyIdentifiers.map { k ->
if (k.value.isNullOrMissing()) KeyIdentifier(k.name, emptyTextNode) else k
}.toMutableList()
ResolutionSummary(
- it.name,
- value,
- it.property?.required ?: false,
- it.property?.type ?: "",
- keyIdentifiers,
- description,
- metadata,
- it.dictionaryName ?: "",
- it.dictionarySource ?: "",
- payload,
- it.status ?: "",
- it.message ?: ""
+ it.name,
+ value,
+ it.property?.required ?: false,
+ it.property?.type ?: "",
+ keyIdentifiers,
+ description,
+ metadata,
+ it.dictionaryName ?: "",
+ it.dictionarySource ?: "",
+ payload,
+ it.status ?: "",
+ it.message ?: ""
)
}
// Wrapper needed for integration with SDNC
@@ -409,7 +413,7 @@ class ResourceAssignmentUtils {
if ((resourceAssignment.property?.entrySchema?.type).isNullOrEmpty()) {
throw BluePrintProcessorException(
"Couldn't get data type for dictionary type " +
- "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
+ "(${resourceAssignment.property!!.type}) and dictionary name ($dName)"
)
}
val entrySchemaType = resourceAssignment.property!!.entrySchema!!.type
@@ -487,7 +491,7 @@ class ResourceAssignmentUtils {
val outputKeyMap = outputKeyMapping.entries.first()
if (resourceAssignment.keyIdentifiers.none { it.name == outputKeyMap.key }) {
resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
+ KeyIdentifier(outputKeyMap.key, JacksonUtils.objectMapper.createArrayNode())
)
}
return parseSingleElementNodeWithOneOutputKeyMapping(
@@ -576,13 +580,14 @@ class ResourceAssignmentUtils {
logKeyValueResolvedResource(metadata, outputKeyMappingKey, responseKeyValue, type)
JacksonUtils.populateJsonNodeValues(outputKeyMappingKey, responseKeyValue, type, arrayChildNode)
resourceAssignment.keyIdentifiers.find { it.name == outputKeyMappingKey && it.value.isArray }
- .let {
- if (it != null)
- (it.value as ArrayNode).add(responseKeyValue)
- else
- resourceAssignment.keyIdentifiers.add(
- KeyIdentifier(outputKeyMappingKey, responseKeyValue))
- }
+ .let {
+ if (it != null)
+ (it.value as ArrayNode).add(responseKeyValue)
+ else
+ resourceAssignment.keyIdentifiers.add(
+ KeyIdentifier(outputKeyMappingKey, responseKeyValue)
+ )
+ }
return arrayChildNode
}
@@ -694,7 +699,7 @@ class ResourceAssignmentUtils {
logger.info(
"For List Type Resource: key ($key), value ($valueToPrint), " +
- "type ({$type})"
+ "type ({$type})"
)
}
@@ -703,6 +708,6 @@ class ResourceAssignmentUtils {
}
fun getValueToLog(metadata: MutableMap<String, String>?, value: Any): Any =
- if (hasLogProtect(metadata)) LOG_REDACTED else value
+ if (hasLogProtect(metadata)) LOG_REDACTED else value
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
index d3641a850..1bf854cbd 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
@@ -45,47 +45,48 @@ object ResourceDefinitionUtils {
resolveDefinition: String,
sources: List<String>
):
- MutableList<ResourceAssignment> {
- /** Check if resolve definition is defined in the resource definition Map */
- val resourceDefinition = resourceDefinitions[resolveDefinition]
- ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
+ MutableList<ResourceAssignment> {
+ /** Check if resolve definition is defined in the resource definition Map */
+ val resourceDefinition = resourceDefinitions[resolveDefinition]
+ ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
- val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- /** Get the dependency property fields for the the resource definition to resolve */
- val definitionDependencies = definitionDependencies(resourceDefinition, sources)
- definitionDependencies.forEach { definitionDependencyName ->
- val definitionDependency = resourceDefinitions[definitionDependencyName]
- ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
+ val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
- val resourceAssignment = ResourceAssignment().apply {
- name = definitionDependency.name
- dictionaryName = definitionDependency.name
- /** The assumption is al resource are already resolved and shall get as input source */
- dictionarySource = "input"
- property = definitionDependency.property
- }
- resourceAssignments.add(resourceAssignment)
- }
+ /** Get the dependency property fields for the the resource definition to resolve */
+ val definitionDependencies = definitionDependencies(resourceDefinition, sources)
+ definitionDependencies.forEach { definitionDependencyName ->
+ val definitionDependency = resourceDefinitions[definitionDependencyName]
+ ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
- resourceDefinition.sources.forEach { (sourceName, source) ->
- if (sources.contains(sourceName)) {
val resourceAssignment = ResourceAssignment().apply {
- name = "$sourceName:${resourceDefinition.name}"
- dictionaryName = resourceDefinition.name
- dictionarySource = sourceName
- dictionarySourceDefinition = source
- // Clone the PropertyDefinition, otherwise property value will be overridden
- property = JacksonUtils
- .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
- val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
- if (keyDependenciesExists) {
- dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
- }
+ name = definitionDependency.name
+ dictionaryName = definitionDependency.name
+ /** The assumption is al resource are already resolved and shall get as input source */
+ dictionarySource = "input"
+ property = definitionDependency.property
}
resourceAssignments.add(resourceAssignment)
}
+
+ resourceDefinition.sources.forEach { (sourceName, source) ->
+ if (sources.contains(sourceName)) {
+ val resourceAssignment = ResourceAssignment().apply {
+ name = "$sourceName:${resourceDefinition.name}"
+ dictionaryName = resourceDefinition.name
+ dictionarySource = sourceName
+ dictionarySourceDefinition = source
+ // Clone the PropertyDefinition, otherwise property value will be overridden
+ property = JacksonUtils
+ .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
+ val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
+ if (keyDependenciesExists) {
+ dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
+ }
+ }
+ resourceAssignments.add(resourceAssignment)
+ }
+ }
+ // Populate Resource Definition's dependencies as Input Resource Assignment
+ return resourceAssignments
}
- // Populate Resource Definition's dependencies as Input Resource Assignment
- return resourceAssignments
- }
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
index d1347113a..f7c41bdac 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
@@ -48,7 +48,8 @@ class ResourceResolutionComponentDSLTest {
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent()
+ }
+ """.trimIndent()
)
}
outputs {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index d6fc52230..a22a73f2f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -95,7 +95,8 @@ class ResourceResolutionServiceTest {
"source-input", "source-default", "source-db",
"source-rest", "source-capability"
)
- ), "failed to get registered sources : $sources"
+ ),
+ "failed to get registered sources : $sources"
)
}
@@ -140,9 +141,9 @@ class ResourceResolutionServiceTest {
assertEquals("This is Sample Velocity Template", templateMap)
val expectedAssignmentMap = hashMapOf(
- "service-instance-id" to "siid_1234",
- "vnf-id" to "vnf_1234",
- "vnf_name" to "temp_vnf"
+ "service-instance-id" to "siid_1234",
+ "vnf-id" to "vnf_1234",
+ "vnf_name" to "temp_vnf"
).asJsonType()
assertEquals(expectedAssignmentMap, assignmentMap)
}
@@ -226,7 +227,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
@@ -239,36 +241,36 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
val artifactPrefix = "notemplate"
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
val summaries = JacksonUtils.jsonNode(it.first)["resolution-summary"]
@@ -285,43 +287,46 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
- "1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java
- )!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(
- bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate"
- )
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
// Prepare Inputs
PayloadUtils.prepareInputsFromWorkflowPayload(
- bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment"
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
)
resourceResolutionService.resolveResources(
- resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
)
}.let {
- assertEquals("""
+ assertEquals(
+ """
{
"service-instance-id" : "siid_1234",
"vnf-id" : "vnf_1234",
"vnf_name" : "temp_vnf"
}
- """.trimIndent(), it.first)
+ """.trimIndent(),
+ it.first
+ )
assertEquals("siid_1234", it.second["service-instance-id"].asText())
}
}
@@ -364,7 +369,8 @@ class ResourceResolutionServiceTest {
"resource-assignment",
artifactPrefix,
props
- ), "Couldn't Resolve Resources for artifact $artifactPrefix"
+ ),
+ "Couldn't Resolve Resources for artifact $artifactPrefix"
)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
index 121fff7cb..096d7ff27 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
@@ -31,8 +31,10 @@ import javax.sql.DataSource
@Configuration
@Import(BluePrintDBLibConfiguration::class)
@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
- "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ basePackages = [
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"
+ ],
entityManagerFactoryRef = "primaryEntityManager",
transactionManagerRef = "primaryTransactionManager"
)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
index e252b4153..8a954c130 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapabilityTest.kt
@@ -51,6 +51,7 @@ import kotlin.test.assertTrue
*/
class IpAssignResolutionCapabilityTest {
+
val log = logger(IpAssignResolutionCapabilityTest::class)
@Before
@@ -61,7 +62,8 @@ class IpAssignResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse(
- 200, """{
+ 200,
+ """{
"fixed_ipv4_Address_01" : "10.10.10.11",
"fixed_ipv4_Address_02" : "10.10.10.12",
"fixed_ipv4_Address_03" : "10.10.10.13"
@@ -133,8 +135,10 @@ class IpAssignResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
@@ -148,7 +152,7 @@ class IpAssignResolutionCapabilityTest {
}
}
- /** Test dictionaries */
+ /** Test dictionaries */
/** Test dictionaries */
private fun resourceDefinitions(): MutableMap<String, ResourceDefinition> {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
index ee53f8a04..449845f7f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapabilityTest.kt
@@ -64,7 +64,8 @@ class NamingResolutionCapabilityTest {
val blueprintWebClientService = mockk<BlueprintWebClientService>()
// Create mock Response
val mockResponse = BlueprintWebClientService.WebClientResponse<String>(
- 200, """{
+ 200,
+ """{
"vf-module-name" : "dlsst001dbcx-adsf-Base-01",
"vnfc-name" : "dlsst001dbcx"
}
@@ -136,8 +137,10 @@ class NamingResolutionCapabilityTest {
)
val resoulutionSummary =
- ResourceAssignmentUtils.generateResolutionSummaryData(resourceAssignments.values.toList(),
- capabilityResourceResolutionProcessor.resourceDictionaries)
+ ResourceAssignmentUtils.generateResolutionSummaryData(
+ resourceAssignments.values.toList(),
+ capabilityResourceResolutionProcessor.resourceDictionaries
+ )
log.info(resoulutionSummary.asJsonType().toPrettyString())
assertNotNull(resoulutionSummary.asJsonType().get("resolution-summary"))
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
index 672d4b75d..fa59876a9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
@@ -239,8 +239,8 @@ open class ResourceResolutionDBServiceTest {
} returns ResourceResolution()
runBlocking {
resourceResolutionDBService.write(
- props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
- )
+ props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
+ )
val res = slot.captured
@@ -255,7 +255,8 @@ open class ResourceResolutionDBServiceTest {
} returns Unit
runBlocking {
val res = resourceResolutionDBService.deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
- blueprintName, blueprintVersion, artifactPrefix, resolutionKey)
+ blueprintName, blueprintVersion, artifactPrefix, resolutionKey
+ )
assertEquals(Unit, res)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
index 61e9f51c9..a2ec75d02 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
@@ -24,13 +24,13 @@ class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintProperti
fun mockBlueprintWebClientService(selector: String):
MockBlueprintWebClientService {
- val prefix = "blueprintsprocessor.restclient.$selector"
- val restClientProperties = restClientProperties(prefix)
- return mockBlueprintWebClientService(restClientProperties)
- }
+ val prefix = "blueprintsprocessor.restclient.$selector"
+ val restClientProperties = restClientProperties(prefix)
+ return mockBlueprintWebClientService(restClientProperties)
+ }
private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties):
MockBlueprintWebClientService {
- return MockBlueprintWebClientService(restClientProperties)
- }
+ return MockBlueprintWebClientService(restClientProperties)
+ }
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
index e27f3ef1b..53db7563f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
@@ -29,6 +29,7 @@ import java.util.Base64
class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) :
BlueprintWebClientService {
+
private var mockServer: ClientAndServer
private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080"
else restClientProperties.url.split(":")[2]
@@ -41,7 +42,8 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
// Create expected requests and responses
setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456")
setRequest(
- "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
+ "GET",
+ "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
"vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
)
setRequestWithPayload(
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
index 3600156ce..0312126b7 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
@@ -33,7 +33,7 @@ import java.util.HashMap
class MockRestResourceResolutionProcessor(
private val blueprintRestLibPropertyService:
- MockBluePrintRestLibPropertyService
+ MockBluePrintRestLibPropertyService
) : ResourceAssignmentProcessor() {
private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
index 5fbe32e07..f618b41db 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
@@ -139,6 +139,7 @@ class CapabilityResourceResolutionProcessorTest {
open class MockCapabilityService
open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
+
val log = logger(MockCapabilityScriptRA::class)
override fun getName(): String {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
index 57d2c1b60..0c8ec7d95 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
@@ -36,10 +36,12 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [TestDatabaseConfiguration::class,
+ classes = [
+ TestDatabaseConfiguration::class,
PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class,
DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class,
- MockBlueprintProcessorCatalogServiceImpl::class]
+ MockBlueprintProcessorCatalogServiceImpl::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class DatabaseResourceResolutionProcessorTest {
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 af78a604a..cb7214123 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
@@ -37,8 +37,10 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(
- classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class]
+ classes = [
+ MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class
+ ]
)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class RestResourceResolutionProcessorTest {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
index 59be79568..2f07e3b9a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
@@ -48,6 +48,7 @@ data class ExpectedResponseIp(val ip: String)
data class ExpectedResponseIpAddress(val ipAddress: IpAddress)
class ResourceAssignmentUtilsTest {
+
private lateinit var resourceAssignmentRuntimeService: ResourceAssignmentRuntimeService
private lateinit var resourceAssignment: ResourceAssignment
@@ -180,9 +181,11 @@ class ResourceAssignmentUtilsTest {
}
val result = ResourceAssignmentUtils.generateResolutionSummaryData(
- listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition))
+ listOf(resourceAssignment), mapOf("pnf-id" to resourceDefinition)
+ )
- assertEquals("""
+ assertEquals(
+ """
{
"resolution-summary":[
{
@@ -203,7 +206,9 @@ class ResourceAssignmentUtilsTest {
}
]
}
- """.replace("\n|\\s".toRegex(), ""), result)
+ """.replace("\n|\\s".toRegex(), ""),
+ result
+ )
}
private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment {
@@ -243,8 +248,8 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for primitive type of key-value String"
)
assertEquals(
- expectedValueToTestPrimitiveType,
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestPrimitiveType,
+ resourceAssignment.keyIdentifiers[0].value
)
}
@@ -262,8 +267,8 @@ class ResourceAssignmentUtilsTest {
val expectedKeyIdentifierValue = JacksonUtils.getJsonNode(outcome.map { it["ip"] })
assertEquals(
- expectedKeyIdentifierValue,
- resourceAssignment.keyIdentifiers[0].value
+ expectedKeyIdentifierValue,
+ resourceAssignment.keyIdentifiers[0].value
)
// FIXME("Map is not collection type, It is known complex type")
@@ -313,8 +318,9 @@ class ResourceAssignmentUtilsTest {
"Unexpected outcome returned for complex type"
)
assertEquals(
- expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
- resourceAssignment.keyIdentifiers[0].value)
+ expectedValueToTestComplexTypeWithOneOutputKeyMapping["host"],
+ resourceAssignment.keyIdentifiers[0].value
+ )
}
@Test
@@ -330,13 +336,13 @@ class ResourceAssignmentUtilsTest {
)
assertEquals(2, resourceAssignment.keyIdentifiers.size)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
- resourceAssignment.keyIdentifiers[0].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["name"],
+ resourceAssignment.keyIdentifiers[0].value
)
assertEquals(
- expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
- resourceAssignment.keyIdentifiers[1].value
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping["ipAddress"],
+ resourceAssignment.keyIdentifiers[1].value
)
}
@@ -351,13 +357,15 @@ class ResourceAssignmentUtilsTest {
// Enable transform template
resourceAssignment.property!!.metadata =
- mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
+ mutableMapOf(METADATA_TRANSFORM_TEMPLATE to "\${vnf_name}_private2")
ResourceAssignmentUtils
- .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
+ .setResourceDataValue(resourceAssignment, resourceAssignmentRuntimeService, value)
- assertEquals("abc-vnf_private2",
- resourceAssignment.property!!.value!!.asText())
+ assertEquals(
+ "abc-vnf_private2",
+ resourceAssignment.property!!.value!!.asText()
+ )
}
private fun initInputMapAndExpectedValuesForPrimitiveType() {
@@ -412,7 +420,8 @@ class ResourceAssignmentUtilsTest {
expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(
ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
- ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
+ ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")),
+ ExpectedResponseIpAddress(
IpAddress("3333", "1.2.3.3")
)
).asJsonType()
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
index 408eaf45b..7aabb73e6 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
@@ -81,7 +81,7 @@ suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(
log.debug("headers: $additionalHeaders")
log.info("configuring device: $deviceId, Configlet: $configletToApply")
val applyConfigUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
- "$deviceId/$configletResourcePath"
+ "$deviceId/$configletResourcePath"
return webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
}
@@ -90,13 +90,13 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(
deviceId: String,
configletResourcePath: String
):
- BlueprintWebClientService.WebClientResponse<String> {
+ BlueprintWebClientService.WebClientResponse<String> {
- val configPathUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
+ val configPathUrl = "/restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
- log.debug("sending GET request, url: $configPathUrl")
- return webClientService.exchangeResource("GET", configPathUrl, "")
-}
+ log.debug("sending GET request, url: $configPathUrl")
+ return webClientService.exchangeResource("GET", configPathUrl, "")
+ }
/**
* Generic UnMount function
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
index e1643b576..a8e02f391 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
@@ -32,6 +32,7 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
lateinit var scriptComponent: RestfulCMComponentFunction
companion object {
+
const val SCRIPT_TYPE = "script-type"
const val SCRIPT_CLASS_REFERENCE = "script-class-reference"
const val INSTANCE_DEPENDENCIES = "instance-dependencies"
@@ -53,8 +54,10 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
* Populate the Script Instance based on the Type
*/
scriptComponent = componentFunctionScriptingService
- .scriptInstance<RestfulCMComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
+ .scriptInstance<RestfulCMComponentFunction>(
+ this, scriptType,
+ scriptClassReference, scriptDependencies
+ )
checkNotNull(scriptComponent) { "failed to get restfulCM script component" }
@@ -64,6 +67,6 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
index 46fec3126..9cd6f57a4 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
@@ -15,18 +15,18 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import com.fasterxml.jackson.databind.node.ObjectNode
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient
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
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
@@ -41,7 +41,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
}
open fun bluePrintRestLibPropertyService(): BluePrintRestLibPropertyService =
- functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
+ functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
fun restClientService(clientInfo: JsonNode): BlueprintWebClientService {
return bluePrintRestLibPropertyService().blueprintWebClientService(clientInfo)
@@ -105,7 +105,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
}
}
"config-delete" -> {
- for (managed_object_instance in managed_object_instances) {
+ for (managed_object_instance in managed_object_instances) {
// invoke deleteMOI for each managed-object-instance
log.info("invoke deleteMOI for each managed-object-instance")
var NRM_Restful_client = RestfulNRMServiceClient()
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
index 31ad377c9..259670d47 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt
@@ -19,12 +19,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfun
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.springframework.http.HttpMethod
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import java.util.UUID
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.http.HttpMethod
import org.springframework.web.util.UriComponentsBuilder
+import java.util.UUID
class RestfulNRMServiceClient() {
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
index e7f04a5d4..6f76c9b40 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt
@@ -17,40 +17,42 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction
import com.fasterxml.jackson.databind.node.ObjectNode
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.junit.Test
import org.junit.Ignore
-import org.springframework.beans.factory.annotation.Autowired
+import org.junit.Test
import org.junit.runner.RunWith
-import org.springframework.test.context.junit4.SpringRunner
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.http.HttpStatus
+import org.springframework.http.ResponseEntity
import org.springframework.test.context.ContextConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration
import org.springframework.test.context.TestPropertySource
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
-import kotlin.test.assertNotNull
-import kotlin.test.assertEquals
-import org.springframework.web.bind.annotation.RestController
-import org.springframework.web.bind.annotation.RequestMapping
-import org.springframework.web.bind.annotation.PutMapping
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PatchMapping
-import org.springframework.web.bind.annotation.DeleteMapping
-import org.springframework.http.ResponseEntity
-import org.springframework.http.HttpStatus
+import org.springframework.web.bind.annotation.PutMapping
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, NrmTestController::class])
-@TestPropertySource(properties = [
- "blueprintsprocessor.restclient.nrm.type=basic-auth",
- "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080",
- "blueprintsprocessor.restclient.nrm.username=admin",
- "blueprintsprocessor.restclient.nrm.password=admin"
-])
+@TestPropertySource(
+ properties = [
+ "blueprintsprocessor.restclient.nrm.type=basic-auth",
+ "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080",
+ "blueprintsprocessor.restclient.nrm.username=admin",
+ "blueprintsprocessor.restclient.nrm.password=admin"
+ ]
+)
@Ignore
class RestfulNRMServiceClientTest {
@@ -100,7 +102,11 @@ class RestfulNRMServiceClientTest {
test_moi_data.put("data", test_attributes_data)
val response = restfulNRMServiceClient.modifyMOIAttributes(restClientService, idStr, test_moi_data)
assertNotNull(response, "failed to get modifyMOIAttributes response")
- assertEquals("Modify MOI object attributes successfully", response.get("body").get("data").toString(), "failed to get modifyMOIAttributes response")
+ assertEquals(
+ "Modify MOI object attributes successfully",
+ response.get("body").get("data").toString(),
+ "failed to get modifyMOIAttributes response"
+ )
}
@Test