LinuxCommandLibrary

gnmic-set

Modify network device configuration using gNMI

TLDR

Update the value of a path

$ gnmic [[-a|--address]] [ip:port] set --update-path [path] --update-value [value]
copy

Update the value of a path to match the contents of a JSON file
$ gnmic [[-a|--address]] [ip:port] set --update-path [path] --update-file [filepath]
copy

Replace the value of a path to match the contents of a JSON file
$ gnmic [[-a|--address]] [ip:port] set --replace-path [path] --replace-file [filepath]
copy

Delete the node at a given path
$ gnmic [[-a|--address]] [ip:port] set --delete [path]
copy

SYNOPSIS

gnmic set [flags]

PARAMETERS

--address strings
    Target address(es) in the format host:port

--config string
    Path to the configuration file

--debug
    Enable debug mode

--encoding string
    Encoding to use (JSON, JSON_IETF, PROTO, ASCII)

--file string
    Path to a file containing gNMI set updates (JSON or YAML format)

--from-file string
    Path to a file containing the value to be set, value is used to build the gnmi set request from a string, file or stdin (--value - --file - stdin)

--password string
    Password for authentication

--path strings
    gNMI path(s) to set

--replace
    Use the Replace operation instead of Update

--target string
    Target to set

--timeout duration
    gRPC timeout

--update
    Use the Update operation (default)

--username string
    Username for authentication

--value strings
    Value to set

--version
    Show version

DESCRIPTION

The gnmic-set command, part of the gnmic tool, is used to configure network devices using the gNMI (gRPC Network Management Interface) protocol. It allows you to modify device settings by sending gNMI Set requests. This command supports various encodings (e.g., JSON, protobuf) for the data payloads and offers options for specifying the target device, data paths, and desired configuration values. It provides a powerful and flexible way to automate network configuration and management.
Key capabilities include:
- Setting values on specified data paths.
- Using different data encodings.
- Targeting specific network devices.
- Secure communication over gRPC.

CAVEATS

Requires a gNMI-enabled network device and appropriate credentials. Ensure the specified data paths are valid and writable on the target device. The gNMI service must be running on the target device. Using replace on complex configurations without a complete set of configurations provided might lead to data loss or inconsistent states. Be careful about the encoding used for the data payload.

<B>EXAMPLES</B>

Set the hostname on a device:
gnmic --address 192.168.1.10:57400 --username admin --password password --target device1 --path /system/hostname --value "new-hostname"

Set an interface description using a file:
gnmic --address 192.168.1.10:57400 --username admin --password password --target device1 --path /interfaces/interface[name=eth0]/config/description --from-file description.txt

<B>ENCODING</B>

gNMIc supports multiple encoding types. The encoding type has to be supported by the target device. Common encoding types are JSON, JSON_IETF and PROTO. Use --encoding to set the desired encoding format.

HISTORY

The gnmic tool, including the gnmic-set command, has been developed to leverage the gNMI protocol for network management automation. It has gained popularity as a versatile and efficient tool for configuring and monitoring network devices in modern network environments. Its development is actively maintained with new features and improvements being regularly added.

SEE ALSO

Copied to clipboard