summaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors/actor.appclcm
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/actors/actor.appclcm')
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java42
-rw-r--r--controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java44
2 files changed, 43 insertions, 43 deletions
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index 0db66c5af..c370f153f 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -39,12 +39,12 @@ import org.onap.policy.aai.AaiNqQueryParameters;
import org.onap.policy.aai.AaiNqRequest;
import org.onap.policy.aai.AaiNqResponse;
import org.onap.policy.aai.util.AaiException;
-import org.onap.policy.appclcm.LCMCommonHeader;
-import org.onap.policy.appclcm.LCMRequest;
-import org.onap.policy.appclcm.LCMRequestWrapper;
-import org.onap.policy.appclcm.LCMResponse;
-import org.onap.policy.appclcm.LCMResponseCode;
-import org.onap.policy.appclcm.LCMResponseWrapper;
+import org.onap.policy.appclcm.LcmCommonHeader;
+import org.onap.policy.appclcm.LcmRequest;
+import org.onap.policy.appclcm.LcmRequestWrapper;
+import org.onap.policy.appclcm.LcmResponse;
+import org.onap.policy.appclcm.LcmResponseCode;
+import org.onap.policy.appclcm.LcmResponseWrapper;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
@@ -187,7 +187,7 @@ public class AppcLcmActorServiceProvider implements Actor {
* Policy GUI/API
* @return an APPC request conforming to the lcm API using the DMAAP wrapper
*/
- public static LCMRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
+ public static LcmRequestWrapper constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation,
Policy policy, String targetVnf) {
/* Construct an APPC request using LCM Model */
@@ -196,19 +196,19 @@ public class AppcLcmActorServiceProvider implements Actor {
* The actual LCM request is placed in a wrapper used to send through dmaap. The current
* version is 2.0 as of R1.
*/
- LCMRequestWrapper dmaapRequest = new LCMRequestWrapper();
+ LcmRequestWrapper dmaapRequest = new LcmRequestWrapper();
dmaapRequest.setVersion("2.0");
- dmaapRequest.setCorrelationId(onset.getRequestID() + "-" + operation.getSubRequestId());
+ dmaapRequest.setCorrelationId(onset.getRequestId() + "-" + operation.getSubRequestId());
dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
dmaapRequest.setType("request");
/* This is the actual request that is placed in the dmaap wrapper. */
- final LCMRequest appcRequest = new LCMRequest();
+ final LcmRequest appcRequest = new LcmRequest();
/* The common header is a required field for all APPC requests. */
- LCMCommonHeader requestCommonHeader = new LCMCommonHeader();
- requestCommonHeader.setOriginatorId(onset.getRequestID().toString());
- requestCommonHeader.setRequestId(onset.getRequestID());
+ LcmCommonHeader requestCommonHeader = new LcmCommonHeader();
+ requestCommonHeader.setOriginatorId(onset.getRequestId().toString());
+ requestCommonHeader.setRequestId(onset.getRequestId());
requestCommonHeader.setSubRequestId(operation.getSubRequestId());
appcRequest.setCommonHeader(requestCommonHeader);
@@ -276,9 +276,9 @@ public class AppcLcmActorServiceProvider implements Actor {
*
* @return an key-value pair that contains the Policy result and APPC response message
*/
- public static SimpleEntry<PolicyResult, String> processResponse(LCMResponseWrapper dmaapResponse) {
+ public static SimpleEntry<PolicyResult, String> processResponse(LcmResponseWrapper dmaapResponse) {
/* The actual APPC response is inside the wrapper's body field. */
- LCMResponse appcResponse = dmaapResponse.getBody();
+ LcmResponse appcResponse = dmaapResponse.getBody();
/* The message returned in the APPC response. */
String message;
@@ -293,7 +293,7 @@ public class AppcLcmActorServiceProvider implements Actor {
}
/* If there is no code, Policy cannot determine if the request was successful. */
- String responseValue = LCMResponseCode.toResponseValue(appcResponse.getStatus().getCode());
+ String responseValue = LcmResponseCode.toResponseValue(appcResponse.getStatus().getCode());
if (responseValue == null) {
message = "Policy was unable to parse APP-C response status code field.";
return new AbstractMap.SimpleEntry<>(PolicyResult.FAILURE_EXCEPTION, message);
@@ -304,18 +304,18 @@ public class AppcLcmActorServiceProvider implements Actor {
/* Maps the APPC response result to a Policy result. */
switch (responseValue) {
- case LCMResponseCode.ACCEPTED:
+ case LcmResponseCode.ACCEPTED:
/* Nothing to do if code is accept, continue processing */
result = null;
break;
- case LCMResponseCode.SUCCESS:
+ case LcmResponseCode.SUCCESS:
result = PolicyResult.SUCCESS;
break;
- case LCMResponseCode.FAILURE:
+ case LcmResponseCode.FAILURE:
result = PolicyResult.FAILURE;
break;
- case LCMResponseCode.REJECT:
- case LCMResponseCode.ERROR:
+ case LcmResponseCode.REJECT:
+ case LcmResponseCode.ERROR:
default:
result = PolicyResult.FAILURE_EXCEPTION;
}
diff --git a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
index 72d43d318..4fb6ac4b9 100644
--- a/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
+++ b/controlloop/common/actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmServiceProviderTest.java
@@ -33,11 +33,11 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.aai.util.AaiException;
-import org.onap.policy.appclcm.LCMCommonHeader;
-import org.onap.policy.appclcm.LCMRequest;
-import org.onap.policy.appclcm.LCMRequestWrapper;
-import org.onap.policy.appclcm.LCMResponse;
-import org.onap.policy.appclcm.LCMResponseWrapper;
+import org.onap.policy.appclcm.LcmCommonHeader;
+import org.onap.policy.appclcm.LcmRequest;
+import org.onap.policy.appclcm.LcmRequestWrapper;
+import org.onap.policy.appclcm.LcmResponse;
+import org.onap.policy.appclcm.LcmResponseWrapper;
import org.onap.policy.controlloop.ControlLoopEventStatus;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.ControlLoopTargetType;
@@ -59,8 +59,8 @@ public class AppcLcmServiceProviderTest {
private static VirtualControlLoopEvent onsetEvent;
private static ControlLoopOperation operation;
private static Policy policy;
- private static LCMRequestWrapper dmaapRequest;
- private static LCMResponseWrapper dmaapResponse;
+ private static LcmRequestWrapper dmaapRequest;
+ private static LcmResponseWrapper dmaapResponse;
static {
/*
@@ -69,14 +69,14 @@ public class AppcLcmServiceProviderTest {
*/
onsetEvent = new VirtualControlLoopEvent();
onsetEvent.setClosedLoopControlName("closedLoopControlName-Test");
- onsetEvent.setRequestID(UUID.randomUUID());
+ onsetEvent.setRequestId(UUID.randomUUID());
onsetEvent.setClosedLoopEventClient("tca.instance00001");
onsetEvent.setTargetType(ControlLoopTargetType.VM);
onsetEvent.setTarget("generic-vnf.vnf-name");
onsetEvent.setFrom("DCAE");
onsetEvent.setClosedLoopAlarmStart(Instant.now());
- onsetEvent.setAAI(new HashMap<>());
- onsetEvent.getAAI().put("generic-vnf.vnf-name", "fw0001vm001fw001");
+ onsetEvent.setAai(new HashMap<>());
+ onsetEvent.getAai().put("generic-vnf.vnf-name", "fw0001vm001fw001");
onsetEvent.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
/* Construct an operation with an APPC actor and restart operation. */
@@ -99,14 +99,14 @@ public class AppcLcmServiceProviderTest {
policy.setTimeout(300);
/* A sample DMAAP request wrapper. */
- dmaapRequest = new LCMRequestWrapper();
- dmaapRequest.setCorrelationId(onsetEvent.getRequestID().toString() + "-" + "1");
+ dmaapRequest = new LcmRequestWrapper();
+ dmaapRequest.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1");
dmaapRequest.setRpcName(policy.getRecipe().toLowerCase());
dmaapRequest.setType("request");
/* A sample DMAAP response wrapper */
- dmaapResponse = new LCMResponseWrapper();
- dmaapResponse.setCorrelationId(onsetEvent.getRequestID().toString() + "-" + "1");
+ dmaapResponse = new LcmResponseWrapper();
+ dmaapResponse.setCorrelationId(onsetEvent.getRequestId().toString() + "-" + "1");
dmaapResponse.setRpcName(policy.getRecipe().toLowerCase());
dmaapResponse.setType("response");
@@ -116,7 +116,7 @@ public class AppcLcmServiceProviderTest {
PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
/* A sample APPC LCM request. */
- LCMRequest appcRequest = new LCMRequest();
+ LcmRequest appcRequest = new LcmRequest();
/* The following code constructs a sample APPC LCM Request */
appcRequest.setAction("restart");
@@ -126,10 +126,10 @@ public class AppcLcmServiceProviderTest {
appcRequest.setActionIdentifiers(actionIdentifiers);
- LCMCommonHeader commonHeader = new LCMCommonHeader();
- commonHeader.setRequestId(onsetEvent.getRequestID());
+ LcmCommonHeader commonHeader = new LcmCommonHeader();
+ commonHeader.setRequestId(onsetEvent.getRequestId());
commonHeader.setSubRequestId("1");
- commonHeader.setOriginatorId(onsetEvent.getRequestID().toString());
+ commonHeader.setOriginatorId(onsetEvent.getRequestId().toString());
appcRequest.setCommonHeader(commonHeader);
@@ -138,7 +138,7 @@ public class AppcLcmServiceProviderTest {
dmaapRequest.setBody(appcRequest);
/* The following code constructs a sample APPC LCM Response */
- LCMResponse appcResponse = new LCMResponse(appcRequest);
+ LcmResponse appcResponse = new LcmResponse(appcRequest);
appcResponse.getStatus().setCode(400);
appcResponse.getStatus().setMessage("Restart Successful");
@@ -171,7 +171,7 @@ public class AppcLcmServiceProviderTest {
@Test
public void constructRestartRequestTest() {
- LCMRequestWrapper dmaapRequest =
+ LcmRequestWrapper dmaapRequest =
AppcLcmActorServiceProvider.constructRequest(onsetEvent, operation, policy, "vnf01");
/* The service provider must return a non null DMAAP request wrapper */
@@ -183,11 +183,11 @@ public class AppcLcmServiceProviderTest {
/* The DMAAP wrapper's body field cannot be null */
assertNotNull(dmaapRequest.getBody());
- LCMRequest appcRequest = dmaapRequest.getBody();
+ LcmRequest appcRequest = dmaapRequest.getBody();
/* A common header is required and cannot be null */
assertNotNull(appcRequest.getCommonHeader());
- assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestID());
+ assertEquals(appcRequest.getCommonHeader().getRequestId(), onsetEvent.getRequestId());
/* An action is required and cannot be null */
assertNotNull(appcRequest.getAction());