From 1f2fff6c740695cb2ae430af16684ebc13bc57d5 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Wed, 13 Sep 2017 14:48:05 -0500 Subject: added "fetch timeout" backoff for UEB endpoints this prevents high frequency fruitless attempts to connect to an unreachable (perhaps temporarily) UEB server. added additional management apis for noop endpoints. bump versions of jackson parsers so through snakeyaml library throughtransitive dependencies is bump up from 1.15 as it is resolved in the classpath at runtime to > 1.17 otherwise causes incompatibilities with the one used in controlloops under their own classloaders, as they expect 1.17. Change-Id: I936348c4b93a2c409c22568868c44ed330dc18f7 Issue-ID: POLICY-119 Signed-off-by: Jorge Hernandez --- .../policy/drools/server/restful/RestManager.java | 33 +++++++++++++++++++++- .../onap/policy/drools/system/PolicyEngine.java | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'policy-management/src') diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java index ffcb35cd..48eedfa5 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java @@ -49,6 +49,7 @@ import org.onap.policy.drools.event.comm.TopicSink; import org.onap.policy.drools.event.comm.TopicSource; import org.onap.policy.drools.event.comm.bus.DmaapTopicSink; import org.onap.policy.drools.event.comm.bus.DmaapTopicSource; +import org.onap.policy.drools.event.comm.bus.NoopTopicSink; import org.onap.policy.drools.event.comm.bus.UebTopicSink; import org.onap.policy.drools.event.comm.bus.UebTopicSource; import org.onap.policy.drools.features.PolicyControllerFeatureAPI; @@ -1645,7 +1646,7 @@ public class RestManager { @Path("engine/topics/sinks/ueb") @ApiOperation(value = "Retrieves the UEB managed topic sinks", notes = "UEB Topic Sinks Agregation", responseContainer = "List", - response = UebTopicSource.class) + response = UebTopicSink.class) public Response uebSinks() { return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getUebTopicSinks()) .build(); @@ -1762,6 +1763,36 @@ public class RestManager { .build(); } + @GET + @Path("engine/topics/sinks/noop") + @ApiOperation(value = "Retrieves the NOOP managed topic sinks", + notes = "NOOP Topic Sinks Agregation", responseContainer = "List", + response = NoopTopicSink.class) + public Response noopSinks() { + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getNoopTopicSinks()) + .build(); + } + + @GET + @Path("engine/topics/sinks/noop/{topic}") + @ApiOperation(value = "Retrieves a NOOP managed topic sink", + notes = "NOOP is an dev/null Network Communicaton Sink", response = NoopTopicSink.class) + public Response noopSinkTopic( + @ApiParam(value = "Topic Name", required = true) @PathParam("topic") String topic) { + return Response.status(Response.Status.OK).entity(TopicEndpoint.manager.getNoopTopicSink(topic)) + .build(); + } + + @GET + @Path("engine/topics/sinks/noop/{topic}/events") + @ApiOperation(value = "Retrieves the latest events send through a NOOP topic", + notes = "NOOP is an dev/null Network Communicaton Sink", responseContainer = "List") + public Response noopSinkEvents(@PathParam("topic") String topic) { + return Response.status(Status.OK) + .entity(Arrays.asList(TopicEndpoint.manager.getNoopTopicSink(topic).getRecentEvents())) + .build(); + } + @GET @Path("engine/topics/sources/ueb/{topic}/switches") @ApiOperation(value = "UEB Topic Control Switches", diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java index a262352b..a6f79374 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java @@ -760,7 +760,7 @@ class PolicyEngineManager implements PolicyEngine { for (final HttpServletServer httpServer : this.httpServers) { try { - if (!httpServer.waitedStart(5 * 1000L)) + if (!httpServer.waitedStart(10 * 1000L)) success = false; } catch (final Exception e) { logger.error("{}: cannot start http-server {} because of {}", this, httpServer, -- cgit 1.2.3-korg