summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor')
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt4
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt11
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt19
3 files changed, 21 insertions, 13 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
index 6678075bd..4e97460d3 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
@@ -304,6 +304,10 @@ class UatExecutor(
return realAnswer
}
+ override suspend fun <T> retry(times: Int, initialDelay: Long, delay: Long, block: suspend (Int) -> T): T {
+ return super.retry(times, initialDelay, delay, block)
+ }
+
fun asServiceDefinition() =
ServiceDefinition(selector, expectations)
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index 4fed0ce67..fa550d1d0 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -19,6 +19,7 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.uat
+import kotlinx.coroutines.runBlocking
import org.junit.ClassRule
import org.junit.Rule
import org.junit.runner.RunWith
@@ -38,7 +39,7 @@ import kotlin.test.Test
// See more on https://docs.spring.io/autorepo/docs/spring-framework/current/spring-framework-reference/testing.html#testcontext-junit4-rules
@RunWith(Parameterized::class)
class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: String, // readable test description
- private val rootFs: FileSystem): BaseUatTest() {
+ private val rootFs: FileSystem) : BaseUatTest() {
companion object {
@@ -84,8 +85,10 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
@Test
fun runUat() {
- val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText()
- val cbaBytes = compressToBytes(rootFs.getPath("/"))
- uatExecutor.execute(uatSpec, cbaBytes)
+ runBlocking {
+ val uatSpec = rootFs.getPath(UAT_SPECIFICATION_FILE).toFile().readText()
+ val cbaBytes = compressToBytes(rootFs.getPath("/"))
+ uatExecutor.execute(uatSpec, cbaBytes)
+ }
}
} \ No newline at end of file
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 49fd025d9..11a35eede 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
@@ -39,19 +39,20 @@ fun AbstractScriptComponentFunction.restconfClientService(selector: String): Blu
*/
suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService: BlueprintWebClientService,
- deviceId: String, payload: Any) {
- val headers: MutableMap<String, String> = hashMapOf()
- headers["Content-Type"] = "application/xml"
+ deviceId: String,
+ payload: Any,
+ headers: Map<String, String> = mutableMapOf("Content-Type" to "application/xml")) {
+
val mountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending mount request, url: $mountUrl")
- webClientService.exchangeNB("PUT", mountUrl, payload, headers)
+ webClientService.exchangeResource("PUT", mountUrl, payload as String, headers)
/** Check device has mounted */
val mountCheckUrl = "restconf/operational/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
val expectedResult = """"netconf-node-topology:connection-status":"connected""""
val mountCheckExecutionBlock: suspend (Int) -> String = { tryCount: Int ->
- val result = webClientService.exchangeNB("GET", mountCheckUrl, "")
+ val result = webClientService.exchangeResource("GET", mountCheckUrl, "")
if (result.body.contains(expectedResult)) {
log.info("NF was mounted successfully on ODL")
result.body
@@ -70,13 +71,13 @@ suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService
suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(webClientService: BlueprintWebClientService,
deviceId: String, configletResourcePath: String,
configletToApply: Any,
- additionalHeaders: Map<String, String>?) {
+ additionalHeaders: Map<String, String > = mutableMapOf("Content-Type" to "application/yang.patch+xml")) {
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"
- val result = webClientService.exchangeNB("PATCH", applyConfigUrl, configletToApply, additionalHeaders)
+ val result:Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
log.info("Configuration application result: $result")
}
@@ -88,7 +89,7 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientServic
val configPathUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
log.debug("sending GET request, url: $configPathUrl")
- return webClientService.exchangeNB("GET", configPathUrl, "")
+ return webClientService.exchangeResource("GET", configPathUrl, "")
}
/**
@@ -98,5 +99,5 @@ suspend fun AbstractScriptComponentFunction.restconfUnMountDevice(webClientServi
deviceId: String, payload: String) {
val unMountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending unMount request, url: $unMountUrl")
- webClientService.exchangeNB("DELETE", unMountUrl, "")
+ webClientService.exchangeResource("DELETE", unMountUrl, "")
} \ No newline at end of file