[SEBA-571] Reset subscriber status when ONU is disabled

Change-Id: Ic05484e0bbf52ab82ee712b895638cbe4e4bacf9
diff --git a/xos/synchronizer/model_policies/model_policy_att_workflow_driver_serviceinstance.py b/xos/synchronizer/model_policies/model_policy_att_workflow_driver_serviceinstance.py
index 3b7b74e..833adf9 100644
--- a/xos/synchronizer/model_policies/model_policy_att_workflow_driver_serviceinstance.py
+++ b/xos/synchronizer/model_policies/model_policy_att_workflow_driver_serviceinstance.py
@@ -37,7 +37,7 @@
 
     def handle_update(self, si):
         self.logger.debug("MODEL_POLICY: handle_update for AttWorkflowDriverServiceInstance %s " %
-                          (si.id), onu_state=si.onu_state, authentication_state=si.authentication_state)
+                          (si.id), onu_state=si.admin_onu_state, authentication_state=si.authentication_state)
 
         # Changing ONU state can change auth state
         # Changing auth state can change DHCP state
@@ -56,21 +56,15 @@
 
         si.save_changed_fields()
 
+    # Check the whitelist to see if the ONU is valid.  If it is, make sure that it's enabled.
     def process_onu_state(self, si):
         [valid, message] = AttHelpers.validate_onu(self.model_accessor, self.logger, si)
-        if si.onu_state == "AWAITING" or si.onu_state == "ENABLED":
-            si.status_message = message
-            if valid:
-                si.onu_state = "ENABLED"
-                self.update_onu(si.serial_number, "ENABLED")
-            else:
-                si.onu_state = "DISABLED"
-                self.update_onu(si.serial_number, "DISABLED")
-        else:  # DISABLED
-            if not valid:
-                si.status_message = message
-            else:
-                si.status_message = "ONU has been disabled"
+        si.status_message = message
+        if valid:
+            si.admin_onu_state = "ENABLED"
+            self.update_onu(si.serial_number, "ENABLED")
+        else:
+            si.admin_onu_state = "DISABLED"
             self.update_onu(si.serial_number, "DISABLED")
 
     # If the ONU has been disabled then we force re-authentication when it
@@ -87,7 +81,7 @@
             "APPROVED": " - Authentication succeeded",
             "DENIED": " - Authentication denied"
         }
-        if si.onu_state == "DISABLED":
+        if si.admin_onu_state == "DISABLED" or si.oper_onu_status == "DISABLED":
             si.authentication_state = "AWAITING"
         else:
             si.status_message += auth_msgs[si.authentication_state]
@@ -119,14 +113,14 @@
     # ENABLED   | APPROVED | *
     # DISABLED  | AWAITING | AWAITING
     def validate_states(self, si):
-        if (si.onu_state == "AWAITING" or si.onu_state ==
+        if (si.admin_onu_state == "AWAITING" or si.admin_onu_state ==
                 "DISABLED") and si.authentication_state == "AWAITING" and si.dhcp_state == "AWAITING":
             return
-        if si.onu_state == "ENABLED" and (si.authentication_state == "APPROVED" or si.dhcp_state == "AWAITING"):
+        if si.admin_onu_state == "ENABLED" and (si.authentication_state == "APPROVED" or si.dhcp_state == "AWAITING"):
             return
         self.logger.warning(
             "MODEL_POLICY (validate_states): invalid state combination",
-            onu_state=si.onu_state,
+            onu_state=si.admin_onu_state,
             auth_state=si.authentication_state,
             dhcp_state=si.dhcp_state)