- ds_put_cstr(&ds, "from [");
- ds_put_cfm_fault(&ds, old_cfm_fault);
- ds_put_cstr(&ds, "] to [");
- ds_put_cfm_fault(&ds, cfm->fault);
- ds_put_char(&ds, ']');
- VLOG_INFO("%s: CFM faults changed %s.", cfm->name, ds_cstr(&ds));
- ds_destroy(&ds);
+ /* If there is a flap, increments the counter. */
+ if (old_cfm_fault == 0 || cfm->fault == 0) {
+ cfm->flap_count++;
+ }
+ }
+
+ /* These variables represent the cfm session status, it is desirable
+ * to update them to database immediately after change. */
+ if (old_health != cfm->health
+ || old_rmp_opup != cfm->remote_opup
+ || (old_rmps_array_len != cfm->rmps_array_len || old_rmps_deleted)
+ || old_cfm_fault != cfm->fault
+ || old_flap_count != cfm->flap_count) {
+ cfm_status_changed(cfm);