When querying a whole subtree, the telemetryParser fails to parse the response from our gNMI server. The update_msg contains a leaflist_val whose elements are TypedValues instead of the expected string.
Proposal for a fix in client.py:1356 (not the cleanest of fixes unfortunately)
element_str = ""
element_dict = {}
for element in val_leaflist.leaflist_val.element:
if isinstance(element, TypedValue):
if "json_val" in element:
element_dict.update(json.loads(element.json_val))
elif "json_ietf_val" in element:
element_dict.update(json.loads(element.json_ietf_val))
else:
raise TypeError(f"Neither json_val nor json_ietf_val found in element.")
elif isinstance(element, str):
element_str += element
else:
raise TypeError("Unsupported element type")
if element_str != "":
update_container.update({"val": element_str})
else:
update_container.update({"val": element_dict})
This either creates a dictionary containing all (parsed) TypedValues or appends to the string, with the string taking precedence over the dict in the final update call.
When querying a whole subtree, the telemetryParser fails to parse the response from our gNMI server. The update_msg contains a leaflist_val whose elements are TypedValues instead of the expected string.
Proposal for a fix in client.py:1356 (not the cleanest of fixes unfortunately)
This either creates a dictionary containing all (parsed) TypedValues or appends to the string, with the string taking precedence over the dict in the final update call.