Skip to content

Get

Description#

The get command represents the gNMI Get RPC.

It is used to send a GetRequest to the specified target(s) (using the global flag --address and expects one GetResponse per target, per path.

The Get RPC is used to retrieve a snapshot of data from the target. It requests that the target snapshots a subset of the data tree as specified by the paths included in the message and serializes this to be returned to the client using the specified encoding.

Usage#

gnmic [global-flags] get [local-flags]

Flags#

prefix#

As per path prefixes, the prefix [--prefix] flag represents a common prefix that is applied to all paths specified using the local --path flag. Defaults to "".

path#

The mandatory path flag [--path] is used to specify the path(s) the client wants to receive a snapshot of.

Multiple paths can be specified, either as a comma separated string:

gnmic -a <ip:port> --insecure \
      get --path "/state/port[port-id=*],\
                  /state/router[router-name=*]/interface[interface-name=*]"

Or by using multiple --path flags:

gnmic -a <ip:port> --insecure \
      get --path "/state/ports[port-id=*]" \
          --path "/state/router[router-name=*]/interface[interface-name=*]"

If a user needs to provide origin information to the Path message, the following pattern should be used for the path string: "origin:path":

gnmic -a <ip:port> --insecure \
      get --path "openconfig-interfaces:interfaces/interface"

model#

The optional model flag [--model] is used to specify the schema definition modules that the target should use when returning a GetResponse. The model name should match the names returned in Capabilities RPC. Currently only single model name is supported.

target#

With the optional [--target] flag it is possible to supply the path target information in the prefix field of the GetRequest message.

type#

The type flag [--type] is used to specify the data type requested from the server.

One of: ALL, CONFIG, STATE, OPERATIONAL (defaults to "ALL")

Examples#

# simple Get RPC
gnmic -a <ip:port> get --path "/state/port[port-id=*]"

# Get RPC with multiple paths
gnmic -a <ip:port> get --path "/state/port[port-id=*]" \
      --path "/state/router[router-name=*]/interface[interface-name=*]"

# Get RPC with path prefix
gnmic -a <ip:port> get --prefix "/state" \
      --path "port[port-id=*]" \
      --path "router[router-name=*]/interface[interface-name=*]"