Modify payload for ANR closedloop to align with A1 based action
[dcaegen2/services/son-handler.git] / src / main / java / org / onap / dcaegen2 / services / sonhms / child / ChildThreadUtils.java
index 6b60992..61653cf 100644 (file)
@@ -2,21 +2,21 @@
  *  ============LICENSE_START=======================================================
  *  son-handler
  *  ================================================================================
- *   Copyright (C) 2019-2021 Wipro Limited.
+ *   Copyright (C) 2019-2022 Wipro Limited.
  *   ==============================================================================
  *     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.
  *     See the License for the specific language governing permissions and
  *     limitations under the License.
  *     ============LICENSE_END=========================================================
- *  
+ *
  *******************************************************************************/
 
 package org.onap.dcaegen2.services.sonhms.child;
@@ -124,8 +124,10 @@ public class ChildThreadUtils {
             String action) {
 
         String closedLoopControlName = "";
-        if (action.equals("ModifyConfig")) {
-            closedLoopControlName = "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459";
+        String policyName = "";
+        if (action.equals("ModifyO1Config")) {
+            closedLoopControlName = "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459";
+            policyName = "SONO1";
             try {
                 closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIG_POLICY_NAME");
             } catch (NullPointerException e) {
@@ -133,7 +135,8 @@ public class ChildThreadUtils {
             }
         }
         else {
-            closedLoopControlName = "ControlLoop-vSONH-7d4baf04-8875-4d1f-946d-06b874048b61";
+            closedLoopControlName = "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61";
+            policyName = "SONA1";
             try {
                 closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIGANR_POLICY_NAME");
             } catch (NullPointerException e) {
@@ -142,10 +145,11 @@ public class ChildThreadUtils {
         }
 
         PolicyNotification policyNotification = new PolicyNotification(closedLoopControlName, requestId, alarmStartTime,
-                pnfName, action);
+                pnfName, action, policyName);
 
         policyNotification.setClosedLoopControlName(closedLoopControlName);
         policyNotification.setPayload(payloadString);
+        policyNotification.setPolicyName(policyName);
         ObjectMapper mapper = new ObjectMapper();
         mapper.setSerializationInclusion(Include.NON_NULL);
 
@@ -200,7 +204,7 @@ public class ChildThreadUtils {
                 String requestId = UUID.randomUUID().toString();
 
                 String notification = getNotificationString(pnfName, requestId, payloadString,
-                        System.currentTimeMillis(), "ModifyConfig");
+                        System.currentTimeMillis(), "ModifyO1Config");
                 log.info("Policy Notification: {}", notification);
                 boolean status = policyDmaapClient.sendNotificationToPolicy(notification);
                 log.debug("sent Message: {}", status);
@@ -271,7 +275,7 @@ public class ChildThreadUtils {
                     }
                     String requestId = UUID.randomUUID().toString();
                     String notification = getNotificationString(pnfName, requestId, payloadString,
-                            System.currentTimeMillis(), "ModifyConfigANR");
+                            System.currentTimeMillis(), "ModifyA1Policy");
                     log.info("Policy Notification: {}", notification);
                     Boolean result = policyDmaapClient.sendNotificationToPolicy(notification);
                     log.info("send notification to policy result {} ", result);