aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-xnf-simulator
diff options
context:
space:
mode:
Diffstat (limited to 'sources/hv-collector-xnf-simulator')
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt12
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/XnfApiServer.kt8
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt4
-rw-r--r--sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt6
4 files changed, 16 insertions, 14 deletions
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt
index 57aaf3db..ca6d169a 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt
@@ -61,12 +61,14 @@ class VesHvClient(private val configuration: SimulatorConfiguration) {
.handle { _, output -> handler(complete, messages, output) }
.connect()
.doOnError {
- logger.info("Failed to connect to VesHvCollector on " +
- "${configuration.vesHost}:${configuration.vesPort}")
+ logger.info {
+ "Failed to connect to VesHvCollector on ${configuration.vesHost}:${configuration.vesPort}"
+ }
}
.subscribe {
- logger.info("Connected to VesHvCollector on " +
- "${configuration.vesHost}:${configuration.vesPort}")
+ logger.info {
+ "Connected to VesHvCollector on ${configuration.vesHost}:${configuration.vesPort}"
+ }
}
return complete.then()
}
@@ -86,7 +88,7 @@ class VesHvClient(private val configuration: SimulatorConfiguration) {
.options { it.flushOnBoundary() }
.sendGroups(frames)
.then {
- logger.info("Messages have been sent")
+ logger.info { "Messages have been sent" }
complete.onComplete()
}
.then()
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 16019384..cfd3a6e9 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
@@ -59,17 +59,17 @@ internal class XnfApiServer(
.post("simulator/async", ::startSimulationHandler)
.get("simulator/:id", ::simulatorStatusHandler)
.get("healthcheck") { ctx ->
- logger.info("Checking health")
+ logger.info { "Checking health" }
ctx.response.status(HttpConstants.STATUS_OK).send()
}
}
private fun startSimulationHandler(ctx: Context) {
- logger.info("Attempting to start 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.Left -> logger.warn { "Failed to start scenario, ${id.a}" }
is Either.Right -> logger.info { "Scenario started, details: ${id.b}" }
}
ctx.response.sendEitherErrorOrResponse(id)
@@ -83,7 +83,7 @@ internal class XnfApiServer(
}
private fun simulatorStatusHandler(ctx: Context) {
- logger.debug("Checking task status")
+ logger.debug { "Checking task status" }
val id = UUID.fromString(ctx.pathTokens["id"])
logger.debug { "Checking status for id: $id" }
val status = ongoingSimulations.status(id)
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
index 21748ae8..d7d42d88 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/simulations.kt
@@ -43,11 +43,11 @@ class OngoingSimulations(executor: Executor = Executors.newCachedThreadPool()) {
simulationIo.continueOn(asyncSimulationContext).unsafeRunAsync { result ->
result.fold(
{ err ->
- logger.warn("Error", err)
+ logger.withWarn { log("Error", err) }
simulations[id] = StatusFailure(err)
},
{
- logger.info("Finished sending messages")
+ logger.info { "Finished sending messages" }
simulations[id] = StatusSuccess
}
)
diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
index 4512dfbf..91070d35 100644
--- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
+++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/main.kt
@@ -42,7 +42,7 @@ const val PROGRAM_NAME = "java $PACKAGE_NAME.MainKt"
fun main(args: Array<String>) = ArgXnfSimulatorConfiguration().parse(args)
.mapLeft(handleWrongArgumentErrorCurried(PROGRAM_NAME))
.map { config ->
- logger.info("Using configuration: $config")
+ logger.info { "Using configuration: $config" }
val xnfSimulator = XnfSimulator(
VesHvClient(config),
MessageGeneratorFactory.create(config.maxPayloadSizeBytes))
@@ -52,10 +52,10 @@ fun main(args: Array<String>) = ArgXnfSimulatorConfiguration().parse(args)
}
.unsafeRunEitherSync(
{ ex ->
- logger.error("Failed to start a server", ex)
+ logger.withError { log("Failed to start a server", ex) }
ExitFailure(1)
},
{
- logger.info("Started xNF Simulator API server")
+ logger.info { "Started xNF Simulator API server" }
}
)