From b359a833a6355e110a1be13096e751d86a6c6d15 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Fri, 15 Feb 2019 18:42:34 -0500 Subject: restconf resolution service Change-Id: I643430d8c7fb8a29f5333297a2ca022082481dc2 Issue-ID: CCSDK-1086 Signed-off-by: Muthuramalingam, Brinda Santh --- .../restconf/executor/ComponentRestconfExecutor.kt | 5 ++++- .../restconf/executor/RestconfComponentFunction.kt | 16 +++++++++++++++- .../restconf/executor/ComponentRestconfExecutorTest.kt | 4 +++- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'ms/blueprintsprocessor/functions/restconf-executor/src') diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt index e91b95ff2..9bcc23b64 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutor.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.BlueprintJythonService +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants @@ -35,7 +36,8 @@ import org.springframework.stereotype.Component open class ComponentRestconfExecutor(private var applicationContext: ApplicationContext, private val blueprintJythonService: BlueprintJythonService, private val bluePrintScriptsService: BluePrintScriptsService, - private var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService) : + private var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService, + private var resourceResolutionService: ResourceResolutionService) : AbstractComponentFunction() { private val log = LoggerFactory.getLogger(ComponentRestconfExecutor::class.java) @@ -68,6 +70,7 @@ open class ComponentRestconfExecutor(private var applicationContext: Application // Set the Rest Lib Property Service scriptComponent.bluePrintRestLibPropertyService = bluePrintRestLibPropertyService + scriptComponent.resourceResolutionService = resourceResolutionService scriptComponent.process(executionServiceInput) } diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt index 7b3615fe3..d9362af83 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/RestconfComponentFunction.kt @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +@file:Suppress("unused") package org.onap.ccsdk.apps.blueprintsprocessor.functions.restconf.executor +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionService import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BlueprintWebClientService import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction @@ -24,10 +25,23 @@ import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractCompon abstract class RestconfComponentFunction : AbstractComponentFunction() { lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService + lateinit var resourceResolutionService: ResourceResolutionService fun restClientService(selector: String): BlueprintWebClientService { return bluePrintRestLibPropertyService.blueprintWebClientService(selector) } + fun generateMessage(artifactName: String): String { + return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName) + } + fun resolveAndGenerateMessage(artifactMapping: String, artifactTemplate: String): String { + return resourceResolutionService.resolveResources(bluePrintRuntimeService, nodeTemplateName, + artifactMapping, artifactTemplate) + } + + fun resolveAndGenerateMessage(artifactPrefix: String): String { + return resourceResolutionService.resolveResources(bluePrintRuntimeService, nodeTemplateName, + artifactPrefix) + } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt index 77d469165..31bd4eb70 100644 --- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt @@ -29,6 +29,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.BlueprintJythonService import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.PythonExecutorProperty +import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.ResourceResolutionServiceImpl import org.onap.ccsdk.apps.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode @@ -46,7 +47,8 @@ import kotlin.test.assertNotNull @RunWith(SpringRunner::class) @ContextConfiguration(classes = [RestconfExecutorConfiguration::class, ComponentRestconfExecutor::class, BlueprintJythonService::class, PythonExecutorProperty::class, BluePrintRestLibPropertyService::class, - BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintScriptsServiceImpl::class]) + BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintScriptsServiceImpl::class, + ResourceResolutionServiceImpl::class]) @TestPropertySource(properties = ["server.port=9111", "blueprintsprocessor.restconfEnabled=true", -- cgit 1.2.3-korg