To provide a reference implementation of a device which provides the collection of customers APIs used for Openconfig. This includes:
to clearly and authoritatively specify the expected behavior of an OpenConfig-compliant device, and to aid in its test development and debugging. Anyone can use this reference implementation to quickly write device tests independent of the availability of a real and compliant implementation. The reference can also be used to augment the consumer contract when a fake-derived test suite is delivered to network device vendors, serving as a tool for consensus in the device-implementor <-> device-consumer relationship.
go run ./cmd/lemming --zapi_addr unix:/tmp/zserv.api --alsologtostderr
Wait for the message "lemming initialization complete".
This might take a minute the first time to compile the large generated code.
Install gnmic: https://gnmic.openconfig.net/
// SetRequest configuring hostname
gnmic -a localhost:9339 --insecure -u foo -p bar --target fakedut set --update-path openconfig:/system/config/hostname --update-value rosesarered -e json_ietf
// SubscribeRequest/ONCE getting configured hostname
gnmic -a localhost:9339 --insecure -u foo -p bar --target fakedut subscribe --mode once --path openconfig:/system/config/hostname
// SubscribeRequest/ONCE getting hostname reflected as system state
gnmic -a localhost:9339 --insecure -u foo -p bar --target fakedut subscribe --mode once --path openconfig:/system/state/hostname
Prerequisites:
Deploy and Test:
make load
go test ./integration_tests/...
make load-debug
nodes: {
name: "lemming"
vendor: OPENCONFIG
config: {
command: "/dlv/dlv"
args: "exec"
args: "--headless"
args: "--continue"
args: "--accept-multiclient"
args: "--listen=:56268"
args: "--api-version=2"
args: "/lemming/lemming"
args: "--"
}
}
kne create <topofile>
.kubectl port-forward -n <topo name> <node name> 56268:56268
dlv connect localhost:56268
config substitute-path /build <abs path to lemming src>
In general, Lemming should be configured through gNMI, however in some cases using flags is acceptable.
When to use gNMI:
When to use flags:
Lemming uses Viper and pflags for configuration. Currently, only flags are supported (no env vars and no config file). Flags are defined in cmd/lemming/lemming.go.
In KNE, flags are set using the args
attribute in the topology file.
The Lemming operator also adds some mandatory flags to lemming for ease of use. These are flags that are always set
since they required to run lemming in a containerized environment.
They are defined at operator/controllers/lemming_controller.go.