+\r
+ private void processTransferCompleteInform(TransferCompleteInform notification) {\r
+\r
+ try {\r
+ ArrayList<ParameterDTO> paramList = new ArrayList<ParameterDTO>();\r
+ DeviceOperationDetails fwDetails =\r
+ deviceOperDAO.findByDeviceId(notification.getDeviceDetails().getDeviceId());\r
+ if (fwDetails == null || fwDetails.getFileName() == null) {\r
+ logger.debug(\r
+ "TransferCompleteInform recevied for invaild device, there is no entry exist in the database");\r
+ return;\r
+ }\r
+ if (fwDetails.getDownLoadStatus() == FirwareUpgradeStatus.DOWNLOAD_INTIATED.getStatus()) {\r
+ paramList.add(new ParameterDTO("download-event.file-name", fwDetails.getFileName()));\r
+\r
+ String status = FirwareUpgradeErrorCode.getErrorCodeMapping(notification.getFaultCode());\r
+ paramList.add(new ParameterDTO("download-event.status", status));\r
+ if (notification.getFaultCode() != 0) {\r
+ fwDetails.setDownLoadStatus(FirwareUpgradeStatus.DOWNLOAD_FAILED.getStatus());\r
+ paramList\r
+ .add(new ParameterDTO("download-event.error-message", notification.getFaultString()));\r
+ } else {\r
+ fwDetails.setDownLoadStatus(FirwareUpgradeStatus.DOWNLOAD_COMPLETED.getStatus());\r
+ logger.debug("downloading file completed on the device successfully.");\r
+ }\r
+ deviceOperDAO.save(fwDetails);\r
+\r
+ logger.debug("sending download-event notification to netconfserver");\r
+ NetConfNotificationDTO netConfNotifDTO =\r
+ new NetConfNotificationDTO(notification.getDeviceDetails().getDeviceId(), null, true);\r
+ netConfNotifDTO.setParameters(paramList);\r
+ netConfNotifDTO.setUri(SOFT_MGMT_NS_URI);\r
+\r
+ if (notiSender.sendCustomNotification(netConfNotifDTO).getStatusCode().is2xxSuccessful()) {\r
+ logger.debug("sending download-event notification to netconfserver sucess");\r
+ } else {\r
+ logger.error("sending download-event notification to netconfserver failed");\r
+ }\r
+ } else {\r
+ logger.debug(\r
+ "TransferCompleteInform recevied after boot is received; already software is activated");\r
+ }\r
+ } catch (Exception e) {\r
+ logger.debug("Exception occured while processing TransferCompleteInform " + e.toString());\r
+ }\r
+ }\r
+\r
+ private void checkForActivateNotification(DeviceInform notification) {\r
+\r
+ try {\r
+ ArrayList<ParameterDTO> paramList = new ArrayList<ParameterDTO>();\r
+ DeviceOperationDetails devDetails =\r
+ deviceOperDAO.findByDeviceId(notification.getDeviceDetails().getDeviceId());\r
+\r
+ if (devDetails == null\r
+ || devDetails.getDownLoadStatus() == FirwareUpgradeStatus.NOT_STARTED.getStatus()) {\r
+ logger.debug("firmware upgrade is not in progress");\r
+ return;\r
+ }\r
+\r
+ if (!notification.getDeviceDetails().getSoftwareVersion()\r
+ .equalsIgnoreCase(devDetails.getSwVersion())\r
+ && devDetails.getDownLoadStatus() == FirwareUpgradeStatus.DOWNLOAD_INTIATED.getStatus()) {\r
+ logger.debug("received the boot/bootstrap before the transfer complete recevied");\r
+ TransferCompleteInform inform = new TransferCompleteInform();\r
+ inform.setDeviceDetails(notification.getDeviceDetails());\r
+ inform.setFaultCode(0);\r
+ processTransferCompleteInform(inform);\r
+ }\r
+\r
+ devDetails = deviceOperDAO.findByDeviceId(notification.getDeviceDetails().getDeviceId());\r
+ if (devDetails.getDownLoadStatus() == FirwareUpgradeStatus.DOWNLOAD_COMPLETED.getStatus()) {\r
+ paramList.add(new ParameterDTO("activation-event.slot-name", "Active-Partion"));\r
+ // check for software change\r
+ if (notification.getDeviceDetails().getSoftwareVersion()\r
+ .equalsIgnoreCase(devDetails.getSwVersion())) {\r
+ paramList.add(new ParameterDTO("activation-event.status", "APPLICATION_ERROR"));\r
+ devDetails.setDownLoadStatus(FirwareUpgradeStatus.ACTIVATION_ERROR.getStatus());\r
+ } else {\r
+ devDetails.setSwVersion(notification.getDeviceDetails().getSoftwareVersion());\r
+ devDetails.setDownLoadStatus(FirwareUpgradeStatus.ACTIVATION_COMPLETED.getStatus());\r
+ paramList.add(new ParameterDTO("activation-event.status", "COMPLETED"));\r
+ }\r
+ deviceOperDAO.save(devDetails);\r
+\r
+ logger.debug("sending activation-event notification to netconfserver");\r
+ NetConfNotificationDTO netConfNotifDTO =\r
+ new NetConfNotificationDTO(notification.getDeviceDetails().getDeviceId(), null, true);\r
+ netConfNotifDTO.setParameters(paramList);\r
+ netConfNotifDTO.setUri(SOFT_MGMT_NS_URI);\r
+\r
+ if (notiSender.sendCustomNotification(netConfNotifDTO).getStatusCode().is2xxSuccessful()) {\r
+ logger.debug("sending activation-event notification to netconfserver sucess");\r
+ } else {\r
+ logger.error("sending activation-event notification to netconfserver failed");\r
+ }\r
+ }\r
+ } catch (Exception e) {\r
+ logger.debug(\r
+ "Exception occured while processing ProcessFirmWareActivateNotification " + e.toString());\r
+ }\r
+ }\r