Ygotsrl
Go API for SR Linux generated with ygot
Install / Use
/learn @srl-labs/YgotsrlREADME
This repository contains generated Go module that provides API for Nokia SR Linux Network OS. The module is generated with ygot project.
ygot (YANG Go Tools) is a collection of Go utilities that can be used to:
- Generate a set of Go structures and enumerated values for a set of YANG modules, with associated helper methods.
- Validate the contents of the Go structures against the YANG schema (e.g., validating range and regular expression constraints).
- Render the Go structures to an output format - such as JSON, or a set of gNMI Notifications for use in a deployment of streaming telemetry.
Usage
To use the generated Go package, users should first identify which SR Linux version(s) they would like to interact with, as the package is generated per each SR Linux release.
For example, to start using the package generated for SR Linux v21.11.1 download the relevant module:
go get github.com/srl-labs/ygotsrl/v21 v21.11.1
and import the ygotsrl package from it:
package main
import (
"github.com/srl-labs/ygotsrl/v21"
)
func main() {
srl := new(ygotsrl.Device)
}
Versioning
Each module is published with the tag matching SR Linux release number. All available releases can be browsed on the tags page.
Because of the adherence to the SR Linux versioning convention, ygotsrl Go module has to artificially follow the SemVer rules. Branches are created per each major release - v21, v22, v23 and so on. Make sure to use the correct major version string when importing the module.
Warning
Because of the immutability of the Go package cache you might find that the latest tag for a given release might not work. In that case check if a tag with-patchXsuffix exists and make sure to use them. The list of releases for which patch releases have been issued:
22.11.1-patch122.6.4-patch122.6.3-patch122.6.2-patch122.6.1-patch1
Package documentation
Package documentation can be found at pkg.go.dev. Switch the required major version number if necessary.
Generation flags
The Go structures and enumerated values provided by this package are generated off of SR Linux YANG Modules.
The generator command used to generate the files can be found in the Makefile.
If you'd like to deviate from the chosen generator options, please follow the ygot guidelines and regenerate the files manually.
Repository structure
The main branch of this repository contains only the documentation. To reveal the generated Go files for a given release select the tag that matches the SR Linux release version.
For instance, tag v22.6.2-patch1 corresponds to the SR Linux release 22.6.2.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
