[SEBA-164] Forcing subscriber auth if onu goes down

Change-Id: I6d1b721ac67533fb2b58048666771b50d3a84b2b
diff --git a/xos/synchronizer/event_steps/onu_event.py b/xos/synchronizer/event_steps/onu_event.py
index 045198f..14c6d9b 100644
--- a/xos/synchronizer/event_steps/onu_event.py
+++ b/xos/synchronizer/event_steps/onu_event.py
@@ -30,15 +30,12 @@
     def __init__(self, *args, **kwargs):
         super(ONUEventStep, self).__init__(*args, **kwargs)
 
-    def handle_onu_activate_event(self, event):
-
-        # NOTE do we need to wait of the ONU to be there?
-
-        self.log.info("onu.events: validating ONU %s" % event["serial_number"], event_data=event)
-
+    def get_att_si(self, event):
         try:
             att_si = AttWorkflowDriverServiceInstance.objects.get(serial_number=event["serial_number"])
             att_si.no_sync = False;
+            att_si.uni_port_id = event["uni_port_id"]
+            att_si.of_dpid = event["of_dpid"]
             self.log.debug("onu.events: Found existing AttWorkflowDriverServiceInstance", si=att_si)
         except IndexError:
             # create an AttWorkflowDriverServiceInstance, the validation will be triggered in the corresponding sync step
@@ -48,13 +45,19 @@
                 uni_port_id=event["uni_port_id"]
             )
             self.log.debug("onu.events: Created new AttWorkflowDriverServiceInstance", si=att_si)
-        att_si.save()
+        return att_si
 
     def process_event(self, event):
         value = json.loads(event.value)
         self.log.info("onu.events: received event", value=value)
 
+        att_si = self.get_att_si(value)
         if value["status"] == "activated":
-            self.log.info("onu.events: activate onu", value=value)
-            self.handle_onu_activate_event(value)
+            self.log.info("onu.events: activated onu", value=value)
+            att_si.onu_state = "ACTIVE"
+        elif value["status"] == "disabled":
+            self.log.info("onu.events: disabled onu", value=value)
+            att_si.onu_state = "DISABLED"
+        att_si.save(always_update_timestamp=True)
+