SEBA-664 Allow ONU to be manually disabled
Change-Id: Ide9707cc965b4c939cf50d13e340a3b1e06cffb6
diff --git a/xos/synchronizer/helpers.py b/xos/synchronizer/helpers.py
index b6b69d4..2f6382b 100644
--- a/xos/synchronizer/helpers.py
+++ b/xos/synchronizer/helpers.py
@@ -45,6 +45,9 @@
except IndexError:
raise DeferredException("ONU device %s is not know to XOS yet" % att_si.serial_number)
+ if onu.admin_state == "ADMIN_DISABLED":
+ return [False, "ONU has been manually disabled"]
+
if pon_port.port_no != whitelisted.pon_port_id or att_si.of_dpid != whitelisted.device_id:
log.warn("ONU disable as location don't match",
object=str(att_si),
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 833adf9..10667b1 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
@@ -127,6 +127,11 @@
def update_onu(self, serial_number, admin_state):
onu = [onu for onu in self.model_accessor.ONUDevice.objects.all() if onu.serial_number.lower()
== serial_number.lower()][0]
+ if onu.admin_state == "ADMIN_DISABLED":
+ self.logger.debug(
+ "MODEL_POLICY: ONUDevice [%s] has been manually disabled, not changing state to %s" %
+ (serial_number, admin_state))
+ return
if onu.admin_state == admin_state:
self.logger.debug(
"MODEL_POLICY: ONUDevice [%s] already has admin_state to %s" %