openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
170 stars 55 forks source link

stringArray in the main branch is not working as expected #479

Closed rao-aneesh closed 2 months ago

rao-aneesh commented 2 months ago

A Get request created like this:

gnmic --address x.x.x.x --port 57400 --username xxx --password xxx --insecure get --path openconfig-system:system/state/hostname,openconfig-system:system/state/boot-time --type ALL --encoding JSON_IETF --print-request --format prototext

Generates this RPC:

Get Request:

path:  {
  elem:  {
    name:  "openconfig-system:system"
  }
  elem:  {
    name:  "state"
  }
  elem:  {
    name:  "hostname,openconfig-system:system"
  }
  elem:  {
    name:  "state"
  }
  elem:  {
    name:  "boot-time"
  }
}
encoding:  JSON_IETF

Comma separated string arrays are supported in 0.37.0. Did something change?

karimra commented 2 months ago

I'm planning to deprecate that behavior (comma separated paths). The only flag that will support comma separated values will be -a | --address

rao-aneesh commented 2 months ago

Alright. Any reason why?

karimra commented 2 months ago

The same behavior can be achieved using multiple --path flags, which I find cleaner than using comma-separated paths. Parsing comma-separated paths is error-prone since paths can contain commas (in the key value), forcing the user to escape commas. This makes the feature (comma-separated paths) tedious to use.

rao-aneesh commented 2 months ago

Okay, thanks!