aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
authorTarun Tej Velaga <tt3868@att.com>2017-08-15 13:20:02 +0000
committerTarun Tej Velaga <tt3868@att.com>2017-08-15 20:27:21 +0000
commit5ae90a9bf72d2d6dbb163c3dbea5474b657be7e7 (patch)
tree4b3baebc47b1edee20e96bcd2e8566234903985f /controlloop/common/eventmanager/src/main
parent18f392b0420a8fe6022a5c3cd6c20e99651a5b66 (diff)
Policy-yaml changes
Changes to Policy-yaml and sdc projects based on changes from policy/engine. Issue-Id: POLICY-88 Change-Id: Ic1a58f00029b9a66db6980fc7732a2ac57390229 Signed-off-by: Tarun Tej Velaga <tt3868@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-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.java26
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java20
3 files changed, 29 insertions, 29 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 1892746f1..d1d2cefd2 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
@@ -335,7 +335,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
// PLD - this is simply comparing the policy. Do we want to equals the whole object?
//
if (this.currentOperation.policy.equals(operation.policy)) {
- System.out.println("Finishing " + this.currentOperation.policy.recipe + " result is " + this.currentOperation.getOperationResult());
+ System.out.println("Finishing " + this.currentOperation.policy.getRecipe() + " result is " + this.currentOperation.getOperationResult());
//
// Save history
//
@@ -380,7 +380,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
// Ask the Guard
//
LockResult<GuardResult, TargetLock> lockResult = PolicyGuard.lockTarget(
- this.currentOperation.policy.target.type,
+ this.currentOperation.policy.getTarget().getType(),
this.getTargetInstance(this.currentOperation.policy),
this.onset.requestID,
this);
@@ -486,7 +486,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
public int getControlLoopTimeout(Integer defaultTimeout) {
if (this.processor != null && this.processor.getControlLoop() != null) {
- return this.processor.getControlLoop().timeout;
+ return this.processor.getControlLoop().getTimeout();
}
if (defaultTimeout != null) {
return defaultTimeout;
@@ -543,9 +543,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
}
public String getTargetInstance(Policy policy) {
- if (policy.target != null) {
- if (policy.target.type != null) {
- switch(policy.target.type) {
+ if (policy.getTarget() != null) {
+ if (policy.getTarget().getType() != null) {
+ switch(policy.getTarget().getType()) {
case PNF:
break;
case VM:
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 81c85b1e8..ff7b2c74d 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
@@ -51,7 +51,7 @@ public class ControlLoopOperationManager implements Serializable {
@Override
public String toString() {
return "ControlLoopOperationManager [onset=" + (onset != null ? onset.requestID : "null") + ", policy="
- + (policy != null ? policy.id : "null") + ", attempts=" + attempts
+ + (policy != null ? policy.getId() : "null") + ", attempts=" + attempts
+ ", policyResult=" + policyResult
+ ", currentOperation=" + currentOperation + ", operationHistory=" + operationHistory
+ "]";
@@ -122,7 +122,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Let's make a sanity check
//
- switch (policy.actor) {
+ switch (policy.getActor()) {
case "APPC":
break;
case "AOTS":
@@ -151,7 +151,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Check if we have maxed out on retries
//
- if (this.policy.retry == null || this.policy.retry < 1) {
+ if (this.policy.getRetry() == null || this.policy.getRetry() < 1) {
//
// No retries are allowed, so check have we even made
// one attempt to execute the operation?
@@ -172,7 +172,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Have we maxed out on retries?
//
- if (this.attempts > this.policy.retry) {
+ if (this.attempts > this.policy.getRetry()) {
if (this.policyResult == null) {
this.policyResult = PolicyResult.FAILURE_RETRIES;
}
@@ -185,14 +185,14 @@ public class ControlLoopOperationManager implements Serializable {
this.policyResult = null;
Operation operation = new Operation();
operation.attempt = ++this.attempts;
- operation.operation.actor = this.policy.actor.toString();
- operation.operation.operation = this.policy.recipe;
- operation.operation.target = this.policy.target.toString();
+ operation.operation.actor = this.policy.getActor().toString();
+ operation.operation.operation = this.policy.getRecipe();
+ operation.operation.target = this.policy.getTarget().toString();
operation.operation.subRequestId = Integer.toString(operation.attempt);
//
// Now determine which actor we need to construct a request for
//
- switch (policy.actor) {
+ switch (policy.getActor()) {
case "APPC":
//Request request = APPCActorServiceProvider.constructRequest(onset, operation.operation, this.policy);
this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
@@ -311,8 +311,8 @@ public class ControlLoopOperationManager implements Serializable {
System.out.println("getOperationTimeout returning 0");
return 0;
}
- System.out.println("getOperationTimeout returning " + this.policy.timeout);
- return this.policy.timeout;
+ System.out.println("getOperationTimeout returning " + this.policy.getTimeout());
+ return this.policy.getTimeout();
}
public String getOperationTimeoutString(int defaultTimeout) {
@@ -398,7 +398,7 @@ public class ControlLoopOperationManager implements Serializable {
//
// Check if there were no retries specified
//
- if (policy.retry == null || policy.retry == 0) {
+ if (policy.getRetry() == null || policy.getRetry() == 0) {
//
// The result is the failure
//
@@ -433,14 +433,14 @@ public class ControlLoopOperationManager implements Serializable {
}
private boolean isRetriesMaxedOut() {
- if (policy.retry == null || policy.retry == 0) {
+ if (policy.getRetry() == null || policy.getRetry() == 0) {
//
// There were NO retries specified, so declare
// this as completed.
//
return (this.attempts > 0);
}
- return (this.attempts > policy.retry);
+ return (this.attempts > policy.getRetry());
}
private void storeOperationInDataBase(){
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
index bc94068ab..b6fad23d9 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
@@ -43,7 +43,7 @@ public class ControlLoopProcessor {
Object obj = y.load(this.yaml);
if (obj instanceof ControlLoopPolicy) {
this.policy = (ControlLoopPolicy) obj;
- this.currentPolicy = this.policy.controlLoop.trigger_policy;
+ this.currentPolicy = this.policy.getControlLoop().getTrigger_policy();
} else {
this.policy = null;
throw new ControlLoopException("Unable to parse yaml into ControlLoopPolicy object");
@@ -57,7 +57,7 @@ public class ControlLoopProcessor {
}
public ControlLoop getControlLoop() {
- return this.policy.controlLoop;
+ return this.policy.getControlLoop();
}
public FinalResult checkIsCurrentPolicyFinal() {
@@ -65,8 +65,8 @@ public class ControlLoopProcessor {
}
public Policy getCurrentPolicy() {
- for (Policy policy : this.policy.policies) {
- if (policy.id.equals(this.currentPolicy)) {
+ for (Policy policy : this.policy.getPolicies()) {
+ if (policy.getId().equals(this.currentPolicy)) {
return policy;
}
}
@@ -81,22 +81,22 @@ public class ControlLoopProcessor {
}
switch (result) {
case SUCCESS:
- this.currentPolicy = policy.success;
+ this.currentPolicy = policy.getSuccess();
break;
case FAILURE:
- this.currentPolicy = policy.failure;
+ this.currentPolicy = policy.getFailure();
break;
case FAILURE_TIMEOUT:
- this.currentPolicy = policy.failure_timeout;
+ this.currentPolicy = policy.getFailure_timeout();
break;
case FAILURE_RETRIES:
- this.currentPolicy = policy.failure_retries;
+ this.currentPolicy = policy.getFailure_retries();
break;
case FAILURE_EXCEPTION:
- this.currentPolicy = policy.failure_exception;
+ this.currentPolicy = policy.getFailure_exception();
break;
case FAILURE_GUARD:
- this.currentPolicy = policy.failure_guard;
+ this.currentPolicy = policy.getFailure_guard();
break;
default:
throw new ControlLoopException("Bad policy result given: " + result);