From 341db21b2ac0a14a1ed2b8bf7930914dda054bfe Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Fri, 22 Nov 2019 18:06:08 -0500 Subject: Formatting Code base with ktlint No Business logic change, just the code format. Competible with IntelliJ: https://github.com/pinterest/ktlint#option-3 To format run: mvn process-sources -P format Issue-ID: CCSDK-1947 Signed-off-by: Singal, Kapil (ks220y) Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331 --- .../internal/scripts/InternalSimpleRestconf.kt | 8 ++--- .../executor/RestconfExecutorConfiguration.kt | 3 +- .../executor/RestconfExecutorExtensions.kt | 42 +++++++++++++--------- .../executor/ComponentRestconfExecutorTest.kt | 16 +++++---- 4 files changed, 41 insertions(+), 28 deletions(-) (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src') 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 = mutableMapOf("Content-Type" to "application/xml")) { +suspend fun AbstractScriptComponentFunction.restconfMountDevice( + webClientService: BlueprintWebClientService, + deviceId: String, + payload: Any, + headers: Map = 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 = mutableMapOf("Content-Type" to "application/yang.patch+xml")) { +suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig( + webClientService: BlueprintWebClientService, + deviceId: String, + configletResourcePath: String, + configletToApply: Any, + additionalHeaders: Map = 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 { +suspend fun AbstractScriptComponentFunction.restconfDeviceConfig( + webClientService: BlueprintWebClientService, + deviceId: String, + configletResourcePath: String +): + BlueprintWebClientService.WebClientResponse { 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 +} diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt index 0336ce958..7d81ef3dc 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt @@ -67,7 +67,7 @@ class ComponentRestconfExecutorTest { operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive() operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive() operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] = - "internal.scripts.TestRestconfConfigure".asJsonPrimitive() + "internal.scripts.TestRestconfConfigure".asJsonPrimitive() val stepInputData = StepData().apply { name = "activate-restconf" @@ -78,17 +78,21 @@ class ComponentRestconfExecutorTest { val blueprintContext = mockk() every { bluePrintRuntime.bluePrintContext() } returns blueprintContext every { - bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-restconf", - "interfaceName", "operationName") + bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs( + "activate-restconf", + "interfaceName", "operationName" + ) } returns operationInputs val operationOutputs = hashMapOf() every { - bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-restconf", - "interfaceName", "operationName") + bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs( + "activate-restconf", + "interfaceName", "operationName" + ) } returns operationOutputs componentScriptExecutor.applyNB(executionServiceInput) } } -} \ No newline at end of file +} -- cgit 1.2.3-korg