Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update generated for empty non-presence containers #24

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/confd_gnmi_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,13 @@ def add_update_json(keypath, _value):
log.debug("save_result=%s", save_result)
assert save_result == 0
gnmi_path = self.make_gnmi_keypath(keypath, csnode)
# the format of saved_data is {"node": {data}}
# we need only the data part
assert len(saved_data) == 1
[data] = saved_data.values()
# the format of saved_data is {"node": {data}}, can be
# {} if the container is empty; we need only the data
# part
if not saved_data:
data = {}
else:
[data] = saved_data.values()
gnmi_value = gnmi_pb2.TypedValue(json_ietf_val=json.dumps(data).encode())
updates.append(gnmi_pb2.Update(path=gnmi_path, val=gnmi_value))

Expand Down
Loading