summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.sdnr/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-08 17:11:37 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-04-08 17:11:43 -0400
commitf95ba842b148c6f31ca528a2e22498ee2885ad47 (patch)
tree761822bd79c002c31b566cad623e1ae3caec9f00 /models-interactions/model-actors/actor.sdnr/src/main
parenta32b49c3ec54e5f3bf23634a5fb538909905f8e6 (diff)
Code changes for OOF SON Use Case
Companian review to https://gerrit.onap.org/r/#/c/84361/ Issue-ID: POLICY-1463 Change-Id: I2640f01c07890a4b1e8938175b637b84dcc19f3c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnr/src/main')
-rw-r--r--models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
index 24db0bd3e..32346bfa2 100644
--- a/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.sdnr/src/main/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProvider.java
@@ -3,7 +3,7 @@
* SdnrActorServiceProvider
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * 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.
@@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.List;
import org.onap.policy.controlloop.ControlLoopOperation;
+import org.onap.policy.controlloop.ControlLoopResponse;
import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.policy.Policy;
@@ -69,6 +70,7 @@ public class SdnrActorServiceProvider implements Actor {
// Strings for recipes
private static final String RECIPE_MODIFY = "ModifyConfig";
+ private static final String RECIPE_MODIFY_ANR = "ModifyConfigANR";
/* To be used in future releases when pci ModifyConfig is used */
private static final String SDNR_REQUEST_PARAMS = "request-parameters";
@@ -253,4 +255,37 @@ public class SdnrActorServiceProvider implements Actor {
}
return new SdnrActorServiceProvider.Pair<>(result, message);
}
+
+ /**
+ * Converts the SDNR response to ControlLoopResponse object.
+ *
+ * @param dmaapResponse
+ * the dmaap wrapper message that contains the actual SDNR reponse
+ * inside the body field
+ *
+ * @return a ControlLoopResponse object to send to DCAE_CL_RSP topic
+ */
+ public static ControlLoopResponse getControlLoopResponse(PciResponseWrapper dmaapResponse,
+ VirtualControlLoopEvent event) {
+
+ logger.info("SDNR getClosedLoopResponse called : {} {}", dmaapResponse, event);
+
+ /* The actual SDNR response is inside the wrapper's body field. */
+ PciResponse sdnrResponse = dmaapResponse.getBody();
+
+ /* The ControlLoop response determined from the SDNR Response and input event. */
+ ControlLoopResponse clRsp = new ControlLoopResponse();
+ clRsp.setPayload(sdnrResponse.getPayload());
+ clRsp.setFrom("SDNR");
+ clRsp.setTarget("DCAE");
+ clRsp.setClosedLoopControlName(event.getClosedLoopControlName());
+ clRsp.setPolicyName(event.getPolicyName());
+ clRsp.setPolicyVersion(event.getPolicyVersion());
+ clRsp.setRequestId(event.getRequestId());
+ clRsp.setVersion(event.getVersion());
+ logger.info("SDNR getClosedLoopResponse clRsp : {}", clRsp);
+
+ return clRsp;
+ }
+
}