diff options
author | Jorge Hernandez <jh1730@att.com> | 2017-09-21 19:38:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-21 19:38:11 +0000 |
commit | 77bfe0936956111cce88044c58b6ff96045dee9d (patch) | |
tree | 1b3efdd316b88da697a3a1ccd4d04f11e81e4ab9 /controlloop/common/eventmanager/src/main | |
parent | f5431672cc07c00f3d4e0a8a0a28d3edffb7d37e (diff) | |
parent | ac8208cc9ce66062fe4edf54f19ad933f9b0ab99 (diff) |
Merge "ONAP AAI GET QUERY code to support ONAP project"
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r-- | controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java | 38 |
1 files changed, 28 insertions, 10 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 4b5d6c935..0d4aa938c 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 @@ -45,6 +45,7 @@ import org.onap.policy.guard.LockCallback; import org.onap.policy.guard.PolicyGuard; import org.onap.policy.guard.PolicyGuard.LockResult; import org.onap.policy.guard.TargetLock; +import org.onap.policy.drools.system.PolicyEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -73,6 +74,12 @@ public class ControlLoopEventManager implements LockCallback, Serializable { private transient TargetLock targetLock = null; private static AAIGETVnfResponse vnfResponse = null; private static AAIGETVserverResponse vserverResponse = null; + private static String aaiHostURL; + private static String aaiUser; + private static String aaiPassword; + private static String aaiGetQueryByVserver; + private static String aaiGetQueryByVnfID; + private static String aaiGetQueryByVnfName; private static Collection<String> requiredAAIKeys = new ArrayList<>(); static { @@ -615,16 +622,19 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public static AAIGETVserverResponse getAAIVserverInfo(VirtualControlLoopEvent event) throws ControlLoopException { - String user = "POLICY"; - String password = "POLICY"; UUID requestID = event.requestID; AAIGETVserverResponse response = null; String vserverName = event.AAI.get("vserver.vserver-name"); try { if (vserverName != null) { - String url = "https://aai-ext1.test.att.com:8443/aai/v11/nodes/vservers?vserver-name="; - response = AAIManager.getQueryByVserverName(url, user, password, requestID, vserverName); + aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url"); + aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.user"); + aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); + String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name="; + String url = aaiHostURL + aaiGetQueryByVserver; + logger.info("url: " + url); + response = AAIManager.getQueryByVserverName(url, aaiUser, aaiPassword, requestID, vserverName); } } catch (Exception e) { logger.error("getAAIVserverInfo exception: ", e); @@ -635,8 +645,6 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } public static AAIGETVnfResponse getAAIVnfInfo(VirtualControlLoopEvent event) throws ControlLoopException { - String user = "POLICY"; - String password = "POLICY"; UUID requestID = event.requestID; AAIGETVnfResponse response = null; String vnfName = event.AAI.get("generic-vnf.vnf-name"); @@ -644,11 +652,21 @@ public class ControlLoopEventManager implements LockCallback, Serializable { try { if (vnfName != null) { - String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; - response = AAIManager.getQueryByVnfName(url, user, password, requestID, vnfName); + aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url"); + aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.user"); + aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); + String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name="; + String url = aaiHostURL + aaiGetQueryByVnfName; + logger.info("url: " + url); + response = AAIManager.getQueryByVnfName(url, aaiUser, aaiPassword, requestID, vnfName); } else if (vnfID != null) { - String url = "https://aai-ext1.test.att.com:8443/aai/v11/network/generic-vnfs/generic-vnf/"; - response = AAIManager.getQueryByVnfID(url, user, password, requestID, vnfID); + aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url"); + aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.user"); + aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password"); + String aaiGetQueryByVnfID = "/aai/v11/network/generic-vnfs/generic-vnf/"; + String url = aaiHostURL + aaiGetQueryByVnfID; + logger.info("url: " + url); + response = AAIManager.getQueryByVnfID(url, aaiUser, aaiPassword, requestID, vnfID); } } catch (Exception e) { logger.error("getAAIVnfInfo exception: ", e); |