summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor')
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties8
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties2
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/logback.xml2
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties1
-rwxr-xr-xms/blueprintsprocessor/distribution/src/main/docker/distribution.xml1
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt4
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts36
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt43
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt32
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties1
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt25
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt139
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt102
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt58
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt45
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt78
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt2
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml53
25 files changed, 471 insertions, 188 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index e64dee2ac..7ed4cc942 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -20,12 +20,14 @@
# Web server config
server.port=8080
-blueprintsprocessor.grpcEnable=false
+blueprintsprocessor.grpcEnable=true
blueprintsprocessor.httpPort=8080
blueprintsprocessor.grpcPort=9111
+
# Blueprint Processor File Execution and Handling Properties
-blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
-blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
+blueprintsprocessor.blueprintDeployPath=blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=blueprints/archive
+blueprintsprocessor.blueprintWorkingPath=blueprints/work
# Primary Database Configuration
blueprintsprocessor.db.primary.url=jdbc:mysql://localhost:3306/sdnctl
blueprintsprocessor.db.primary.username=sdnctl
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index 66073a0dc..b34609cd1 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -25,7 +25,7 @@ blueprintsprocessor.grpcPort=9111
# Blueprint Processor File Execution and Handling Properties
blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
-
+blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/work
# Primary Database Configuration
blueprintsprocessor.db.primary.url=jdbc:mysql://db:3306/sdnctl
blueprintsprocessor.db.primary.username=sdnctl
diff --git a/ms/blueprintsprocessor/application/src/main/resources/logback.xml b/ms/blueprintsprocessor/application/src/main/resources/logback.xml
index 48fc057fe..a6caf92fd 100644
--- a/ms/blueprintsprocessor/application/src/main/resources/logback.xml
+++ b/ms/blueprintsprocessor/application/src/main/resources/logback.xml
@@ -19,7 +19,7 @@
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
index fc6f72907..307850547 100644
--- a/ms/blueprintsprocessor/application/src/test/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties
@@ -23,6 +23,7 @@ blueprintsprocessor.grpcPort=9111
# Blueprint Processor File Execution and Handling Properties
blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive
+blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/work
# Primary Database Configuration
blueprintsprocessor.db.primary.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE
blueprintsprocessor.db.primary.username=sa
diff --git a/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml b/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
index 3137eb493..6af268cb0 100755
--- a/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
+++ b/ms/blueprintsprocessor/distribution/src/main/docker/distribution.xml
@@ -28,6 +28,7 @@
<outputDirectory>/opt/app/onap/lib</outputDirectory>
<outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<excludes>
+ <exclude>org.slf4j:slf4j-simple</exclude>
</excludes>
</dependencySet>
</dependencySets>
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 d1ecb4f75..de4cda950 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
@@ -19,10 +19,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableSet
import org.apache.sshd.client.SshClient
-import org.apache.sshd.client.channel.ChannelSubsystem
import org.apache.sshd.client.channel.ClientChannel
import org.apache.sshd.client.session.ClientSession
-import org.apache.sshd.client.session.ClientSessionImpl
import org.apache.sshd.common.FactoryManager
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
@@ -195,9 +193,9 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
private fun startClient() {
client = SshClient.setUpDefaultClient()
+
client.properties.putIfAbsent(FactoryManager.IDLE_TIMEOUT, TimeUnit.SECONDS.toMillis(idleTimeout.toLong()))
client.properties.putIfAbsent(FactoryManager.NIO2_READ_TIMEOUT, TimeUnit.SECONDS.toMillis(idleTimeout + 15L))
- client.keyPairProvider = SimpleGeneratorHostKeyProvider()
client.start()
startSession()
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt
index c6d6308ab..2b7aa76c9 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfDeviceSimulator.kt
@@ -17,12 +17,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.mocks
import org.apache.sshd.common.NamedFactory
-import org.apache.sshd.server.Command
+import org.apache.sshd.server.command.Command
import org.apache.sshd.server.SshServer
import org.apache.sshd.server.auth.UserAuth
import org.apache.sshd.server.auth.UserAuthNoneFactory
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfSubsystemFactory
import java.util.*
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt
index de0a5d016..f3e5d382b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/mocks/NetconfSubsystemFactory.kt
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.mocks
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
import org.apache.sshd.common.NamedFactory;
-import org.apache.sshd.server.Command;
+import org.apache.sshd.server.command.Command;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.ExitCallback;
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 7f4f452ac..4fc933612 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
@@ -17,8 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils
-import com.att.eelf.configuration.EELFLogger
-import com.att.eelf.configuration.EELFManager
+import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.NullNode
@@ -39,7 +38,7 @@ import java.util.*
class ResourceAssignmentUtils {
companion object {
- private val logger: EELFLogger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils::class.toString())
+ private val logger= LoggerFactory.getLogger(ResourceAssignmentUtils::class.toString())
// TODO("Modify Value type from Any to JsonNode")
@Throws(BluePrintProcessorException::class)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts
new file mode 100644
index 000000000..e6fc2baf7
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kts
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
+import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
+
+open class SimpleRAProcessor : ResourceAssignmentProcessor() {
+
+ private val log = LoggerFactory.getLogger(SimpleRAProcessor::class.java)!!
+
+ override fun getName(): String {
+ return "ScriptResourceAssignmentProcessor"
+ }
+
+ override fun process(executionRequest: ResourceAssignment) {
+ log.info("Processing input")
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
+ log.info("Recovering input")
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
index 0a625007f..3234c9a3c 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImpl.kt
@@ -18,13 +18,12 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintProcessorModelContent
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintProcessorModelRepository
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
@@ -35,16 +34,16 @@ import org.springframework.stereotype.Service
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
-import java.nio.file.Paths
+import java.util.*
/**
* Similar/Duplicate implementation in [org.onap.ccsdk.cds.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
*/
@Service
class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService,
- private val blueprintConfig: BluePrintCoreConfiguration,
+ private val bluePrintPathConfiguration: BluePrintPathConfiguration,
private val blueprintModelRepository: BlueprintProcessorModelRepository)
- : BlueprintCatalogServiceImpl(bluePrintRuntimeValidatorService) {
+ : BlueprintCatalogServiceImpl(bluePrintPathConfiguration, bluePrintRuntimeValidatorService) {
private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString())
@@ -53,33 +52,47 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
log.info("BlueprintProcessorCatalogServiceImpl initialized")
}
- override fun delete(name: String, version: String) = blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(name, version)
+ override suspend fun delete(name: String, version: String) {
+ // Cleaning Deployed Blueprint
+ deleteNBDir(bluePrintPathConfiguration.blueprintDeployPath, name, version)
+ // Cleaning Data Base
+ blueprintModelRepository
+ .deleteByArtifactNameAndArtifactVersion(name, version)
+ }
+
+
+ override suspend fun get(name: String, version: String, extract: Boolean): Path? {
+ val getId = UUID.randomUUID().toString()
+ var path = "${bluePrintPathConfiguration.blueprintArchivePath}/$getId/cba.zip"
- override fun get(name: String, version: String, extract: Boolean): Path? {
- var path = "${blueprintConfig.archivePath}/$name/$version.zip"
+ // TODO("Check first location for the file", If not get from database")
blueprintModelRepository.findByArtifactNameAndArtifactVersion(name, version)?.also {
it.blueprintModelContent.run {
- val file = File(path)
- file.parentFile.mkdirs()
- file.createNewFile()
+ val file = normalizedFile(path)
+ file.parentFile.reCreateDirs()
+
file.writeBytes(this!!.content!!).let {
if (extract) {
- path = "${blueprintConfig.archivePath}/$name/$version"
+ path = "${bluePrintPathConfiguration.blueprintDeployPath}/$name/$version"
BluePrintArchiveUtils.deCompress(file, path)
}
- return Paths.get(path)
+ return normalizedPath(path)
}
}
}
return null
}
- override fun save(metadata: MutableMap<String, String>, archiveFile: File) {
+ override suspend fun save(metadata: MutableMap<String, String>, archiveFile: File) {
val artifactName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]
val artifactVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]
+ check(archiveFile.isFile && !archiveFile.isDirectory) {
+ throw BluePrintException("Not a valid Archive file(${archiveFile.absolutePath})")
+ }
+
blueprintModelRepository.findByArtifactNameAndArtifactVersion(artifactName!!, artifactVersion!!)?.let {
log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index a9a2ae73e..2fda15906 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -15,16 +15,19 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.db
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import java.nio.file.Paths
+import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@@ -36,17 +39,30 @@ class BlueprintProcessorCatalogServiceImplTest {
@Autowired
lateinit var blueprintCatalog: BluePrintCatalogService
+ @BeforeTest
+ fun setup() {
+ deleteDir("target", "blueprints")
+ }
+
+ @AfterTest
+ fun cleanDir() {
+ deleteDir("target", "blueprints")
+ }
+
@Test
fun `test catalog service`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
+ runBlocking {
+ //FIXME("Create ZIP from test blueprints")
+
+ val file = normalizedFile("./src/test/resources/test-cba.zip")
+ assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase(file)
+ blueprintCatalog.saveToDatabase("1234", file)
- blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
+ blueprintCatalog.getFromDatabase("baseconfiguration", "1.0.0")
- blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
+ blueprintCatalog.deleteFromDatabase("baseconfiguration", "1.0.0")
- File("./src/test/resources/baseconfiguration").deleteRecursively()
+ }
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
index 3ac7ec38b..9dda71eb2 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
@@ -25,3 +25,4 @@ blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
+blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
index 03b847e51..5f1ae7d37 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -16,23 +16,29 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Value
+import org.springframework.boot.context.properties.bind.Bindable
import org.springframework.boot.context.properties.bind.Binder
import org.springframework.boot.context.properties.source.ConfigurationPropertySources
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.env.Environment
+import org.springframework.stereotype.Service
@Configuration
-open class BluePrintCoreConfiguration {
+open class BluePrintCoreConfiguration(private val bluePrintProperties: BlueprintProcessorProperties) {
- @Value("\${blueprintsprocessor.blueprintDeployPath}")
- lateinit var deployPath: String
+ companion object {
+ const val PREFIX_BLUEPRINT_PROCESSOR = "blueprintsprocessor"
+ }
- @Value("\${blueprintsprocessor.blueprintArchivePath}")
- lateinit var archivePath: String
+ @Bean
+ open fun bluePrintPathConfiguration(): BluePrintPathConfiguration {
+ return bluePrintProperties
+ .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintPathConfiguration::class.java)
+ }
}
@@ -46,4 +52,11 @@ open class BlueprintPropertyConfiguration {
val configurationPropertySource = ConfigurationPropertySources.get(environment)
return Binder(configurationPropertySource)
}
+}
+
+@Service
+open class BlueprintProcessorProperties(private var bluePrintPropertyBinder: Binder) {
+ fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
+ return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
index a32d61e2f..bb2c040f7 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
@@ -17,8 +17,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core.factory
-import com.att.eelf.configuration.EELFManager
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationContextAware
@@ -48,7 +48,7 @@ interface ComponentNode {
* @author Brinda Santh
*/
open class ComponentNodeFactory : ApplicationContextAware {
- private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)
+ private val log = LoggerFactory.getLogger(ComponentNodeFactory::class.java)
var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
index 94a575397..1c1d510fc 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2019 AT&T, Bell Canada, Nordix Foundation
+ * Modifications Copyright © 2018-2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +17,9 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
+import com.fasterxml.jackson.databind.JsonNode
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.apache.http.client.methods.*
import org.apache.http.entity.StringEntity
@@ -24,6 +28,7 @@ import org.apache.http.impl.client.HttpClients
import org.apache.http.message.BasicHeader
import org.onap.ccsdk.cds.blueprintsprocessor.rest.utils.WebClientUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.http.HttpMethod
import java.nio.charset.Charset
@@ -35,9 +40,9 @@ interface BlueprintWebClientService {
fun httpClient(): CloseableHttpClient {
return HttpClients.custom()
- .addInterceptorFirst(WebClientUtils.logRequest())
- .addInterceptorLast(WebClientUtils.logResponse())
- .build()
+ .addInterceptorFirst(WebClientUtils.logRequest())
+ .addInterceptorLast(WebClientUtils.logResponse())
+ .build()
}
fun exchangeResource(methodType: String, path: String, request: String): String {
@@ -105,4 +110,132 @@ interface BlueprintWebClientService {
return IOUtils.toString(it, Charset.defaultCharset())
}
}
+
+ // Non Blocking Rest Implementation
+ suspend fun httpClientNB(): CloseableHttpClient {
+ return HttpClients.custom()
+ .addInterceptorFirst(WebClientUtils.logRequest())
+ .addInterceptorLast(WebClientUtils.logResponse())
+ .build()
+ }
+
+ suspend fun getNB(path: String): String {
+ return getNB(path, null, String::class.java)
+ }
+
+ suspend fun getNB(path: String, additionalHeaders: Map<String, String>?): String {
+ return getNB(path, additionalHeaders, String::class.java)
+ }
+
+ suspend fun <T> getNB(path: String, additionalHeaders: Map<String, String>?,
+ responseType: Class<T>): T = withContext(Dispatchers.IO) {
+ val httpGet = HttpGet(host(path))
+ httpGet.setHeaders(basicHeaders(additionalHeaders))
+ httpClientNB().execute(httpGet).entity.content.use {
+ JacksonUtils.readValue(it, responseType)!!
+ }
+ }
+
+ suspend fun postNB(path: String, request: Any): String {
+ return postNB(path, request, null, String::class.java)
+ }
+
+ suspend fun postNB(path: String, request: Any, additionalHeaders: Map<String, String>?): String {
+ return postNB(path, request, additionalHeaders, String::class.java)
+ }
+
+ suspend fun <T> postNB(path: String, request: Any, additionalHeaders: Map<String, String>?,
+ responseType: Class<T>): T =
+ withContext(Dispatchers.IO) {
+ val httpPost = HttpPost(host(path))
+ httpPost.entity = StringEntity(strRequest(request))
+ httpPost.setHeaders(basicHeaders(additionalHeaders))
+ httpClientNB().execute(httpPost).entity.content.use {
+ JacksonUtils.readValue(it, responseType)!!
+ }
+ }
+
+ suspend fun putNB(path: String, request: Any): String {
+ return putNB(path, request, null, String::class.java)
+ }
+
+ suspend fun putNB(path: String, request: Any, additionalHeaders: Map<String, String>?): String {
+ return putNB(path, request, additionalHeaders, String::class.java)
+ }
+
+ suspend fun <T> putNB(path: String, request: Any, additionalHeaders: Map<String, String>?,
+ responseType: Class<T>): T = withContext(Dispatchers.IO) {
+ val httpPut = HttpPut(host(path))
+ httpPut.entity = StringEntity(strRequest(request))
+ httpPut.setHeaders(basicHeaders(additionalHeaders))
+ httpClientNB().execute(httpPut).entity.content.use {
+ JacksonUtils.readValue(it, responseType)!!
+ }
+ }
+
+ suspend fun <T> deleteNB(path: String): String {
+ return deleteNB(path, null, String::class.java)
+ }
+
+ suspend fun <T> deleteNB(path: String, additionalHeaders: Map<String, String>?): String {
+ return deleteNB(path, additionalHeaders, String::class.java)
+ }
+
+ suspend fun <T> deleteNB(path: String, additionalHeaders: Map<String, String>?, responseType: Class<T>): T =
+ withContext(Dispatchers.IO) {
+ val httpDelete = HttpDelete(host(path))
+ httpDelete.setHeaders(basicHeaders(additionalHeaders))
+ httpClient().execute(httpDelete).entity.content.use {
+ JacksonUtils.readValue(it, responseType)!!
+ }
+ }
+
+ suspend fun <T> patchNB(path: String, request: Any, additionalHeaders: Map<String, String>?,
+ responseType: Class<T>): T = withContext(Dispatchers.IO) {
+ val httpPatch = HttpPatch(host(path))
+ httpPatch.entity = StringEntity(strRequest(request))
+ httpPatch.setHeaders(basicHeaders(additionalHeaders))
+ httpClient().execute(httpPatch).entity.content.use {
+ JacksonUtils.readValue(it, responseType)!!
+ }
+ }
+
+ suspend fun exchangeNB(methodType: String, path: String, request: Any): String {
+ return exchangeNB(methodType, path, request, hashMapOf(), String::class.java)
+ }
+
+ suspend fun exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?): String {
+ return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
+ }
+
+ suspend fun <T> exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?,
+ responseType: Class<T>): T {
+ return when (HttpMethod.resolve(methodType)) {
+ HttpMethod.GET -> getNB(path, additionalHeaders, responseType)
+ HttpMethod.POST -> postNB(path, request, additionalHeaders, responseType)
+ HttpMethod.DELETE -> deleteNB(path, additionalHeaders, responseType)
+ HttpMethod.PUT -> putNB(path, request, additionalHeaders, responseType)
+ HttpMethod.PATCH -> patchNB(path, request, additionalHeaders, responseType)
+ else -> throw BluePrintProcessorException("Unsupported methodType($methodType)")
+ }
+ }
+
+ private fun strRequest(request: Any): String {
+ return when (request) {
+ is String -> request.toString()
+ is JsonNode -> request.toString()
+ else -> JacksonUtils.getJson(request)
+ }
+ }
+
+ private fun basicHeaders(headers: Map<String, String>?): Array<BasicHeader> {
+ val basicHeaders = mutableListOf<BasicHeader>()
+ defaultHeaders().forEach { name, value ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ headers?.forEach { name, value ->
+ basicHeaders.add(BasicHeader(name, value))
+ }
+ return basicHeaders.toTypedArray()
+ }
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
index 1fa141034..251ae2c3a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt
@@ -1,6 +1,7 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
* Modifications Copyright © 2019 Bell Canada.
+ * Modifications Copyright © 2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,78 +20,87 @@ package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
import io.grpc.StatusException
import io.grpc.stub.StreamObserver
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.currentTimestamp
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementInput
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.reCreateDirs
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput
import org.slf4j.LoggerFactory
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.stereotype.Service
import java.io.File
+import java.util.*
@Service
-open class BluePrintManagementGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
- private val bluePrintCatalogService: BluePrintCatalogService)
+open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration,
+ private val bluePrintCatalogService: BluePrintCatalogService)
: BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
@PreAuthorize("hasRole('USER')")
- override fun uploadBlueprint(request: BluePrintManagementInput, responseObserver: StreamObserver<BluePrintManagementOutput>) {
- val blueprintName = request.blueprintName
- val blueprintVersion = request.blueprintVersion
- val blueprint = "blueprint $blueprintName:$blueprintVersion"
+ override fun uploadBlueprint(request: BluePrintUploadInput, responseObserver:
+ StreamObserver<BluePrintManagementOutput>) {
+ runBlocking {
+
+ log.info("request(${request.commonHeader.requestId})")
+ val uploadId = UUID.randomUUID().toString()
+ try {
+ val cbaFile = normalizedFile(bluePrintPathConfiguration.blueprintArchivePath, uploadId, "cba-zip")
+
+ saveToDisk(request, cbaFile)
+
+ val blueprintId = bluePrintCatalogService.saveToDatabase(uploadId, cbaFile)
+ responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", request.commonHeader))
+ responseObserver.onCompleted()
+ } catch (e: Exception) {
+ failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e)
+ } finally {
+ deleteDir(bluePrintPathConfiguration.blueprintArchivePath, uploadId)
+ deleteDir(bluePrintPathConfiguration.blueprintWorkingPath, uploadId)
+ }
+ }
+ }
- log.info("request(${request.commonHeader.requestId}): Received upload $blueprint")
+ @PreAuthorize("hasRole('USER')")
+ override fun removeBlueprint(request: BluePrintRemoveInput, responseObserver:
+ StreamObserver<BluePrintManagementOutput>) {
- val blueprintArchivedFilePath = "${bluePrintCoreConfiguration.archivePath}/$blueprintName/$blueprintVersion/$blueprintName.zip"
- try {
- val blueprintArchivedFile = File(blueprintArchivedFilePath)
+ runBlocking {
+ val blueprintName = request.blueprintName
+ val blueprintVersion = request.blueprintVersion
+ val blueprint = "blueprint $blueprintName:$blueprintVersion"
- saveToDisk(request, blueprintArchivedFile)
- val blueprintId = bluePrintCatalogService.saveToDatabase(blueprintArchivedFile)
+ log.info("request(${request.commonHeader.requestId}): Received delete $blueprint")
- File("${bluePrintCoreConfiguration.archivePath}/$blueprintName").deleteRecursively()
- responseObserver.onNext(successStatus("Successfully uploaded $blueprint with id($blueprintId)", request.commonHeader))
- responseObserver.onCompleted()
- } catch (e: Exception) {
- failStatus("request(${request.commonHeader.requestId}): Failed to upload $blueprint at path $blueprintArchivedFilePath", e)
+ try {
+ bluePrintCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
+ responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
+ responseObserver.onCompleted()
+ } catch (e: Exception) {
+ failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)
+ }
}
}
- @PreAuthorize("hasRole('USER')")
- override fun removeBlueprint(request: BluePrintManagementInput, responseObserver: StreamObserver<BluePrintManagementOutput>) {
- val blueprintName = request.blueprintName
- val blueprintVersion = request.blueprintVersion
- val blueprint = "blueprint $blueprintName:$blueprintVersion"
-
- log.info("request(${request.commonHeader.requestId}): Received delete $blueprint")
-
- try {
- bluePrintCatalogService.deleteFromDatabase(blueprintName, blueprintVersion)
- responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
- responseObserver.onCompleted()
- } catch (e: Exception) {
- failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)
- }
- }
+ private fun saveToDisk(request: BluePrintUploadInput, cbaFile: File) {
+ log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${cbaFile.absolutePath}")
- private fun saveToDisk(request: BluePrintManagementInput, blueprintDir: File) {
- log.info("request(${request.commonHeader.requestId}): Writing CBA File under :${blueprintDir.absolutePath}")
- if (blueprintDir.exists()) {
- log.info("request(${request.commonHeader.requestId}): Re-creating blueprint directory(${blueprintDir.absolutePath})")
- //FileUtils.deleteDirectory(blueprintDir.parentFile)
- blueprintDir.parentFile.deleteRecursively()
- }
- blueprintDir.parentFile.mkdirs()
- //FileUtils.forceMkdir(blueprintDir.parentFile)
- blueprintDir.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
- log.info("request(${request.commonHeader.requestId}): CBA file(${blueprintDir.absolutePath} written successfully")
+ // Recreate Folder
+ cbaFile.parentFile.reCreateDirs()
+
+ // Write the File
+ cbaFile.writeBytes(request.fileChunk.chunk.toByteArray()).apply {
+ log.info("request(${request.commonHeader.requestId}): CBA file(${cbaFile.absolutePath} written successfully")
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
index 1039d5cd2..41e78e518 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -27,7 +27,6 @@ import org.springframework.http.MediaType
import org.springframework.http.codec.multipart.FilePart
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.web.bind.annotation.*
-import reactor.core.publisher.Mono
@RestController
@RequestMapping("/api/v1/execution-service")
@@ -46,11 +45,8 @@ open class ExecutionServiceController {
@ApiOperation(value = "Upload CBA", notes = "Takes a File and load it in the runtime database")
@ResponseBody
@PreAuthorize("hasRole('USER')")
- fun upload(@RequestPart("file") parts: Mono<FilePart>): Mono<String> {
- return parts
- .filter { it is FilePart }
- .ofType(FilePart::class.java)
- .flatMap(executionServiceHandler::upload)
+ fun upload(@RequestPart("file") filePart: FilePart): String = runBlocking {
+ executionServiceHandler.upload(filePart)
}
@RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index f3af254be..0120a8f33 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -22,44 +22,50 @@ import io.grpc.stub.StreamObserver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_SYNC
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.saveCBAFile
+import kotlinx.coroutines.reactive.awaitSingle
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
import org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.utils.toProto
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
import org.springframework.http.codec.multipart.FilePart
import org.springframework.stereotype.Service
-import reactor.core.publisher.Mono
+import java.io.File
+import java.io.IOException
+import java.util.*
import java.util.stream.Collectors
@Service
-class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
+class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintPathConfiguration,
private val bluePrintCatalogService: BluePrintCatalogService,
private val bluePrintWorkflowExecutionService
: BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>) {
private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString())
- fun upload(filePart: FilePart): Mono<String> {
+ suspend fun upload(filePart: FilePart): String {
+ val saveId = UUID.randomUUID().toString()
+ val blueprintArchive = normalizedPathName(bluePrintPathConfiguration.blueprintArchivePath, saveId)
+ val blueprintWorking = normalizedPathName(bluePrintPathConfiguration.blueprintWorkingPath, saveId)
try {
- val archivedPath = BluePrintFileUtils.getCbaStorageDirectory(bluePrintCoreConfiguration.archivePath)
- val cbaPath = saveCBAFile(filePart, archivedPath)
- bluePrintCatalogService.saveToDatabase(cbaPath.toFile()).let {
- return Mono.just("{\"status\": \"Successfully uploaded blueprint with id($it)\"}")
- }
- } catch (e: Exception) {
- return Mono.error<String>(BluePrintException("Error uploading the CBA file.", e))
+
+ val compressedFile = normalizedFile(blueprintArchive, "cba.zip")
+ compressedFile.parentFile.reCreateNBDirs()
+ // Copy the File Part to Local File
+ copyFromFilePart(filePart, compressedFile)
+ // Save the Copied file to Database
+ return bluePrintCatalogService.saveToDatabase(saveId, compressedFile, true)
+ } catch (e: IOException) {
+ throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Upload CBA: ${e.message}", e)
+ } finally {
+ deleteNBDir(blueprintArchive)
+ deleteNBDir(blueprintWorking)
}
}
@@ -80,8 +86,8 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC
responseObserver.onCompleted()
}
else -> responseObserver.onNext(response(executionServiceInput,
- "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
- true).toProto());
+ "Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
+ true).toProto());
}
}
@@ -100,7 +106,7 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC
val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
val output = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(blueprintRuntimeService,
- executionServiceInput, hashMapOf())
+ executionServiceInput, hashMapOf())
val errors = blueprintRuntimeService.getBluePrintError().errors
if (errors.isNotEmpty()) {
@@ -111,6 +117,12 @@ class ExecutionServiceHandler(private val bluePrintCoreConfiguration: BluePrintC
return output
}
+ private suspend fun copyFromFilePart(filePart: FilePart, targetFile: File): File {
+ return filePart.transferTo(targetFile)
+ .thenReturn(targetFile)
+ .awaitSingle()
+ }
+
private fun setErrorStatus(errorMessage: String, status: Status) {
status.errorMessage = errorMessage
status.eventType = EventType.EVENT_COMPONENT_FAILURE.name
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
index a03ad9e47..fd764d78f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandlerTest.kt
@@ -1,6 +1,7 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
* Modifications Copyright © 2019 Bell Canada.
+ * Modifications Copyright © 2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +24,11 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementInput
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput
import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
@@ -32,7 +36,6 @@ import org.springframework.context.annotation.ComponentScan
import org.springframework.test.annotation.DirtiesContext
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
@@ -55,25 +58,23 @@ class BluePrintManagementGRPCHandlerTest {
fun init() {
// Create a server, add service, start, and register for automatic graceful shutdown.
grpcServerRule.serviceRegistry.addService(bluePrintManagementGRPCHandler)
+ deleteDir("target", "blueprints")
}
@AfterTest
fun cleanDir() {
- //TODO It's giving fluctuating results, need to look for another way to cleanup
- // works sometimes otherwise results IO Exception
- // Most probably bufferReader stream is not getting closed when cleanDir is getting invoked
- File("./target/blueprints").deleteRecursively()
+ deleteDir("target", "blueprints")
}
@Test
fun `test upload blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
val id = "123_upload"
- val req = createInputRequest(id)
+ val req = createUploadInputRequest(id)
val output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
+ assertTrue(output.status.message.contains("Successfully uploaded CBA"))
assertEquals(id, output.commonHeader.requestId)
}
@@ -81,19 +82,20 @@ class BluePrintManagementGRPCHandlerTest {
fun `test delete blueprint`() {
val blockingStub = BluePrintManagementServiceGrpc.newBlockingStub(grpcServerRule.channel)
val id = "123_delete"
- val req = createInputRequest(id)
+ val req = createUploadInputRequest(id)
var output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contains("Successfully uploaded blueprint sample:1.0.0 with id("))
+ assertTrue(output.status.message.contains("Successfully uploaded CBA"))
assertEquals(id, output.commonHeader.requestId)
- output = blockingStub.removeBlueprint(req)
+ val removeReq = createRemoveInputRequest(id)
+ output = blockingStub.removeBlueprint(removeReq)
assertEquals(200, output.status.code)
}
- private fun createInputRequest(id: String): BluePrintManagementInput {
- val file = File("./src/test/resources/test-cba.zip")
+ private fun createUploadInputRequest(id: String): BluePrintUploadInput {
+ val file = normalizedFile("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
val commonHeader = CommonHeader
@@ -106,11 +108,24 @@ class BluePrintManagementGRPCHandlerTest {
val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes()))
.build()
- return BluePrintManagementInput.newBuilder()
+ return BluePrintUploadInput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setFileChunk(fileChunk)
+ .build()
+ }
+
+ private fun createRemoveInputRequest(id: String): BluePrintRemoveInput {
+ val commonHeader = CommonHeader
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
+
+ return BluePrintRemoveInput.newBuilder()
.setCommonHeader(commonHeader)
.setBlueprintName("sample")
.setBlueprintVersion("1.0.0")
- .setFileChunk(fileChunk)
.build()
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
index b131fb7d1..d14761cc9 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -17,10 +17,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
+import kotlinx.coroutines.reactive.awaitSingle
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
@@ -33,9 +36,13 @@ import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
+import org.springframework.test.web.reactive.server.returnResult
import org.springframework.web.reactive.function.BodyInserters
import java.nio.file.Files
import java.nio.file.Paths
+import java.util.*
+import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@@ -50,40 +57,61 @@ class ExecutionServiceHandlerTest {
@Autowired
lateinit var webTestClient: WebTestClient
+ @BeforeTest
+ fun init() {
+ deleteDir("target", "blueprints")
+ }
+
+ @AfterTest
+ fun cleanDir() {
+ deleteDir("target", "blueprints")
+ }
+
@Test
fun `test rest upload blueprint`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
+ runBlocking {
+ val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
+ assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
+
+ val body = MultipartBodyBuilder().apply {
+ part("file", object : ByteArrayResource(Files.readAllBytes(Paths.get("./src/test/resources/test-cba.zip"))) {
+ override fun getFilename(): String {
+ return "test-cba.zip"
+ }
+ })
+ }.build()
- val body = MultipartBodyBuilder().apply {
- part("file", object : ByteArrayResource(Files.readAllBytes(Paths.get("./src/test/resources/test-cba.zip"))) {
- override fun getFilename(): String {
- return "test-cba.zip"
- }
- })
- }.build()
+ webTestClient
+ .post()
+ .uri("/api/v1/execution-service/upload")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<String>()
+ .responseBody
+ .awaitSingle()
+ }
- webTestClient
- .post()
- .uri("/api/v1/execution-service/upload")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
}
@Test
fun `test rest process`() {
- val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
- assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
- blueprintCatalog.saveToDatabase(file)
+ runBlocking {
+ val file = Paths.get("./src/test/resources/test-cba.zip").toFile()
+ assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
+ blueprintCatalog.saveToDatabase(UUID.randomUUID().toString(), file)
+
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile("execution-input/default-input.json",
+ ExecutionServiceInput::class.java)!!
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
- webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().isOk
+ webTestClient
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().isOk
+ }
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
index 6d8b62ff9..6705523df 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/application-test.properties
@@ -25,6 +25,7 @@ blueprintsprocessor.db.primary.hibernateNamingStrategy=org.hibernate.cfg.Improve
blueprintsprocessor.db.primary.hibernateDialect=org.hibernate.dialect.H2Dialect
# Controller Blueprints Core Configuration
blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
+blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
# Python executor
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index 35fef96fd..be4327bfe 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode
@@ -120,6 +119,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
prepareRequest(executionServiceInput)
process(executionServiceInput)
} catch (runtimeException: RuntimeException) {
+ log.error("failed in ${getName()} : ${runtimeException.message}", runtimeException)
recover(runtimeException, executionServiceInput)
}
return prepareResponse()
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
index 6712a7ff4..df250ae98 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
@@ -77,7 +77,7 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
}
override fun registerExecutors(name: String, svcLogicNodeExecutor: AbstractSvcLogicNodeExecutor) {
- log.info("Registering executors($name) with type(${svcLogicNodeExecutor.javaClass}")
+ log.debug("Registering executors($name) with type(${svcLogicNodeExecutor.javaClass}")
nodeExecutors[name] = svcLogicNodeExecutor
}
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index 0b2ac7061..4343ff67d 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -37,8 +37,7 @@
<kotlin.maven.version>1.3.21</kotlin.maven.version>
<kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
<grpc.version>1.18.0</grpc.version>
- <!-- TODO("Migrate SSHD to 2.x version") -->
- <sshd.version>1.7.0</sshd.version>
+ <sshd.version>2.2.0</sshd.version>
<jsch.version>0.1.55</jsch.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
@@ -63,23 +62,17 @@
<scope>import</scope>
</dependency>
- <!-- Logging Dependencies -->
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- <version>${eelf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>${onap.logger.slf4j}</version>
- </dependency>
-
<!--Swagger Dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.swagger2.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
@@ -112,6 +105,12 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -226,6 +225,12 @@
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>${sshd.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
@@ -419,14 +424,6 @@
<dependencies>
<dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
@@ -445,6 +442,12 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -453,6 +456,12 @@
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>