summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2019-08-01 15:20:21 -0500
committerjhh <jorge.hernandez-herrero@att.com>2019-08-01 15:49:17 -0500
commit02b85efab5f18527023accc1ca20b614b16fee30 (patch)
tree6afb64e7d011fa8197e40bd3c5dc994005555003 /controlloop/common/eventmanager/src
parent33988de160467e00a602684c8da774668d780b91 (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/eventmanager/src')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java56
1 files changed, 33 insertions, 23 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index 57df6b3f4..7d42f8f76 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -81,9 +81,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public static final String GENERIC_VNF_PROV_STATUS = "generic-vnf.prov-status";
public static final String VSERVER_PROV_STATUS = "vserver.prov-status";
- private static final String AAI_URL = "aai.url";
- private static final String AAI_USERNAME_PROPERTY = "aai.username";
- private static final String AAI_PASS_PROPERTY = "aai.password";
+ public static final String AAI_URL = "aai.url";
+ public static final String AAI_USERNAME_PROPERTY = "aai.username";
+ public static final String AAI_PASS_PROPERTY = "aai.password";
private static final String QUERY_AAI_ERROR_MSG = "Exception from queryAai: ";
@@ -961,26 +961,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
logger.warn("Missing vserver-name for AAI request {}", onset.getRequestId());
return null;
}
-
- // create AAI named-query request with UUID started with ""
- AaiNqRequest aaiNqRequest = new AaiNqRequest();
- AaiNqQueryParameters aaiNqQueryParam = new AaiNqQueryParameters();
- AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
- final AaiNqInstanceFilters aaiNqInstanceFilter = new AaiNqInstanceFilters();
-
- // queryParameters
- aaiNqNamedQuery.setNamedQueryUuid(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
- aaiNqQueryParam.setNamedQuery(aaiNqNamedQuery);
- aaiNqRequest.setQueryParameters(aaiNqQueryParam);
- //
- // instanceFilters
- //
- Map<String, Map<String, String>> aaiNqInstanceFilterMap = new HashMap<>();
- Map<String, String> aaiNqInstanceFilterMapItem = new HashMap<>();
- aaiNqInstanceFilterMapItem.put("vserver-name", vserverName);
- aaiNqInstanceFilterMap.put("vserver", aaiNqInstanceFilterMapItem);
- aaiNqInstanceFilter.getInstanceFilter().add(aaiNqInstanceFilterMap);
- aaiNqRequest.setInstanceFilters(aaiNqInstanceFilter);
+ AaiNqRequest aaiNqRequest = getAaiNqRequest(vserverName);
if (logger.isDebugEnabled()) {
logger.debug("AAI Request sent: {}", Serialization.gsonPretty.toJson(aaiNqRequest));
@@ -1008,6 +989,35 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
/**
+ * Gets an AAI Named Query Request object.
+ *
+ * @param vserverName vserver name.
+ * @return the AAI Named Query Request object.
+ */
+ public static AaiNqRequest getAaiNqRequest(String vserverName) {
+ // create AAI named-query request with UUID started with ""
+ AaiNqRequest aaiNqRequest = new AaiNqRequest();
+ AaiNqQueryParameters aaiNqQueryParam = new AaiNqQueryParameters();
+ AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery();
+ final AaiNqInstanceFilters aaiNqInstanceFilter = new AaiNqInstanceFilters();
+
+ // queryParameters
+ aaiNqNamedQuery.setNamedQueryUuid(UUID.fromString("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"));
+ aaiNqQueryParam.setNamedQuery(aaiNqNamedQuery);
+ aaiNqRequest.setQueryParameters(aaiNqQueryParam);
+ //
+ // instanceFilters
+ //
+ Map<String, Map<String, String>> aaiNqInstanceFilterMap = new HashMap<>();
+ Map<String, String> aaiNqInstanceFilterMapItem = new HashMap<>();
+ aaiNqInstanceFilterMapItem.put("vserver-name", vserverName);
+ aaiNqInstanceFilterMap.put("vserver", aaiNqInstanceFilterMapItem);
+ aaiNqInstanceFilter.getInstanceFilter().add(aaiNqInstanceFilterMap);
+ aaiNqRequest.setInstanceFilters(aaiNqInstanceFilter);
+ return aaiNqRequest;
+ }
+
+ /**
* This method reads and validates environmental properties coming from the policy engine. Null properties cause an
* {@link IllegalArgumentException} runtime exception to be thrown
*