diff options
28 files changed, 249 insertions, 276 deletions
diff --git a/controlloop/common/guard/checkstyle-suppressions.xml b/controlloop/common/guard/checkstyle-suppressions.xml deleted file mode 100644 index 7893c0b7d..000000000 --- a/controlloop/common/guard/checkstyle-suppressions.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2018 AT&T Technologies. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - SPDX-License-Identifier: Apache-2.0 - ============LICENSE_END========================================================= ---> - -<!DOCTYPE suppressions PUBLIC - "-//Puppy Crawl//DTD Suppressions 1.0//EN" - "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> - -<suppressions> - <suppress checks="AbbreviationAsWordInName" - files="PNFTargetLock.java|VNFTargetLock.java|VMTargetLock.java|PolicyGuardRequest.java|PolicyGuardResponse.java|PolicyGuardXacmlHelper.java|TargetLock.java|PolicyGuardXacmlRequestAttributes.java" - lines="1-9999"/> -</suppressions> diff --git a/controlloop/common/guard/pom.xml b/controlloop/common/guard/pom.xml index 4f2edc506..7dc85d778 100644 --- a/controlloop/common/guard/pom.xml +++ b/controlloop/common/guard/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= drools-pdp-apps ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -129,7 +129,6 @@ <includeTestResources>true</includeTestResources> <excludes> </excludes> - <suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation> <consoleOutput>true</consoleOutput> <failsOnViolation>true</failsOnViolation> <violationSeverity>warning</violationSeverity> diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java index fefea39ab..046b7cfd6 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/CallGuardTask.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,7 +131,7 @@ public class CallGuardTask implements Runnable { // // Make guard request // - guardDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + guardDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); logger.debug("\n********** XACML RESPONSE START ********"); logger.debug("{}", guardDecision); @@ -153,7 +153,7 @@ public class CallGuardTask implements Runnable { // if ("Indeterminate".equals(guardResponse.getResult())) { guardResponse.setOperation(recipe); - guardResponse.setRequestID(UUID.fromString(requestId)); + guardResponse.setRequestId(UUID.fromString(requestId)); } long estimatedTime = System.nanoTime() - startTime; diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java index e4849cea5..7ae0e7eb2 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ package org.onap.policy.guard; import java.util.UUID; import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.drools.core.lock.PolicyResourceLockManager; -import org.onap.policy.guard.impl.PNFTargetLock; -import org.onap.policy.guard.impl.VMTargetLock; -import org.onap.policy.guard.impl.VNFTargetLock; +import org.onap.policy.guard.impl.PnfTargetLock; +import org.onap.policy.guard.impl.VmTargetLock; +import org.onap.policy.guard.impl.VnfTargetLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -97,17 +97,17 @@ public class PolicyGuard { // // Create the Lock object // - return new PNFTargetLock(targetType, targetInstance, requestId, callback); + return new PnfTargetLock(targetType, targetInstance, requestId, callback); case VM: // // Create the Lock object // - return new VMTargetLock(targetType, targetInstance, requestId, callback); + return new VmTargetLock(targetType, targetInstance, requestId, callback); case VNF: // // Create the Lock object // - return new VNFTargetLock(targetType, targetInstance, requestId, callback); + return new VnfTargetLock(targetType, targetInstance, requestId, callback); default: logger.error("invalid target type {} for lock on {}", targetType, targetInstance); return null; @@ -156,7 +156,7 @@ public class PolicyGuard { * @return the result: acquired or denied */ public static GuardResult lockTarget(TargetLock lock, int holdSec) { - String owner = makeOwner(lock.getTargetType(), lock.getRequestID()); + String owner = makeOwner(lock.getTargetType(), lock.getRequestId()); boolean result = factory.getManager().refresh(lock.getTargetInstance(), owner, holdSec); @@ -173,7 +173,7 @@ public class PolicyGuard { * @throws IllegalArgumentException if an argument is null */ public static boolean unlockTarget(TargetLock lock) { - String owner = makeOwner(lock.getTargetType(), lock.getRequestID()); + String owner = makeOwner(lock.getTargetType(), lock.getRequestId()); boolean result = factory.getManager().unlock(lock.getTargetInstance(), owner); if (result) { diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java index 5cb080fa5..8887e00b7 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardRequest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class PolicyGuardRequest { @Override public String toString() { - return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestID=" + requestId + ", operation=" + return "PolicyGuardRequest [actor=" + actor + ", target=" + target + ", requestId=" + requestId + ", operation=" + operation + "]"; } @@ -66,11 +66,11 @@ public class PolicyGuardRequest { this.target = target; } - public UUID getRequestID() { + public UUID getRequestId() { return requestId; } - public void setRequestID(UUID requestId) { + public void setRequestId(UUID requestId) { this.requestId = requestId; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java index d7ece3081..574c50b79 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardResponse.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,14 +42,14 @@ public class PolicyGuardResponse { @Override public String toString() { - return "PolicyGuardResponse [requestID=" + requestId + ", operation=" + operation + ", result=" + result + "]"; + return "PolicyGuardResponse [requestId=" + requestId + ", operation=" + operation + ", result=" + result + "]"; } - public UUID getRequestID() { + public UUID getRequestId() { return requestId; } - public void setRequestID(UUID requestId) { + public void setRequestId(UUID requestId) { this.requestId = requestId; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java index 35b1d2561..c2dfc908d 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public class PolicyGuardXacmlHelper { * @param xacmlReq the XACML request * @return the response */ - public String callPDP(PolicyGuardXacmlRequestAttributes xacmlReq) { + public String callPdp(PolicyGuardXacmlRequestAttributes xacmlReq) { // // Send it to the PDP // @@ -94,11 +94,11 @@ public class PolicyGuardXacmlHelper { // Build the json request // JSONObject attributes = new JSONObject(); - attributes.put("actor", xacmlReq.getActorID()); - attributes.put("recipe", xacmlReq.getOperationID()); - attributes.put("target", xacmlReq.getTargetID()); - if (xacmlReq.getClnameID() != null) { - attributes.put("clname", xacmlReq.getClnameID()); + attributes.put("actor", xacmlReq.getActorId()); + attributes.put("recipe", xacmlReq.getOperationId()); + attributes.put("target", xacmlReq.getTargetId()); + if (xacmlReq.getClnameId() != null) { + attributes.put("clname", xacmlReq.getClnameId()); } if (xacmlReq.getVfCount() != null) { attributes.put("vfCount", xacmlReq.getVfCount()); @@ -221,7 +221,7 @@ public class PolicyGuardXacmlHelper { * @param xacmlResponse the XACML response * @return the PolicyGuardResponse */ - public static PolicyGuardResponse parseXACMLPDPResponse(com.att.research.xacml.api.Response xacmlResponse) { + public static PolicyGuardResponse parseXacmlPdpResponse(com.att.research.xacml.api.Response xacmlResponse) { if (xacmlResponse == null) { // // In case the actual XACML response was null, create an empty diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java index d7e608cb8..da03addf9 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributes.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,19 +29,19 @@ import com.att.research.xacml.std.annotations.XACMLSubject; public class PolicyGuardXacmlRequestAttributes { @XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:clname:clname-id") - String clnameID; + String clnameId; @XACMLSubject(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:actor:actor-id") - String actorID; + String actorId; @XACMLAction(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:operation:operation-id") - String operationID; + String operationId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:target:target-id") - String targetID; + String targetId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:request-id") - String requestID; + String requestId; @XACMLResource(includeInResults = true, attributeId = "urn:oasis:names:tc:xacml:1.0:request:vf-count") Integer vfCount; @@ -59,58 +59,58 @@ public class PolicyGuardXacmlRequestAttributes { public PolicyGuardXacmlRequestAttributes(String clnameId, String actorId, String operationId, String targetId, String requestId, Integer vfCount) { super(); - this.clnameID = clnameId; - this.actorID = actorId; - this.operationID = operationId; - this.targetID = targetId; - this.requestID = requestId; + this.clnameId = clnameId; + this.actorId = actorId; + this.operationId = operationId; + this.targetId = targetId; + this.requestId = requestId; this.vfCount = vfCount; } @Override public String toString() { - return "PolicyGuardXacmlRequestAttributes [actorID=" + actorID + ", operationID=" + operationID + ", targetID=" - + targetID + ", requestID=" + requestID + "]"; + return "PolicyGuardXacmlRequestAttributes [actorId=" + actorId + ", operationId=" + operationId + ", targetId=" + + targetId + ", requestId=" + requestId + "]"; } - public String getActorID() { - return actorID; + public String getActorId() { + return actorId; } - public void setActorID(String actorID) { - this.actorID = actorID; + public void setActorId(String actorId) { + this.actorId = actorId; } - public String getOperationID() { - return operationID; + public String getOperationId() { + return operationId; } - public void setOperationID(String operationID) { - this.operationID = operationID; + public void setOperationId(String operationId) { + this.operationId = operationId; } - public String getTargetID() { - return targetID; + public String getTargetId() { + return targetId; } - public void setTargetID(String targetID) { - this.targetID = targetID; + public void setTargetId(String targetId) { + this.targetId = targetId; } - public String getRequestID() { - return requestID; + public String getRequestId() { + return requestId; } - public void setRequestID(String requestID) { - this.requestID = requestID; + public void setRequestId(String requestId) { + this.requestId = requestId; } - public String getClnameID() { - return clnameID; + public String getClnameId() { + return clnameId; } - public void setClnameID(String clnameID) { - this.clnameID = clnameID; + public void setClnameId(String clnameId) { + this.clnameId = clnameId; } public Integer getVfCount() { diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java index 1e3064abd..eea46c3cc 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/TargetLock.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,12 +26,12 @@ import org.onap.policy.controlloop.policy.TargetType; public interface TargetLock { - public UUID getLockID(); + public UUID getLockId(); public TargetType getTargetType(); public String getTargetInstance(); - public UUID getRequestID(); + public UUID getRequestId(); } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java index 904448591..c1ad34a22 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PNFTargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/PnfTargetLock.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.guard.LockCallback; import org.onap.policy.guard.TargetLock; -public class PNFTargetLock implements TargetLock, Serializable { +public class PnfTargetLock implements TargetLock, Serializable { private static final long serialVersionUID = 2335897394577202732L; @@ -45,7 +45,7 @@ public class PNFTargetLock implements TargetLock, Serializable { * @param requestId the request Id * @param callback the callback */ - public PNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { + public PnfTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { this.lockId = UUID.randomUUID(); this.targetType = type; this.target = target; @@ -54,7 +54,7 @@ public class PNFTargetLock implements TargetLock, Serializable { } @Override - public UUID getLockID() { + public UUID getLockId() { return this.lockId; } @@ -70,7 +70,7 @@ public class PNFTargetLock implements TargetLock, Serializable { } @Override - public UUID getRequestID() { + public UUID getRequestId() { return this.requestId; } @@ -80,7 +80,7 @@ public class PNFTargetLock implements TargetLock, Serializable { @Override public String toString() { - return "PNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" + return "PnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + requestId + "]"; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java index 6046e3a32..301c6ec7c 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VMTargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VmTargetLock.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.guard.LockCallback; import org.onap.policy.guard.TargetLock; -public class VMTargetLock implements TargetLock, Serializable { +public class VmTargetLock implements TargetLock, Serializable { private static final long serialVersionUID = -8795145054334409724L; private final UUID lockId; @@ -44,7 +44,7 @@ public class VMTargetLock implements TargetLock, Serializable { * @param requestId the request Id * @param callback the callback */ - public VMTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) { + public VmTargetLock(TargetType targetType, String target, UUID requestId, LockCallback callback) { this.lockId = UUID.randomUUID(); this.targetType = targetType; this.target = target; @@ -53,7 +53,7 @@ public class VMTargetLock implements TargetLock, Serializable { } @Override - public UUID getLockID() { + public UUID getLockId() { return this.lockId; } @@ -68,7 +68,7 @@ public class VMTargetLock implements TargetLock, Serializable { } @Override - public UUID getRequestID() { + public UUID getRequestId() { return this.requestId; } @@ -78,7 +78,7 @@ public class VMTargetLock implements TargetLock, Serializable { @Override public String toString() { - return "VMTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" + return "VmTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + requestId + "]"; } diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java index 418a3ed78..2e3fc28b1 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VnfTargetLock.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.guard.LockCallback; import org.onap.policy.guard.TargetLock; -public class VNFTargetLock implements TargetLock, Serializable { +public class VnfTargetLock implements TargetLock, Serializable { private static final long serialVersionUID = 2335897394577202732L; @@ -45,7 +45,7 @@ public class VNFTargetLock implements TargetLock, Serializable { * @param requestId the request Id * @param callback the callback */ - public VNFTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { + public VnfTargetLock(TargetType type, String target, UUID requestId, LockCallback callback) { this.lockId = UUID.randomUUID(); this.targetType = type; this.target = target; @@ -54,7 +54,7 @@ public class VNFTargetLock implements TargetLock, Serializable { } @Override - public UUID getLockID() { + public UUID getLockId() { return this.lockId; } @@ -70,7 +70,7 @@ public class VNFTargetLock implements TargetLock, Serializable { } @Override - public UUID getRequestID() { + public UUID getRequestId() { return this.requestId; } @@ -80,7 +80,7 @@ public class VNFTargetLock implements TargetLock, Serializable { @Override public String toString() { - return "VNFTargetLock [lockID=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestID=" + return "VnfTargetLock [lockId=" + lockId + ", targetType=" + targetType + ", target=" + target + ", requestId=" + requestId + "]"; } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java index b1b057542..9e4c809c2 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/CallGuardTaskTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class CallGuardTaskTest { // and has same reqID PolicyGuardResponse response = (PolicyGuardResponse) obj; // req ID has form 00000001-0002-0003-0004-000000000005 - return status.equals(response.getResult()) && response.getRequestID().toString().matches(REQ_MATCHER); + return status.equals(response.getResult()) && response.getRequestId().toString().matches(REQ_MATCHER); })); } } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java index 7c9aae7b4..3b0441fc2 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardRequestTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -37,8 +39,8 @@ public class PolicyGuardRequestTest { PolicyGuardRequest request = new PolicyGuardRequest("Dorothy", "Kansas", requestId, "GetBackHome"); - request.setRequestID(requestId); - assertEquals(requestId, request.getRequestID()); + request.setRequestId(requestId); + assertEquals(requestId, request.getRequestId()); request.setActor("Dorothy"); assertEquals("Dorothy", request.getActor()); diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java index f9bd94795..b30ae0210 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardResponseTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -37,8 +39,8 @@ public class PolicyGuardResponseTest { PolicyGuardResponse response = new PolicyGuardResponse("BackHome", requestId, "GetBackHome"); - response.setRequestID(requestId); - assertEquals(requestId, response.getRequestID()); + response.setRequestId(requestId); + assertEquals(requestId, response.getRequestId()); response.setResult("BackHome"); assertEquals("BackHome", response.getResult()); @@ -46,6 +48,6 @@ public class PolicyGuardResponseTest { response.setOperation("GetBackHome"); assertEquals("GetBackHome", response.getOperation()); - assertEquals("PolicyGuardResponse [requestID=", response.toString().substring(0, 31)); + assertEquals("PolicyGuardResponse [requestId=", response.toString().substring(0, 31)); } } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java index 273d8fb01..87303623c 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,9 +39,9 @@ import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.drools.core.lock.PolicyResourceLockManager; import org.onap.policy.guard.PolicyGuard.Factory; import org.onap.policy.guard.PolicyGuard.LockResult; -import org.onap.policy.guard.impl.PNFTargetLock; -import org.onap.policy.guard.impl.VMTargetLock; -import org.onap.policy.guard.impl.VNFTargetLock; +import org.onap.policy.guard.impl.PnfTargetLock; +import org.onap.policy.guard.impl.VmTargetLock; +import org.onap.policy.guard.impl.VnfTargetLock; public class PolicyGuardTest { private static final String INSTANCENAME = "targetInstance"; @@ -76,7 +76,7 @@ public class PolicyGuardTest { } @Override - public UUID getLockID() { + public UUID getLockId() { return null; } @@ -91,7 +91,7 @@ public class PolicyGuardTest { } @Override - public UUID getRequestID() { + public UUID getRequestId() { return reqid; } } @@ -137,13 +137,13 @@ public class PolicyGuardTest { assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid)); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VMTargetLock.class, result.getB().getClass()); + assertEquals(VmTargetLock.class, result.getB().getClass()); - VMTargetLock vtl = (VMTargetLock) result.getB(); - assertNotNull(vtl.getLockID()); + VmTargetLock vtl = (VmTargetLock) result.getB(); + assertNotNull(vtl.getLockId()); assertEquals(INSTANCENAME, vtl.getTargetInstance()); assertEquals(TargetType.VM, vtl.getTargetType()); - assertNotNull(vtl.getRequestID()); + assertNotNull(vtl.getRequestId()); assertEquals(dlcb, vtl.getCallback()); // Test isLocked after lock removed @@ -161,13 +161,13 @@ public class PolicyGuardTest { assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid)); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(PNFTargetLock.class, result.getB().getClass()); + assertEquals(PnfTargetLock.class, result.getB().getClass()); - PNFTargetLock ptl = (PNFTargetLock) result.getB(); - assertNotNull(ptl.getLockID()); + PnfTargetLock ptl = (PnfTargetLock) result.getB(); + assertNotNull(ptl.getLockId()); assertEquals(INSTANCENAME, ptl.getTargetInstance()); assertEquals(TargetType.PNF, ptl.getTargetType()); - assertNotNull(ptl.getRequestID()); + assertNotNull(ptl.getRequestId()); assertEquals(dlcb, ptl.getCallback()); // Test isLocked after lock removed @@ -186,13 +186,13 @@ public class PolicyGuardTest { assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid)); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VNFTargetLock.class, result.getB().getClass()); + assertEquals(VnfTargetLock.class, result.getB().getClass()); - VNFTargetLock vtl = (VNFTargetLock) result.getB(); - assertNotNull(vtl.getLockID()); + VnfTargetLock vtl = (VnfTargetLock) result.getB(); + assertNotNull(vtl.getLockId()); assertEquals(INSTANCENAME, vtl.getTargetInstance()); assertEquals(TargetType.VNF, vtl.getTargetType()); - assertNotNull(vtl.getRequestID()); + assertNotNull(vtl.getRequestId()); assertEquals(dlcb, vtl.getCallback()); // Test isLocked after lock removed @@ -227,7 +227,7 @@ public class PolicyGuardTest { assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid)); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VMTargetLock.class, result.getB().getClass()); + assertEquals(VmTargetLock.class, result.getB().getClass()); // Test isLocked after lock removed PolicyGuard.unlockTarget(new DummyTargetLock(type, uuid)); @@ -248,7 +248,7 @@ public class PolicyGuardTest { assertTrue(PolicyGuard.isLocked(type, INSTANCENAME, uuid)); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VMTargetLock.class, result.getB().getClass()); + assertEquals(VmTargetLock.class, result.getB().getClass()); UUID uuid2 = UUID.randomUUID(); result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid2, dlcb, LOCK_SEC); @@ -272,8 +272,8 @@ public class PolicyGuardTest { assertFalse(dlcb.releaseLock()); DummyTargetLock dtl = new DummyTargetLock(type, uuid); - assertNull(dtl.getLockID()); - assertEquals(uuid, dtl.getRequestID()); + assertNull(dtl.getLockId()); + assertEquals(uuid, dtl.getRequestId()); assertEquals(INSTANCENAME, dtl.getTargetInstance()); assertEquals(type, dtl.getTargetType()); } @@ -288,7 +288,7 @@ public class PolicyGuardTest { result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC); verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VMTargetLock.class, result.getB().getClass()); + assertEquals(VmTargetLock.class, result.getB().getClass()); // diff owner - denied UUID uuid2 = UUID.randomUUID(); @@ -308,7 +308,7 @@ public class PolicyGuardTest { result = PolicyGuard.lockTarget(type, INSTANCENAME, uuid, dlcb, LOCK_SEC); verify(mgr).lock(INSTANCENAME, type + ":" + uuid, LOCK_SEC); assertEquals(GuardResult.LOCK_ACQUIRED, result.getA()); - assertEquals(VMTargetLock.class, result.getB().getClass()); + assertEquals(VmTargetLock.class, result.getB().getClass()); TargetLock lock = result.getB(); diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java index e69820a3d..8b007fdcc 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlHelperTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ public class PolicyGuardXacmlHelperTest { PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes( org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target", "requestId", VF_COUNT); - String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); assertNotNull(rawDecision); assertEquals(0, Util.INDETERMINATE.compareToIgnoreCase(rawDecision)); } @@ -101,13 +101,13 @@ public class PolicyGuardXacmlHelperTest { public void testSimulator() { PolicyGuardXacmlRequestAttributes request = new PolicyGuardXacmlRequestAttributes("clname_id", "actor_id", "operation_id", "target_id", "request_id", VF_COUNT); - String xacmlResponse = new PolicyGuardXacmlHelper().callPDP(request); + String xacmlResponse = new PolicyGuardXacmlHelper().callPdp(request); assertNotNull(xacmlResponse); } @Test /** - * Tests PolicyGuardXacmlHelper.callPDP method to determine if it returns DENY, PERMIT, or + * Tests PolicyGuardXacmlHelper.callPdp method to determine if it returns DENY, PERMIT, or * INDETERMINATE as expected. */ public void testCallPdp() { @@ -115,13 +115,13 @@ public class PolicyGuardXacmlHelperTest { PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes( org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target", "requestId", VF_COUNT); - String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); assertNotNull(rawDecision); assertTrue(0 == Util.DENY.compareToIgnoreCase(rawDecision)); // Permit Case xacmlReq = new PolicyGuardXacmlRequestAttributes("clname", "actor", "recipe", "target", "requestId", VF_COUNT); - rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); assertNotNull(rawDecision); assertEquals(0, Util.PERMIT.compareToIgnoreCase(rawDecision)); @@ -130,21 +130,21 @@ public class PolicyGuardXacmlHelperTest { @Test /** - * Tests PolicyGuardXacmlHelper.callPDP method to exercise all branches + * Tests PolicyGuardXacmlHelper.callPdp method to exercise all branches */ public void testCallPdpExtra() { PolicyGuardXacmlRequestAttributes xacmlReq = new PolicyGuardXacmlRequestAttributes( org.onap.policy.simulators.GuardSimulatorJaxRs.DENY_CLNAME, "actor", "recipe", "target", "requestId", VF_COUNT); - xacmlReq.setClnameID(null); - String rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + xacmlReq.setClnameId(null); + String rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); assertNotNull(rawDecision); assertEquals(-5, Util.DENY.compareToIgnoreCase(rawDecision)); org.onap.policy.guard.Util.setGuardEnvProps("http://localhost:6669/pdp/api/getDecision", "", "", "", "", ""); - rawDecision = new PolicyGuardXacmlHelper().callPDP(xacmlReq); + rawDecision = new PolicyGuardXacmlHelper().callPdp(xacmlReq); assertNotNull(rawDecision); org.onap.policy.guard.Util.setGuardEnvProps("http://localhost:6669/pdp/api/getDecision", "python", "test", @@ -154,14 +154,14 @@ public class PolicyGuardXacmlHelperTest { @Test public void testParseXacmlPdpResponse() throws URISyntaxException { - PolicyGuardResponse pgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(null); + PolicyGuardResponse pgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(null); assertEquals("Indeterminate", pgResponse.getResult()); Decision decision = Decision.PERMIT; Status status = new StdStatus(StdStatus.STATUS_OK); Result result = new StdResult(decision, status); Response xacmlResponse = new StdResponse(result); - pgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(xacmlResponse); + pgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(xacmlResponse); assertEquals("Permit", pgResponse.getResult()); @@ -193,7 +193,7 @@ public class PolicyGuardXacmlHelperTest { Result fullResult = new StdResult(Decision.DENY, obligationsIn, adviceIn, attributesIn, policyIdentifiersIn, policySetIdentifiersIn); Response fullXacmlResponse = new StdResponse(fullResult); - PolicyGuardResponse fullPgResponse = PolicyGuardXacmlHelper.parseXACMLPDPResponse(fullXacmlResponse); + PolicyGuardResponse fullPgResponse = PolicyGuardXacmlHelper.parseXacmlPdpResponse(fullXacmlResponse); assertEquals("Deny", fullPgResponse.getResult()); } diff --git a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java index 7b5affd32..b4f8c443a 100644 --- a/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java +++ b/controlloop/common/guard/src/test/java/org/onap/policy/guard/PolicyGuardXacmlRequestAttributesTest.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * ================================================================================ - * Modifications Copyright (C) 2018 AT&T. All rights reserved. + * Modifications Copyright (C) 2018-2019 AT&T. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,30 +38,30 @@ public class PolicyGuardXacmlRequestAttributesTest { assertNotNull(attributes); UUID requestId = UUID.randomUUID(); - attributes.setRequestID(requestId.toString()); - assertEquals(requestId.toString(), attributes.getRequestID()); + attributes.setRequestId(requestId.toString()); + assertEquals(requestId.toString(), attributes.getRequestId()); UUID operationId = UUID.randomUUID(); - attributes.setOperationID(operationId.toString()); - assertEquals(operationId.toString(), attributes.getOperationID()); + attributes.setOperationId(operationId.toString()); + assertEquals(operationId.toString(), attributes.getOperationId()); UUID actorId = UUID.randomUUID(); - attributes.setActorID(actorId.toString()); - assertEquals(actorId.toString(), attributes.getActorID()); + attributes.setActorId(actorId.toString()); + assertEquals(actorId.toString(), attributes.getActorId()); UUID targetId = UUID.randomUUID(); - attributes.setTargetID(targetId.toString()); - assertEquals(targetId.toString(), attributes.getTargetID()); + attributes.setTargetId(targetId.toString()); + assertEquals(targetId.toString(), attributes.getTargetId()); - attributes.setTargetID(targetId.toString()); - assertEquals(targetId.toString(), attributes.getTargetID()); + attributes.setTargetId(targetId.toString()); + assertEquals(targetId.toString(), attributes.getTargetId()); UUID controlLoopId = UUID.randomUUID(); - attributes.setClnameID(controlLoopId.toString()); - assertEquals(controlLoopId.toString(), attributes.getClnameID()); + attributes.setClnameId(controlLoopId.toString()); + assertEquals(controlLoopId.toString(), attributes.getClnameId()); - attributes.setClnameID(null); - assertEquals(null, attributes.getClnameID()); + attributes.setClnameId(null); + assertEquals(null, attributes.getClnameId()); Integer vfCount = 20; attributes.setVfCount(vfCount); @@ -70,6 +70,6 @@ public class PolicyGuardXacmlRequestAttributesTest { attributes.setVfCount(null); assertEquals(null, attributes.getVfCount()); - assertEquals("PolicyGuardXacmlRequestAttributes [actorID=", attributes.toString().substring(0, 43)); + assertEquals("PolicyGuardXacmlRequestAttributes [actorId=", attributes.toString().substring(0, 43)); } } diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java index b2beb5548..e58c45b5b 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/CommonHeader.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * appc * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,8 +130,8 @@ public class CommonHeader implements Serializable { @Override public String toString() { - return "CommonHeader [TimeStamp=" + timeStamp + ", APIver=" + apiVer + ", OriginatorID=" + originatorId - + ", RequestID=" + requestId + ", SubrequestID=" + subRequestId + ", RequestTrack=" + requestTrack + return "CommonHeader [TimeStamp=" + timeStamp + ", APIver=" + apiVer + ", OriginatorId=" + originatorId + + ", RequestId=" + requestId + ", SubrequestId=" + subRequestId + ", RequestTrack=" + requestTrack + ", Flags=" + flags + "]"; } diff --git a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java index c25e881a8..cbf5b44d6 100644 --- a/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java +++ b/controlloop/common/model-impl/appc/src/main/java/org/onap/policy/appc/Request.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * appc * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -158,7 +158,7 @@ public class Request implements Serializable { @Override public String toString() { - return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetID=" + targetId + ", ObjectID=" + return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetId=" + targetId + ", ObjectId=" + objectId + ", Payload=" + payload + "]"; } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java index 121b54e5a..a747f8fd6 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,7 +118,7 @@ public class Resource implements Serializable { @Override public String toString() { - return "Resource [resourceUUID=" + resourceUuid + ", resourceInvariantUUID=" + resourceInvariantUuid + return "Resource [resourceUuid=" + resourceUuid + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" + resourceType + "]"; } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java index eaee5a27b..dcf663e64 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,8 +105,8 @@ public class ResourceInstance implements Serializable { @Override public String toString() { return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName - + ", resourceInvariantUUID=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion - + ", resourceType=" + resourceType + ", resourceUUID=" + resourceUuid + "]"; + + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion + + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; } @Override diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java index 4a53ee232..3262d03eb 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoResponseWrapper.java @@ -96,7 +96,7 @@ public class SoResponseWrapper implements Serializable { @Override public String toString() { - return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestID=" + requestId + "]"; + return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestId=" + requestId + "]"; } } diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index 3368e9153..5b012d3b5 100644 --- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -115,7 +115,7 @@ end */ declare ControlLoopTimer closedLoopControlName : String - requestID : String + requestId : String delay : String expired : boolean //timerType is the type of timer: either "ClosedLoop" or "Operation" @@ -231,7 +231,7 @@ rule "${policyName}.EVENT" ControlLoopTimer clTimer = new ControlLoopTimer(); clTimer.setTimerType("ClosedLoop"); clTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - clTimer.setRequestID($event.getRequestId().toString()); + clTimer.setRequestId($event.getRequestId().toString()); clTimer.setDelay(manager.getControlLoopTimeout(1500) + "s"); // // Insert it @@ -287,7 +287,7 @@ rule "${policyName}.EVENT.MANAGER" $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $clTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "ClosedLoop", !expired ) + requestId == $event.getRequestId().toString(), timerType == "ClosedLoop", !expired ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -453,7 +453,7 @@ rule "${policyName}.EVENT.MANAGER" ControlLoopTimer opTimer = new ControlLoopTimer(); opTimer.setTimerType("Operation"); opTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - opTimer.setRequestID($event.getRequestId().toString()); + opTimer.setRequestId($event.getRequestId().toString()); opTimer.setDelay(operation.getOperationTimeout().toString() + "s"); insert(opTimer); @@ -529,9 +529,9 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), "Permit".equalsIgnoreCase(getGuardApprovalStatus()) ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -677,7 +677,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), getGuardApprovalStatus() == "NONE" ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -746,10 +746,10 @@ rule "${policyName}.GUARD.RESPONSE" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $guardResponse : PolicyGuardResponse(requestID == $event.getRequestId(), $operation.policy.recipe == operation) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $guardResponse : PolicyGuardResponse(requestId == $event.getRequestId(), $operation.policy.recipe == operation) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -816,8 +816,8 @@ rule "${policyName}.APPC.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : Response( getCommonHeader().RequestId == $event.getRequestId() ) then @@ -934,8 +934,8 @@ rule "${policyName}.APPC.LCM.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : LcmResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() ) then @@ -1043,8 +1043,8 @@ rule "${policyName}.SDNR.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : PciResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() ) then @@ -1152,8 +1152,8 @@ rule "${policyName}.SO.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then @@ -1240,8 +1240,8 @@ rule "${policyName}.VFC.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1317,8 +1317,8 @@ rule "${policyName}.SDNC.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : SdncResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1408,8 +1408,8 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.TIMEOUT" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), expired, timerType == "Operation" ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), expired, timerType == "Operation" ) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1473,7 +1473,7 @@ rule "${policyName}.EVENT.MANAGER.TIMEOUT" $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $clTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), expired, timerType == "ClosedLoop" ) + requestId == $event.getRequestId().toString(), expired, timerType == "ClosedLoop" ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1516,9 +1516,9 @@ rule "${policyName}.EVENT.MANAGER.CLEANUP" onset.getRequestId() == $requestId ) ) $timers : LinkedList() from collect( ControlLoopTimer( closedLoopControlName == $clName, - requestID == $requestId.toString() ) ) + requestId == $requestId.toString() ) ) $locks : LinkedList() - from collect( TargetLock (requestID == $requestId) ) + from collect( TargetLock (requestId == $requestId) ) not( VirtualControlLoopEvent( closedLoopControlName == $clName, requestId == $requestId ) ) then diff --git a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl index 92fa87559..b0262f989 100644 --- a/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/archetype-cl-casablanca/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl @@ -81,7 +81,7 @@ import org.onap.policy.drools.system.PolicyEngine; */ declare ControlLoopTimer closedLoopControlName : String - requestID : String + requestId : String delay : String expired : boolean //timerType is the type of timer: either "ClosedLoop" or "Operation" @@ -134,7 +134,7 @@ rule "EVENT" VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event); notification.setNotification(ControlLoopNotificationType.REJECTED); notification.setFrom("policy"); - notification.setMessage("Missing requestID"); + notification.setMessage("Missing requestId"); notification.setPolicyName($params.getPolicyName() + "." + drools.getRule().getName()); notification.setPolicyScope($params.getPolicyScope()); notification.setPolicyVersion($params.getPolicyVersion()); @@ -182,7 +182,7 @@ rule "EVENT" ControlLoopTimer clTimer = new ControlLoopTimer(); clTimer.setTimerType("ClosedLoop"); clTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - clTimer.setRequestID($event.getRequestId().toString()); + clTimer.setRequestId($event.getRequestId().toString()); clTimer.setDelay(manager.getControlLoopTimeout(1500) + "s"); // // Insert it @@ -202,7 +202,7 @@ rule "EVENT" // // Now that the manager is inserted into Drools working memory, we'll wait for // another rule to fire in order to continue processing. This way we can also - // then screen for additional ONSET and ABATED events for this RequestID. + // then screen for additional ONSET and ABATED events for this RequestId. // } } catch (Exception e) { @@ -238,7 +238,7 @@ rule "EVENT.MANAGER" $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $clTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "ClosedLoop", !expired ) + requestId == $event.getRequestId().toString(), timerType == "ClosedLoop", !expired ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -331,7 +331,7 @@ rule "EVENT.MANAGER" // don't retract manager, etc. - a clean-up rule will do that // - // TODO - what if we get subsequent Events for this RequestID? + // TODO - what if we get subsequent Events for this RequestId? // By default, it will all start over again. May be confusing for Ruby. // Or, we could track this and then subsequently ignore the events // @@ -401,7 +401,7 @@ rule "EVENT.MANAGER" ControlLoopTimer opTimer = new ControlLoopTimer(); opTimer.setTimerType("Operation"); opTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - opTimer.setRequestID($event.getRequestId().toString()); + opTimer.setRequestId($event.getRequestId().toString()); opTimer.setDelay(operation.getOperationTimeout().toString() + "s"); insert(opTimer); @@ -478,9 +478,9 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), "Permit".equalsIgnoreCase(getGuardApprovalStatus()) ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -627,7 +627,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), getGuardApprovalStatus() == "NONE" ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -696,10 +696,10 @@ rule "GUARD.RESPONSE" requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $guardResponse : PolicyGuardResponse(requestID == $event.getRequestId(), $operation.policy.recipe == operation) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $guardResponse : PolicyGuardResponse(requestId == $event.getRequestId(), $operation.policy.recipe == operation) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -766,8 +766,8 @@ rule "APPC.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : Response( getCommonHeader().RequestId == $event.getRequestId() ) then @@ -846,7 +846,7 @@ end /* * * The problem with Responses is that they don't have a controlLoopControlName -* field in them, so the only way to attach them is via RequestID. If we have multiple +* field in them, so the only way to attach them is via RequestId. If we have multiple * control loop .drl's loaded in the same container, we need to be sure the cleanup * rules don't remove Responses for other control loops. * @@ -884,8 +884,8 @@ rule "APPC.LCM.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : LcmResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() ) then @@ -993,8 +993,8 @@ rule "SO.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then @@ -1081,8 +1081,8 @@ rule "VFC.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1154,8 +1154,8 @@ rule "SDNC.RESPONSE" $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : SdncResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1245,8 +1245,8 @@ rule "EVENT.MANAGER.OPERATION.TIMEOUT" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", expired ) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1310,7 +1310,7 @@ rule "EVENT.MANAGER.TIMEOUT" $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $clTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "ClosedLoop", expired ) + requestId == $event.getRequestId().toString(), timerType == "ClosedLoop", expired ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1353,9 +1353,9 @@ rule "EVENT.MANAGER.CLEANUP" onset.getRequestId() == $requestId ) ) $timers : LinkedList() from collect( ControlLoopTimer( closedLoopControlName == $clName, - requestID == $requestId.toString() ) ) + requestId == $requestId.toString() ) ) $locks : LinkedList() - from collect( TargetLock (requestID == $requestId) ) + from collect( TargetLock (requestId == $requestId) ) not( VirtualControlLoopEvent( closedLoopControlName == $clName, requestId == $requestId ) ) then @@ -1422,8 +1422,8 @@ rule "SDNR.RESPONSE" $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) $opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(), - requestID == $event.getRequestId().toString(), timerType == "Operation", !expired ) - $lock : TargetLock (requestID == $event.getRequestId()) + requestId == $event.getRequestId().toString(), timerType == "Operation", !expired ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : PciResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() ) then diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java index c75c8a0b7..1c4cada61 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,7 +153,7 @@ public class CallGuardTaskEmbedded implements Runnable { // if ("Indeterminate".equals(guardResponse.getResult())) { guardResponse.setOperation(recipe); - guardResponse.setRequestID(UUID.fromString(requestId)); + guardResponse.setRequestId(UUID.fromString(requestId)); } long estimatedTime = System.nanoTime() - startTime; diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java index 64fb70bbd..1e9f3371b 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * guard * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,11 +107,11 @@ public class PolicyGuardXacmlHelperEmbedded { // Build the json request // JSONObject attributes = new JSONObject(); - attributes.put("actor", xacmlReq.getActorID()); - attributes.put("recipe", xacmlReq.getOperationID()); - attributes.put("target", xacmlReq.getTargetID()); - if (xacmlReq.getClnameID() != null) { - attributes.put("clname", xacmlReq.getClnameID()); + attributes.put("actor", xacmlReq.getActorId()); + attributes.put("recipe", xacmlReq.getOperationId()); + attributes.put("target", xacmlReq.getTargetId()); + if (xacmlReq.getClnameId() != null) { + attributes.put("clname", xacmlReq.getClnameId()); } if (xacmlReq.getVfCount() != null) { attributes.put("vfCount", xacmlReq.getVfCount()); diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl index 1cbeac34c..f2584c063 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -109,7 +109,7 @@ end */ declare OperationTimer closedLoopControlName : String - requestID : String + requestId : String delay : String end @@ -118,7 +118,7 @@ end */ declare ControlLoopTimer closedLoopControlName : String - requestID : String + requestId : String delay : String end @@ -229,7 +229,7 @@ rule "${policyName}.EVENT" // ControlLoopTimer clTimer = new ControlLoopTimer(); clTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - clTimer.setRequestID($event.getRequestId().toString()); + clTimer.setRequestId($event.getRequestId().toString()); clTimer.setDelay(manager.getControlLoopTimeout(1500) + "s"); // // Insert it @@ -283,7 +283,7 @@ rule "${policyName}.EVENT.MANAGER" $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" ) $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) - $clTimer : ControlLoopTimer ( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) + $clTimer : ControlLoopTimer ( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -461,7 +461,7 @@ rule "${policyName}.EVENT.MANAGER" // OperationTimer opTimer = new OperationTimer(); opTimer.setClosedLoopControlName($event.getClosedLoopControlName()); - opTimer.setRequestID($event.getRequestId().toString()); + opTimer.setRequestId($event.getRequestId().toString()); opTimer.setDelay(operation.getOperationTimeout().toString() + "s"); insert(opTimer); @@ -535,8 +535,8 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), "Permit".equalsIgnoreCase(getGuardApprovalStatus()) ) - $lock : TargetLock (requestID == $event.getRequestId()) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) + $lock : TargetLock (requestId == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -662,7 +662,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_NOT_YET_QUERIED" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId(), getGuardApprovalStatus() == "NONE" ) - $lock : TargetLock (requestID == $event.getRequestId()) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -724,9 +724,9 @@ rule "${policyName}.GUARD.RESPONSE" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $lock : TargetLock (requestID == $event.getRequestId()) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) - $guardResponse : PolicyGuardResponse(requestID == $event.getRequestId(), $operation.policy.recipe == operation) + $lock : TargetLock (requestId == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) + $guardResponse : PolicyGuardResponse(requestId == $event.getRequestId(), $operation.policy.recipe == operation) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -788,8 +788,8 @@ rule "${policyName}.APPC.RESPONSE" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : Response( getCommonHeader().RequestId == $event.getRequestId() ) then @@ -902,8 +902,8 @@ rule "${policyName}.APPC.LCM.RESPONSE" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : LcmResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() ) then @@ -1007,8 +1007,8 @@ rule "${policyName}.SO.RESPONSE" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : SoResponseWrapper(requestId.toString() == $event.getRequestId().toString() ) then @@ -1091,8 +1091,8 @@ rule "${policyName}.VFC.RESPONSE" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString() ) + $lock : TargetLock (requestId == $event.getRequestId()) $response : VfcResponse( requestId.toString() == $event.getRequestId().toString() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1164,8 +1164,8 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.TIMEOUT" $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.getClosedLoopControlName(), onset.getRequestId() == $event.getRequestId() ) - $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), $to : getDelay() ) - $lock : TargetLock (requestID == $event.getRequestId()) + $opTimer : OperationTimer( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString(), $to : getDelay() ) + $lock : TargetLock (requestId == $event.getRequestId()) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1228,7 +1228,7 @@ rule "${policyName}.EVENT.MANAGER.TIMEOUT" $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" ) $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName() ) $manager : ControlLoopEventManager( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId() ) - $clTimer : ControlLoopTimer ( closedLoopControlName == $event.getClosedLoopControlName(), requestID == $event.getRequestId().toString(), $to : getDelay() ) + $clTimer : ControlLoopTimer ( closedLoopControlName == $event.getClosedLoopControlName(), requestId == $event.getRequestId().toString(), $to : getDelay() ) then Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage()); @@ -1266,13 +1266,13 @@ end rule "${policyName}.EVENT.MANAGER.CLEANUP" when $manager : ControlLoopEventManager( $clName : getClosedLoopControlName(), $requestId : getRequestId() ) - $clTimer : ControlLoopTimer ( closedLoopControlName == $clName, requestID == $requestId.toString() ) + $clTimer : ControlLoopTimer ( closedLoopControlName == $clName, requestId == $requestId.toString() ) $operations : LinkedList() from collect( ControlLoopOperationManager( onset.closedLoopControlName == $clName, onset.getRequestId() == $requestId ) ) $opTimers : LinkedList() - from collect( OperationTimer( closedLoopControlName == $clName, requestID == $requestId.toString() ) ) + from collect( OperationTimer( closedLoopControlName == $clName, requestId == $requestId.toString() ) ) $locks : LinkedList() - from collect( TargetLock (requestID == $requestId) ) + from collect( TargetLock (requestId == $requestId) ) not( VirtualControlLoopEvent( closedLoopControlName == $clName, requestId == $requestId ) ) then |