aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/aai
diff options
context:
space:
mode:
authorpramod.jamkhedkar <pramod@research.att.com>2019-04-11 10:03:23 -0400
committerpramod.jamkhedkar <pramod@research.att.com>2019-04-11 11:40:24 -0400
commit23fc065efe1a2152b6bea3d522039784c3c29488 (patch)
tree737daf40dc15840681896f35de3ffecfdef3cd5f /models-interactions/model-impl/aai
parent38c89e3a57f168603faaf2ad4220105b2d54a9c8 (diff)
Aai Simulator for CQ
Added the aai simulator for custom query. Minor change to AaiManager Issue-ID: POLICY-1278 Change-Id: I4d5d2a616d2ce85f3b6c539a1d90fe85ee55e093 Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'models-interactions/model-impl/aai')
-rw-r--r--models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
index f50f0cb9f..891114aa1 100644
--- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
+++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java
@@ -50,9 +50,10 @@ public final class AaiManager {
private final RestManager restManager;
/** custom query URLs. */
- private static String cqUrl = "/aai/v16/query?format=resource";
- private static String tenantUrl = "/aai/v16/search/nodes-query?search-node-type=vserver&filter=vserver-name:";
- private static String prefix = "/aai/v16";
+ private static final String CQ_URL = "/aai/v16/query?format=resource";
+ private static final String TENANT_URL =
+ "/aai/v16/search/nodes-query?search-node-type=vserver&filter=vserver-name:EQUALS:";
+ private static final String PREFIX = "/aai/v16";
/**
@@ -83,7 +84,7 @@ public final class AaiManager {
return null;
}
String resourceLink = resultsArray.getJSONObject(0).getString("resource-link");
- String start = resourceLink.replace(prefix, "");
+ String start = resourceLink.replace(PREFIX, "");
String query = "query/closed-loop";
JSONObject payload = new JSONObject();
payload.put("start", start);
@@ -107,7 +108,8 @@ public final class AaiManager {
private String getCustomQueryRequestPayload(String url, String username, String password, UUID requestId,
String vserver) {
- String urlGet = url + tenantUrl;
+ String urlGet = url + TENANT_URL;
+
String getResponse = getStringQuery(urlGet, username, password, requestId, vserver);
return createCustomQueryPayload(getResponse);
}
@@ -129,11 +131,12 @@ public final class AaiManager {
final Map<String, String> headers = createHeaders(requestId);
- url = url + cqUrl;
-
logger.debug("RestManager.put before");
String requestJson = getCustomQueryRequestPayload(url, username, password, requestId, vserver);
NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, url, requestJson);
+
+ url = url + CQ_URL;
+
Pair<Integer, String> httpDetails =
this.restManager.put(url, username, password, headers, "application/json", requestJson);
logger.debug("RestManager.put after");