Skip to content

gNMI get response parser fails on empty values #2251

@tokarenko

Description

@tokarenko

Describe the bug
gNMI get response parser fails on empty values, e.g.

{
  "openconfig-acl:acl": {
    "acl-sets": null
  }
}

Solution

The solution is to add VALUE_NOT_SET case to updateToNormalizedNode method in lighty-modules\lighty-gnmi\lighty-gnmi-sb\src\main\java\io\lighty\gnmi\southbound\mountpoint\codecs\GetResponseToNormalizedNodeCodec.java. I can't figure out how to do it with gson library used. I would be grateful if you could do it.

Workaround
In the meanwhile I applied the following workaround (last 3 lines):

    public Optional<NormalizedNode> apply(Gnmi.GetResponse response, YangInstanceIdentifier identifier)
            throws GnmiCodecException {
        for (Gnmi.Notification notification : response.getNotificationList()) {
            if (!notification.getUpdateList().isEmpty()) {
                // Json to NormalizedNode
                final var update = notification.getUpdateList().get(0);
                if (update.getVal().getValueCase() == Gnmi.TypedValue.ValueCase.VALUE_NOT_SET) {
                    return Optional.empty();
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions