diff options
author | Singal, Kapil (ks220y) <ks220y@att.com> | 2019-11-22 18:06:08 -0500 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2019-11-26 21:32:38 +0000 |
commit | 341db21b2ac0a14a1ed2b8bf7930914dda054bfe (patch) | |
tree | 113bba965b06cfe3a8af3a0a527d1a41c9faf0f9 /ms/blueprintsprocessor/functions/restconf-executor | |
parent | d274e5fc552cf9ae25500f504f0434981cf3accf (diff) |
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) <ks220y@att.com>
Change-Id: Ic9e9209fb7023d77f434693ad5a01229f8d09331
Diffstat (limited to 'ms/blueprintsprocessor/functions/restconf-executor')
4 files changed, 41 insertions, 28 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 +} 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<BluePrintContext>() every { bluePrintRuntime.bluePrintContext() } returns blueprintContext every { - bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-restconf", - "interfaceName", "operationName") + bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs( + "activate-restconf", + "interfaceName", "operationName" + ) } returns operationInputs val operationOutputs = hashMapOf<String, JsonNode>() every { - bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-restconf", - "interfaceName", "operationName") + bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs( + "activate-restconf", + "interfaceName", "operationName" + ) } returns operationOutputs componentScriptExecutor.applyNB(executionServiceInput) } } -}
\ No newline at end of file +} |