[SEBA-744] Not triggering subscriber model_policies/sync_step if we're only storing the IP
Change-Id: I164cf21ce238a281b14cd4143df253be8adb11ca
diff --git a/requirements.txt b/requirements.txt
index 669c29b..d1f251f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
-xossynchronizer~=3.2.1
-xosapi~=3.2.1
-xoskafka~=3.2.1
+xossynchronizer~=3.2.6
+xosapi~=3.2.6
+xoskafka~=3.2.6
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 10667b1..7dbf07d 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
@@ -206,18 +206,22 @@
# - the status has changed
# - we get a DHCPACK event
if cur_status != subscriber.status or si.dhcp_state == "DHCPACK":
- self.logger.debug(
- "MODEL_POLICY: updating subscriber",
- onu_device=subscriber.onu_device,
- authentication_state=si.authentication_state,
- subscriber_status=subscriber.status)
if subscriber.status == "awaiting-auth":
self.delete_subscriber_ip(subscriber, si.ip_address)
subscriber.mac_address = ""
elif si.ip_address and si.mac_address:
self.update_subscriber_ip(subscriber, si.ip_address)
subscriber.mac_address = si.mac_address
- subscriber.save_changed_fields(always_update_timestamp=True)
+
+ # NOTE SEBA-744 if the update is a DHCP assignment we don't want to trigger model_policies and sync_steps
+ important_change = (cur_status != subscriber.status)
+ self.logger.debug(
+ "MODEL_POLICY: updating subscriber",
+ onu_device=subscriber.onu_device,
+ authentication_state=si.authentication_state,
+ subscriber_status=subscriber.status,
+ always_update_timestamp=important_change)
+ subscriber.save_changed_fields(always_update_timestamp=important_change)
else:
self.logger.debug("MODEL_POLICY: subscriber status has not changed", onu_device=subscriber.onu_device,
authentication_state=si.authentication_state, subscriber_status=subscriber.status)
diff --git a/xos/synchronizer/model_policies/test_model_policy_att_workflow_driver_serviceinstance.py b/xos/synchronizer/model_policies/test_model_policy_att_workflow_driver_serviceinstance.py
index 7de68cb..ee0037f 100644
--- a/xos/synchronizer/model_policies/test_model_policy_att_workflow_driver_serviceinstance.py
+++ b/xos/synchronizer/model_policies/test_model_policy_att_workflow_driver_serviceinstance.py
@@ -249,7 +249,8 @@
ip_mock.return_value = []
self.policy.update_subscriber(sub, self.si)
- sub_save.assert_called()
+ sub_save.assert_called_with(always_update_timestamp=False,
+ update_fields=['id', 'mac_address', 'onu_device', 'status'])
self.assertEqual(sub.mac_address, self.si.mac_address)
ip_mock.assert_called_with()
@@ -271,7 +272,8 @@
ip_mock.return_value = []
self.policy.update_subscriber(sub, self.si)
- sub_save.assert_called()
+ sub_save.assert_called_with(always_update_timestamp=False,
+ update_fields=['id', 'mac_address', 'onu_device', 'status'])
self.assertEqual(sub.mac_address, self.si.mac_address)
saved_ip = ip_mock.call_args[0][0]