From 0f7bc6b6ec219b6e22a4b5b5a4ee1efd4e54efba Mon Sep 17 00:00:00 2001 From: kjaniak Date: Thu, 29 Nov 2018 13:44:50 +0100 Subject: Enhance of logging in test part Change-Id: Ibdec0ac5cead7e46ada4c32983b9ccf962df703b Issue-ID: DCAEGEN2-1004 Signed-off-by: kjaniak --- .../veshv/simulators/xnf/impl/adapters/XnfApiServer.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sources/hv-collector-xnf-simulator/src/main') diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/XnfApiServer.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/XnfApiServer.kt index 06f1cffe..16019384 100644 --- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/XnfApiServer.kt +++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/XnfApiServer.kt @@ -20,6 +20,7 @@ package org.onap.dcae.collectors.veshv.simulators.xnf.impl.adapters import arrow.core.Either +import arrow.core.getOrElse import arrow.effects.IO import org.onap.dcae.collectors.veshv.simulators.xnf.impl.OngoingSimulations import org.onap.dcae.collectors.veshv.simulators.xnf.impl.XnfSimulator @@ -64,9 +65,13 @@ internal class XnfApiServer( } private fun startSimulationHandler(ctx: Context) { - logger.info("Starting asynchronous scenario") + logger.info("Attempting to start asynchronous scenario") ctx.request.body.then { body -> val id = startSimulation(body) + when (id) { + is Either.Left -> logger.warn { "Failed to start scenario, ${id.a}"} + is Either.Right -> logger.info { "Scenario started, details: ${id.b}" } + } ctx.response.sendEitherErrorOrResponse(id) } } @@ -78,9 +83,12 @@ internal class XnfApiServer( } private fun simulatorStatusHandler(ctx: Context) { + logger.debug("Checking task status") val id = UUID.fromString(ctx.pathTokens["id"]) + logger.debug { "Checking status for id: $id" } val status = ongoingSimulations.status(id) val response = Responses.statusResponse(status.toString(), status.message) + logger.info { "Task $id status: $response" } ctx.response.sendAndHandleErrors(IO.just(response)) } -- cgit 1.2.3-korg