diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-07-26 12:00:59 -0400 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-07-28 15:44:01 -0400 |
commit | daab14bd058de198c80b71d63e108fd788b7f5ee (patch) | |
tree | 252cfdef5b2e1500e5bd152f3f5c52602b6b0deb /ms/blueprintsprocessor/functions/restconf-executor/src | |
parent | 82e396d6917519468376d177dd6a2710e84fa23a (diff) |
Revert "Renaming Files having BluePrint to have Blueprint"
The renaming in CCSDK-3098 caused breaking changes to the grpc api and
compile issues for kotlin scripts.
Issue-ID: CCSDK-3385
Change-Id: I0d745cb858371678eabcb2284671c1fd76a1ab6d
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src')
3 files changed, 39 insertions, 39 deletions
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutor.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutor.kt index f9c9ce88d..4b9333544 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutor.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutor.kt @@ -18,9 +18,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientSer import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentRemoteScriptExecutor import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants.PROPERTY_CONNECTION_CONFIG -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.PROPERTY_CONNECTION_CONFIG +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils.Companion.jsonNodeFromObject @@ -41,14 +41,14 @@ open class Mount : AbstractScriptComponentFunction() { val webclientService = restconfClientService(deviceInformation) val nodeId = requestPayloadActionProperty(NODE_ID)?.first()?.textValue() - ?: throw BlueprintProcessorException("Failed to load $NODE_ID properties.") + ?: throw BluePrintProcessorException("Failed to load $NODE_ID properties.") val mountPayload = requestPayloadActionProperty(MOUNT_PAYLOAD)?.first() - ?: throw BlueprintProcessorException("Failed to load $MOUNT_PAYLOAD properties.") + ?: throw BluePrintProcessorException("Failed to load $MOUNT_PAYLOAD properties.") restconfMountDeviceJson(webclientService, nodeId, mountPayload.toString()) setAttribute( ComponentRemoteScriptExecutor.ATTRIBUTE_STATUS, - BlueprintConstants.STATUS_SUCCESS.asJsonPrimitive() + BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive() ) } @@ -67,7 +67,7 @@ open class Execute : AbstractScriptComponentFunction() { override suspend fun processNB(executionRequest: ExecutionServiceInput) { val nodeIdJson = requestPayloadActionProperty(NODE_ID)?.first() - ?: throw BlueprintProcessorException("Failed to load $NODE_ID properties.") + ?: throw BluePrintProcessorException("Failed to load $NODE_ID properties.") val failFastJsonNode = requestPayloadActionProperty(FAIL_FAST)!! val failFast = if (failFastJsonNode.isEmpty) false else failFastJsonNode.first().booleanValue() @@ -78,7 +78,7 @@ open class Execute : AbstractScriptComponentFunction() { val nodeId = nodeIdJson.textValue() val actionList = requestPayloadActionProperty("action")?.first() - ?: throw BlueprintProcessorException("Failed to load action properties.") + ?: throw BluePrintProcessorException("Failed to load action properties.") validateActionList(actionList) val actionListResults: MutableList<Map<String, JsonNode>> = mutableListOf() @@ -113,12 +113,12 @@ open class Execute : AbstractScriptComponentFunction() { if (response.status in HTTP_SUCCESS_RANGE) { log.info("\nRestconf execution response : \n{}", responseBody.asJsonType().toPrettyString()) actionResult[ComponentScriptExecutor.ATTRIBUTE_STATUS] = - BlueprintConstants.STATUS_SUCCESS.asJsonPrimitive() + BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive() } else { actionResult[ComponentScriptExecutor.ATTRIBUTE_STATUS] = - BlueprintConstants.STATUS_FAILURE.asJsonPrimitive() + BluePrintConstants.STATUS_FAILURE.asJsonPrimitive() addError( - BlueprintConstants.STATUS_FAILURE, + BluePrintConstants.STATUS_FAILURE, ComponentScriptExecutor.ATTRIBUTE_STATUS, actionResponse.asText() ) @@ -131,17 +131,17 @@ open class Execute : AbstractScriptComponentFunction() { } setAttribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, jsonNodeFromObject(actionListResults)) - setAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BlueprintConstants.STATUS_SUCCESS.asJsonPrimitive()) + setAttribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive()) actionListResults.forEach { actionResult -> val actionResultStatus = actionResult[ComponentScriptExecutor.ATTRIBUTE_STATUS] - if (BlueprintConstants.STATUS_SUCCESS.asJsonPrimitive() != actionResultStatus) { + if (BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive() != actionResultStatus) { setAttribute( ComponentScriptExecutor.ATTRIBUTE_STATUS, - BlueprintConstants.STATUS_FAILURE.asJsonPrimitive() + BluePrintConstants.STATUS_FAILURE.asJsonPrimitive() ) val errorResponse = actionResult[ACTION_OUTPUT]!! addError( - BlueprintConstants.STATUS_FAILURE, ComponentScriptExecutor.ATTRIBUTE_STATUS, + BluePrintConstants.STATUS_FAILURE, ComponentScriptExecutor.ATTRIBUTE_STATUS, errorResponse.asText() ) } @@ -178,19 +178,19 @@ open class Execute : AbstractScriptComponentFunction() { private fun validateActionList(actionList: JsonNode) { if (actionList.isEmpty) { - throw BlueprintProcessorException("No actions defined") + throw BluePrintProcessorException("No actions defined") } actionList.forEach { action -> action.get(ACTION_PATH) - ?: throw BlueprintProcessorException("Failed to load action path.") + ?: throw BluePrintProcessorException("Failed to load action path.") action.get(ACTION_DATASTORE) - ?: throw BlueprintProcessorException("Failed to load action datastore.") + ?: throw BluePrintProcessorException("Failed to load action datastore.") val actionTypeJsonNode = action.get(ACTION_TYPE) - ?: throw BlueprintProcessorException("Failed to load action type.") + ?: throw BluePrintProcessorException("Failed to load action type.") when (val actionType = RestconfRequestType.valueOf(actionTypeJsonNode.asText().toUpperCase())) { RestconfRequestType.PATCH, RestconfRequestType.PUT, RestconfRequestType.POST -> { action.get(ACTION_PAYLOAD) - ?: throw BlueprintProcessorException("Failed to load action $actionType payload.") + ?: throw BluePrintProcessorException("Failed to load action $actionType payload.") } } } 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 aade8965b..5892c9f8b 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 @@ -24,9 +24,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.restconf.executor.Restco import org.onap.ccsdk.cds.blueprintsprocessor.rest.restClientService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintRetryException -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyService +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintRetryException +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService /** * Register the Restconf module exposed dependency @@ -34,11 +34,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyS val log = LoggerFactory.logger(AbstractScriptComponentFunction::class.java)!! fun AbstractScriptComponentFunction.restconfClientService(selector: String): BlueprintWebClientService { - return BlueprintDependencyService.restClientService(selector) + return BluePrintDependencyService.restClientService(selector) } fun AbstractScriptComponentFunction.restconfClientService(jsonNode: JsonNode): BlueprintWebClientService { - return BlueprintDependencyService.restClientService(jsonNode) + return BluePrintDependencyService.restClientService(jsonNode) } /** @@ -85,14 +85,14 @@ suspend fun AbstractScriptComponentFunction.restconfMountDevice( webClientService.exchangeResource(RestconfRequestType.PUT.name, mountUrl, payload as String, headers) if (mountResult.status !in RestconfConstants.HTTP_SUCCESS_RANGE) { - throw BlueprintProcessorException("Failed to mount device with url($mountUrl) ") + throw BluePrintProcessorException("Failed to mount device with url($mountUrl) ") } /** Check device has mounted */ val mountCheckExecutionBlock: suspend (Int) -> String = { val result = webClientService.exchangeResource(RestconfRequestType.GET.name, mountVerifyUrl, "") if (!result.body.contains(expectedMountResult)) { - throw BlueprintRetryException("Wait for device with url($mountUrl) to mount") + throw BluePrintRetryException("Wait for device with url($mountUrl) to mount") } log.info("NF was mounted successfully on ODL") result.body @@ -151,7 +151,7 @@ suspend fun AbstractScriptComponentFunction.genericPutPatchPostRequest( RestconfRequestType.PUT -> log.info("sending PUT request, url: $requestUrl") RestconfRequestType.PATCH -> log.info("sending PATCH request, url: $requestUrl") RestconfRequestType.POST -> log.info("sending POST request, url: $requestUrl") - else -> throw BlueprintProcessorException("Illegal request type, only POST, PUT or PATCH allowed.") + else -> throw BluePrintProcessorException("Illegal request type, only POST, PUT or PATCH allowed.") } return webClientService.exchangeResource(requestType.name, requestUrl, payload as String, headers) } @@ -168,7 +168,7 @@ suspend fun AbstractScriptComponentFunction.getRequest( { tryCount: Int -> val result = genericGetOrDeleteRequest(webClientService, requestUrl, RestconfRequestType.GET) if (result.status !in RestconfConstants.HTTP_SUCCESS_RANGE && tryCount < retryTimes - 1) { - throw BlueprintRetryException("Failed to read url($requestUrl) to mount") + throw BluePrintRetryException("Failed to read url($requestUrl) to mount") } log.info("NF was mounted successfully on ODL") result @@ -198,7 +198,7 @@ suspend fun AbstractScriptComponentFunction.genericGetOrDeleteRequest( when (requestType) { RestconfRequestType.GET -> log.info("sending GET request, url: $requestUrl") RestconfRequestType.DELETE -> log.info("sending DELETE request, url: $requestUrl") - else -> throw BlueprintProcessorException("Illegal request type, only GET and DELETE allowed.") + else -> throw BluePrintProcessorException("Illegal request type, only GET and DELETE allowed.") } return webClientService.exchangeResource(requestType.name, requestUrl, "") } 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 653b4c56a..47cf34fad 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 @@ -28,11 +28,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor -import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation -import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintContext -import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBlueprintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.springframework.context.ApplicationContext import kotlin.test.assertNotNull @@ -59,25 +59,25 @@ class ComponentRestconfExecutorTest { payload = JacksonUtils.jsonNode("{}") as ObjectNode } - val blueprintContext = mockk<BlueprintContext>() + val blueprintContext = mockk<BluePrintContext>() every { blueprintContext.nodeTemplateOperationImplementation( any(), any(), any() ) } returns Implementation() - val bluePrintRuntime = mockk<DefaultBlueprintRuntimeService>("1234") + val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234") every { bluePrintRuntime.bluePrintContext() } returns blueprintContext componentScriptExecutor.bluePrintRuntimeService = bluePrintRuntime componentScriptExecutor.stepName = "sample-step" val operationInputs = hashMapOf<String, JsonNode>() - operationInputs[BlueprintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-restconf".asJsonPrimitive() - operationInputs[BlueprintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive() - operationInputs[BlueprintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-restconf".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive() operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = - BlueprintConstants.SCRIPT_INTERNAL.asJsonPrimitive() + BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive() operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] = "internal.scripts.TestRestconfConfigure".asJsonPrimitive() |