Do not generate notification in SDNR Actor 68/108568/1
authorJim Hahn <jrh3@att.com>
Fri, 29 May 2020 13:25:04 +0000 (09:25 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 29 May 2020 13:26:49 +0000 (09:26 -0400)
Now that the SDNR Actor populates the operation outcome with the
SDNR response, it no longer needs to populate the notification
structure, as the application (e.g., drools-apps) can now generate
the notification, itself, using the response.

Issue-ID: POLICY-2593
Change-Id: Ie9bed0e59ca750211f17782fa7a2833c2087ac23
Signed-off-by: Jim Hahn <jrh3@att.com>
models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperation.java
models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrOperationTest.java
models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcome.java
models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/OperationOutcomeTest.java

index d0bb38e..6c8f45d 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.policy.controlloop.actor.sdnr;
 
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
-import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.VirtualControlLoopEvent;
 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
 import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation;
@@ -121,45 +120,19 @@ public class SdnrOperation extends BidirectionalTopicOperation<PciMessage, PciMe
         outcome.setResponse(responseWrapper);
 
         if (responseWrapper.getBody() == null || responseWrapper.getBody().getOutput() == null) {
-            outcome.setControlLoopResponse(makeControlLoopResponse(null));
             return setOutcome(outcome, result);
         }
 
         PciResponse pciResponse = responseWrapper.getBody().getOutput();
         if (pciResponse.getStatus() == null || pciResponse.getStatus().getValue() == null) {
-            outcome.setControlLoopResponse(makeControlLoopResponse(pciResponse.getPayload()));
             return setOutcome(outcome, result);
         }
 
         outcome.setResult(result);
         outcome.setMessage(pciResponse.getStatus().getValue());
-        outcome.setControlLoopResponse(makeControlLoopResponse(pciResponse.getPayload()));
         return outcome;
     }
 
-    /**
-     * Converts the SDNR response to a ControlLoopResponse.
-     *
-     * @param responsePayload payload from the response
-     *
-     * @return a new ControlLoopResponse
-     */
-    private ControlLoopResponse makeControlLoopResponse(String responsePayload) {
-        VirtualControlLoopEvent event = params.getContext().getEvent();
-
-        ControlLoopResponse clRsp = new ControlLoopResponse();
-        clRsp.setPayload(responsePayload);
-        clRsp.setFrom(params.getActor());
-        clRsp.setTarget("DCAE");
-        clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
-        clRsp.setPolicyName(event.getPolicyName());
-        clRsp.setPolicyVersion(event.getPolicyVersion());
-        clRsp.setRequestId(event.getRequestId());
-        clRsp.setVersion(event.getVersion());
-
-        return clRsp;
-    }
-
     @Override
     protected PciMessage makeRequest(int attempt) {
         VirtualControlLoopEvent onset = params.getContext().getEvent();
index 370d676..7e9d263 100644 (file)
@@ -36,7 +36,6 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
 import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
 import org.onap.policy.controlloop.actorserviceprovider.controlloop.ControlLoopEventContext;
@@ -136,18 +135,6 @@ public class SdnrOperationTest extends BasicSdnrOperation {
         outcome = operation.start().get();
         assertEquals(PolicyResult.SUCCESS, outcome.getResult());
         assertTrue(outcome.getResponse() instanceof PciMessage);
-
-        ControlLoopResponse clresp = outcome.getControlLoopResponse();
-        assertNotNull(clresp);
-
-        assertEquals(DEFAULT_ACTOR, clresp.getFrom());
-        assertEquals("DCAE", clresp.getTarget());
-        assertEquals(CL_NAME, clresp.getClosedLoopControlName());
-        assertEquals(EVENT_POLICY_NAME, clresp.getPolicyName());
-        assertEquals(EVENT_POLICY_VERSION, clresp.getPolicyVersion());
-        assertEquals(EVENT_VERSION, clresp.getVersion());
-        assertEquals(REQ_ID, clresp.getRequestId());
-        assertNotNull(clresp.getPayload());
     }
 
     @Test
index 0fd2c0b..0c4350c 100644 (file)
@@ -25,7 +25,6 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
 import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.policy.PolicyResult;
 
 /**
@@ -44,7 +43,6 @@ public class OperationOutcome {
     private String message;
     private boolean finalOutcome;
     private Object response;
-    private ControlLoopResponse controlLoopResponse;
 
     /**
      * Copy constructor.
@@ -62,7 +60,6 @@ public class OperationOutcome {
         this.message = source.message;
         this.finalOutcome = source.finalOutcome;
         this.response = source.response;
-        this.controlLoopResponse = source.controlLoopResponse;
     }
 
     /**
index c60a0f0..5820bec 100644 (file)
@@ -30,7 +30,6 @@ import java.time.Instant;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopResponse;
 import org.onap.policy.controlloop.policy.PolicyResult;
 
 public class OperationOutcomeTest {
@@ -44,7 +43,6 @@ public class OperationOutcomeTest {
     private static final String MESSAGE = "my-message";
     private static final String RESPONSE = "my-response";
 
-    private ControlLoopResponse response;
     private OperationOutcome outcome;
 
     /**
@@ -52,8 +50,6 @@ public class OperationOutcomeTest {
      */
     @Before
     public void setUp() {
-        response = new ControlLoopResponse();
-
         outcome = new OperationOutcome();
     }
 
@@ -72,7 +68,6 @@ public class OperationOutcomeTest {
         assertEquals(RESULT, outcome2.getResult());
         assertEquals(MESSAGE, outcome2.getMessage());
         assertSame(RESPONSE, outcome2.getResponse());
-        assertSame(response, outcome2.getControlLoopResponse());
     }
 
     @Test
@@ -145,6 +140,5 @@ public class OperationOutcomeTest {
         outcome.setSubRequestId(SUB_REQ_ID);
         outcome.setTarget(TARGET);
         outcome.setResponse(RESPONSE);
-        outcome.setControlLoopResponse(response);
     }
 }