Skip to content

Delta deduplication#55

Open
srieger1 wants to merge 4 commits into
mainfrom
delta-deduplication
Open

Delta deduplication#55
srieger1 wants to merge 4 commits into
mainfrom
delta-deduplication

Conversation

@srieger1
Copy link
Copy Markdown
Owner

@srieger1 srieger1 commented Sep 3, 2025

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces DeepDiff-based gNMI diffing with a custom delta format and updates consumers to apply or inspect those deltas. It fits into the synchronization path between realnet gNMI notifications, sibling topology updates, and CI-triggered fuzzer behavior.

Changes:

  • Adds a new delta calculation module for gNMI notification updates.
  • Changes gNMI publishing to send full data conditionally and otherwise send deltas.
  • Updates the controller and CI app to consume the changed notification structure.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 22 comments.

File Description
interfaces/gnmi.py Switches diff calculation to the new delta module and changes notification payload publishing.
interfaces/delta_based_dedup.py Adds custom delta generation helpers for gNMI notification data.
controllers/controller.py Adds delta application logic and uses either full data or reconstructed state for sibling updates.
apps/ci.py Updates fuzzer trigger logic for gNMI diff handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

new_values = update.get("val", update.get("values", {}))
current_values = {}
# Get the last stored state for this path
if "notification" in oldData:
Comment thread interfaces/gnmi.py
Comment on lines +200 to +203
sendFullData = self.updateCounter == 0
# if differential data exists and is empty, don't send updates the queues
if diff is not None and len(diff) > 0:
# even if diff is null send data in regular intervals
if (diff is not None and len(diff) > 0) or sendFullData:
Comment thread controllers/controller.py
Comment on lines +408 to +412
if "data" in task:
self.current_state = task["data"]
elif task["diff"] != {}:
# notification_data = task["data"]
self.current_state = self.apply_diff(task["diff"])
Comment thread controllers/controller.py
Comment on lines +455 to +466
if path_key == change_path_key:
# Process each change in the list
for change in change_list:
if not isinstance(change, dict):
continue

change_type = change.get("type")
json_key = change.get("json_key", "")

if change_type == "ALLNEW":
# Replace the entire val with new_value
update["val"] = change.get("new_value", {})
Comment thread apps/ci.py
Comment on lines 24 to +28
task.get("diff")
and task["diff"].get("values_changed")
and task["diff"]["values_changed"].items[1].t2 == "fuzz_me"
and isinstance(task["diff"].get("values_changed"), dict)
):
# self.logger.debug("gNMI data changed: " + str(task['diff']['values_changed']))
self.logger.info(
f"Sibling {sibling} detected gNMI notification 'fuzz_me', asking sec"
"app to run fuzzer..."
)
# add task to queue for sec app
broker.publish(
"security",
{
"type": "run fuzzer",
"source": "ci",
"timestamp": time.time(),
"data": "",
},
)
for key, change in task["diff"]["values_changed"].items():
if change.get("new_value") == "fuzz_me":
Comment on lines +1 to +2
import json
from copy import deepcopy
Comment on lines +11 to +12
for idx_notif, notif in enumerate(newData.get("notification", [])):
for idx, update in enumerate(notif.get("update", [])):
Comment thread apps/ci.py
Comment on lines +42 to +46
# if (
# task.get("diff")
# and task["diff"].get("values_changed")
# and task["diff"]["values_changed"].items[1].t2 == "fuzz_me"
# ):
Comment thread interfaces/gnmi.py
},
"diff": diff
}
# send full data regulary
Comment on lines +25 to +28
if len(oldData["notification"]) > idx_notif:
if len(oldData["notification"][idx_notif].get("update", [])) > idx:
current_update = oldData["notification"][idx_notif].get("update", [])[idx]
current_values = current_update.get("val", current_update.get("values", {}))
@srieger1
Copy link
Copy Markdown
Owner Author

@copilot yeah! I know! But I thought you could take a look at the test that failed. Otherwise I'd be happy to merge the new functionality

Copy link
Copy Markdown

Copilot AI commented May 31, 2026

@copilot yeah! I know! But I thought you could take a look at the test that failed. Otherwise I'd be happy to merge the new functionality

The CI failure was a flake8 lint error in digsinet.py:22 — an unused global broker declaration in gracefull_shutdown_handler. The function only reads broker (no assignment), so the global statement wasn't needed and triggered an F824 error. Removed it in the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants