read
Read NVRAM parameters from a device
go-udap read MAC [--all|-a] [--timeout DURATION] [--format text|json|csv | --json]What it does
Reads every recognised NVRAM parameter (the 26 in
udap.Parameters) from the device and prints
them as param=value lines, sorted by parameter name.
By default, factory-default values are filtered out so the output
round-trips cleanly through set --config FILE. Pass
--all (or -a) to include factory defaults and unrecognised
offset_NNN entries.
Output
The default text format is param=value lines, one per parameter,
sorted by name. Suitable for redirection to a .conf file.
With --json (or -o json), one object mapping each parameter name to
its value, sorted by name. Values are always strings, including numbers
and IP addresses:
{"hostname":"kitchen","interface":"1","server_address":"192.168.1.250"}With -o csv, a name,value header and one row per parameter, sorted
by name:
name,value
hostname,kitchen
interface,1
server_address,192.168.1.250With --all, every format also includes the factory defaults and the
offset_NNN entries, whose values are the raw bytes in hex (for
example "offset_900":"dead").
When every value is a factory default, stdout is empty for text, {}
for json, and the header row alone for csv.
The JSON keys and CSV columns are a stable contract: none will be removed or renamed without a major version. New ones may be added. See Output formats.
Flags
| Flag | Default | Description |
|---|---|---|
--all, -a | off | Include factory-default values and unknown-offset entries |
--timeout DURATION | 2s | Operation timeout |
--format FORMAT, -o | text | Output format: text, json or csv |
--json | off | Shorthand for --format json |
Exit codes
0— success1— device not found, or transport error2— invalid MAC argument, or an unknown or invalid flag (including a format name other thantext,jsonorcsv, or--jsonwith--format)
Examples
# Back up a device's non-default settings
go-udap read 00:04:20:16:06:02 > backup.conf
# Restore later
go-udap set 00:04:20:16:06:02 --config backup.conf --reboot