├── get-all-modules.sh ├── LICENSE ├── README.md └── extract.sh /get-all-modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # export all available YANG modules in a flat dir structure 4 | # with a dir per SR Linux YANG module version. 5 | 6 | # usage: 7 | # to extract all modules to the $(pwd)/all directory: 8 | # ./get-all-modules.sh 9 | 10 | # to extract to a custom directory 11 | # TARGET_DIR=/tmp/all ./get-all-modules.sh 12 | 13 | set -e 14 | 15 | # target directory which nests all extracted modules 16 | TARGET_DIR=${TARGET_DIR:-$(pwd)/all} 17 | 18 | # create target dir 19 | mkdir -p ${TARGET_DIR} 20 | 21 | ALL_TAGS=$(git tag) 22 | 23 | # Loop over each tag and extract the models 24 | for tag in ${ALL_TAGS} 25 | do 26 | echo "\n\nExtracting ${tag} models" 27 | mkdir -p ${TARGET_DIR}/${tag} 28 | git checkout ${tag} 29 | cp -a srlinux-yang-models/* all/${tag} 30 | done 31 | 32 | # go back to main 33 | git checkout main -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, Nokia 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | [](https://yang.srlinux.dev) 4 | 5 | --- 6 | 7 | Nokia SR Linux makes extensive use of structured data models. Each application, whether provided by Nokia or written by a user against the [NDK](https://learn.srlinux.dev/ndk), has a YANG model that defines its configuration and state. 8 | 9 | With this design, the YANG data model is defined first, then the CLI, APIs, and show output formats are derived from it. 10 | 11 | ## Yang browser 12 | 13 | This repository contains only the source YANG files that one can use to build code bindings or explore the way the modules are built. To browse the modules, we recommend using [yang.srlinux.dev](https://yang.srlinux.dev) portal, which provides human-friendly tools to browse and search through the models. 14 | 15 | ## Repository structure 16 | 17 | The main branch of this repository contains only the documentation. To see the yang files for a given release, select the tag that matches the SR Linux release version. 18 | 19 | For instance, the `v21.6.2` tag corresponds to the SR Linux release 21.6.2. 20 | 21 | ## Download 22 | 23 | There are several ways to download the yang files for a specific SR Linux release. The below examples are provided for the `v21.6.2` version. 24 | 25 | ### Clone with git 26 | 27 | Clone the yang files for a specific release with the following `git` command: 28 | 29 | ```bash 30 | git clone -b v21.6.2 --depth 1 https://github.com/nokia/srlinux-yang-models 31 | ``` 32 | 33 | ### Download archives 34 | 35 | To download the proto files for a specific release in the `zip` or `tgz` archive, navigate to the GitHub [`tag`](https://github.com/nokia/srlinux-yang-models/tags) page, which contains the links to the archives. 36 | 37 | If needed, the download link can be programmatically derived using the following rule: 38 | 39 | **for zip** 40 | `https://github.com/nokia/srlinux-yang-models/archive/tags/` + `$tag` + `.zip` 41 | 42 | **for tar.gz** 43 | `https://github.com/nokia/srlinux-yang-models/archive/tags/` + `$tag` + `.tar.gz` 44 | 45 | ### Extracting all modules 46 | 47 | To extract YANG modules of each SR Linux release and put them in a single directory, use the provided `get-all-modules.sh` script: 48 | 49 | ```bash 50 | # extracts modules in the `$(pwd)/all` directory 51 | ./get-all-modules.sh 52 | ``` 53 | -------------------------------------------------------------------------------- /extract.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2020 Nokia 4 | # Licensed under the BSD 3-Clause License. 5 | # SPDX-License-Identifier: BSD-3-Clause 6 | 7 | # this script extracts YANG files from srlinux public container image 8 | # usage: bash extract.sh $srlVersion 9 | # example: bash extract.sh 21.6.3 10 | 11 | set -e 12 | 13 | if [ -z "$1" ]; then 14 | echo "srlinux version is not set. usage: bash extract.sh