exchanging new version yang models on firmware upgrade
[oam/tr069-adapter.git] / mapper / src / main / java / org / commscope / tr069adapter / mapper / acs / impl / ACSNotificationHandlerImpl.java
index b6adad7..4d39d57 100644 (file)
@@ -36,7 +36,6 @@ import org.commscope.tr069adapter.mapper.MapperConfigProperties;
 import org.commscope.tr069adapter.mapper.acs.ACSNotificationHandler;\r
 import org.commscope.tr069adapter.mapper.dao.DeviceOperationsDAO;\r
 import org.commscope.tr069adapter.mapper.entity.DeviceOperationDetails;\r
-import org.commscope.tr069adapter.mapper.model.NetConfNotificationDTO;\r
 import org.commscope.tr069adapter.mapper.model.NetConfServerDetails;\r
 import org.commscope.tr069adapter.mapper.model.NetconfServerManagementError;\r
 import org.commscope.tr069adapter.mapper.netconf.NetConfNotificationSender;\r
@@ -118,30 +117,38 @@ public class ACSNotificationHandlerImpl implements ACSNotificationHandler {
       vesnotiSender.sendNotification(bootstrapNotification, serverInfo);\r
       BootstrapInform bsInform =\r
           getDeviceBootStrapNotification(bootstrapNotification, TR069InformType.BOOTSTRAP);\r
+      ValueChangeInform vcInform = null;\r
       if (bootstrapNotification.getValueChangeNotification() != null) {\r
         logger.info("Bootstrap notification received along with VC");\r
-        ValueChangeInform vcInform =\r
+        vcInform =\r
             getDeviceValueChangeNotification(bootstrapNotification, TR069InformType.VALUECHANGE);\r
         processVCNotification(vcInform, isAlarmVC);\r
       }\r
       notiSender.sendNotification(bsInform);\r
+      if (vcInform != null)\r
+        processVCNotification(vcInform, isAlarmVC);\r
     } else if (notification instanceof BootInform) {\r
       logger.info("Boot notification received");\r
+\r
+      NetConfServerDetails serverInfo = createNtConfServer(notification);\r
+      if (serverInfo == null)\r
+        return;\r
+\r
       checkForActivateNotification(notification);\r
       BootInform bootNotification = (BootInform) notification;\r
       BootInform bInform = getDeviceBootNotification(bootNotification, TR069InformType.BOOT);\r
+      ValueChangeInform vcInform = null;\r
       if (bootNotification.getValueChangeNotification() != null) {\r
         logger.info("Boot notification received along with VC");\r
-        ValueChangeInform vcInform =\r
-            getDeviceValueChangeNotification(bootNotification, TR069InformType.VALUECHANGE);\r
-        processVCNotification(vcInform, isAlarmVC);\r
+        vcInform = getDeviceValueChangeNotification(bootNotification, TR069InformType.VALUECHANGE);\r
       }\r
       notiSender.sendNotification(bInform);\r
+      processVCNotification(vcInform, isAlarmVC);\r
     } else if (notification instanceof PeriodicInform) {\r
       PeriodicInform pINotificaiton = (PeriodicInform) notification;\r
       vesnotiSender.sendNotification(pINotificaiton, null);\r
       notiSender.sendNotification(pINotificaiton);\r
-      logger.info("VC notification received");\r
+      logger.info("PI notification received");\r
     } else if (notification instanceof ConnectionRequestInform) {\r
       ConnectionRequestInform crNotificaiton = (ConnectionRequestInform) notification;\r
       vesnotiSender.sendNotification(crNotificaiton, null);\r
@@ -162,21 +169,20 @@ public class ACSNotificationHandlerImpl implements ACSNotificationHandler {
     pnpPreProvisioningHandler.onDeviceNotification(notification);\r
   }\r
 \r
-  private NetConfServerDetails createNtConfServer(BootstrapInform bootstrapNotification) {\r
+  private NetConfServerDetails createNtConfServer(DeviceInform inform) {\r
     String eNodeBName = pnpPreProvisioningHandler.getEnodeBName(\r
-        bootstrapNotification.getDeviceDetails().getDeviceId(),\r
-        bootstrapNotification.getDeviceDetails().getSoftwareVersion(),\r
-        bootstrapNotification.getDeviceDetails().getHardwareVersion());\r
+        inform.getDeviceDetails().getDeviceId(), inform.getDeviceDetails().getSoftwareVersion(),\r
+        inform.getDeviceDetails().getHardwareVersion());\r
     if (eNodeBName == null)\r
-      eNodeBName = bootstrapNotification.getDeviceDetails().getDeviceId();\r
+      eNodeBName = inform.getDeviceDetails().getDeviceId();\r
     NetConfServerDetails serverInfo =\r
-        netconfManager.createNetconfServer(bootstrapNotification.getDeviceDetails().getDeviceId(),\r
-            eNodeBName, bootstrapNotification.getDeviceDetails().getSoftwareVersion(),\r
-            bootstrapNotification.getDeviceDetails().getHardwareVersion());\r
+        netconfManager.createNetconfServer(inform.getDeviceDetails().getDeviceId(), eNodeBName,\r
+            inform.getDeviceDetails().getSoftwareVersion(),\r
+            inform.getDeviceDetails().getHardwareVersion());\r
     if (serverInfo != null && !NetconfServerManagementError.SUCCESS.equals(serverInfo.getError())) {\r
-      logger.error("Failed to handle bootstrap notification. Server INFO: {}", serverInfo);\r
+      logger.error("Failed to handle boot/bootstrap notification. Server INFO: {}", serverInfo);\r
       logger.error("Failed to create the netconf server for device ID: {}  Error: {}",\r
-          bootstrapNotification.getDeviceDetails().getDeviceId(), serverInfo.getError());\r
+          inform.getDeviceDetails().getDeviceId(), serverInfo.getError());\r
       return null;\r
     } else if (serverInfo == null) {\r
       logger.error(\r