openconfig / reference

This repository contains reference implementations, specifications and tooling related to OpenConfig-based network management.
Apache License 2.0
155 stars 88 forks source link

support for yang list's key's value case sensitivity. #199

Closed abhishekkarigar closed 9 months ago

abhishekkarigar commented 9 months ago

Hi team,

As of now Yang doesn't support case sensitivity or insensitivity metadata for value of list's key.
for example:
/a/e[key=value1]
here I need info on if value1 is case sensitive or insensitive how can we achieve this

abhishekkarigar commented 9 months ago

@wenovus

robshakir commented 9 months ago

Hi,

Sorry -- not sure what is being requested here. YANG keys are themselves case sensitive, this isn't a gNMI thing, but adherence with the standard. If you need to match keys that are case insensitive, then you likely need to have tooling that handles this (e.g., subscribe to get all list entries, match case).

Cheers, r.

abhishekkarigar commented 9 months ago

thanks @robshakir for the reply. i am talking about the value not key. as i gave example as well.

another example:

/system/snmp-servers/snmp-server[name=DEFAULT]/vrfs/vrf[name=myvrf]/hosts/host[hostname=1.1.1.1][community-or-user-name=PUBLIC]

in this community-or-user-name key has value "PUBLIC" but this is case sensitive for us, as user can give public as well.
but we are ok for name key in snmp-server list to be either DEFAULT or default

so you can see there are scenarios , which would be helpful to provide an additional info on Values whether its case-sensitive or insensitive.

robshakir commented 9 months ago

I'm also talking about the value of the key leaf. In the case that you have defined:


list foo {
  key "bar";

  leaf bar { type string; }
}

then since the contents of bar are case sensitive, then there's no way to indicate that the value of the key should be case insensitive. You have to solve this in tooling.

To fix this, a change would need to be made to YANG to have some means to indicate that leaf bar is case insensitive. You could do this through an extension, however, it will also need server side support. Solving it in client tooling is a much more compatible solution.

robshakir commented 9 months ago

Closing this issue since this isn't an OpenConfig or gNMI requirement.