summaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
authorDaniel Cruz <dc443y@att.com>2019-10-23 18:18:07 -0500
committerJorge Hernandez <jorge.hernandez-herrero@att.com>2019-10-29 13:53:48 +0000
commit25628c56e5fc6b1d6e2e3b761f435fc9596ce1b3 (patch)
tree743e0d540f3ff9a7630caeb74da95b9d874d4ea5 /controlloop
parent1be8ef842916c239ab840cf1d22b3c7d017363cd (diff)
Update APPC LCM Model references
Updates to all references of APPC LCM model code based on changes in policy models for APPC LCM. Issue-ID: POLICY-2043 Change-Id: I0102eb27f449578636cfc0bf22124fa863f05724 Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl12
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java10
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java22
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java80
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java20
-rw-r--r--controlloop/common/feature-controlloop-amsterdam/src/main/feature/config/amsterdam-controller.properties6
-rw-r--r--controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties6
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties6
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json6
-rw-r--r--controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/resources/__closedLoopControlName__.drl14
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java4
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java23
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java24
13 files changed, 120 insertions, 113 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index fb6812a88..b10ffad54 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -46,11 +46,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.CommonHeader;
-import org.onap.policy.appclcm.LcmRequestWrapper;
-import org.onap.policy.appclcm.LcmResponseWrapper;
-import org.onap.policy.appclcm.LcmRequest;
-import org.onap.policy.appclcm.LcmResponse;
-import org.onap.policy.appclcm.LcmCommonHeader;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.cds.CdsResponse;
import org.onap.policy.cds.client.CdsProcessorGrpcClient;
import org.onap.policy.cds.properties.CdsServerProperties;
@@ -585,7 +581,7 @@ rule "EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if (request instanceof Request) {
PolicyEngineConstants.getManager().deliver("APPC-CL", request);
}
- else if (request instanceof LcmRequestWrapper) {
+ else if (request instanceof AppcLcmDmaapWrapper) {
PolicyEngineConstants.getManager().deliver("APPC-LCM-READ", request);
}
break;
@@ -1022,7 +1018,7 @@ rule "APPC.LCM.RESPONSE"
onset.getRequestId() == $event.getRequestId() )
$opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId().toString(), timerType == "Operation", !expired )
- $response : LcmResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() )
+ $response : AppcLcmDmaapWrapper( getBody().getOutput().getCommonHeader().getRequestId() == $event.getRequestId() )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
@@ -1100,7 +1096,7 @@ end
rule "APPC.LCM.RESPONSE.CLEANUP"
when
$params : ControlLoopParams( $clName : getClosedLoopControlName() )
- $response : LcmResponseWrapper($id : getBody().getCommonHeader().getRequestId )
+ $response : AppcLcmDmaapWrapper($id : getBody().getOutput().getCommonHeader().getRequestId() )
not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
then
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
index 62bd0c1e9..87e76c34f 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java
@@ -45,7 +45,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.aai.util.AaiException;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appclcm.LcmResponseWrapper;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.cds.CdsResponse;
import org.onap.policy.controlloop.ControlLoopEvent;
import org.onap.policy.controlloop.ControlLoopException;
@@ -507,11 +507,11 @@ public class ControlLoopOperationManager implements Serializable {
// Cast APPC response and handle it
//
return onResponse((Response) response);
- } else if (response instanceof LcmResponseWrapper) {
+ } else if (response instanceof AppcLcmDmaapWrapper) {
//
// Cast LCM response and handle it
//
- return onResponse((LcmResponseWrapper) response);
+ return onResponse(( AppcLcmDmaapWrapper) response);
} else if (response instanceof PciResponseWrapper) {
//
// Cast SDNR response and handle it
@@ -633,12 +633,12 @@ public class ControlLoopOperationManager implements Serializable {
* @param dmaapResponse the LCM response
* @return The result of the response handling
*/
- private PolicyResult onResponse(LcmResponseWrapper dmaapResponse) {
+ private PolicyResult onResponse(AppcLcmDmaapWrapper dmaapResponse) {
/*
* Parse out the operation attempt using the subrequestid
*/
Integer operationAttempt = AppcLcmActorServiceProvider
- .parseOperationAttempt(dmaapResponse.getBody().getCommonHeader().getSubRequestId());
+ .parseOperationAttempt(dmaapResponse.getBody().getOutput().getCommonHeader().getSubRequestId());
if (operationAttempt == null) {
this.completeOperation(operationAttempt, "Policy was unable to parse APP-C SubRequestID (it was null).",
PolicyResult.FAILURE_EXCEPTION);
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java
index 773299dc2..6a3be2d6a 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/drools/impl/PolicyEngineJUnitImpl.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* policy engine
* ================================================================================
- * 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.
* 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.
@@ -28,7 +28,7 @@ import java.util.Map;
import java.util.Queue;
import org.onap.policy.appc.Request;
-import org.onap.policy.appclcm.LcmRequestWrapper;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.controlloop.ControlLoopNotification;
import org.onap.policy.controlloop.util.Serialization;
import org.onap.policy.drools.PolicyEngine;
@@ -45,7 +45,7 @@ public class PolicyEngineJUnitImpl implements PolicyEngine {
/**
* Adds all objects that implement PolicyEngineListener to the notification list when an event
* occurs.
- *
+ *
* @param listener an object that is interest in knowing about events published to the
* PolicyEngine
*/
@@ -55,7 +55,7 @@ public class PolicyEngineJUnitImpl implements PolicyEngine {
/**
* Notifies all listeners about a new event.
- *
+ *
* @param topic the topic in which the notification was sent to
*/
public void notifyListeners(String topic) {
@@ -75,10 +75,10 @@ public class PolicyEngineJUnitImpl implements PolicyEngine {
if (obj instanceof Request) {
Request request = (Request) obj;
logger.debug("Request: {} subrequest {}", request.getAction(), request.getCommonHeader().getSubRequestId());
- } else if (obj instanceof LcmRequestWrapper) {
- LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) obj;
- logger.debug("Request: {} subrequest {}", dmaapRequest.getBody().getAction(),
- dmaapRequest.getBody().getCommonHeader().getSubRequestId());
+ } else if (obj instanceof AppcLcmDmaapWrapper) {
+ AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) obj;
+ logger.debug("Request: {} subrequest {}", dmaapRequest.getBody().getInput().getAction(),
+ dmaapRequest.getBody().getInput().getCommonHeader().getSubRequestId());
}
//
// Does the bus exist?
@@ -115,7 +115,7 @@ public class PolicyEngineJUnitImpl implements PolicyEngine {
/**
* Subscribe to a topic on a bus.
- *
+ *
* @param busType the bus type
* @param topic the topic
* @return the head of the queue, or <code>null</code> if the queue or bus does not exist or the
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index 914eb7664..480bc290e 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
@@ -50,11 +50,11 @@ import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.ResponseStatus;
-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.AppcLcmBody;
+import org.onap.policy.appclcm.AppcLcmCommonHeader;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.io.Serializer;
import org.onap.policy.controlloop.ControlLoopEventStatus;
@@ -201,20 +201,22 @@ public class ControlLoopOperationManagerTest {
Object request = manager.startOperation(onset);
logger.debug("{}", manager);
assertNotNull(request);
- assertTrue(request instanceof LcmRequestWrapper);
- LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) request;
- LcmRequest appcRequest = dmaapRequest.getBody();
+ assertTrue(request instanceof AppcLcmDmaapWrapper);
+ AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) request;
+ AppcLcmInput appcRequest = dmaapRequest.getBody().getInput();
assertTrue(appcRequest.getCommonHeader().getSubRequestId().contentEquals("1"));
assertFalse(manager.isOperationComplete());
assertTrue(manager.isOperationRunning());
//
// Accept
//
- LcmResponseWrapper dmaapResponse = new LcmResponseWrapper();
- LcmResponse appcResponse = new LcmResponse(appcRequest);
+ AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(100);
appcResponse.getStatus().setMessage(ACCEPT);
- dmaapResponse.setBody(appcResponse);
+ AppcLcmBody outputBody = new AppcLcmBody();
+ outputBody.setOutput(appcResponse);
+ AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper();
+ dmaapResponse.setBody(outputBody);
//
//
//
@@ -226,10 +228,11 @@ public class ControlLoopOperationManagerTest {
//
// Now we are going to Fail it
//
- appcResponse = new LcmResponse(appcRequest);
+ appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(401);
appcResponse.getStatus().setMessage(APPC_FAILURE_REASON);
- dmaapResponse.setBody(appcResponse);
+ outputBody.setOutput(appcResponse);
+ dmaapResponse.setBody(outputBody);
result = manager.onResponse(dmaapResponse);
logger.debug("{}", manager);
assertTrue(result.equals(PolicyResult.FAILURE));
@@ -241,20 +244,21 @@ public class ControlLoopOperationManagerTest {
request = manager.startOperation(onset);
logger.debug("{}", manager);
assertNotNull(request);
- assertTrue(request instanceof LcmRequestWrapper);
- dmaapRequest = (LcmRequestWrapper) request;
- appcRequest = dmaapRequest.getBody();
+ assertTrue(request instanceof AppcLcmDmaapWrapper);
+ dmaapRequest = (AppcLcmDmaapWrapper) request;
+ appcRequest = dmaapRequest.getBody().getInput();
assertTrue(appcRequest.getCommonHeader().getSubRequestId().contentEquals("2"));
assertFalse(manager.isOperationComplete());
assertTrue(manager.isOperationRunning());
//
//
//
- appcResponse = new LcmResponse(appcRequest);
+ appcResponse = new AppcLcmOutput(appcRequest);
logger.debug("{}", manager);
appcResponse.getStatus().setCode(100);
appcResponse.getStatus().setMessage(ACCEPT);
- dmaapResponse.setBody(appcResponse);
+ outputBody.setOutput(appcResponse);
+ dmaapResponse.setBody(outputBody);
//
//
//
@@ -266,10 +270,11 @@ public class ControlLoopOperationManagerTest {
//
// Now we are going to Fail it
//
- appcResponse = new LcmResponse(appcRequest);
+ appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(401);
appcResponse.getStatus().setMessage(APPC_FAILURE_REASON);
- dmaapResponse.setBody(appcResponse);
+ outputBody.setOutput(appcResponse);
+ dmaapResponse.setBody(outputBody);
result = manager.onResponse(dmaapResponse);
logger.debug("{}", manager);
assertTrue(result.equals(PolicyResult.FAILURE));
@@ -323,18 +328,20 @@ public class ControlLoopOperationManagerTest {
Object request = manager.startOperation(onset);
logger.debug("{}", manager);
assertNotNull(request);
- assertTrue((request) instanceof LcmRequestWrapper);
- LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) request;
- LcmRequest appcRequest = dmaapRequest.getBody();
+ assertTrue((request) instanceof AppcLcmDmaapWrapper);
+ AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) request;
+ AppcLcmInput appcRequest = dmaapRequest.getBody().getInput();
assertTrue((appcRequest).getCommonHeader().getSubRequestId().contentEquals("1"));
assertFalse(manager.isOperationComplete());
assertTrue(manager.isOperationRunning());
//
// Accept
//
- LcmResponseWrapper dmaapResponse = new LcmResponseWrapper();
- LcmResponse appcResponse = new LcmResponse(appcRequest);
- dmaapResponse.setBody(appcResponse);
+ AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper();
+ AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest);
+ AppcLcmBody outputBody = new AppcLcmBody();
+ outputBody.setOutput(appcResponse);
+ dmaapResponse.setBody(outputBody);
appcResponse.getStatus().setCode(100);
appcResponse.getStatus().setMessage(ACCEPT);
//
@@ -357,10 +364,11 @@ public class ControlLoopOperationManagerTest {
//
// Now we are going to Fail the previous request
//
- appcResponse = new LcmResponse(appcRequest);
+ appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(401);
appcResponse.getStatus().setMessage(APPC_FAILURE_REASON);
- dmaapResponse.setBody(appcResponse);
+ outputBody.setOutput(appcResponse);
+ dmaapResponse.setBody(outputBody);
manager.onResponse(dmaapResponse);
logger.debug("{}", manager);
//
@@ -671,17 +679,19 @@ public class ControlLoopOperationManagerTest {
responseStatus.setCode(ResponseCode.SUCCESS.getValue());
assertEquals(PolicyResult.SUCCESS, clom.onResponse(appcResponse));
- LcmResponseWrapper lrw = new LcmResponseWrapper();
- LcmResponse body = new LcmResponse();
- LcmCommonHeader lcmCh = new LcmCommonHeader();
- body.setCommonHeader(lcmCh);
- lrw.setBody(body);
+ AppcLcmDmaapWrapper dmaapWrapper = new AppcLcmDmaapWrapper();
+ AppcLcmBody body = new AppcLcmBody();
+ AppcLcmOutput output = new AppcLcmOutput();
+ AppcLcmCommonHeader lcmCh = new AppcLcmCommonHeader();
+ output.setCommonHeader(lcmCh);
+ body.setOutput(output);
+ dmaapWrapper.setBody(body);
lcmCh.setSubRequestId("NotANumber");
- assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(lrw));
+ assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(dmaapWrapper));
lcmCh.setSubRequestId("12345");
- assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(lrw));
+ assertEquals(PolicyResult.FAILURE_EXCEPTION, clom.onResponse(dmaapWrapper));
SoResponse soResponse = new SoResponse();
SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null);
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java
index cc5302f61..3b61faaf2 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/drools/DroolsPolicyEngineTest.java
@@ -8,9 +8,9 @@
* 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.
@@ -27,9 +27,10 @@ import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Request;
-import org.onap.policy.appclcm.LcmCommonHeader;
-import org.onap.policy.appclcm.LcmRequest;
-import org.onap.policy.appclcm.LcmRequestWrapper;
+import org.onap.policy.appclcm.AppcLcmBody;
+import org.onap.policy.appclcm.AppcLcmCommonHeader;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+import org.onap.policy.appclcm.AppcLcmInput;
import org.onap.policy.controlloop.ControlLoopNotification;
import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
@@ -61,10 +62,11 @@ public class DroolsPolicyEngineTest {
request.getCommonHeader().setSubRequestId("12321");
pe.deliver(OMNI_BUS, TOPIC, request);
- LcmRequestWrapper lcmRw = new LcmRequestWrapper();
- lcmRw.setBody(new LcmRequest());
- lcmRw.getBody().setCommonHeader(new LcmCommonHeader());
- lcmRw.getBody().getCommonHeader().setSubRequestId("54321");
+ AppcLcmDmaapWrapper lcmRw = new AppcLcmDmaapWrapper();
+ lcmRw.setBody(new AppcLcmBody());
+ lcmRw.getBody().setInput(new AppcLcmInput());
+ lcmRw.getBody().getInput().setCommonHeader(new AppcLcmCommonHeader());
+ lcmRw.getBody().getInput().getCommonHeader().setSubRequestId("54321");
pe.deliver(OMNI_BUS, TOPIC, lcmRw);
}
diff --git a/controlloop/common/feature-controlloop-amsterdam/src/main/feature/config/amsterdam-controller.properties b/controlloop/common/feature-controlloop-amsterdam/src/main/feature/config/amsterdam-controller.properties
index d769d9af2..1feb7ce60 100644
--- a/controlloop/common/feature-controlloop-amsterdam/src/main/feature/config/amsterdam-controller.properties
+++ b/controlloop/common/feature-controlloop-amsterdam/src/main/feature/config/amsterdam-controller.properties
@@ -37,8 +37,8 @@ dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Seriali
dmaap.source.topics.APPC-CL.servers.https=true
dmaap.source.topics.APPC-LCM-WRITE.servers=${env:DMAAP_SERVERS}
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.LcmResponseWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LcmResponseWrapper.filter=[?($.type == 'response')]
+dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
+dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.source.topics.APPC-LCM-WRITE.https=true
@@ -56,7 +56,7 @@ dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serializa
dmaap.sink.topics.APPC-CL.https=true
dmaap.sink.topics.APPC-LCM-READ.servers=${env:DMAAP_SERVERS}
-dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.LcmRequestWrapper
+dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.sink.topics.APPC-LCM-READ.https=true
diff --git a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
index f4196ccb1..236ff61f9 100644
--- a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
+++ b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties
@@ -37,8 +37,8 @@ dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Seriali
dmaap.source.topics.APPC-CL.https=true
dmaap.source.topics.APPC-LCM-WRITE.servers=${env:DMAAP_SERVERS}
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.LcmResponseWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LcmResponseWrapper.filter=[?($.type == 'response')]
+dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
+dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.source.topics.APPC-LCM-WRITE.https=true
@@ -50,7 +50,7 @@ dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serializa
dmaap.sink.topics.APPC-CL.https=true
dmaap.sink.topics.APPC-LCM-READ.servers=${env:DMAAP_SERVERS}
-dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.LcmRequestWrapper
+dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.sink.topics.APPC-LCM-READ.https=true
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
index edb828676..b43c3b244 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.properties
@@ -41,8 +41,8 @@ dmaap.source.topics.APPC-CL.https=true
dmaap.source.topics.APPC-LCM-WRITE.servers=${dmaapServers}
dmaap.source.topics.APPC-LCM-WRITE.apiKey=
dmaap.source.topics.APPC-LCM-WRITE.apiSecret=
-dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.LcmResponseWrapper
-dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LcmResponseWrapper.filter=[?($.type == 'response')]
+dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
+dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')]
dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
dmaap.source.topics.APPC-LCM-WRITE.https=true
@@ -65,7 +65,7 @@ noop.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serializat
noop.sink.topics.APPC-LCM-READ.servers=${dmaapServers}
noop.sink.topics.APPC-LCM-READ.apiKey=
noop.sink.topics.APPC-LCM-READ.apiSecret=
-noop.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.LcmRequestWrapper
+noop.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper
noop.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson
noop.sink.topics.POLICY-CL-MGT.servers=${dmaapServers}
diff --git a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
index 0dda5d41b..53843b1db 100644
--- a/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
+++ b/controlloop/templates/archetype-cl-amsterdam/src/main/resources/archetype-resources/src/main/config/__artifactId__-controller.rest.json
@@ -14,8 +14,8 @@
"ueb.source.topics.APPC-CL.events.custom.gson": "org.onap.policy.appc.util.Serialization,gsonPretty",
"ueb.source.topics.APPC-LCM-WRITE.servers": "${dmaapServers}",
- "ueb.source.topics.APPC-LCM-WRITE.events": "org.onap.policy.appclcm.LcmResponseWrapper",
- "ueb.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.LcmResponseWrapper.filter": "[?($.type == 'response')]",
+ "ueb.source.topics.APPC-LCM-WRITE.events": "org.onap.policy.appclcm.AppcLcmDmaapWrapper",
+ "ueb.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter": "[?($.type == 'response')]",
"ueb.source.topics.APPC-LCM-WRITE.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
"ueb.source.topics.SDNR-CL-RSP.servers": "${dmaapServers}",
@@ -30,7 +30,7 @@
"noop.sink.topics.APPC-CL.events.custom.gson": "org.onap.policy.appc.util.Serialization,gsonPretty",
"noop.sink.topics.APPC-LCM-READ.servers": "${dmaapServers}",
- "noop.sink.topics.APPC-LCM-READ.events": "org.onap.policy.appclcm.LcmRequestWrapper",
+ "noop.sink.topics.APPC-LCM-READ.events": "org.onap.policy.appclcm.AppcLcmDmaapWrapper",
"noop.sink.topics.APPC-LCM-READ.events.custom.gson": "org.onap.policy.appclcm.util.Serialization,gson",
"noop.sink.topics.POLICY-CL-MGT.servers": "${dmaapServers}",
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 cfd1877b1..91fc22285 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
@@ -44,11 +44,7 @@ import org.onap.policy.aai.AaiCqResponse;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.CommonHeader;
-import org.onap.policy.appclcm.LcmRequestWrapper;
-import org.onap.policy.appclcm.LcmResponseWrapper;
-import org.onap.policy.appclcm.LcmRequest;
-import org.onap.policy.appclcm.LcmResponse;
-import org.onap.policy.appclcm.LcmCommonHeader;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
import org.onap.policy.cds.CdsResponse;
import org.onap.policy.cds.client.CdsProcessorGrpcClient;
import org.onap.policy.cds.properties.CdsServerProperties;
@@ -600,7 +596,7 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if (request instanceof Request) {
PolicyEngineConstants.getManager().deliver("APPC-CL", request);
}
- else if (request instanceof LcmRequestWrapper) {
+ else if (request instanceof AppcLcmDmaapWrapper) {
PolicyEngineConstants.getManager().deliver("APPC-LCM-READ", request);
}
break;
@@ -1041,7 +1037,7 @@ rule "${policyName}.APPC.LCM.RESPONSE"
onset.getRequestId() == $event.getRequestId() )
$opTimer : ControlLoopTimer( closedLoopControlName == $event.getClosedLoopControlName(),
requestId == $event.getRequestId().toString(), timerType == "Operation", !expired )
- $response : LcmResponseWrapper( getBody().getCommonHeader().getRequestId() == $event.getRequestId() )
+ $response : AppcLcmDmaapWrapper( getBody().getOutput().getCommonHeader().getRequestId() == $event.getRequestId() )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
@@ -1119,8 +1115,8 @@ end
rule "${policyName}.APPC.LCM.RESPONSE.CLEANUP"
when
$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
- $response : LcmResponseWrapper($id : getBody().getCommonHeader().getRequestId )
- not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
+ $response : AppcLcmDmaapWrapper($id : getBody().getOutput().getCommonHeader().getRequestId() )
+ not ( VirtualControlLoopEvent( requestId == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
then
Logger logger = LoggerFactory.getLogger(drools.getRule().getPackage());
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java
index 716452f73..a311ba0b0 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java
@@ -96,7 +96,7 @@ public class ControlLoopBase {
Properties noopSinkProperties = new Properties();
noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS,
"APPC-LCM-READ,APPC-CL,SDNR-CL,POLICY-CL-MGT");
- noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events", "org.onap.policy.appclcm.LcmRequestWrapper");
+ noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events", "org.onap.policy.appclcm.AppcLcmDmaapWrapper");
noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events.custom.gson",
"org.onap.policy.appclcm.util.Serialization,gson");
noopSinkProperties.put("noop.sink.topics.APPC-CL.events", "org.onap.policy.appc.Response");
@@ -119,7 +119,7 @@ public class ControlLoopBase {
.groupId(JUNIT_GROUP_ID)
.artifactId(JUNIT_ARTIFACT_ID)
.topic("APPC-LCM-READ")
- .eventClass("org.onap.policy.appclcm.LcmRequestWrapper")
+ .eventClass("org.onap.policy.appclcm.AppcLcmDmaapWrapper")
.protocolFilter(new JsonProtocolFilter())
.modelClassLoaderHash(1111));
EventProtocolCoderConstants.getManager().addEncoder(EventProtocolParams.builder()
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
index db5da1e4a..1647fa0e1 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java
@@ -30,10 +30,10 @@ import java.util.HashMap;
import java.util.UUID;
import org.junit.BeforeClass;
import org.junit.Test;
-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.AppcLcmBody;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
@@ -155,7 +155,7 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList
org.onap.policy.controlloop.VirtualControlLoopNotification.class);
} else if ("APPC-LCM-READ".equals(topic)) {
obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event,
- org.onap.policy.appclcm.LcmRequestWrapper.class);
+ org.onap.policy.appclcm.AppcLcmDmaapWrapper.class);
}
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
@@ -222,12 +222,12 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
}
- } else if (obj instanceof LcmRequestWrapper) {
+ } else if (obj instanceof AppcLcmDmaapWrapper) {
/*
* The request should be of type LCMRequestWrapper and the subrequestid should be 1
*/
- LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) obj;
- LcmRequest appcRequest = dmaapRequest.getBody();
+ AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) obj;
+ AppcLcmInput appcRequest = dmaapRequest.getBody().getInput();
assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1"));
logger.debug("\n============ APPC received the request!!! ===========\n");
@@ -235,11 +235,12 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList
/*
* Simulate a success response from APPC and insert the response into the working memory
*/
- LcmResponseWrapper dmaapResponse = new LcmResponseWrapper();
- LcmResponse appcResponse = new LcmResponse(appcRequest);
+ AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper();
+ AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(400);
appcResponse.getStatus().setMessage("AppC success");
- dmaapResponse.setBody(appcResponse);
+ dmaapResponse.setBody(new AppcLcmBody());
+ dmaapResponse.getBody().setOutput(appcResponse);
/*
* Interrupting with a different request for the same target entity to check if lock
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
index 7d5a4f3a8..57085f614 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java
@@ -30,10 +30,10 @@ import java.util.HashMap;
import java.util.UUID;
import org.junit.BeforeClass;
import org.junit.Test;
-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.AppcLcmBody;
+import org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+import org.onap.policy.appclcm.AppcLcmInput;
+import org.onap.policy.appclcm.AppcLcmOutput;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
@@ -155,7 +155,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
org.onap.policy.controlloop.VirtualControlLoopNotification.class);
} else if ("APPC-LCM-READ".equals(topic)) {
obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event,
- org.onap.policy.appclcm.LcmRequestWrapper.class);
+ org.onap.policy.appclcm.AppcLcmDmaapWrapper.class);
}
assertNotNull(obj);
if (obj instanceof VirtualControlLoopNotification) {
@@ -205,12 +205,12 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
logger.debug("The control loop timed out");
fail("Control Loop Timed Out");
}
- } else if (obj instanceof LcmRequestWrapper) {
+ } else if (obj instanceof AppcLcmDmaapWrapper) {
/*
* The request should be of type LcmRequestWrapper and the subrequestid should be 1
*/
- LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) obj;
- LcmRequest appcRequest = dmaapRequest.getBody();
+ AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) obj;
+ AppcLcmInput appcRequest = dmaapRequest.getBody().getInput();
assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1"));
assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id"));
@@ -219,11 +219,13 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene
/*
* Simulate a success response from APPC and insert the response into the working memory
*/
- LcmResponseWrapper dmaapResponse = new LcmResponseWrapper();
- LcmResponse appcResponse = new LcmResponse(appcRequest);
+ AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper();
+ AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest);
appcResponse.getStatus().setCode(400);
appcResponse.getStatus().setMessage("AppC success");
- dmaapResponse.setBody(appcResponse);
+ dmaapResponse.setBody(new AppcLcmBody());
+ dmaapResponse.getBody().setOutput(appcResponse);
+
kieSession.insert(dmaapResponse);
}
}