diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2019-08-01 15:20:21 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2019-08-01 15:49:17 -0500 |
commit | 02b85efab5f18527023accc1ca20b614b16fee30 (patch) | |
tree | 6afb64e7d011fa8197e40bd3c5dc994005555003 /controlloop/common/feature-controlloop-management/src/main | |
parent | 33988de160467e00a602684c8da774668d780b91 (diff) |
Add AAI test tooling to telemetry.
Issue-ID: POLICY-1956
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Icceab57db9c19364afbedbf63ecc8e52c1572cba
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'controlloop/common/feature-controlloop-management/src/main')
-rw-r--r-- | controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java index 57ef17a33..22e0451e3 100644 --- a/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java +++ b/controlloop/common/feature-controlloop-management/src/main/java/org/onap/policy/drools/server/restful/RestControlLoopManager.java @@ -29,6 +29,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.List; +import java.util.UUID; import java.util.stream.Collectors; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -39,12 +40,17 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.onap.policy.aai.AaiManager; +import org.onap.policy.aai.util.AaiException; import org.onap.policy.controlloop.ControlLoopException; +import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager; import org.onap.policy.controlloop.params.ControlLoopParams; import org.onap.policy.controlloop.processor.ControlLoopProcessor; import org.onap.policy.drools.apps.controlloop.feature.management.ControlLoopManagementFeature; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.system.PolicyController; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RestManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -221,4 +227,46 @@ public class RestControlLoopManager { return Response.status(Status.NOT_ACCEPTABLE).entity(e).build(); } } + + /** + * AAI Custom Query. + * + * @param vserverId vServer identifier. + * @return query results. + */ + @GET + @Path("engine/tools/controlloops/aai/customQuery/{vserverId}") + @ApiOperation(value = "AAI Custom Query") + public Response aaiCustomQuery(@ApiParam(value = "vserver Identifier") String vserverId) { + return Response + .status(Status.OK) + .entity(new AaiManager(new RestManager()) + .getCustomQueryResponse(PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_URL), + PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_USERNAME_PROPERTY), + PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_PASS_PROPERTY), + UUID.randomUUID(), + vserverId)) + .build(); + } + + /** + * AAI Named Query. + * + * @param vserverId vServer identifier. + * @return query results. + */ + @GET + @Path("engine/tools/controlloops/aai/namedQuery/{vserverId}") + @ApiOperation(value = "AAI Custom Query") + public Response aaiNamedQuery(@ApiParam(value = "vserver Identifier") String vserverId) { + return Response + .status(Status.OK) + .entity(new AaiManager(new RestManager()) + .postQuery(PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_URL), + PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_USERNAME_PROPERTY), + PolicyEngine.manager.getEnvironmentProperty(ControlLoopEventManager.AAI_PASS_PROPERTY), + ControlLoopEventManager.getAaiNqRequest(vserverId), + UUID.randomUUID())) + .build(); + } } |