Skip to content
/ lemming Public
forked from openconfig/lemming

An OpenConfig reference device implementation

License

Notifications You must be signed in to change notification settings

royyi8/lemming

This branch is 10 commits behind openconfig/lemming:main.

Folders and files

NameName
Last commit message
Last commit date
Jan 7, 2025
Dec 3, 2024
Dec 5, 2024
Jan 7, 2025
Oct 21, 2024
May 16, 2024
Jan 15, 2025
Dec 10, 2024
Oct 30, 2024
Oct 30, 2024
Jan 6, 2025
Dec 13, 2024
Dec 19, 2024
Mar 1, 2023
Jan 7, 2025
Oct 30, 2024
Dec 19, 2024
Aug 6, 2024
Jan 6, 2025
Jan 15, 2025
Sep 5, 2023
Feb 1, 2024
Oct 25, 2023
May 17, 2023
Mar 20, 2023
Apr 4, 2022
Oct 30, 2024
Mar 3, 2022
Mar 3, 2022
Nov 12, 2024
Mar 20, 2023
Nov 12, 2024
Mar 20, 2023
Feb 8, 2024
Mar 3, 2022
Nov 20, 2024
Jul 11, 2023
Jan 7, 2025
Oct 21, 2024
Oct 21, 2024
Jan 8, 2025
Jan 8, 2025
Jul 16, 2024
Jun 11, 2024
Jan 8, 2025
Jun 22, 2023

Repository files navigation

Lemming the Openconfig reference device implementation

Purpose

To provide a reference implementation of a device which provides the collection of customers APIs used for Openconfig. This includes:

  • gNMI
  • gNOI
  • gRIBI
  • P4RT
  • BGP
  • ISIS

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.

Running the Fake gNMI Server

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

Running integration tests

Prerequisites:

  • KNE setup and cluster deployed

Deploy and Test:

  • Optional: Build and load lemming container from source: make load
  • Run integration tests: go test ./integration_tests/...

Debugging Lemming

  1. Load the debug image in the cluster: make load-debug
  2. Modify a topology.pb.txt to start lemming with dlv.
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: "--"
    }
}
  1. Create the topology: kne create <topofile>.
  2. Forward the debugger connection (this is blocking so run in seperate terminal): kubectl port-forward -n <topo name> <node name> 56268:56268
  3. Attach to the debugger.
    1. Using VS Code: Run and Debug -> Connect to server
    2. Using dlv cli: dlv connect localhost:56268
      1. Required: Configure subsitute-path so dlv can resolve source code: config substitute-path /build <abs path to lemming src>

Configuration

In general, Lemming should be configured through gNMI, however in some cases using flags is acceptable.

When to use gNMI:

  • Config modelled in OC
  • Values that may be modified at runtime

When to use flags:

  • Startup options: (eg gNMI listen port)
  • Immutable config
  • Environment specific options (location of some resource)

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.

About

An OpenConfig reference device implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 92.7%
  • C++ 6.0%
  • C 0.7%
  • Starlark 0.6%
  • Shell 0.0%
  • Makefile 0.0%