diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin')
3 files changed, 31 insertions, 22 deletions
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt index c4553abd6..6e468509f 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:Suppress("unused") + package internal.scripts import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput @@ -29,12 +30,12 @@ open class EditConfigure : AbstractScriptComponentFunction() { } override suspend fun processNB(executionRequest: ExecutionServiceInput) { - //val webClientService = restClientService("odlparent") - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + // val webClientService = restClientService("odlparent") + TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + TODO("not implemented") // To change body of created functions use File | Settings | File Templates. } } @@ -53,7 +54,6 @@ open class MountNEditConfigure : AbstractScriptComponentFunction() { override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { addError("failed in restconf execution : ${runtimeException.message}") } - } /** diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt index 11e774315..ff6714f21 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt @@ -21,9 +21,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration - @Configuration @ComponentScan @EnableConfigurationProperties @ConditionalOnProperty(name = ["blueprintsprocessor.restconfEnabled"], havingValue = "true") -open class RestconfExecutorConfiguration
\ No newline at end of file +open class RestconfExecutorConfiguration 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 11a35eede..906bef9a4 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 @@ -38,10 +38,12 @@ fun AbstractScriptComponentFunction.restconfClientService(selector: String): Blu * Generic Mount function */ -suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService: BlueprintWebClientService, - deviceId: String, - payload: Any, - headers: Map<String, String> = mutableMapOf("Content-Type" to "application/xml")) { +suspend fun AbstractScriptComponentFunction.restconfMountDevice( + webClientService: BlueprintWebClientService, + 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") @@ -68,23 +70,28 @@ suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService /** * Generic Configure function */ -suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(webClientService: BlueprintWebClientService, - deviceId: String, configletResourcePath: String, - configletToApply: Any, - additionalHeaders: Map<String, String > = mutableMapOf("Content-Type" to "application/yang.patch+xml")) { +suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig( + webClientService: BlueprintWebClientService, + deviceId: String, + configletResourcePath: String, + configletToApply: Any, + 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:Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders) + val result: Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders) log.info("Configuration application result: $result") } - -suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientService: BlueprintWebClientService, - deviceId: String, configletResourcePath: String) - : BlueprintWebClientService.WebClientResponse<String> { +suspend fun AbstractScriptComponentFunction.restconfDeviceConfig( + webClientService: BlueprintWebClientService, + deviceId: String, + configletResourcePath: String +): + BlueprintWebClientService.WebClientResponse<String> { val configPathUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" + "$deviceId/$configletResourcePath" @@ -95,9 +102,12 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientServic /** * Generic UnMount function */ -suspend fun AbstractScriptComponentFunction.restconfUnMountDevice(webClientService: BlueprintWebClientService, - deviceId: String, payload: String) { +suspend fun AbstractScriptComponentFunction.restconfUnMountDevice( + webClientService: BlueprintWebClientService, + 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.exchangeResource("DELETE", unMountUrl, "") -}
\ No newline at end of file +} |