aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager')
-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
*