SEBA-301 Only save changed state
Change-Id: I177e2d6eee878551cc2236deabfddc920a553868
diff --git a/xos/synchronizer/event_steps/auth_event.py b/xos/synchronizer/event_steps/auth_event.py
index 6786c98..e534aee 100644
--- a/xos/synchronizer/event_steps/auth_event.py
+++ b/xos/synchronizer/event_steps/auth_event.py
@@ -38,4 +38,4 @@
raise Exception("authentication.events: Cannot find att-workflow-driver service instance for this event")
si.authentication_state = value["authenticationState"];
- si.save(update_fields=["authentication_state", "updated"], always_update_timestamp=True)
+ si.save_changed_fields(always_update_timestamp=True)
diff --git a/xos/synchronizer/event_steps/dhcp_event.py b/xos/synchronizer/event_steps/dhcp_event.py
index 3d04e96..ddd1e31 100644
--- a/xos/synchronizer/event_steps/dhcp_event.py
+++ b/xos/synchronizer/event_steps/dhcp_event.py
@@ -43,7 +43,7 @@
si.dhcp_state = value["messageType"];
si.ip_address = value["ipAddress"];
si.mac_address = value["macAddress"];
- si.save(update_fields=["dhcp_state", "ip_address", "mac_address", "updated"], always_update_timestamp=True)
+ si.save_changed_fields(always_update_timestamp=True)
# subscriber = RCORDSubscriber.objects.get(onu_device=onu_sn)
#
#
diff --git a/xos/synchronizer/event_steps/onu_event.py b/xos/synchronizer/event_steps/onu_event.py
index 4b770a1..d205a59 100644
--- a/xos/synchronizer/event_steps/onu_event.py
+++ b/xos/synchronizer/event_steps/onu_event.py
@@ -59,6 +59,6 @@
att_si.authentication_state = "AWAITING"
else:
self.log.warn("onu.events: Unkown status value: %s" % value["status"], value=value)
- att_si.save(always_update_timestamp=True)
+ att_si.save_changed_fields(always_update_timestamp=True)
diff --git a/xos/synchronizer/event_steps/test_auth_event.py b/xos/synchronizer/event_steps/test_auth_event.py
index e04f70b..5587940 100644
--- a/xos/synchronizer/event_steps/test_auth_event.py
+++ b/xos/synchronizer/event_steps/test_auth_event.py
@@ -107,5 +107,5 @@
self.event_step.process_event(self.event)
- self.hippie_si.save.assert_called_with(always_update_timestamp=True, update_fields=['authentication_state', 'updated'])
+ self.hippie_si.save.assert_called_with(always_update_timestamp=True, update_fields=['authentication_state', 'serial_number', 'updated'])
self.assertEqual(self.hippie_si.authentication_state, 'APPROVED')