diff options
Diffstat (limited to 'controlloop/templates')
6 files changed, 38 insertions, 39 deletions
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); } } |