summaryrefslogtreecommitdiffstats
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.java12
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java16
2 files changed, 17 insertions, 11 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 0d4aa938c..7aaac9ead 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
@@ -629,7 +629,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
try {
if (vserverName != null) {
aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url");
- aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.user");
+ aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
String url = aaiHostURL + aaiGetQueryByVserver;
@@ -650,19 +650,17 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
String vnfName = event.AAI.get("generic-vnf.vnf-name");
String vnfID = event.AAI.get("generic-vnf.vnf-id");
+ aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url");
+ aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
+ aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
+
try {
if (vnfName != null) {
- 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) {
- 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);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index 10cf173fc..e13352ac0 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -346,13 +346,16 @@ public class ControlLoopOperationManager implements Serializable {
return null;
} else if (response instanceof SOResponse) {
SOResponse msoResponse = (SOResponse) response;
+
+ Integer operationAttempt = this.attempts;
+
switch (msoResponse.httpResponseCode) {
case 200:
case 202:
//
// Consider it as success
//
- this.completeOperation(new Integer(1), msoResponse.httpResponseCode + " Success", PolicyResult.SUCCESS);
+ this.completeOperation(operationAttempt, msoResponse.httpResponseCode + " Success", PolicyResult.SUCCESS);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
@@ -361,20 +364,23 @@ public class ControlLoopOperationManager implements Serializable {
//
// Consider it as failure
//
- this.completeOperation(new Integer(1), msoResponse.httpResponseCode + " Failed", PolicyResult.FAILURE);
+ this.completeOperation(operationAttempt, msoResponse.httpResponseCode + " Failed", PolicyResult.FAILURE);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
+ // increment operation attempts for retries
+ this.attempts += 1;
return PolicyResult.FAILURE;
}
} else if (response instanceof VFCResponse) {
VFCResponse vfcResponse = (VFCResponse) response;
+ Integer operationAttempt = this.attempts;
if (vfcResponse.responseDescriptor.getStatus().equalsIgnoreCase("finished")) {
//
// Consider it as success
//
- this.completeOperation(new Integer(1), " Success", PolicyResult.SUCCESS);
+ this.completeOperation(operationAttempt, " Success", PolicyResult.SUCCESS);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
@@ -383,10 +389,12 @@ public class ControlLoopOperationManager implements Serializable {
//
// Consider it as failure
//
- this.completeOperation(new Integer(1), " Failed", PolicyResult.FAILURE);
+ this.completeOperation(operationAttempt, " Failed", PolicyResult.FAILURE);
if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
return null;
}
+ // increment operation attempts for retries
+ this.attempts += 1;
return PolicyResult.FAILURE;
}
}