VES Heartbeat and Software Management Feature
[oam/tr069-adapter.git] / ves-agent / src / main / java / org / commscope / tr069adapter / vesagent / controller / VESAgentService.java
index 1836163..9a1ec07 100644 (file)
@@ -20,11 +20,15 @@ package org.commscope.tr069adapter.vesagent.controller;
 \r
 import com.fasterxml.jackson.core.JsonProcessingException;\r
 \r
+import org.commscope.tr069adapter.acs.common.DeviceRPCRequest;\r
+import org.commscope.tr069adapter.acs.common.DeviceRPCResponse;\r
 import org.commscope.tr069adapter.acs.common.inform.BootstrapInform;\r
+import org.commscope.tr069adapter.acs.common.inform.ConnectionRequestInform;\r
 import org.commscope.tr069adapter.acs.common.inform.PeriodicInform;\r
 import org.commscope.tr069adapter.acs.common.inform.ValueChangeInform;\r
 import org.commscope.tr069adapter.mapper.model.VESNotification;\r
 import org.commscope.tr069adapter.mapper.model.VESNotificationResponse;\r
+import org.commscope.tr069adapter.vesagent.async.WaitForNotifications;\r
 import org.commscope.tr069adapter.vesagent.exception.InvalidFaultOperationException;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
@@ -49,6 +53,9 @@ public class VESAgentService {
   @Autowired\r
   HeartBeatMessageHandler hbHandler;\r
 \r
+  @Autowired\r
+  WaitForNotifications waitForNotifications;\r
+\r
   @PostMapping(path = "/deviceEvent", consumes = "application/json")\r
   public VESNotificationResponse processDeviceNotificationAsVESEvent(\r
       @RequestBody VESNotification notification)\r
@@ -61,15 +68,20 @@ public class VESAgentService {
     } else if (notification.getDevnotification() instanceof BootstrapInform) {\r
       logger.debug("VES Notification request PnfRegister processing started");\r
       response = pnfHandler.handlePnfRegNotification(notification);\r
+      hbHandler.handleRegisterRequest(notification);\r
       logger.debug("VES Notification request PnfRegister processing completed");\r
     } else if (notification.getDevnotification() instanceof ValueChangeInform) {\r
       logger.debug("VES Notification request Fault processing started");\r
       response = alarmHanler.handleAlarmNotification(notification);\r
+      waitForNotifications.notifyDeviceNotification(notification);\r
       logger.debug("VES Notification request Fault processing completed");\r
     } else if (notification.getDevnotification() instanceof PeriodicInform) {\r
       logger.debug("VES Notification request PI processing started");\r
-      response = hbHandler.handlePINotification(notification);\r
+      waitForNotifications.notifyDeviceNotification(notification);\r
       logger.debug("VES Notification request PI processing completed");\r
+    } else if (notification.getDevnotification() instanceof ConnectionRequestInform) {\r
+      logger.debug("Recieived ConnectionRequest inform from device.");\r
+      waitForNotifications.notifyDeviceNotification(notification);\r
     } else {\r
       logger.error("VES Notification request is unknown");\r
       response =\r
@@ -78,4 +90,36 @@ public class VESAgentService {
     logger.debug("VES Notification request processing completed");\r
     return response;\r
   }\r
+\r
+  @PostMapping(path = "/deleteConfig", consumes = "application/json")\r
+  public VESNotificationResponse processDeleteConfigRequest(\r
+      @RequestBody VESNotification vesNotification) {\r
+    VESNotificationResponse response = null;\r
+\r
+    logger.debug("Initiating deleteConfig VES Notification request");\r
+    response = hbHandler.handleDeleteConfigRequest(vesNotification);\r
+    logger.debug("deleteConfig VES Notification request is completed");\r
+    return response;\r
+  }\r
+\r
+  @PostMapping(path = "/editConfig", consumes = "application/json")\r
+  public DeviceRPCResponse processEditConfigRequest(\r
+      @RequestBody DeviceRPCRequest deviceRPCRequest) {\r
+    DeviceRPCResponse response = null;\r
+\r
+    logger.debug("Initiating setConfig VES Notification request");\r
+    response = hbHandler.handleSetConfigRequest(deviceRPCRequest);\r
+    logger.debug("setConfig VES Notification request is compelted");\r
+    return response;\r
+  }\r
+\r
+  @PostMapping(path = "/getConfig", consumes = "application/json")\r
+  public DeviceRPCResponse processGetConfigRequest(@RequestBody DeviceRPCRequest deviceRPCRequest) {\r
+    DeviceRPCResponse response = null;\r
+\r
+    logger.debug("Initiating getConfig VES Notification request");\r
+    response = hbHandler.handleGetConfigRequest(deviceRPCRequest);\r
+    logger.debug("getConfig VES Notification request is compelted");\r
+    return response;\r
+  }\r
 }\r