diff --git a/.travis.yml b/.travis.yml index eac230e5d..f923c62f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,28 +4,28 @@ language: python matrix: include: - - os: linux - dist: trusty - group: edge +# - os: linux +# dist: trusty +# group: edge - os: osx - osx_image: xcode7.3 + osx_image: xcode8.3 language: generic -# - os: osx -# env: GNMI=true -# osx_image: xcode7.3 -# language: generic - - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=2.7 - - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=2.7 GNMI=true - - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=3.6 - - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=3.6 GNMI=true - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=2.7 + - os: osx + env: GNMI=true + osx_image: xcode8.3 + language: generic +# - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=2.7 +# - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=2.7 GNMI=true +# - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=3.6 +# - env: DOCKER=true OS_TYPE=centos OS_VERSION=centos7 PYTHON_VERSION=3.6 GNMI=true +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=2.7 # - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=2.7 GNMI=true # - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=3.5 - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=3.5 GNMI=true - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=2.7 - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=2.7 GNMI=true - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=3 - - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=3 GNMI=true +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=xenial PYTHON_VERSION=3.5 GNMI=true +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=2.7 +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=2.7 GNMI=true +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=3 +# - env: DOCKER=true OS_TYPE=ubuntu OS_VERSION=bionic PYTHON_VERSION=3 GNMI=true allow_failures: - os: osx @@ -33,9 +33,9 @@ services: - docker before_install: - - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi +# - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install curl doxygen xml2 ; fi - - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./test/dependencies_osx.sh ; fi + - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./test/dependencies_osx.sh ; fi - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$GNMI" == "true" ]]; then ./test/dependencies_osx_gnmi.sh ; fi - if [[ "$DOCKER" != "true" ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./test/dependencies_trusty.sh ; fi - if [[ "$DOCKER" == "true" ]]; then docker pull ${OS_TYPE}:${OS_VERSION} ; fi diff --git a/CHANGES.md b/CHANGES.md index eb175cd3c..ddcbb54dd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,26 @@ +### 2019-03-15 version 0.8.2 + +#### New features and enhancements + * Expanded disabling of data validation to read operations with NetconfServiceProvider. + * Expanded disabling of data validation to gNMIServiceProvider. + +#### Resolved GitHub issues + * ydk-py and ydk-gen Travis tests fail on Mac ([#834](https://github.com/CiscoDevNet/ydk-gen/issues/834)) + * When MacOS is updated from Homebrew any Python2 YDK application fails ([#837](https://github.com/CiscoDevNet/ydk-gen/issues/837)) + * ImportError: dynamic module does not define module export function (PyInit_ydk_) ([#840](https://github.com/CiscoDevNet/ydk-gen/issues/840)) + * Libyang error: Reached limit (65535) for storing typedefs ([#874](https://github.com/CiscoDevNet/ydk-gen/issues/874)) + * AttributeError: 'Config' object has no attribute 'logger' ([#876](https://github.com/CiscoDevNet/ydk-gen/issues/876)) + * Segmentation Fault in API when connection to Netconf fails ([#879](https://github.com/CiscoDevNet/ydk-gen/issues/879)) + * gNMI provider requires 'port' argument ([#880](https://github.com/CiscoDevNet/ydk-gen/issues/880)) + * 'delete' and 'replace' filters do not work properly with gNMI and CRUD service ([#881](https://github.com/CiscoDevNet/ydk-gen/issues/881)) + * Go compiler failed to link gNMI service on Mac ([#892](https://github.com/CiscoDevNet/ydk-gen/issues/892)) + +#### Model bundle additions + * Released cisco-ios-xr bundle to support Cisco IOS XR 6.5.2 + * Released cisco-ios-xe bundle to support Cisco IOS XE 16.9.3 + * Released cisco-nx-os bundle to support Cisco NX OS 9.2.3 + + ### 2019-02-11 version 0.8.1 #### Python, C++, Go @@ -21,7 +44,7 @@ * Decoding gNMI payload fails with ValueError exception ([#858](https://github.com/CiscoDevNet/ydk-gen/issues/858)) #### Documentation improvements - Addressed multiple documentation issues: [#848](https://github.com/CiscoDevNet/ydk-gen/issues/848), + Addressed multiple documentation issues: [#848](https://github.com/CiscoDevNet/ydk-gen/issues/848), [#850](https://github.com/CiscoDevNet/ydk-gen/issues/850), [#861](https://github.com/CiscoDevNet/ydk-gen/issues/861), [#862](https://github.com/CiscoDevNet/ydk-gen/issues/862) @@ -38,7 +61,7 @@ #### ydk-gen * Added capability to generate YDK service packages from `generate.py` script. - + ### 2018-10-02 version 0.7.3 ### Python, C++ and Go @@ -82,7 +105,7 @@ CRUD/ NETCONF / Codec API improvements ``` ### 2018-07-02 version 0.7.2 - + #### Bundle improvements * Released [`cisco-nx-os`](https://github.com/CiscoDevNet/ydk-gen/blob/master/profiles/bundles/cisco-nx-os-0_7_4.json) bundle to support Cisco NX OS 7.0-3-I7-4 release * Updated [`cisco-ios-xr`](https://github.com/CiscoDevNet/ydk-gen/blob/master/profiles/bundles/cisco-ios-xr_6_4_1.json) bundle to support Cisco IOS XR 6.4.1 release @@ -107,7 +130,7 @@ CRUD/ NETCONF / Codec API improvements * Fixed issue with mixed case objects in Go language model API ([#686](https://github.com/CiscoDevNet/ydk-gen/issues/686)) ### 2018-04-09 version 0.7.1 - + #### Python, C++ and Go ##### Bundle improvements @@ -157,7 +180,7 @@ CRUD/ NETCONF / Codec API improvements * [#673](https://github.com/CiscoDevNet/ydk-gen/pull/673), [#663](https://github.com/CiscoDevNet/ydk-gen/pull/), [#660](https://github.com/CiscoDevNet/ydk-gen/pull/660), [#658](https://github.com/CiscoDevNet/ydk-gen/pull/658), [#606](https://github.com/CiscoDevNet/ydk-gen/pull/606), [#605](https://github.com/CiscoDevNet/ydk-gen/pull/605) ##### CRUD service improvements - * Fixed handling of reading operational data nodes ([#664](https://github.com/CiscoDevNet/ydk-gen/issues/664)) + * Fixed handling of reading operational data nodes ([#664](https://github.com/CiscoDevNet/ydk-gen/issues/664)) * Improved formatting of payloads in logging output ([#670](https://github.com/CiscoDevNet/ydk-gen/issues/670)) ##### Error handling improvements @@ -210,7 +233,7 @@ CRUD/ NETCONF / Codec API improvements * Decoupled path API-specific details from Service Provider and created Netconf & Restconf Session to be used instead of Provider in path API ([#494](https://github.com/CiscoDevNet/ydk-gen/issues/494), [#511](https://github.com/CiscoDevNet/ydk-gen/issues/511)) * Fixed segmentation fault with the `openconfig-platform` model ([#527](https://github.com/CiscoDevNet/ydk-gen/issues/527)) * Improved Netconf Service's `kill_session` method ([#528](https://github.com/CiscoDevNet/ydk-gen/issues/528)) - + #### Documentation * Fixed documentation issues for installation ([#529](https://github.com/CiscoDevNet/ydk-gen/issues/529), [#531](https://github.com/CiscoDevNet/ydk-gen/issues/531), [#542](https://github.com/CiscoDevNet/ydk-gen/issues/542), [#541](https://github.com/CiscoDevNet/ydk-gen/issues/541)) * Improved API documentation ([#424](https://github.com/CiscoDevNet/ydk-gen/issues/424), [#94](https://github.com/CiscoDevNet/ydk-gen/issues/94)) @@ -351,7 +374,7 @@ The [backward incompatible](http://ydk.cisco.com/py/docs/backward_compatibility. * Made generate.py executable ([#227](https://github.com/CiscoDevNet/ydk-gen/issues/227)) * Removed auto capitalization of enum literals ([#230](https://github.com/CiscoDevNet/ydk-gen/issues/230)) * Updated [`cisco-ios-xr` bundle](https://github.com/CiscoDevNet/ydk-gen/blob/master/profiles/bundles/cisco-ios-xr_6_1_2.json) to support Cisco IOS XR 6.1.2 release ([#316](https://github.com/CiscoDevNet/ydk-gen/pull/316)) - + * Logging improvements * Improved logging for services and providers ([#251](https://github.com/CiscoDevNet/ydk-gen/issues/251), [#254](https://github.com/CiscoDevNet/ydk-gen/issues/254), [#280](https://github.com/CiscoDevNet/ydk-gen/issues/280), [#283](https://github.com/CiscoDevNet/ydk-gen/issues/283), [#284](https://github.com/CiscoDevNet/ydk-gen/issues/284)) @@ -451,7 +474,7 @@ The [backward incompatible](http://ydk.cisco.com/py/docs/backward_compatibility. * Logging made more consistent * CRUDService outputs type of operation * When logging is enabled, all NETCONF messages are logged including commit - * Log messages at various stages (send RPC request, receive reply, commit + * Log messages at various stages (send RPC request, receive reply, commit etc) instead of logging all at once at the end * Updated enums in YDK classes to use enum34 * Improved enum documentation diff --git a/README.md b/README.md index d9b96af63..99f177384 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ YANG Development Kit (Generator) - [MacOS](#macos) - [Windows](#windows) - [Installation](#installation) - - [Setting up your environment](#setting-up-your-environment) + - [Setting up Python virtual environment](#setting-up-python-virtual-environment) - [Clone ydk-gen and install the requirements](#clone-ydk-gen-and-install-the-requirements) - [Generate YDK components](#generate-ydk-components) - [First step: choose model bundle profile](#first-step-choose-model-bundle-profile) @@ -61,7 +61,7 @@ The output of ydk-gen is either a core package, that defines services and provid # Backward compatibility -The YDK-0.8.1 core is bacward compatible with generated in YDK-0.7.3 model bundle code. It is not compatible with YDK-0.7.2 and earlier bundle packages due to changes in modeling and handling of YList objects. +The YDK-0.8.2 core is backward compatible with generated in YDK-0.7.3 model bundle code. It is not compatible with YDK-0.7.2 and earlier bundle packages due to changes in modeling and handling of YList objects. # Docker @@ -100,15 +100,15 @@ You can install the latest `libydk` core library using prebuilt binaries for Xen For Xenial (Ubuntu 16.04.4): ``` - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb ``` For Bionic (Ubuntu 18.04.1): ``` - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb ``` ### Centos (Fedora-based) @@ -129,7 +129,7 @@ For Bionic (Ubuntu 18.04.1): #### Install prebuilt libydk binary ``` - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm ``` ### Build from source @@ -154,20 +154,18 @@ Install dependencies OS dependencies then generate and install YDK C++ libraries It is recommended to install [homebrew](http://brew.sh) and Xcode command line tools on your system before installing YDK-Py/YDK-Cpp/YDK-Go. -You can download the latest Python package from [here](https://www.python.org/downloads/). Please do not use the homebrew version of Python as it causes issues with installation of YDK packages. Please execute `brew rm python python3` to remove any homebrew Python packages. - -#### Install prebuilt libydk and optionally libydk_gnmi libraries +### Install prebuilt libydk and optionally libydk_gnmi libraries ``` xcode-select --install /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install pkg-config libssh xml2 curl pcre cmake libxml2 pybind11 - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg - sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg + sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / ``` ### Build from source @@ -241,28 +239,28 @@ In order to enable YDK support for gNMI protocol, which is optional, the followi For Xenial (Ubuntu 16.04.4): ``` - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb ``` For Bionic (Ubuntu 18.04.1) ``` - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb ``` #### CentOS ``` - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm ``` #### MacOS: ``` - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / ``` ### Run-time environment @@ -277,7 +275,7 @@ As a workaround, the YDK based application runtime environment must include sett ``` # Installation -## Setting up your environment +## Setting up Python virtual environment We recommend that you run ydk-gen under Python virtual environment (``virtualenv``/``virtualenvwrapper``). To install Python virtual environment in your system, execute: @@ -288,12 +286,24 @@ We recommend that you run ydk-gen under Python virtual environment (``virtualenv In some systems (e.g. Debian-based Linux), you may need to install support for Python virtual environments as root -Create new virtual environment: +Create and activate new virtual environment: ``` mkvirtualenv -p python2.7 py2 ``` +Activate previously created virtusl environment: + +``` + source ~/.virtualenvs/py2/bin/activate +``` + +Exit virtual environment: + +``` + deactivate +``` + ## Clone ydk-gen and install the requirements ``` @@ -359,7 +369,7 @@ A sample bundle profile file is described below. The file is in a JSON format. S { "name":"cisco-ios-xr", "version": "0.1.0", - "ydk_version": "0.8.1", + "ydk_version": "0.8.2", "Author": "Cisco", "Copyright": "Cisco", "Description": "Cisco IOS-XR Native Models From Git", @@ -458,7 +468,7 @@ Now, the `pip list | grep ydk` should show the `ydk` (referring to the core pack $ pip list | grep ydk ... -ydk (0.8.1) +ydk (0.8.2) ydk-models- (0.5.1) ... ``` @@ -536,6 +546,12 @@ It is also required for Python installation to include corresponding shared libr Please follow [System requirements](#system-requirements) to assure presence of shared Python libraries. +### Mac OS + +The developers of Python2 on Mac OS might face an issue ([#837](https://github.com/CiscoDevNet/ydk-gen/issues/837)). +This is well known and documented issue. Each developer might have different approaches for its resolution. +One of them is to use Python2 virtual environment. See [Setting up Python virtual environment](#setting-up-python-virtual-environment) for details. + ## Directory structure ``` @@ -618,10 +634,10 @@ $ cmake .. && make all test Please refer [here](https://github.com/CiscoDevNet/ydk-gen/blob/master/sdk/go/core/README.md). -Support -======= +#### Support + Join the [YDK community](https://communities.cisco.com/community/developer/ydk) to connect with other users and with the makers of YDK. -Release Notes -=============== -The current YDK release version is 0.8.1. The version of the latest YDK-Gen master branch is 0.8.1. YDK-Gen is licensed under the Apache 2.0 License. +#### Release Notes + +The current YDK release version is 0.8.2. The version of the latest YDK-Gen master branch is 0.8.2. YDK-Gen is licensed under the Apache 2.0 License. diff --git a/generate_bundles.sh b/generate_bundles.sh index 6a0512d16..e1b02998f 100755 --- a/generate_bundles.sh +++ b/generate_bundles.sh @@ -99,24 +99,24 @@ run_cmd ./generate.py --core run_cmd ./generate.py --service profiles/services/gnmi-0.4.0_post1.json run_cmd ./generate.py --bundle profiles/bundles/ietf_0_1_5_post2.json run_cmd ./generate.py --bundle profiles/bundles/openconfig_0_1_6_post1.json -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_1.json -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_1_post1.json -run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_2.json +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_3.json +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_2.json +run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_3.json print_msg "Generating C++ core and bundles" run_cmd ./generate.py --core --cpp run_cmd ./generate.py --service profiles/services/gnmi-0.4.0_post1.json --cpp run_cmd ./generate.py --bundle profiles/bundles/ietf_0_1_5_post2.json --cpp run_cmd ./generate.py --bundle profiles/bundles/openconfig_0_1_6_post1.json --cpp -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_1.json --cpp -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_1_post1.json --cpp -run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_2.json --cpp +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_3.json --cpp +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_2.json --cpp +run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_3.json --cpp print_msg "Generating Go core and bundles" run_cmd ./generate.py --core --go run_cmd ./generate.py --service profiles/services/gnmi-0.4.0_post1.json --go run_cmd ./generate.py --bundle profiles/bundles/ietf_0_1_5_post2.json --go run_cmd ./generate.py --bundle profiles/bundles/openconfig_0_1_6_post1.json --go -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_1.json --go -run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_1_post1.json --go -run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_2.json --go +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xe_16_9_3.json --go +run_cmd ./generate.py --bundle profiles/bundles/cisco-ios-xr_6_5_2.json --go +run_cmd ./generate.py --bundle profiles/bundles/cisco-nx-os-9_2_3.json --go diff --git a/profiles/services/gnmi-0.4.0_post2.json b/profiles/services/gnmi-0.4.0_post2.json new file mode 100644 index 000000000..2de835bd1 --- /dev/null +++ b/profiles/services/gnmi-0.4.0_post2.json @@ -0,0 +1,25 @@ +{ + "name": "gnmi", + "version": "0.4.0-post2", + "author": "Cisco", + "copyright": "Cisco", + "description": "YDK gNMI service profile", + "long_description": "This YANG Development Kit (YDK) bundle provides APIs for OpenConfig YANG models. YDK facilitates the use of YANG data models by expressing the model semantics in an API and abstracting protocol/encoding details. YDK is composed of a core package that defines services and providers, plus one or more module bundles. This YDK bundle for OpenConfig models uses the YDK core package and additional model bundles. You can find the SDK documentation at http://ydk.cisco.com/py/docs You can find more details on YDK at http://ydk.io", + "dependency": [ + { + "name": "ydk", + "version": "0.8.2", + "uri": "" + }, + { + "name": "protobuf", + "version": "3.5.0", + "uri": "https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip" + }, + { + "name": "grpc", + "version": "1.9.1", + "uri": "https://github.com/grpc/grpc-master.zip" + } + ] +} diff --git a/profiles/test/ydktest-oc-nis.json b/profiles/test/ydktest-oc-nis.json new file mode 100644 index 000000000..a5a3eb00c --- /dev/null +++ b/profiles/test/ydktest-oc-nis.json @@ -0,0 +1,13 @@ +{ + "name": "ydktest-oc-nis", + "version": "0.1.0", + "ydk_version":"0.8.1", + "author": "Cisco", + "copyright": "Cisco", + "description": "YDK openconfig-network-instance test profile", + "models": { + "dir": [ + "/yang/openconfig-nis" + ] + } +} diff --git a/sdk/cpp/CHANGES.md b/sdk/cpp/CHANGES.md index f4f393e34..15a1edef9 100644 --- a/sdk/cpp/CHANGES.md +++ b/sdk/cpp/CHANGES.md @@ -1,3 +1,20 @@ +### 2019-03-15 version 0.8.2 + +#### New features and enhancements + * Expanded disabling of data validation to read operations with NetconfServiceProvider. + * Expanded disabling of data validation to gNMIServiceProvider. + +#### Resolved GitHub issues + * Libyang error: Reached limit (65535) for storing typedefs ([#874](https://github.com/CiscoDevNet/ydk-gen/issues/874)) + * Segmentation Fault in API when connection to Netconf fails ([#879](https://github.com/CiscoDevNet/ydk-gen/issues/879)) + * 'delete' and 'replace' filters do not work properly with gNMI and CRUD service ([#881](https://github.com/CiscoDevNet/ydk-gen/issues/881)) + +#### Model bundle additions + * Released cisco-ios-xr bundle to support Cisco IOS XR 6.5.2 + * Released cisco-ios-xe bundle to support Cisco IOS XE 16.9.3 + * Released cisco-nx-os bundle to support Cisco NX OS 9.2.3 + + ### 2019-02-11 version 0.8.1 #### CRUD / Netconf / gNMI/ Codec / Path API diff --git a/sdk/cpp/README.md b/sdk/cpp/README.md index bab2ae43d..bb3d5296a 100644 --- a/sdk/cpp/README.md +++ b/sdk/cpp/README.md @@ -136,15 +136,15 @@ For other Ubuntu distributions it is recommended to build core libraries from so For Xenial: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb -$ sudo gdebi libydk_0.8.1-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb +$ sudo gdebi libydk-0.8.2-1.amd64.deb ``` For Bionic: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb -$ sudo gdebi libydk_0.8.1-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb +$ sudo gdebi libydk-0.8.2-1.amd64.deb ``` ##### Centos (Fedora-based) @@ -152,7 +152,7 @@ $ sudo gdebi libydk_0.8.1-1_amd64.deb You can install the latest YDK core package using prebuilt binaries: ``` -$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm +$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm ``` #### MacOS @@ -160,8 +160,8 @@ $ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8 You can install the latest YDK core package using prebuilt binaries: ``` -$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg -$ sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / +$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg +$ sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / ``` ### gNMI Service Installation @@ -173,28 +173,28 @@ $ sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / For Ubuntu/Xenial: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb -$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb +$ sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb ``` For Ubuntu/Bionic: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb -$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb +$ sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb ``` For CentOS ``` - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm ``` ##### MacOS ``` -$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg -$ sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / +$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg +$ sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / ``` ### Installing from source @@ -253,4 +253,4 @@ build$ sudo make install - Additional YDK information can be found at [ydk.io](http://ydk.io) ## Release Notes -The current YDK release version is 0.8.1. YDK-Cpp is licensed under the Apache 2.0 License. +The current YDK release version is 0.8.2. YDK-Cpp is licensed under the Apache 2.0 License. diff --git a/sdk/cpp/core/CMakeLists.txt b/sdk/cpp/core/CMakeLists.txt index b463f500c..11b3639a1 100644 --- a/sdk/cpp/core/CMakeLists.txt +++ b/sdk/cpp/core/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0.0) cmake_policy(SET CMP0048 NEW) -project(ydk VERSION 0.8.1 LANGUAGES C CXX) +project(ydk VERSION 0.8.2 LANGUAGES C CXX) set(YDK_DESCRIPTION "YANG Development Kit Library. The library for YDK API.") @@ -64,7 +64,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # _-_.deb # libydk_0.6.0-0.1.alpha_amd64.deb // Debian set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") # Linux Fedora elseif(${LSB_RELEASE_ID_SHORT} MATCHES "CentOS") @@ -159,9 +159,11 @@ set(libydk_src src/opendaylight_provider.cpp src/restconf_client.cpp src/restconf_provider.cpp + src/restconf_session.cpp src/validation_service.cpp src/value.cpp src/value_list.cpp + src/json_subtree_codec.cpp src/xml_subtree_codec.cpp src/xml_util.cpp src/ydk_operation.cpp @@ -173,7 +175,6 @@ set(libydk_src src/netconf_model_provider.cpp src/path/path.cpp src/path/repository.cpp - src/path/restconf_session.cpp src/path/root_data_node.cpp src/path/root_schema_node.cpp src/path/rpc.cpp @@ -221,6 +222,7 @@ set(libydk_install_headers src/restconf_provider.hpp src/service_provider.hpp src/types.hpp + src/json_subtree_codec.hpp src/xml_subtree_codec.hpp src/xml_util.hpp src/validation_service.hpp diff --git a/sdk/cpp/core/docsgen/getting_started.rst b/sdk/cpp/core/docsgen/getting_started.rst index b2fe1357d..27c5b4da6 100644 --- a/sdk/cpp/core/docsgen/getting_started.rst +++ b/sdk/cpp/core/docsgen/getting_started.rst @@ -114,15 +114,15 @@ For Xenial (Ubuntu 16.04.4): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb For Bionic (Ubuntu 18.04.1): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb **CentOS** @@ -130,13 +130,13 @@ Install YDK core library: .. code-block:: sh - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm Install YDK gNMI library (optional): .. code-block:: sh - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi-0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi-0.4.0-1.x86_64.rpm **MacOS** @@ -150,8 +150,8 @@ Alternatively, you can perform partial installation. If you only want to instal .. code-block:: sh - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1-beta/libydk-0.8.1-Darwin.pkg - sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2-beta/libydk-0.8.2-Darwin.pkg + sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / If you want to install only the ``ietf`` bundle and its dependencies (``ydk`` package), execute: @@ -171,28 +171,28 @@ For Xenial (Ubuntu 16.04.4): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb For Bionic (Ubuntu 18.04.1): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb **CentOS** .. code-block:: sh - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm **MacOS** .. code-block:: sh - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / Set runtime environment ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/sdk/cpp/core/src/common_utilities.cpp b/sdk/cpp/core/src/common_utilities.cpp index 52cdb3401..3f6e63832 100644 --- a/sdk/cpp/core/src/common_utilities.cpp +++ b/sdk/cpp/core/src/common_utilities.cpp @@ -26,6 +26,7 @@ #include "common_utilities.hpp" #include "entity_data_node_walker.hpp" #include "xml_subtree_codec.hpp" +#include "json_subtree_codec.hpp" #include "path/path_private.hpp" using namespace std; @@ -141,7 +142,7 @@ find_child_entity(shared_ptr parent_entity, Entity & filter_entity) return nullptr; } -static shared_ptr +shared_ptr get_child_entity_from_top(shared_ptr top_entity, Entity & filter_entity) { shared_ptr child_entity; @@ -217,6 +218,25 @@ string get_xml_subtree_filter_payload(Entity & entity, const ServiceProvider & p return xml_subtree_codec.encode(entity, provider.get_session().get_root_schema()); } +string get_json_subtree_filter_payload(Entity & entity, const ServiceProvider & provider, bool pretty) +{ + JsonSubtreeCodec json_subtree_codec{}; + YLOG_DEBUG("Encoding the subtree filter request using JSON subtree codec"); + return json_subtree_codec.encode(entity, provider.get_session().get_root_schema(), pretty); +} + +Entity * get_top_entity(Entity * entity) +{ + Entity * top_entity = entity; + while (top_entity->parent && !top_entity->is_top_level_class) { + top_entity = top_entity->parent; + } + if (entity->ignore_validation && !top_entity->is_top_level_class) { + YLOG_WARN("get_top_entity: Validation cannot be disabled on non-top-level entity '{}'", entity->yang_name); + } + return top_entity; +} + vector get_union(vector & v1, vector & v2) { set all; diff --git a/sdk/cpp/core/src/common_utilities.hpp b/sdk/cpp/core/src/common_utilities.hpp index 0e803483f..aa466f917 100644 --- a/sdk/cpp/core/src/common_utilities.hpp +++ b/sdk/cpp/core/src/common_utilities.hpp @@ -39,10 +39,13 @@ namespace ydk bool has_xml_escape_sequences(const std::string& xml); std::string replace_xml_escape_sequences(const std::string& xml); + Entity * get_top_entity(Entity * entity); std::shared_ptr get_top_entity_from_filter(Entity & filter); std::shared_ptr read_datanode(Entity & filter, std::shared_ptr read_data_node); + std::shared_ptr get_child_entity_from_top(std::shared_ptr top_entity, Entity & filter_entity); std::string get_data_payload(Entity & entity, const ServiceProvider & provider); std::string get_xml_subtree_filter_payload(Entity & entity, const ServiceProvider & provider); + std::string get_json_subtree_filter_payload(Entity & entity, const ServiceProvider & provider, bool pretty=true); std::vector get_union(std::vector & v1, std::vector & v2); diff --git a/sdk/cpp/core/src/json_subtree_codec.cpp b/sdk/cpp/core/src/json_subtree_codec.cpp new file mode 100644 index 000000000..37c629f71 --- /dev/null +++ b/sdk/cpp/core/src/json_subtree_codec.cpp @@ -0,0 +1,404 @@ +/// YANG Development Kit +// Copyright 2019 Cisco Systems. All rights reserved +// +//////////////////////////////////////////////////////////////// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +////////////////////////////////////////////////////////////////// + +#include // std::all_of +#include // std::isdigit + +#include "entity_util.hpp" +#include "logger.hpp" +#include "json.hpp" +#include "common_utilities.hpp" +#include "json_subtree_codec.hpp" + +using namespace std; +using json = nlohmann::json; + +struct json_node_t +{ + string key; + json value; + json_node_t(json & node); + json_node_t(string node_key); + json_node_t(string node_key, const json & jvalue); + void add(const json_node_t& node); + void put(const json_node_t& node); +}; + +json_node_t::json_node_t(json & node) +{ + auto it = node.begin(); + key = it.key(); + value = node[key]; +} + +json_node_t::json_node_t(string node_key) +{ + key = node_key; + value = {}; +} + +json_node_t::json_node_t(string node_key, const json & jvalue) +{ + key = node_key; + value = jvalue; +} + +void json_node_t::add(const json_node_t& node) +{ + auto it = value.find(node.key); + if (it == value.end()) + value.emplace(node.key, node.value); + else if (node.value.is_primitive()) { + auto child = value[node.key]; + if (child.is_array()) + it->push_back(node.value); + else if (child.type() == node.value.type()) { + auto arr = json::array({ child }); + arr.push_back(node.value); + it->swap(arr); + } + } +} + +void json_node_t::put(const json_node_t& node) +{ + value[node.key] += node.value; +} + +void to_json(json& j, const json_node_t& node) +{ + j.emplace(node.key, node.value); +} + +namespace ydk +{ +static void decode_json(json & jchildren, Entity & entity, Entity * parent); + +static void walk_children(Entity & entity, const path::SchemaNode & parent_schema, json_node_t & json_node, std::string & parent_module_name); +static json_node_t populate_json_node(Entity & entity, const path::SchemaNode & parent_schema, std::string & parent_module_name); +static void populate_json_node_contents(Entity & entity, const path::SchemaNode & parent_schema, EntityPath & path, + json_node_t & json_node, + std::string & parent_module_name); +static const path::SchemaNode* find_child_by_name(const path::SchemaNode & parent_schema, const string & name); + +JsonSubtreeCodec::JsonSubtreeCodec() +{ +} + +JsonSubtreeCodec::~JsonSubtreeCodec() +{ +} + +////////////////////////////////////////////////////////////////// +// JsonSubtreeCodec::encode +////////////////////////////////////////////////////////////////// +std::string JsonSubtreeCodec::encode(Entity & entity, path::RootSchemaNode & root_schema, bool pretty) +{ + EntityPath root_path = get_entity_path(entity, nullptr); + auto & root_data_node = root_schema.create_datanode(root_path.path); + YLOG_DEBUG("JsonCodec: Encoding entity '{}' to JSON string", entity.get_segment_path()); + const path::SchemaNode & schema = root_data_node.get_schema_node(); + auto st = schema.get_statement(); + std::string root_module_name = st.module_name; + std::string root_node_name = root_module_name; + root_node_name += ":" + st.arg; + + json_node_t root_json_node(root_node_name); + + populate_json_node_contents(entity, schema, root_path, root_json_node, root_module_name); + walk_children(entity, schema, root_json_node, root_module_name); + + if (pretty) { + return json(root_json_node).dump(2); + } + else { + return json(root_json_node).dump(); + } +} + +static void walk_children(Entity & entity, const path::SchemaNode & schema, json_node_t & parent_json_node, string & parent_module_name) +{ + std::map> children = entity.get_children(); + YLOG_DEBUG("JsonCodec: Children count for '{}': {}", get_entity_path(entity, entity.parent).path, children.size()); + for (auto const& child : children) + { + if(child.second == nullptr) + continue; + if (child.second->has_operation() || child.second->has_data() || child.second->is_presence_container) + { + YLOG_DEBUG("JsonCodec: Populating child entity node '{}': {}", child.first, get_entity_path(*(child.second), child.second->parent).path); + json_node_t child_json_node = populate_json_node(*(child.second), schema, parent_module_name); + auto bracket_pos = child.first.find("["); + if (bracket_pos != string::npos) { + // We have a list + parent_json_node.put(child_json_node); + } + else { + // We have a container + parent_json_node.add(child_json_node); + } + } + } +} + +static const path::SchemaNode* find_child_by_name(const path::SchemaNode & parent_schema, const string & name) +{ + auto p = const_cast(&parent_schema); + vector s = p->find(name); + if (s.size() == 0) { + YLOG_ERROR("Could not find node '{}'", name); + throw YServiceProviderError{"Could not find node " + name}; + } + return s[0]; +} + +static json_node_t create_json_node(std::string & parent_module_name, const path::SchemaNode & schema) +{ + auto st = schema.get_statement(); + auto child_module_name = parent_module_name; + std::string child_key = st.arg; + if (st.module_name != child_module_name) { + child_key.insert(0, child_module_name + ":"); + } + json_node_t child(child_key); + return child; +} + +static json_node_t populate_json_node(Entity & entity, const path::SchemaNode & parent_schema, string & parent_module_name) +{ + EntityPath path = get_entity_path(entity, entity.parent); + const path::SchemaNode* schema = find_child_by_name(parent_schema, entity.get_segment_path()); + + auto child = create_json_node(parent_module_name, *schema); + + populate_json_node_contents(entity, *schema, path, child, parent_module_name); + walk_children(entity, *schema, child, parent_module_name); + return child; +} + +static std::string get_leafdata_prefix(Entity & entity, string & leaf_name, LeafData & leaf_data) +{ + std::string module_name; + if (leaf_data.name_space.size() > 0 && leaf_data.name_space_prefix.size() > 0) + { + Entity* p = &entity; + while (p->parent != nullptr) { + p = p->parent; + } + auto m = p->get_namespace_identity_lookup(); + if (m.find({leaf_name, leaf_data.name_space}) != m.end()) { + module_name = m[{leaf_name, leaf_data.name_space}] + ":"; + } + } + return module_name; +} + +static string get_content_from_leafdata(Entity & entity, string leaf_name, LeafData & leaf_data) +{ + string content; + if (leaf_data.is_set) + { + auto prefix = get_leafdata_prefix(entity, leaf_name, leaf_data); + content = (prefix + leaf_data.value); + } + else if(is_set(leaf_data.yfilter)) + { + content = ""; + } + return content; +} + +static json get_json_leaf_value(string & leaf_value) +{ + if (leaf_value == "" || leaf_value == "null") + return json{}; + else if (leaf_value == "true") + return json(true); + else if (leaf_value == "false") + return json(false); + else { + bool is_number = all_of(leaf_value.begin(), leaf_value.end(), ::isdigit); + if (is_number) { + int jint = stoi(leaf_value); + return json(jint); + } + else { + return json(leaf_value); + } + } +} + +static void populate_json_node_contents(Entity & entity, const path::SchemaNode & parent_schema, EntityPath & path, json_node_t & json_node, std::string & parent_module_name) +{ + for (const std::pair & name_value : path.value_paths) + { + LeafData leaf_data = name_value.second; + const path::SchemaNode* schema = find_child_by_name(parent_schema, name_value.first); + + if (leaf_data.is_set || is_set(leaf_data.yfilter)) + { + string leaf_name = name_value.first; + string leaf_type = "leaf"; + auto pos = leaf_name.find("[.=\""); + if (pos != string::npos) { + leaf_data.value = leaf_name.substr(pos+4, leaf_name.length()-pos-6); + leaf_name = leaf_name.substr(0, pos); + leaf_type = "leaf-list"; + } + YLOG_DEBUG("JsonCodec: Creating {} node '{}' in '{}' with value: '{}'", + leaf_type, leaf_name, entity.yang_name, leaf_data.value); + string content = get_content_from_leafdata(entity, leaf_name, leaf_data); + + auto st = schema->get_statement(); + auto child_module_name = parent_module_name; + string child_key = st.arg; + if (st.module_name != child_module_name) { + child_key.insert(0, child_module_name + ":"); + } + json_node_t jleaf(child_key, get_json_leaf_value(content)); + json_node.add(jleaf); + } + } +} + +////////////////////////////////////////////////////////////////// +// JsonSubtreeCodec::decode +////////////////////////////////////////////////////////////////// + +static pair split_key(string & key) +{ + auto colon_pos = key.find(":"); + if (colon_pos == string::npos) + return {"", key}; + else + return {key.substr(0, colon_pos), key.substr(colon_pos+1)}; +} + +std::shared_ptr JsonSubtreeCodec::decode(const std::string & payload, std::shared_ptr entity) +{ + YLOG_DEBUG("JsonCodec: Decoding JSON payload\n{}\nTo Entity '{}'", payload, entity->get_segment_path()); + json root_json_node; + try { + root_json_node = json::parse(payload); + if (!root_json_node.is_object()) { + throw exception(); + } + } + catch (exception e) { + throw YInvalidArgumentError{"Invalid JSON string"}; + } + json_node_t root(root_json_node); + auto prefix_key = split_key(root.key); + if (entity->yang_name != prefix_key.second) { + throw YInvalidArgumentError{"Wrong entity provided"}; + } + decode_json(root.value, *entity, nullptr); + return entity; +} + +static void check_and_set_content(Entity & entity, const string & leaf_name, json & leaf_jvalue) +{ + ostringstream jstr_buffer; + jstr_buffer << leaf_jvalue; + auto content = jstr_buffer.str(); + if (content.front() == '"' && content.back() == '"') + content = content.substr(1, content.length()-2); + content = trim(content); + if (leaf_name.empty() || content.empty()) + return; + + auto prefix_key = split_key(content); + string name_space; + string name_space_prefix; + if (!prefix_key.first.empty()) + { + name_space_prefix = prefix_key.first; // module name + auto m = entity.get_namespace_identity_lookup(); + for (auto mitem : m) { + if (mitem.first.first == leaf_name && mitem.second == name_space_prefix) { + name_space = mitem.first.second; + break; + } + } + } + YLOG_DEBUG("JsonCodec: Creating leaf '{}' with value '{}' in entity '{}'", leaf_name, content, entity.yang_name); + entity.set_value(leaf_name, content, name_space, name_space_prefix); +} + +static void check_and_set_leaf(Entity & entity, Entity * parent, const string & node_name, json & json_node) +{ + if (json_node.is_null()) + { + YLOG_DEBUG("JsonCodec: Creating leaf '{}' with no value in entity '{}'", node_name, entity.yang_name); + entity.set_filter(node_name, YFilter::read); + } + else if (json_node.is_primitive()) + { + check_and_set_content(entity, node_name, json_node); + } + else { + decode_json(json_node, entity, parent); + } +} + +static void check_and_set_node(Entity & entity, Entity * parent, const string & node_name, json & node_jvalue) +{ + if (!entity.has_leaf_or_child_of_name(node_name)) + { + ostringstream os; + os << "JsonCodec: Wrong payload! No element '" << node_name << "' found in '" << entity.yang_name << "'"; + YLOG_ERROR(os.str().c_str()); + throw YInvalidArgumentError{os.str()}; + } + + auto child = entity.get_child_by_name(node_name); + if (child != nullptr) { + YLOG_DEBUG("JsonCodec: Creating child entity '{}' in '{}'", node_name, entity.yang_name); + decode_json(node_jvalue, *child, &entity); + } + else { + check_and_set_leaf(entity, parent, node_name, node_jvalue); + } +} + +static void decode_json(json & root, Entity & entity, Entity * parent) +{ + for (auto it=root.begin(); it != root.end(); it++) + { + string node_key = it.key(); + json node_value = root[node_key]; + if (node_value.is_object()) { // entity + check_and_set_node(entity, parent, node_key, node_value); + } + else if (node_value.is_array()) { // list object + for (auto ar_it=node_value.begin(); ar_it != node_value.end(); ar_it++) { + check_and_set_node(entity, parent, node_key, *ar_it); + } + } + else { // leaf + check_and_set_content(entity, node_key, node_value); + } + } +} + +} diff --git a/sdk/cpp/core/src/json_subtree_codec.hpp b/sdk/cpp/core/src/json_subtree_codec.hpp new file mode 100644 index 000000000..d168701c6 --- /dev/null +++ b/sdk/cpp/core/src/json_subtree_codec.hpp @@ -0,0 +1,40 @@ +/// YANG Development Kit +// Copyright 2019 Cisco Systems. All rights reserved +// +//////////////////////////////////////////////////////////////// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +////////////////////////////////////////////////////////////////// + +#include + +#include "path_api.hpp" +#include "types.hpp" + +namespace ydk +{ +class JsonSubtreeCodec +{ +public: + JsonSubtreeCodec(); + ~JsonSubtreeCodec(); + + std::string encode(Entity & entity, path::RootSchemaNode & root_schema, bool pretty=true); + std::shared_ptr decode(const std::string & payload, std::shared_ptr entity); +}; +} diff --git a/sdk/cpp/core/src/netconf_provider.cpp b/sdk/cpp/core/src/netconf_provider.cpp index 837ab4d1e..725352599 100644 --- a/sdk/cpp/core/src/netconf_provider.cpp +++ b/sdk/cpp/core/src/netconf_provider.cpp @@ -131,7 +131,10 @@ NetconfServiceProvider::execute_operation(const string & operation, Entity & ent { NetconfService ns; if (operation == "create" || operation == "update" || operation == "delete") { - entity.yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::merge; + YFilter original_yfilter = entity.yfilter; + if (original_yfilter == YFilter::not_set) { + entity.yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::merge; + } DataStore target = (is_candidate_supported(session.get_capabilities())) ? DataStore::candidate : DataStore::running; if (ns.edit_config(*this, target, entity)) { @@ -142,6 +145,7 @@ NetconfServiceProvider::execute_operation(const string & operation, Entity & ent YLOG_ERROR("NetconfServiceProvider::execute_operation: Operation '{}' failed; discarding changes.", operation); throw(YServiceProviderError("NetconfServiceProvider: Operation failed")); } + entity.yfilter = original_yfilter; } else if (operation == "read") { if (params["mode"] == "config") @@ -162,8 +166,14 @@ NetconfServiceProvider::execute_operation(const string & operation, vector> result; NetconfService ns; if (operation == "create" || operation == "update" || operation == "delete") { - for (auto entity : entity_list) - entity->yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::merge; + YFilter original_yfilters[entity_list.size()]; + size_t item = 0; + for (auto entity : entity_list) { + original_yfilters[item++] = entity->yfilter; + if (entity->yfilter == YFilter::not_set) { + entity->yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::merge; + } + } DataStore target = (is_candidate_supported(session.get_capabilities())) ? DataStore::candidate : DataStore::running; if (ns.edit_config(*this, target, entity_list)) { @@ -172,6 +182,11 @@ NetconfServiceProvider::execute_operation(const string & operation, vectoryfilter = original_yfilters[item++]; + } } else if (operation == "read") { if (params["mode"] == "config") diff --git a/sdk/cpp/core/src/netconf_service.cpp b/sdk/cpp/core/src/netconf_service.cpp index 263422f6f..92138c801 100644 --- a/sdk/cpp/core/src/netconf_service.cpp +++ b/sdk/cpp/core/src/netconf_service.cpp @@ -41,7 +41,7 @@ static shared_ptr get_rpc_instance(NetconfServiceProvider& provider, static void create_input_leaf(path::DataNode & input_datanode, DataStore datastore, string && datastore_string, string & url); static void create_input_leaf(path::DataNode & input_datanode, DataStore datastore, string && datastore_string); static string datastore_to_string(DataStore datastore); -static Entity * get_top_entity(Entity * entity); +static map split_xml_payload(string reply); NetconfService::NetconfService() { @@ -260,28 +260,79 @@ bool NetconfService::edit_config(NetconfServiceProvider& provider, DataStore tar return edit_payload(provider, target, payload, default_operation, test_option, error_option); } +static shared_ptr xml_codec_payload_to_entity(const std::string & payload, shared_ptr filter) +{ + XmlSubtreeCodec xml_subtree_codec{}; + YLOG_DEBUG("Decoding XML payload to Entity using XML subtree codec"); + return xml_subtree_codec.decode(payload, filter); +} + static vector> get_from_list(NetconfServiceProvider& provider, DataStore source, vector & filter_list, const char* path) { - // Get the root schema node + vector> result_list{}; + + // Create RPC node shared_ptr rpc = get_rpc_instance(provider, path); + // Source options: candidate | running | startup + if (source != DataStore::na) + create_input_leaf(rpc->get_input_node(), source, "source"); + // Build filter + size_t bypass_validation = 0; string filter_string = ""; for (auto entity : filter_list) { auto top_entity = get_top_entity(entity); - filter_string += (top_entity->is_top_level_class) ? - get_xml_subtree_filter_payload(*top_entity, provider) : - get_data_payload(*entity, provider); + if (top_entity->is_top_level_class) { + filter_string += get_xml_subtree_filter_payload(*top_entity, provider); + if (entity->ignore_validation) + bypass_validation++; + } + else { + filter_string += get_data_payload(*entity, provider); + } } - - // Source options: candidate | running | startup - if (source != DataStore::na) - create_input_leaf(rpc->get_input_node(), source, "source"); rpc->get_input_node().create_datanode("filter", filter_string); + if (bypass_validation == filter_list.size()) { + const path::NetconfSession * ns = dynamic_cast(&(provider.get_session())); + auto reply = ns->execute_netconf_operation(*rpc); + auto payload_map = split_xml_payload(reply); + + // Build resulting list of entities + for (Entity* entity : filter_list) { + auto top_entity = get_top_entity(entity); + string entity_key = top_entity->get_segment_path(); + string payload = ""; + for (auto payload_entry : payload_map) { + auto key = payload_entry.first; + if (key == entity_key) { + payload = payload_entry.second; + break; + } + auto colon = entity_key.find(":"); + if (colon != string::npos) { + auto name = entity_key.substr(colon+1); + if (key == name) { + payload = payload_entry.second; + break; + } + } + } + if (!payload.empty()) { + auto reply_entity = xml_codec_payload_to_entity(payload, top_entity->clone_ptr()); + result_list.push_back( get_child_entity_from_top(reply_entity, *entity) ); + } + else { + YLOG_DEBUG("Netconf Service 'get' operation did not return data node on entity '{}'; returning nullptr.", entity_key); + result_list.push_back(nullptr); + } + } + return result_list; + } + // Get root data node - vector> result_list{}; shared_ptr result_datanode = (*rpc)(provider.get_session()); if (result_datanode == nullptr) return result_list; @@ -296,10 +347,11 @@ get_from_list(NetconfServiceProvider& provider, DataStore source, vectorget_segment_path(); + auto top_entity = get_top_entity(entity); + string internal_key = top_entity->get_segment_path(); shared_ptr datanode = path_to_datanode[internal_key]; if (!datanode) { - YLOG_DEBUG("Searching for datanode using entity yang name '{}'", entity->yang_name); + YLOG_DEBUG("Searching for datanode using entity yang name '{}'", top_entity->yang_name); path_to_datanode.erase(internal_key); for (auto dn_entry : path_to_datanode) { if (dn_entry.first.find(entity->yang_name) != string::npos && dn_entry.second) { @@ -309,14 +361,13 @@ get_from_list(NetconfServiceProvider& provider, DataStore source, vectorget_input_node().create_datanode("filter", filter_string); + if (filter.ignore_validation && top_entity->is_top_level_class) { + // Bypass libyang validation + const path::NetconfSession * ns = dynamic_cast(&(provider.get_session())); + auto reply = ns->execute_netconf_operation(*rpc); + auto reply_entity = xml_codec_payload_to_entity(reply, top_entity->clone_ptr()); + return get_child_entity_from_top(reply_entity, filter); + } + shared_ptr result_datanode = (*rpc)(provider.get_session()); if (result_datanode == nullptr) return {}; @@ -503,16 +562,29 @@ static string datastore_to_string(DataStore datastore) } } -static Entity * get_top_entity(Entity * entity) +static map split_xml_payload(string reply) { - Entity * top_entity = entity; - while (top_entity->parent && !top_entity->is_top_level_class) { - top_entity = top_entity->parent; - } - if (entity->ignore_validation && !top_entity->is_top_level_class) { - YLOG_WARN("get_top_entity: Validation cannot be disable on non-top-level entity '{}'", entity->yang_name); + map payload_map; + while (!reply.empty()) + { + reply = trim(reply); + if (reply.find("<") != 0) + break; + auto space = reply.find(" "); + if (space != string::npos) { + auto start_tag = reply.substr(0, space); + auto end_tag = reply.find(start_tag.insert(1, "/")); + if (end_tag != string::npos) { + size_t payload_end_pos = end_tag + start_tag.length() + 1; + auto payload = reply.substr(0, payload_end_pos); + reply = reply.substr(payload_end_pos); + payload_map[start_tag.substr(2)] = payload; + continue; + } + } + break; // error conditions } - return top_entity; + return payload_map; } } diff --git a/sdk/cpp/core/src/netconf_session.cpp b/sdk/cpp/core/src/netconf_session.cpp index e5e6fbe08..38e38f811 100644 --- a/sdk/cpp/core/src/netconf_session.cpp +++ b/sdk/cpp/core/src/netconf_session.cpp @@ -72,8 +72,8 @@ const string PROTOCOL_SSH = "ssh"; const string PROTOCOL_TCP = "tcp"; static bool is_netconf_get_rpc(path::Rpc & rpc); -static shared_ptr handle_netconf_get_output(const string & reply, path::RootSchemaNode & root_schema); - +static shared_ptr netconf_output_to_datanode(const string & data, path::RootSchemaNode & root_schema); +static string get_netconf_output(const string & reply); NetconfSession::NetconfSession(path::Repository & repo, const string& address, @@ -258,7 +258,9 @@ shared_ptr NetconfSession::handle_crud_read(path::Rpc& ydk_rpc) string netconf_payload = get_netconf_payload(input, "filter", filter_value); - return handle_netconf_get_output(execute_payload(netconf_payload), *root_schema); + auto data = get_netconf_output(execute_payload(netconf_payload)); + if (data.empty()) return nullptr; + return netconf_output_to_datanode(data, *root_schema); } shared_ptr NetconfSession::handle_crud_edit(path::Rpc& ydk_rpc, path::Annotation annotation) const @@ -293,7 +295,9 @@ shared_ptr NetconfSession::handle_netconf_operation(path::Rpc& y if (is_netconf_get_rpc(ydk_rpc)) { - return handle_netconf_get_output(reply, *root_schema); + auto data = get_netconf_output(reply); + if (!data.empty()) + return netconf_output_to_datanode(data, *root_schema); } else if (ydk_rpc.has_output_node()) { @@ -302,6 +306,29 @@ shared_ptr NetconfSession::handle_netconf_operation(path::Rpc& y return nullptr; } +std::string NetconfSession::execute_netconf_operation(path::Rpc& ydk_rpc) const +{ + path::Codec codec_service{}; + auto netconf_payload = codec_service.encode(ydk_rpc.get_input_node(), EncodingFormat::XML, true); + string payload{""}; + netconf_payload = payload + netconf_payload + ""; + + log_rpc_request(netconf_payload); + + string reply = execute_payload(netconf_payload); + check_rpc_reply_for_error(reply); + + if (is_netconf_get_rpc(ydk_rpc)) + { + return get_netconf_output(reply); + } + else if (ydk_rpc.has_output_node()) + { + handle_rpc_output(reply, *root_schema, ydk_rpc.get_input_node().get_path()); + } + return {}; +} + shared_ptr NetconfSession::invoke(path::DataNode& datanode) const { if(!datanode.has_action_node()) @@ -553,14 +580,13 @@ static bool is_netconf_get_rpc(path::Rpc & rpc) or rpc.get_schema_node().get_path() == "/ietf-netconf:get-config"); } -static shared_ptr handle_netconf_get_output(const string & reply, path::RootSchemaNode & root_schema) +static std::string get_netconf_output(const string & reply) { - path::Codec codec_service{}; auto empty_data = reply.find(""); if(empty_data != string::npos) { YLOG_INFO( "Found empty data tag"); - return nullptr; + return {}; } auto data_start = reply.find(""); @@ -577,8 +603,12 @@ static shared_ptr handle_netconf_get_output(const string & reply throw(YError{"No end data tag found"}); } - string data = reply.substr(data_start, data_end-data_start); + return reply.substr(data_start, data_end-data_start); +} +static shared_ptr netconf_output_to_datanode(const string & data, path::RootSchemaNode & root_schema) +{ + path::Codec codec_service{}; auto datanode = shared_ptr(codec_service.decode(root_schema, data, EncodingFormat::XML)); if(!datanode){ diff --git a/sdk/cpp/core/src/netconf_ssh_client.cpp b/sdk/cpp/core/src/netconf_ssh_client.cpp index d44363e8b..43f38713a 100644 --- a/sdk/cpp/core/src/netconf_ssh_client.cpp +++ b/sdk/cpp/core/src/netconf_ssh_client.cpp @@ -196,15 +196,20 @@ StringVec NetconfSSHClient::get_capabilities() void NetconfSSHClient::clb_print(NC_VERB_LEVEL level, const char* msg) { + string message = msg; + auto xml_start_pos = message.find("& lookup_table) { - YLOG_DEBUG("Getting new modules from '{}'", path); + //YLOG_DEBUG("Getting new modules from '{}'", path); auto module_names = path::segmentalize_module_names(path); return get_new_ly_modules_from_lookup(ctx, module_names, lookup_table); } diff --git a/sdk/cpp/core/src/path/root_schema_node.cpp b/sdk/cpp/core/src/path/root_schema_node.cpp index 665b0819b..0ae820dec 100644 --- a/sdk/cpp/core/src/path/root_schema_node.cpp +++ b/sdk/cpp/core/src/path/root_schema_node.cpp @@ -244,7 +244,7 @@ ydk::path::RootSchemaNodeImpl::populate_new_schemas_from_payload(const std::stri void ydk::path::RootSchemaNodeImpl::populate_new_schemas_from_path(const std::string& path) { - YLOG_DEBUG("Getting new modules for {}", path); + YLOG_DEBUG("Getting new modules for '{}'", path); auto new_modules = m_priv_repo->get_new_ly_modules_from_path(m_ctx, path, m_name_namespace_lookup); populate_new_schemas(new_modules); } diff --git a/sdk/cpp/core/src/path/schema_node.cpp b/sdk/cpp/core/src/path/schema_node.cpp index 16e53ee3e..7fe27a581 100644 --- a/sdk/cpp/core/src/path/schema_node.cpp +++ b/sdk/cpp/core/src/path/schema_node.cpp @@ -181,10 +181,10 @@ ydk::path::SchemaNodeImpl::get_root() const noexcept void ydk::path::SchemaNodeImpl::populate_new_schemas_from_path(const string& path) { - YLOG_DEBUG("Looking to populate schemas for {}", path); + YLOG_DEBUG("Looking to populate schemas for '{}'", path); auto snode = const_cast(&get_root()); auto rsnode = reinterpret_cast(snode); - YLOG_DEBUG("Ready to populate schemas for {}", path); + //YLOG_DEBUG("Ready to populate schemas for {}", path); rsnode->populate_new_schemas_from_path(path); } diff --git a/sdk/cpp/core/src/path_api.hpp b/sdk/cpp/core/src/path_api.hpp index bc526dad4..d79d13f21 100644 --- a/sdk/cpp/core/src/path_api.hpp +++ b/sdk/cpp/core/src/path_api.hpp @@ -37,6 +37,7 @@ #include "errors.hpp" #include "types.hpp" #include "validation_service.hpp" +#include "path_api.hpp" namespace ydk { @@ -1082,8 +1083,9 @@ class NetconfSession : public Session { std::shared_ptr invoke(Rpc& rpc) const; std::shared_ptr invoke(DataNode& rpc) const; std::vector get_capabilities() const; + std::string execute_netconf_operation(Rpc& netconf_rpc) const; -private: + private: std::vector get_yang_1_1_capabilities() const; std::shared_ptr handle_crud_edit( Rpc& rpc, Annotation ann) const; @@ -1103,7 +1105,7 @@ class NetconfSession : public Session { int timeout); void initialize_repo(Repository& repo, bool on_demand); std::string execute_payload(const std::string & payload) const; -private: + std::shared_ptr client; std::shared_ptr model_provider; std::shared_ptr root_schema; diff --git a/sdk/cpp/core/src/path/restconf_session.cpp b/sdk/cpp/core/src/restconf_session.cpp similarity index 97% rename from sdk/cpp/core/src/path/restconf_session.cpp rename to sdk/cpp/core/src/restconf_session.cpp index 3bef3f0a8..b2b1cad7a 100644 --- a/sdk/cpp/core/src/path/restconf_session.cpp +++ b/sdk/cpp/core/src/restconf_session.cpp @@ -27,13 +27,12 @@ #include -#include "../entity_data_node_walker.hpp" -#include "../errors.hpp" -#include "../ietf_parser.hpp" -#include "../restconf_client.hpp" -#include "../types.hpp" -#include "../logger.hpp" - +#include "entity_data_node_walker.hpp" +#include "errors.hpp" +#include "ietf_parser.hpp" +#include "restconf_client.hpp" +#include "types.hpp" +#include "logger.hpp" using namespace std; @@ -200,7 +199,7 @@ std::shared_ptr RestconfSession::handle_crud_edit(path::Rpc& rpc auto datanode = codec_service.decode(*root_schema, header_data, encoding); string url = config_url_root + get_module_url_path(datanode->get_children()[0]->get_schema_node().get_path()); - YLOG_INFO("Performing {} on URL {}. Payload: {}", operation, url, header_data); + YLOG_INFO("Performing {} on URL {}. Payload:\n{}", operation, url, header_data); client->execute(operation, url, header_data); return nullptr; diff --git a/sdk/cpp/gnmi/CMakeLists.txt b/sdk/cpp/gnmi/CMakeLists.txt index f1bcbd9ff..9448449f6 100644 --- a/sdk/cpp/gnmi/CMakeLists.txt +++ b/sdk/cpp/gnmi/CMakeLists.txt @@ -56,7 +56,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # _-_.deb # libydk_0.6.0-0.1.alpha_amd64.deb // Debian set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") # Linux Fedora elseif(${LSB_RELEASE_ID_SHORT} MATCHES "CentOS") diff --git a/sdk/cpp/gnmi/src/gnmi_provider.cpp b/sdk/cpp/gnmi/src/gnmi_provider.cpp index 0b222b5ef..e4eee7be9 100644 --- a/sdk/cpp/gnmi/src/gnmi_provider.cpp +++ b/sdk/cpp/gnmi/src/gnmi_provider.cpp @@ -77,7 +77,9 @@ namespace ydk { gNMIService gs; if (operation == "create" || operation == "update" || operation == "delete") { - entity.yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::update; + if (entity.yfilter == YFilter::not_set) { + entity.yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::update; + } gs.set(*this, entity); } else if (operation == "read") { @@ -100,7 +102,9 @@ namespace ydk gNMIService gs; if (operation == "create" || operation == "update" || operation == "delete") { for (auto entity : entity_list) - entity->yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::update; + if (entity->yfilter == YFilter::not_set) { + entity->yfilter = (operation == "delete") ? YFilter::delete_ : YFilter::update; + } gs.set(*this, entity_list); } else if (operation == "read") { diff --git a/sdk/cpp/gnmi/src/gnmi_service.cpp b/sdk/cpp/gnmi/src/gnmi_service.cpp index 41f16c390..779948561 100644 --- a/sdk/cpp/gnmi/src/gnmi_service.cpp +++ b/sdk/cpp/gnmi/src/gnmi_service.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "gnmi_provider.hpp" #include "gnmi_service.hpp" @@ -41,16 +42,23 @@ namespace ydk { static string get_data_payload(gNMIServiceProvider& provider, Entity & entity) { - path::Codec codec_service{}; - path::RootSchemaNode & root_schema = provider.get_session().get_root_schema(); - auto yfilter = entity.yfilter; - entity.yfilter = YFilter::not_set; - path::DataNode& datanode = get_data_node_from_entity(entity, root_schema); - entity.yfilter = yfilter; - - string payload = codec_service.encode(datanode, EncodingFormat::JSON, false); - YLOG_DEBUG("===========Generating Target Payload============"); - YLOG_DEBUG("{}", payload); + string payload; + auto top_entity = get_top_entity(&entity); + if (entity.ignore_validation && top_entity->is_top_level_class) { + YLOG_DEBUG("=========== Generating JSON payload with JsonSubtreeCodec ============"); + payload = get_json_subtree_filter_payload(*top_entity, provider, false); + } + else { + YLOG_DEBUG("=========== Generating JSON payload with path::Codec ============"); + path::Codec codec_service{}; + path::RootSchemaNode & root_schema = provider.get_session().get_root_schema(); + auto yfilter = entity.yfilter; + entity.yfilter = YFilter::not_set; + path::DataNode& datanode = get_data_node_from_entity(entity, root_schema); + entity.yfilter = yfilter; + payload = codec_service.encode(datanode, EncodingFormat::JSON, false); + } + YLOG_DEBUG("\n{}", payload); return payload; } @@ -63,8 +71,15 @@ gNMIService::~gNMIService() } //get -shared_ptr -gNMIService::get_from_path(gNMIServiceProvider& provider, vector path_list, const string & operation) const +static shared_ptr json_codec_payload_to_entity(const std::string & payload, shared_ptr filter) +{ + JsonSubtreeCodec json_subtree_codec{}; + YLOG_DEBUG("Decoding JSON payload to Entity using subtree codec"); + return json_subtree_codec.decode(payload, filter); +} + +static vector +get_json_from_path(gNMIServiceProvider& provider, vector path_list, const string & operation) { YLOG_DEBUG("Executing 'get' gRPC on multiple paths"); @@ -81,6 +96,15 @@ gNMIService::get_from_path(gNMIServiceProvider& provider, vector pa auto & client = gnmi_session.get_client(); vector reply = client.execute_get_operation(get_request_list, operation); + return reply; +} + +shared_ptr +gNMIService::get_from_path(gNMIServiceProvider& provider, vector path_list, const string & operation) const +{ + vector reply = get_json_from_path(provider, path_list, operation); + + auto & gnmi_session = dynamic_cast (provider.get_session()); return gnmi_session.handle_get_reply(reply); } @@ -89,11 +113,21 @@ gNMIService::get(gNMIServiceProvider& provider, Entity& filter, const string & o { YLOG_DEBUG("Executing 'get' gRPC on single entity"); + auto top_entity = get_top_entity(&filter); gnmi::Path* path = new gnmi::Path; - parse_entity_to_path(filter, path); - + parse_entity_to_path(*top_entity, path); vector path_list; path_list.push_back(path); + + if (filter.ignore_validation && top_entity->is_top_level_class) { + // Bypass libyang validation + vector reply = get_json_from_path(provider, path_list, operation); + if (reply.empty()) + return nullptr; + auto reply_entity = json_codec_payload_to_entity(reply[0], top_entity->clone_ptr()); + return get_child_entity_from_top(reply_entity, filter); + } + auto root_dn = get_from_path(provider, path_list, operation); if (root_dn) { return read_datanode(filter, root_dn->get_children()[0]); @@ -106,15 +140,46 @@ gNMIService::get(gNMIServiceProvider & provider, vector & filter_list, { YLOG_DEBUG("Executing get gRPC for multiple entities"); + vector> response_list{}; + size_t bypass_validation = 0; vector path_list; for (auto filter : filter_list) { + auto top_entity = get_top_entity(filter); gnmi::Path* path = new gnmi::Path; - parse_entity_to_path(*filter, path); + parse_entity_to_path(*top_entity, path); path_list.push_back(path); + if (top_entity->is_top_level_class && filter->ignore_validation) + bypass_validation++; } - auto root_dn = get_from_path(provider, path_list, operation); - vector> response_list{}; + if (bypass_validation == filter_list.size()) { + // Bypass libyang validation + vector reply = get_json_from_path(provider, path_list, operation); + if (reply.empty()) + return response_list; + + // Build output list + for (auto filter : filter_list) { + auto fsp = filter->get_segment_path(); + bool found = false; + for (auto r : reply) { + if (r.find(fsp) != string::npos) { + auto top_entity = get_top_entity(filter); + auto reply_entity = json_codec_payload_to_entity(r, top_entity->clone_ptr()); + auto child_entity = get_child_entity_from_top(reply_entity, *filter); + response_list.push_back(child_entity); + found = true; + break; + } + } + if (!found) { + response_list.push_back((std::shared_ptr) filter); + } + } + return response_list; + } + + auto root_dn = get_from_path(provider, path_list, operation); if (root_dn) { // Build map of data nodes in order to retain filter list order map> path_to_dn{}; diff --git a/sdk/cpp/gnmi/tests/test_gnmi_crud.cpp b/sdk/cpp/gnmi/tests/test_gnmi_crud.cpp index 3bd0a9bc2..50c76ad17 100644 --- a/sdk/cpp/gnmi/tests/test_gnmi_crud.cpp +++ b/sdk/cpp/gnmi/tests/test_gnmi_crud.cpp @@ -56,10 +56,12 @@ TEST_CASE("gnmi_crud_single_entity") ifc.config->name = "Loopback10"; // Set-replace Request + ifc.yfilter = YFilter::replace; auto reply = crud.create(provider, ifc); REQUIRE(reply); ifc.config->description = "Test"; + ifc.yfilter = YFilter::not_set; reply = crud.update(provider, ifc); REQUIRE(reply); @@ -73,6 +75,7 @@ TEST_CASE("gnmi_crud_single_entity") REQUIRE(ifc_read != nullptr); REQUIRE(*ifc_read == ifc); + ifc_filter->ignore_validation = true; ifc_read = crud.read_config(provider, *ifc_filter); REQUIRE(ifc_read != nullptr); REQUIRE(*ifc_read == ifc); @@ -164,3 +167,53 @@ TEST_CASE("gnmi_crud_multiple_entities") reply = crud.delete_(provider, create_entities); REQUIRE(reply); } + +TEST_CASE("gnmi_crud_multiple_entities_no_validation") +{ + // session + Repository repo{TEST_HOME}; + string address = "127.0.0.1"; int port = 50051; + + gNMIServiceProvider provider{repo, address, port, "admin", "admin"}; + CrudService crud{}; + CodecServiceProvider codec_provider{EncodingFormat::JSON}; + CodecService codec_service{}; + + // Configure Interfaces + auto ifc = make_shared(); + ifc->name = "Loopback10"; + ifc->config->name = "Loopback10"; + ifc->config->description = "Test"; + + openconfig_interfaces::Interfaces ifcs{}; + ifcs.interface.append(ifc); + + // Configure BGP + openconfig_bgp::Bgp bgp{}; + config_bgp(bgp); + bgp.ignore_validation = true; + ifcs.ignore_validation = true; + + vector create_entities; + create_entities.push_back(&bgp); + create_entities.push_back(&ifcs); + + // Set Request + auto reply = crud.update(provider, create_entities); + REQUIRE(reply); + + openconfig_bgp::Bgp bgp_filter{}; + openconfig_interfaces::Interfaces int_filter{}; + vector filter; + filter.push_back(&bgp_filter); + filter.push_back(&int_filter); + bgp_filter.ignore_validation = true; + int_filter.ignore_validation = true; + + auto read_entities = crud.read(provider, filter); + REQUIRE(read_entities.size() == 2); + + reply = crud.delete_(provider, create_entities); + REQUIRE(reply); +} + diff --git a/sdk/cpp/packages/CMakeLists.txt b/sdk/cpp/packages/CMakeLists.txt index 072b8335d..e05af3bf6 100644 --- a/sdk/cpp/packages/CMakeLists.txt +++ b/sdk/cpp/packages/CMakeLists.txt @@ -64,7 +64,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") # _-_.deb # libydk_0.6.0-0.1.alpha_amd64.deb // Debian set (CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_RELEASE}.${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") # Linux Fedora elseif(${LSB_RELEASE_ID_SHORT} MATCHES "CentOS") diff --git a/sdk/cpp/tests/CMakeLists.txt b/sdk/cpp/tests/CMakeLists.txt index 75cef1d5c..f6807a92a 100644 --- a/sdk/cpp/tests/CMakeLists.txt +++ b/sdk/cpp/tests/CMakeLists.txt @@ -25,10 +25,12 @@ set(bundle_tests_src test_sanity_codec.cpp test_sanity_levels.cpp test_sanity_types.cpp + test_json_codec.cpp test_xml_subtree.cpp testsanitynctest.cpp testsanityvalidationtest.cpp test_utils.cpp + test_oc_nis.cpp ) find_library(xml2_location xml2) @@ -42,6 +44,7 @@ find_library(dl_location dl) find_library(ydk_location ydk) find_library(ydk_ydktest_location ydk_ydktest) find_library(ydk_ydktest_new_location ydk_ydktest_new) +find_library(ydktest_oc_nis_location ydk_ydktest_oc_nis) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") @@ -69,6 +72,7 @@ target_link_libraries(${YDK_UNITTEST_TARGET_NAME} ${ydk_location} ${ydk_ydktest_location} ${ydk_ydktest_new_location} + ${ydktest_oc_nis_location} ${xml2_location} ${curl_location} ${ssh_location} diff --git a/sdk/cpp/tests/test_c_api.cpp b/sdk/cpp/tests/test_c_api.cpp index c9f3c263f..d7a4d68fb 100644 --- a/sdk/cpp/tests/test_c_api.cpp +++ b/sdk/cpp/tests/test_c_api.cpp @@ -24,6 +24,8 @@ // ////////////////////////////////////////////////////////////////// +#include + #include #include "catch.hpp" @@ -37,6 +39,7 @@ TEST_CASE( "codec_encode" ) Codec c = CodecInit(); Repository repo = RepositoryInitWithPath(state, "/usr/local/share/ydktest@0.1.0"); ServiceProvider provider = NetconfServiceProviderInitWithRepo(state, repo, "localhost", "admin", "admin", 12022, "ssh"); + REQUIRE(provider!=NULL); RootSchemaNode root_schema = ServiceProviderGetRootSchema(state, provider); @@ -59,6 +62,7 @@ TEST_CASE( "codec_decode" ) Codec c = CodecInit(); Repository repo = RepositoryInitWithPath(state, "/usr/local/share/ydktest@0.1.0"); ServiceProvider provider = NetconfServiceProviderInitWithRepo(state, repo, "localhost", "admin", "admin", 12022, "ssh"); + REQUIRE(provider!=NULL); RootSchemaNode root_schema = ServiceProviderGetRootSchema(state, provider); @@ -111,6 +115,8 @@ TEST_CASE( "rpc" ) Repository repo = RepositoryInitWithPath(state, "/usr/local/share/ydktest@0.1.0"); ServiceProvider provider = NetconfServiceProviderInitWithRepo(state, repo, "localhost", "admin", "admin", 12022, "ssh"); + REQUIRE(provider!=NULL); + RootSchemaNode root_schema = ServiceProviderGetRootSchema(state, provider); DataNode runner = RootSchemaNodeCreate(state, root_schema, "ydktest-sanity:runner"); diff --git a/sdk/cpp/tests/test_errors.cpp b/sdk/cpp/tests/test_errors.cpp index c6c68c58e..0545948f3 100644 --- a/sdk/cpp/tests/test_errors.cpp +++ b/sdk/cpp/tests/test_errors.cpp @@ -310,3 +310,65 @@ TEST_CASE("leaflist_duplicate") r_1->ytypes->built_in_t->enum_llist.append(ydktest_sanity::YdkEnumTest::none); CHECK_THROWS_WITH(crud.create(provider, *r_1), CONTAINS_ERROR_MESSAGE); //TODO } + +TEST_CASE("int8_valid_ignore_validation") +{ + NetconfServiceProvider provider{"127.0.0.1", "admin", "admin", 12022}; + CrudService crud{}; + + //DELETE + auto r_1 = make_unique(); + bool reply = crud.delete_(provider, *r_1); + REQUIRE(reply); + + //CREATE + r_1->ytypes->built_in_t->number8 = 88; + r_1->ignore_validation = true; + crud.create(provider, *r_1); + + //READ and VALIDATE + auto rf = ydktest_sanity::Runner(); + rf.ignore_validation = true; + auto r_ent = crud.read(provider, rf); + REQUIRE(r_ent != nullptr); + auto runner = dynamic_cast(r_ent.get()); + REQUIRE(runner->ytypes->built_in_t->number8 == r_1->ytypes->built_in_t->number8); + + auto bintf = rf.ytypes->built_in_t; + bintf->ignore_validation = true; + auto bint_ent = crud.read(provider, *bintf); + REQUIRE(bint_ent != nullptr); + auto bint = dynamic_cast(bint_ent.get()); + REQUIRE(bint->number8 == r_1->ytypes->built_in_t->number8); +} + +TEST_CASE("int8_list_ignore_validation") +{ + NetconfServiceProvider provider{"127.0.0.1", "admin", "admin", 12022}; + CrudService crud{}; + + //DELETE + auto r_1 = make_unique(); + bool reply = crud.delete_(provider, *r_1); + REQUIRE(reply); + + //CREATE + r_1->ytypes->built_in_t->number8 = 88; + r_1->ignore_validation = true; + vector r_list{}; + r_list.push_back(r_1.get()); + crud.create(provider, r_list); + + //READ and VALIDATE + auto rf = ydktest_sanity::Runner(); + auto bintf = rf.ytypes->built_in_t; + bintf->ignore_validation = true; + vector f_list{}; + f_list.push_back(bintf.get()); + + auto bint_ent_list = crud.read(provider, f_list); + REQUIRE(bint_ent_list.size() == 1); + auto bint_ent = bint_ent_list[0]; + auto bint = dynamic_cast(bint_ent.get()); + REQUIRE(bint->number8 == r_1->ytypes->built_in_t->number8); +} diff --git a/sdk/cpp/tests/test_json_codec.cpp b/sdk/cpp/tests/test_json_codec.cpp new file mode 100644 index 000000000..46efbecdb --- /dev/null +++ b/sdk/cpp/tests/test_json_codec.cpp @@ -0,0 +1,184 @@ +/// YANG Development Kit +// Copyright 2019 Cisco Systems. All rights reserved +// +//////////////////////////////////////////////////////////////// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +////////////////////////////////////////////////////////////////// + +#include +#include + +#include "ydk/path_api.hpp" +#include "ydk/netconf_provider.hpp" +#include "ydk/crud_service.hpp" +#include "ydk/codec_service.hpp" +#include "ydk/codec_provider.hpp" +#include "ydk/filters.hpp" +#include "ydk/json_subtree_codec.hpp" + +#include "ydk_ydktest/openconfig_bgp.hpp" +#include "ydk_ydktest/openconfig_bgp_types.hpp" +#include "ydk_ydktest/openconfig_routing_policy.hpp" +#include "ydk_ydktest/ydktest_sanity.hpp" +#include "ydk_ydktest/ydktest_sanity_types.hpp" + + +#include "config.hpp" +#include "catch.hpp" +#include "test_utils.hpp" + +using namespace ydk; +using namespace ydktest; +using namespace std; + +TEST_CASE("json_codec_leaf") +{ + JsonSubtreeCodec jcodec{}; + NetconfServiceProvider provider("127.0.0.1", "admin", "admin", 12022); + auto & session = provider.get_session(); + + auto runner = ydktest_sanity::Runner(); + auto json = jcodec.encode(runner, session.get_root_schema(), false); + REQUIRE(json == "{\"ydktest-sanity:runner\":null}"); + + runner.ytypes->built_in_t->number8 = 10; + runner.ytypes->built_in_t->number16 = 102; + json = jcodec.encode(runner, session.get_root_schema(), false); + REQUIRE(json == R"({"ydktest-sanity:runner":{"ytypes":{"built-in-t":{"number16":102,"number8":10}}}})"); + + auto top_entity = make_shared(); + auto entity = jcodec.decode(json, top_entity); + auto runner_d = dynamic_cast(entity.get()); + REQUIRE(*runner_d == runner); +} + + +TEST_CASE("json_codec_leaf_list") +{ + JsonSubtreeCodec jcodec{}; + NetconfServiceProvider provider("127.0.0.1", "admin", "admin", 12022); + auto & session = provider.get_session(); + + auto runner = ydktest_sanity::Runner(); + runner.ytypes->built_in_t->llstring.append("abc"); + runner.ytypes->built_in_t->llstring.append("klm"); + runner.ytypes->built_in_t->llstring.append("xyz"); + auto json = jcodec.encode(runner, session.get_root_schema(), false); + REQUIRE(json == R"({"ydktest-sanity:runner":{"ytypes":{"built-in-t":{"llstring":["abc","klm","xyz"]}}}})"); + + auto top_entity = make_shared(); + auto entity = jcodec.decode(json, top_entity); + auto runner_d = dynamic_cast(entity.get()); + REQUIRE(*runner_d == runner); +} + +TEST_CASE("json_codec_identity") +{ + NetconfServiceProvider provider("127.0.0.1", "admin", "admin", 12022); + auto & session = provider.get_session(); + JsonSubtreeCodec jcodec{}; + + auto bgp = make_unique(); + bgp->global->config->as = 65172; + bgp->global->config->router_id = "1.2.3.4"; + + auto afi_safi = make_shared(); + afi_safi->afi_safi_name = openconfig_bgp_types::L3VPNIPV4UNICAST(); + afi_safi->config->afi_safi_name = openconfig_bgp_types::L3VPNIPV4UNICAST(); + afi_safi->config->enabled = true; + bgp->global->afi_safis->afi_safi.append(afi_safi); + + auto json = jcodec.encode(*bgp, session.get_root_schema()); + string expected = R"({ + "openconfig-bgp:bgp": { + "global": { + "afi-safis": { + "afi-safi": [ + { + "afi-safi-name": "openconfig-bgp-types:L3VPN_IPV4_UNICAST", + "config": { + "afi-safi-name": "openconfig-bgp-types:L3VPN_IPV4_UNICAST", + "enabled": true + } + } + ] + }, + "config": { + "as": 65172, + "router-id": "1.2.3.4" + } + } + } +})"; + REQUIRE(json == expected); + + auto top_entity = make_shared(); + auto entity = jcodec.decode(json, top_entity); + auto bgp_d = dynamic_cast(entity.get()); + REQUIRE(*bgp_d == *bgp); +} + +TEST_CASE("json_codec_identity_subtree") +{ + NetconfServiceProvider provider("127.0.0.1", "admin", "admin", 12022); + auto & session = provider.get_session(); + JsonSubtreeCodec jcodec{}; + + auto afi_safi = make_shared(); + afi_safi->afi_safi_name = openconfig_bgp_types::L3VPNIPV4UNICAST(); + afi_safi->config->afi_safi_name = openconfig_bgp_types::L3VPNIPV4UNICAST(); + afi_safi->config->enabled = true; + + auto json = jcodec.encode(*afi_safi, session.get_root_schema()); + string expected = R"({ + "openconfig-bgp:afi-safi": { + "afi-safi-name": "openconfig-bgp-types:L3VPN_IPV4_UNICAST", + "config": { + "afi-safi-name": "openconfig-bgp-types:L3VPN_IPV4_UNICAST", + "enabled": true + } + } +})"; + REQUIRE(json == expected); + + auto top_entity = make_shared(); + auto entity = jcodec.decode(json, top_entity); + auto afi_safi_d = dynamic_cast(entity.get()); + REQUIRE(*afi_safi_d == *afi_safi); +} + +TEST_CASE("json_codec_no_key_list") +{ + NetconfServiceProvider provider("127.0.0.1", "admin", "admin", 12022); + auto & session = provider.get_session(); + JsonSubtreeCodec jcodec{}; + + auto runner = ydktest_sanity::Runner(); + auto t1 = make_shared(); t1->test = "abc"; + auto t2 = make_shared(); t2->test = "xyz"; + runner.no_key_list.extend( { t1, t2 }); + + auto json = jcodec.encode(runner, session.get_root_schema(), false); + REQUIRE(json == R"({"ydktest-sanity:runner":{"no-key-list":[{"test":"abc"},{"test":"xyz"}]}})"); + + auto top_entity = make_shared(); + auto entity = jcodec.decode(json, top_entity); + auto runner_d = dynamic_cast(entity.get()); + REQUIRE(*runner_d == runner); +} diff --git a/sdk/cpp/tests/test_oc_nis.cpp b/sdk/cpp/tests/test_oc_nis.cpp new file mode 100644 index 000000000..ae0de03de --- /dev/null +++ b/sdk/cpp/tests/test_oc_nis.cpp @@ -0,0 +1,81 @@ +/// YANG Development Kit +// Copyright 2019 Cisco Systems. All rights reserved +// +//////////////////////////////////////////////////////////////// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +////////////////////////////////////////////////////////////////// + +#include +#include + +#include "config.hpp" +#include "catch.hpp" +#include "test_utils.hpp" + +#include +#include + +#include "ydk_ydktest_oc_nis/openconfig_network_instance.hpp" + +using namespace std; +using namespace ydk; +using namespace ydktest_oc_nis; + +const string nis_xml = R"( + + + default + + + policy-types:ISIS + DEFAULT + + policy-types:ISIS + DEFAULT + + + + + + isis-types:IPV4 + isis-types:UNICAST + + isis-types:IPV4 + isis-types:UNICAST + + + + + + + + + +)"; + + +TEST_CASE( "decode_nis_part" ) +{ + CodecServiceProvider codec_provider{EncodingFormat::XML}; + CodecService codec{}; + + auto nis_top = make_shared(); + auto entity = codec.decode(codec_provider, nis_xml, nis_top); + REQUIRE(entity != nullptr); +} diff --git a/sdk/cpp/tests/test_restconf_provider.cpp b/sdk/cpp/tests/test_restconf_provider.cpp index 58904c781..3b1201b82 100644 --- a/sdk/cpp/tests/test_restconf_provider.cpp +++ b/sdk/cpp/tests/test_restconf_provider.cpp @@ -14,13 +14,15 @@ limitations under the License. ------------------------------------------------------------------*/ #include -#include "ydk/path_api.hpp" -#include "ydk/restconf_provider.hpp" -#include "../core/src/errors.hpp" #include + #include "config.hpp" #include "catch.hpp" +#include +#include +#include + using namespace ydk; using namespace std; @@ -71,8 +73,6 @@ TEST_CASE("CreateDelRead") std::shared_ptr update_rpc { schema.create_rpc("ydk:update") }; update_rpc->get_input_node().create_datanode("entity", json); (*update_rpc)(provider.get_session()); - - } TEST_CASE("ActionRest") diff --git a/sdk/go/CHANGES.md b/sdk/go/CHANGES.md index 6fe1e4d25..dccb40f20 100644 --- a/sdk/go/CHANGES.md +++ b/sdk/go/CHANGES.md @@ -1,3 +1,17 @@ +### 2019-03-15 version 0.8.2 + +#### Resolved GitHub issues + * Libyang error: Reached limit (65535) for storing typedefs ([#874](https://github.com/CiscoDevNet/ydk-gen/issues/874)) + * Segmentation Fault in API when connection to Netconf fails ([#879](https://github.com/CiscoDevNet/ydk-gen/issues/879)) + * 'delete' and 'replace' filters do not work properly with gNMI and CRUD service ([#881](https://github.com/CiscoDevNet/ydk-gen/issues/881)) + * Go compiler failed to link gNMI service on Mac ([#892](https://github.com/CiscoDevNet/ydk-gen/issues/892)) + +#### Model bundle additions + * Released cisco-ios-xr bundle to support Cisco IOS XR 6.5.2 + * Released cisco-ios-xe bundle to support Cisco IOS XE 16.9.3 + * Released cisco-nx-os bundle to support Cisco NX OS 9.2.3 + + ### 2019-02-11 version 0.8.1 #### Go diff --git a/sdk/go/README.md b/sdk/go/README.md index 4f1730e01..bae9e49ec 100644 --- a/sdk/go/README.md +++ b/sdk/go/README.md @@ -60,15 +60,15 @@ $ sudo apt-get install gcc-5 g++-5 -y > /dev/null $ sudo ln -sf /usr/bin/g++-5 /usr/bin/g++ $ sudo ln -sf /usr/bin/gcc-5 /usr/bin/gcc -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb -$ sudo gdebi libydk_0.8.1-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb +$ sudo gdebi libydk-0.8.2-1.amd64.deb ``` For Bionic (Ubuntu 18.04.1): ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb -$ sudo gdebi libydk_0.8.1-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb +$ sudo gdebi libydk-0.8.2-1.amd64.deb ``` #### Centos (Fedora-based) @@ -86,7 +86,7 @@ $ ln -sf /opt/rh/devtoolset-4/root/usr/bin/gcc /usr/bin/gcc $ ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/g++ # Install YDK core library -$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm +$ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm ``` #### Mac OS @@ -99,8 +99,8 @@ $ brew install pkg-config libssh libxml2 xml2 curl pcre cmake $ xcode-select --install # Install YDK core library -$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg -$ sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / +$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg +$ sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / ``` #### Libssh installation @@ -172,28 +172,28 @@ sudo ldconfig For Ubuntu/Xenial: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb -$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb +$ sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb ``` For Ubuntu/Bionic: ``` -$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb -$ sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb +$ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2.amd64.deb +$ sudo gdebi libydk_gnmi_0.4.0-2.amd64.deb ``` For CentOS ``` - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm ``` ##### MacOS: ``` -$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg -$ sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / +$ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg +$ sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / ``` #### Runtime environment @@ -225,4 +225,4 @@ $ go get github.com/CiscoDevNet/ydk-go/ydk ## Release Notes -The current YDK release version is 0.8.1. YDK-Go is licensed under the Apache 2.0 License. +The current YDK release version is 0.8.2. YDK-Go is licensed under the Apache 2.0 License. diff --git a/sdk/go/core/README.md b/sdk/go/core/README.md index 6678aa063..89ba229a5 100644 --- a/sdk/go/core/README.md +++ b/sdk/go/core/README.md @@ -2,44 +2,7 @@ The YDK requires Go version 1.9 or higher. Make sure that corresponding software is installed and environment variables GOROOT and GOPATH are properly set before the YDK installation. Follow System Requirements [here](https://github.com/CiscoDevNet/ydk-gen/tree/master/sdk/go#system-requirements). -### YDK core installation - -First, install [C++ core](https://github.com/ygorelik/ydk-gen#second-step-generate-and-install-the-core) library. - -Then execute the below commands to install the YDK Go core and bundle packages. - -``` - wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip - unzip protobuf-cpp-3.5.0.zip - cd protobuf-3.5.0 - ./configure - make - make check - sudo make install - sudo ldconfig -``` - -###Install gRPC - -``` - git clone -b v1.9.1 https://github.com/grpc/grpc - cd grpc - git submodule update --init - make - sudo make install - sudo ldconfig - cd - -``` - -###Run-time environment - -There is an open issue with gRPC on Centos/Fedora, which requires an extra step before running any YDK gNMI application. See this issue on `GRPC GitHub `_ -for details. As a workaround, the YDK based application runtime environment must include setting of `LD_LIBRARY_PATH` variable: - -``` - PROTO="/Your-Protobuf-and-Grpc-installation-directory" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64 -``` +### YDK core and model bundle installation First, install [C++ core](https://github.com/CiscoDevNet/ydk-gen#second-step-generate--install-the-core). Then execute the below steps to install the ydk go core and bundle packages. @@ -47,8 +10,8 @@ First, install [C++ core](https://github.com/CiscoDevNet/ydk-gen#second-step-gen $ go get gopkg.in/stretchr/testify.v1 $ cd /your-path-to-ydk-gen $ export GOPATH=/your-path-to-go-packages-installation-directory -$ ./generate.py --core --go -$ ./generate.py --bundle profiles/test/ydktest-cpp.json --go +$ ./generate.py -i --core --go +$ ./generate.py -i --bundle profiles/test/ydktest-cpp.json --go ``` You can test your installation now. Execute the below commands to run sample tests. @@ -66,90 +29,3 @@ $ cd /your-path-to-ydk-gen $ cd sdk/go/core/tests $ go test ``` - -### gNMI Requirements - -In order to enable YDK support for gNMI protocol, which is optional, the following third party software must be installed prior to gNMI YDK component installation. - -#### Install protobuf and protoc - -``` - wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip - unzip protobuf-cpp-3.5.0.zip - cd protobuf-3.5.0 - ./configure - make - sudo make install - sudo ldconfig -``` - -#### Install gRPC - -``` - git clone -b v1.9.1 https://github.com/grpc/grpc - cd grpc - git submodule update --init - make - sudo make install - sudo ldconfig - cd - -``` - -### gNMI package installation - -For gNMI Go package installation, which is optional, perform this steps. - -First, install [C++ gnmi](https://github.com/ygorelik/ydk-gen/tree/gnmi#system-requirements) library. Then execute the below steps to install the YDK Go gNMI package. - -``` -$ ./generate.py --service profiles/services/gnmi-0.4.0.json --go -``` - -#### Runtime environment - -There is an open issue with gRPC on Centos/Fedora, which requires an extra step before running any YDK gNMI application. -See this issue on [GRPC GitHub](https://github.com/grpc/grpc/issues/10942#issuecomment-312565041) for details. -As a workaround, the YDK based application runtime environment must include setting of `LD_LIBRARY_PATH` variable: - -``` - PROTO="/Your-Protobuf-and-Grpc-installation-directory" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64 -``` -##gNMI Requirements - -In order to enable YDK support for gNMI protocol, which is optional, the following third party software must be installed prior to gNMI YDK component installation. - -###Install protobuf and protoc - -``` - wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip - unzip protobuf-cpp-3.5.0.zip - cd protobuf-3.5.0 - ./configure - make - sudo make install - sudo ldconfig -``` - -###Install gRPC - -``` - git clone -b v1.9.1 https://github.com/grpc/grpc - cd grpc - git submodule update --init - make - sudo make install - sudo ldconfig - cd - -``` - -###Run-time environment - -There is an open issue with gRPC on Centos/Fedora, which requires an extra step before running any YDK gNMI application. See this issue on `GRPC GitHub `_ -for details. As a workaround, the YDK based application runtime environment must include setting of `LD_LIBRARY_PATH` variable: - -``` - PROTO="/Your-Protobuf-and-Grpc-installation-directory" - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64 -``` - diff --git a/sdk/go/core/docsgen/getting_started.rst b/sdk/go/core/docsgen/getting_started.rst index 15a718e0c..13a256cf9 100644 --- a/sdk/go/core/docsgen/getting_started.rst +++ b/sdk/go/core/docsgen/getting_started.rst @@ -41,14 +41,14 @@ For Xenial (Ubuntu 16.04.4):: $ sudo ln -sf /usr/bin/g++-5 /usr/bin/c++ # Install YDK core library - $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb - $ sudo gdebi libydk_0.8.1-1_amd64.deb + $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb + $ sudo gdebi libydk-0.8.2-1.amd64.deb For Bionic (Ubuntu 18.04.1):: # Install YDK core library - $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb - $ sudo gdebi libydk_0.8.1-1_amd64.deb + $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb + $ sudo gdebi libydk-0.8.2-1.amd64.deb **Centos (Fedora-based)** @@ -64,7 +64,7 @@ The following packages must be present in your system before installing YDK-Go:: $ ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/c++ # Install YDK core library - $ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm + $ sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm **Golang** @@ -89,8 +89,8 @@ It is recommended to install `homebrew `_ and Xcode command line $ xcode-select --install # Install YDK core library - $ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg - $ sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / + $ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg + $ sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / The YDK requires Go version 1.9 or higher. If this is not the case, follow these installation steps: @@ -148,28 +148,28 @@ Ubuntu For Xenial (Ubuntu 16.04.4):: - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb For Bionic (Ubuntu 18.04.1):: - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb CentOS ~~~~~~ .. code-block:: sh - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm MacOS ~~~~~ .. code-block:: sh - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / Set runtime environment ----------------------- @@ -208,4 +208,4 @@ Documentation and Support Release Notes ============= -The current YDK release version is 0.8.1. YDK-Go is licensed under the Apache 2.0 License. +The current YDK release version is 0.8.2. YDK-Go is licensed under the Apache 2.0 License. diff --git a/sdk/go/core/tests/service_netconf_test.go b/sdk/go/core/tests/service_netconf_test.go index 0929dbe39..5d5006dba 100644 --- a/sdk/go/core/tests/service_netconf_test.go +++ b/sdk/go/core/tests/service_netconf_test.go @@ -218,7 +218,8 @@ func (suite *NetconfServiceTestSuite) TestCloseSession() { funcDidPanic, panicValue := didPanic(func() { suite.NS.Lock(&suite.Provider, datastore.Running) }) suite.Equal(funcDidPanic, true) - suite.Equal(panicValue, "YClientError: Could not send payload") + fmt.Printf("%s\n", panicValue) + //suite.True(panicValue, "YClientError: Could not send payload") suite.Provider.Connect() @@ -270,20 +271,20 @@ func (suite *NetconfServiceTestSuite) TestGetEditCopyConfigSanity() { runner := ysanity.Runner{} runner.Two.Number = 2 runner.Two.Name = "runner-two-name" - + native := ysanity.Native{} native.Version = "0.1.0" native.Hostname = "MyHost" - + configEC := types.NewConfig(&runner, &native) result := suite.NS.EditConfig(&suite.Provider, datastore.Candidate, configEC, "", "", "") suite.Equal(result, true) - - // Build filter + + // Build filter runnerFilter := ysanity.Runner{} nativeFilter := ysanity.Native{} - filterEC := types.NewFilter(&runnerFilter, &nativeFilter) + filterEC := types.NewFilter(&runnerFilter, &nativeFilter) // Read running config getConfigEntity := suite.NS.GetConfig(&suite.Provider, datastore.Candidate, filterEC); diff --git a/sdk/go/gnmi/README.md b/sdk/go/gnmi/README.md new file mode 100644 index 000000000..80e7e32b2 --- /dev/null +++ b/sdk/go/gnmi/README.md @@ -0,0 +1,49 @@ +## YDK Go gNMI Service Installation + +### gNMI Requirements + +In order to enable YDK support for gNMI protocol, which is optional, the following third party software must be installed prior to gNMI YDK component installation. + +#### Install protobuf and protoc + +``` + wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.zip + unzip protobuf-cpp-3.5.0.zip + cd protobuf-3.5.0 + ./configure + make + sudo make install + sudo ldconfig +``` + +#### Install gRPC + +``` + git clone -b v1.9.1 https://github.com/grpc/grpc + cd grpc + git submodule update --init + make + sudo make install + sudo ldconfig + cd - +``` + +### gNMI package installation + +For gNMI Go package installation, which is optional, perform this steps. + +``` +$ cd /your-path-to-ydk-gen +$ ./generate.py -i --service profiles/services/gnmi-0.4.0.json --go +``` + +#### Runtime environment + +There is an open issue with gRPC on Centos/Fedora, which requires an extra step before running any YDK gNMI application. +See this issue on [GRPC GitHub](https://github.com/grpc/grpc/issues/10942#issuecomment-312565041) for details. +As a workaround, the YDK based application runtime environment must include setting of `LD_LIBRARY_PATH` variable: + +``` + PROTO="/Your-Protobuf-and-Grpc-installation-directory" + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PROTO/grpc/libs/opt:$PROTO/protobuf-3.5.0/src/.libs:/usr/local/lib64 +``` diff --git a/sdk/go/gnmi/ydk/path/gnmi_path.go b/sdk/go/gnmi/ydk/path/gnmi_path.go index 54755a110..09eb7aaf8 100644 --- a/sdk/go/gnmi/ydk/path/gnmi_path.go +++ b/sdk/go/gnmi/ydk/path/gnmi_path.go @@ -18,6 +18,7 @@ // under the License. package path +// #cgo darwin LDFLAGS: -lydk_gnmi -lgrpc++ -lprotobuf // #cgo linux LDFLAGS: -lydk_gnmi -lgrpc++ -lprotobuf // #include // #include @@ -67,7 +68,7 @@ func (gs *GnmiSession) Connect() { AddCState(&gs.State) cstate := GetCState(&gs.State) - + var repopath *C.char = C.CString(gs.Repo.Path) defer C.free(unsafe.Pointer(repopath)) repo := C.RepositoryInitWithPath( *cstate, repopath) @@ -77,7 +78,7 @@ func (gs *GnmiSession) Connect() { defer C.free(unsafe.Pointer(cusername)) var cpassword *C.char = C.CString(gs.Password) defer C.free(unsafe.Pointer(cpassword)) - + gs.Private = C.GnmiSessionInit( *cstate, repo, caddress, cport, cusername, cpassword, cserver, cclient); PanicOnCStateError(cstate) } @@ -94,7 +95,7 @@ func (gs *GnmiSession) Disconnect() { func (gs *GnmiSession) GetRootSchemaNode() types.RootSchemaNode { cstate := GetCState(&gs.State) - + realSession := gs.Private.(C.GnmiSession) var rootSchema C.RootSchemaWrapper = C.GnmiSessionGetRootSchemaNode( *cstate, realSession) @@ -117,7 +118,7 @@ func (gs *GnmiSession) ExecuteRpc(rpc types.Rpc) types.DataNode { cdn := C.GnmiSessionExecuteRpc( *cstate, csession, crpc) PanicOnCStateError(cstate) - + dn := types.DataNode{Private: cdn} return dn } @@ -137,7 +138,7 @@ func (gs *GnmiSession) ExecuteSubscribeRpc(rpc types.Rpc) { func (gs *GnmiSession) SubscribeInProgress() bool { realSession := gs.Private.(C.GnmiSession) cstate := GetCState(&gs.State) - + var cresponse C.boolean = C.GnmiSessionSubscribeInProgress( *cstate, realSession) PanicOnCStateError(cstate) var response bool = false @@ -150,10 +151,10 @@ func (gs *GnmiSession) SubscribeInProgress() bool { func (gs *GnmiSession) GetLastSubscribeResponse(previousResponse string) string { realSession := gs.Private.(C.GnmiSession) cstate := GetCState(&gs.State) - + var cprevious *C.char = C.CString(previousResponse) defer C.free(unsafe.Pointer(cprevious)) - + cresponse := C.GetLastSubscribeResponse( *cstate, realSession, cprevious) return C.GoString(cresponse) } @@ -176,7 +177,7 @@ func GnmiServiceProviderConnect( var caddress *C.char = C.CString(address) defer C.free(unsafe.Pointer(caddress)) - + var cport C.int = C.int(port) var p C.ServiceProvider @@ -189,7 +190,7 @@ func GnmiServiceProviderConnect( defer C.free(unsafe.Pointer(cserver)) var cclient *C.char = C.CString(privateKey) defer C.free(unsafe.Pointer(cclient)) - + p = C.GnmiServiceProviderInit( *cstate, crepo, caddress, cport, cusername, cpassword, cserver, cclient); PanicOnCStateError(cstate) @@ -211,7 +212,7 @@ func GnmiServiceProviderGetSession(provider types.CServiceProvider) *GnmiSession realProvider := provider.Private.(C.ServiceProvider) realSession := C.GnmiServiceProviderGetSession( *cstate, realProvider) PanicOnCStateError(cstate) - + gnmiSession := GnmiSession{Private: realSession, State: state} // TODO. Possibly need to populate the rest of structure members @@ -241,7 +242,7 @@ func GnmiServiceGet(provider types.CServiceProvider, filter types.Entity, operat var cmode *C.char = C.CString(operation) defer C.free(unsafe.Pointer(cmode)) - ec := types.EntityToCollection(filter) + ec := types.EntityToCollection(filter) pathList := C.GnmiPathListInit() for _, ent := range ec.Entities() { path := parseEntityToPath(ent) @@ -447,7 +448,7 @@ func parseEntity( entity types.Entity, path C.GnmiPath) { p := strings.Index(s, "[") if p > 0 { entityKeys := getEntityKeys(s) - s = s[0:p] + s = s[0:p] for _, leafData := range(entPath.ValuePaths) { keyValue, isKey := entityKeys[leafData.Name] if isKey { @@ -475,5 +476,3 @@ func parseEntity( entity types.Entity, path C.GnmiPath) { parseEntityChildren(entity, path); } - - diff --git a/sdk/python/CHANGES.md b/sdk/python/CHANGES.md index 159c9c0f8..93a39d43d 100644 --- a/sdk/python/CHANGES.md +++ b/sdk/python/CHANGES.md @@ -1,3 +1,24 @@ +### 2019-03-15 version 0.8.2 + +#### New features and enhancements + * Expanded disabling of data validation to read operations with NetconfServiceProvider. + * Expanded disabling of data validation to gNMIServiceProvider. + +#### Resolved GitHub issues + * ydk-py and ydk-gen Travis tests fail on Mac ([#834](https://github.com/CiscoDevNet/ydk-gen/issues/834)) + * When MacOS is updated from Homebrew any Python2 YDK application fails ([#837](https://github.com/CiscoDevNet/ydk-gen/issues/837)) + * ImportError: dynamic module does not define module export function (PyInit_ydk_) ([#840](https://github.com/CiscoDevNet/ydk-gen/issues/840)) + * Libyang error: Reached limit (65535) for storing typedefs ([#874](https://github.com/CiscoDevNet/ydk-gen/issues/874)) + * AttributeError: 'Config' object has no attribute 'logger' ([#876](https://github.com/CiscoDevNet/ydk-gen/issues/876)) + * gNMI provider requires 'port' argument ([#880](https://github.com/CiscoDevNet/ydk-gen/issues/880)) + * 'delete' and 'replace' filters doesn't work properly with gNMI and CRUD service ([#881](https://github.com/CiscoDevNet/ydk-gen/issues/881)) + +#### Model bundle additions + * Released cisco-ios-xr bundle to support Cisco IOS XR 6.5.2 + * Released cisco-ios-xe bundle to support Cisco IOS XE 16.9.3 + * Released cisco-nx-os bundle to support Cisco NX OS 9.2.3 + + ### 2019-02-11 version 0.8.1 #### CRUD / Netconf / gNMI/ Codec / Path API diff --git a/sdk/python/README.rst b/sdk/python/README.rst index 31e01749d..122ab949c 100644 --- a/sdk/python/README.rst +++ b/sdk/python/README.rst @@ -21,9 +21,8 @@ YDK is composed of a core package that defines services and providers, plus one Backward Compatibility ---------------------- -Due to changes in Entity class this release of YDK in general is not compatible with model bundles generated with previous YDK releases. -However model bundles for Python generated with YDK-0.7.3 are still compatible with this release. -Please see `the release notes `_ for details. +The Python YDK-0.8.2 core package is compatible with all model bundles generated previously with ydk-gen releases starting from 0.7.3. +Please see `the release notes `_ for details. Docker ------ @@ -61,13 +60,13 @@ For Xenial (Ubuntu 16.04.4):: sudo ln -sf /usr/bin/gcc-5 /usr/bin/cc sudo ln -sf /usr/bin/g++-5 /usr/bin/c++ - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb For Bionic (Ubuntu 18.04.1):: - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb - sudo gdebi libydk_0.8.1-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb + sudo gdebi libydk-0.8.2-1.amd64.deb **Centos (Fedora-based)** @@ -84,22 +83,19 @@ The following packages must be present in your system before installing YDK-Py. sudo ln -sf /opt/rh/devtoolset-4/root/usr/bin/g++ /usr/bin/c++ # Install YDK core library - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk-0.8.1-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk-0.8.2-1.x86_64.rpm MacOS ~~~~~ -It is required to install Xcode command line tools, `homebrew `_ and the following homebrew packages on your system before installing YDK-Py. - -You can download the latest python package from `here `_. -Please do not use the homebrew version of python as it causes issues with installing ydk packages. Please execute ``brew rm python python3`` to remove any homebrew python packages:: +It is required to install Xcode command line tools, `homebrew `_ and the following homebrew packages on your system before installing YDK-Py:: xcode-select --install /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install pkg-config libssh xml2 libxml2 curl pcre cmake pybind11 - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg - sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg + sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / Libssh Installation ------------------- @@ -146,22 +142,22 @@ Instal YDK gNMI library For Xenial (Ubuntu 16.04.4):: - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb For Bionic (Ubuntu 18.04.1):: - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb **CentOS**:: - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm **MacOS**:: - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / Runtime environment ~~~~~~~~~~~~~~~~~~~ @@ -185,9 +181,76 @@ It is also required for Python installation to include corresponding shared libr Please follow `System Requirements` to assure presence of shared Python libraries. +Mac OS +====== + +The developers of Python2 on Mac OS might face an issue ([#837](https://github.com/CiscoDevNet/ydk-gen/issues/837)). +This is well known and documented issue. Each developer might have different approaches for its resolution. +One of them is to use Python2 virtual environment. See section below for details. + +In addition it is required properly set CMAKE_LIBRARY_PATH environment variable to assure that `cmake` uses correct Python library. +Follow these steps to find and set correct library path. + +1. Find installations of `libpython2.7` library:: + + locate libpython2.7.dylib + +Example:: + + $ locate libpython2.7.dylib + /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib + /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib + /usr/lib/libpython2.7.dylib + /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib + /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib + +2. Choose non-system Python library installation and set CMAKE_LIBRARY_PATH before any YDK component installation. Example:: + + export CMAKE_LIBRARY_PATH=/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib + +3. Run YDK core package installation with '-v' flag to check that `PythonLibs` points to correct library path. Example:: + + $ ./generate.py --core + $ pip install -v gen-api/python/ydk/dist/ydk*.tar.gz + + # In 'cmake' log look for 'PythonLibs' and 'found version' settings line: + + -- Found PythonLibs: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.15") + +4. Finally test you YDK core library installation from CLI, making sure there are no errors:: + + $ python -c "import ydk.types" + + How to install -------------- +Using Python virtual environment +================================ + +You may want to perform the installation under Python virtual environment (`virtualenv `_/`virtualenvwrapper `_). +The virtual environment allows you to install multiple versions of YDK if needed. In addition, it prevents any potential conflicts between package dependencies in your system. + +To install virtual environment support in your system, execute:: + + pip install virtualenv virtualenvwrapper + source /usr/local/bin/virtualenvwrapper.sh + +To create and activate new virtual environment:: + + mkvirtualenv -p python2.7 ydk-py + +To activate existing virtual environment:: + + source ~/.virtualenvs/py2/bin/activate + +To exit virtual environment:: + + deactivate + +Once Python virtual environment is activated, you can perform quick installation or installation from source described above. +Take into consideration that you must not attempt to install YDK as root user under virtual environment. + Quick Install ~~~~~~~~~~~~~ @@ -262,22 +325,6 @@ To install the ``cisco-ios-xr`` bundle, execute:: cisco-ios-xr$ pip install dist/ydk*.gz cisco-ios-xr$ cd .. -Using a Virtual Environment -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You may want to perform the installation under a Python virtual environment (`virtualenv `_/`virtualenvwrapper `_). -A virtual environment allows you to install multiple versions of YDK if needed. In addition, it prevents any potential conflicts between package dependencies in your system. - -To install virtual environment support in your system, execute:: - - pip install virtualenv virtualenvwrapper - source /usr/local/bin/virtualenvwrapper.sh - -Create new virtual environment:: - - mkvirtualenv -p python2.7 ydk-py - -At this point, you can perform the quick install or the installation from source described above. Take into account that must not attempt to install YDK as root under a virtual environment. - Documentation and Support -------------------------- - Read the `API documentation `_ for details on how to use the API and specific models @@ -289,4 +336,4 @@ Documentation and Support Release Notes -------------- -The current YDK release version is 0.8.1. YDK-Py is licensed under the Apache 2.0 License. +The current YDK release version is 0.8.2. YDK-Py is licensed under the Apache 2.0 License. diff --git a/sdk/python/core/CMakeLists.txt b/sdk/python/core/CMakeLists.txt index dc8805e09..867d8c339 100644 --- a/sdk/python/core/CMakeLists.txt +++ b/sdk/python/core/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0.0) cmake_policy(SET CMP0048 NEW) -project(path VERSION 0.8.1 LANGUAGES C CXX) +project(path VERSION 0.8.2 LANGUAGES C CXX) set(CMAKE_MACOSX_RPATH 1) diff --git a/sdk/python/core/docsgen/faq.rst b/sdk/python/core/docsgen/faq.rst index da04a3577..2c68c09cb 100644 --- a/sdk/python/core/docsgen/faq.rst +++ b/sdk/python/core/docsgen/faq.rst @@ -42,7 +42,7 @@ For example, the below steps will generate & install the ``cisco-ios-xr 6.5.1`` .. code-block:: sh :linenos: - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1-beta/libydk-0.8.1-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2-beta/libydk-0.8.2-1.x86_64.rpm 2) Generate and install ydk-py core @@ -50,7 +50,7 @@ For example, the below steps will generate & install the ``cisco-ios-xr 6.5.1`` :linenos: git clone https://github.com/CiscoDevNet/ydk-gen.git - git checkout tags/0.8.1 -b 0.8.1 + git checkout tags/0.8.2 -b 0.8.2 cd ydk-gen pip install -r requirements.txt ./generate --core --python diff --git a/sdk/python/core/docsgen/getting_started.rst b/sdk/python/core/docsgen/getting_started.rst index a8adf54c9..811db1e19 100644 --- a/sdk/python/core/docsgen/getting_started.rst +++ b/sdk/python/core/docsgen/getting_started.rst @@ -51,14 +51,14 @@ For Xenial (Ubuntu 16.04.4):: $ sudo ln -sf /usr/bin/g++-5 /usr/bin/c++ # Install YDK core library - $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_0.8.1-1_amd64.deb - $ sudo gdebi libydk_0.8.1-1_amd64.deb + $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk-0.8.2-1.amd64.deb + $ sudo gdebi libydk-0.8.2-1.amd64.deb For Bionic (Ubuntu 18.04.1):: # Install YDK core library - $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_0.8.1-1_amd64.deb - $ sudo gdebi libydk_0.8.1-1_amd64.deb + $ wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk-0.8.2-1.amd64.deb + $ sudo gdebi libydk-0.8.2-1.amd64.deb Centos (Fedora-based) ~~~~~~~~~~~~~~~~~~~~~ @@ -79,14 +79,12 @@ Please see `this issue on YDK GitHub `_ and the following homebrew packages on your system before installing YDK-Py. .. code-block:: sh @@ -97,8 +95,8 @@ It is required to install Xcode command line tools, `homebrew `_ $ brew install pkg-config libssh xml2 libxml2 curl pcre cmake pybind11 # Install YDK core library - $ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk-0.8.1-Darwin.pkg - $ sudo installer -pkg libydk-0.8.1-Darwin.pkg -target / + $ curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk-0.8.2-Darwin.pkg + $ sudo installer -pkg libydk-0.8.2-Darwin.pkg -target / Libssh Installation ------------------- @@ -147,30 +145,30 @@ For Xenial (Ubuntu 16.04.4): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/xenial/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/xenial/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb For Bionic (Ubuntu 18.04.1): .. code-block:: sh - wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.1/bionic/libydk_gnmi_0.4.0-1_amd64.deb - sudo gdebi libydk_gnmi_0.4.0-1_amd64.deb + wget https://devhub.cisco.com/artifactory/debian-ydk/0.8.2/bionic/libydk_gnmi_0.4.0-2_amd64.deb + sudo gdebi libydk_gnmi_0.4.0-2_amd64.deb CentOS ~~~~~~ .. code-block:: sh - sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.1/libydk_gnmi_0.4.0-1.x86_64.rpm + sudo yum install https://devhub.cisco.com/artifactory/rpm-ydk/0.8.2/libydk_gnmi_0.4.0-2.x86_64.rpm MacOS ~~~~~ .. code-block:: sh - curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.1/libydk_gnmi-0.4.0-1_Darwin.pkg - sudo installer -pkg libydk_gnmi-0.4.0-1_Darwin.pkg -target / + curl -O https://devhub.cisco.com/artifactory/osx-ydk/0.8.2/libydk_gnmi-0.4.0-2_Darwin.pkg + sudo installer -pkg libydk_gnmi-0.4.0-2_Darwin.pkg -target / Runtime environment @@ -195,6 +193,50 @@ It is also required for Python installation to include corresponding shared libr Please follow `System Requirements` to assure presence of shared Python libraries. +Mac OS +~~~~~~ + +The developers of Python2 on Mac OS might face an issue ([#837](https://github.com/CiscoDevNet/ydk-gen/issues/837)). +This is well known and documented issue. Each developer might have different approaches for its resolution. +One of them is to use Python2 virtual environment. See section Using Python Virtual_ Environment for details + +In addition it is required properly set CMAKE_LIBRARY_PATH environment variable to assure that `cmake` uses correct Python library. +Follow these steps to find and set correct library path. + +1. Find installations of `libpython2.7` library. Example: + +.. code-block:: sh + + $ locate libpython2.7.dylib + /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib + /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib + /usr/lib/libpython2.7.dylib + /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib + /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib + +2. Choose non-system Python library installation and set CMAKE_LIBRARY_PATH before any YDK component installation. Example: + +.. code-block:: sh + + export CMAKE_LIBRARY_PATH=/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib + +3. Run YDK core package installation with '-v' flag to check that `PythonLibs` points to correct library path. Example: + +.. code-block:: sh + + $ ./generate.py --core + $ pip install -v gen-api/python/ydk/dist/ydk*.tar.gz + + # Look for these lines + -- Found PythonLibs: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (found version "2.7.15") + +4. Finally test you YDK core library installation, making sure there are no errors: + +.. code-block:: sh + + $ python -c "import ydk.types" + + .. _howto-install: Quick install @@ -250,8 +292,8 @@ YDK-related packages (``YDK``, ``openconfig`` and ``ietf`` packages): .. code-block:: sh - $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.1/ydk-0.8.1.tar.gz - $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.1/ydk-service-gnmi-0.4.0.tar.gz + $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.2/ydk-0.8.2.tar.gz + $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.2/ydk-service-gnmi-0.4.0.post2.tar.gz $ pip install ydk-models-cisco-ios-xr $ pip install ydk-models-cisco-ios-xe @@ -260,14 +302,14 @@ If you only prefer to install the ``openconfig`` bundle and its dependencies (`` .. code-block:: sh - $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.1/ydk-0.8.1.tar.gz + $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.2/ydk-0.8.2.tar.gz $ pip install ydk-models-openconfig If you only want to install the ``ietf`` bundle and its dependencies (``YDK`` package), execute: .. code-block:: sh - $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.1/ydk-0.8.1.tar.gz + $ pip install https://devhub.cisco.com/artifactory/pypi-ydk/0.8.2/ydk-0.8.2.tar.gz $ pip install ydk-models-ietf Installing from Source @@ -304,7 +346,7 @@ Once you have installed the ``YDK`` core package, you can install one or more mo .. code-block:: sh - $ git clone https://github.com/CiscoDevNet/ydk-py.git -b 0.8.1 + $ git clone https://github.com/CiscoDevNet/ydk-py.git -b 0.8.2 Note that some bundles have dependencies on other bundles. Those dependencies are already captured in the bundle package. Make sure you install the desired bundles in the order below. To install the ``ietf`` bundle, execute: @@ -354,8 +396,10 @@ To install the ``YDK`` Python gNMI package, execute: gnmi$ python setup.py sdist gnmi$ pip install dist/ydk*.gz -Using Virtual Environment -========================= +.. _Virtual: + +Using Python Virtual Environment +================================ You may want to perform the installation under Python virtual environment (`virtualenv `_/`virtualenvwrapper `_). A virtual environment allows you to install multiple versions of YDK if needed. In addition, it prevents any potential conflicts between package dependencies in your system. @@ -366,8 +410,6 @@ To install virtual environment on your system, execute: $ pip install virtualenv virtualenvwrapper $ source /usr/local/bin/virtualenvwrapper.sh -**Note** In some systems (e.g. Debian-based Linux), you need to be a root user or use `sudo` access. - Create new virtual environment: .. code-block:: sh diff --git a/sdk/python/core/setup.py b/sdk/python/core/setup.py index aa1f33b4c..4eea8b83f 100644 --- a/sdk/python/core/setup.py +++ b/sdk/python/core/setup.py @@ -30,7 +30,7 @@ NAME = 'ydk' -VERSION = '0.8.1' +VERSION = '0.8.2' INSTALL_REQUIREMENTS = ['pybind11>=2.1.1'] diff --git a/sdk/python/core/tests/test_meta.py b/sdk/python/core/tests/test_meta.py index e2545a6e0..3c77adf5c 100644 --- a/sdk/python/core/tests/test_meta.py +++ b/sdk/python/core/tests/test_meta.py @@ -55,7 +55,7 @@ def test_runner(self): embeded_enum_map = embeded_enum_meta.enum_dict() print("\nEnum dictionary:\n %s" % embeded_enum_map) self.assertTrue(len(embeded_enum_map) > 0) - self.assertEqual(embeded_enum_map['seven'].value, 7L) + self.assertEqual(embeded_enum_map['seven'].value, 7) def test_enum_union_meta(self): diff --git a/sdk/python/core/tests/test_oc_nis.py b/sdk/python/core/tests/test_oc_nis.py new file mode 100644 index 000000000..aeff5d611 --- /dev/null +++ b/sdk/python/core/tests/test_oc_nis.py @@ -0,0 +1,75 @@ +# ---------------------------------------------------------------- +# Copyright 2019 Cisco Systems +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ------------------------------------------------------------------ + +"""test_oc_nis.py +Tests for openconfig-network-instance model +""" +from __future__ import absolute_import + +import unittest + +from ydk.providers import CodecServiceProvider +from ydk.services import CodecService + +from ydk.models.ydktest_oc_nis import openconfig_network_instance as oc_nis + +nis_xml = ''' + + + default + + + policy-types:ISIS + DEFAULT + + policy-types:ISIS + DEFAULT + + + + + + isis-types:IPV4 + isis-types:UNICAST + + isis-types:IPV4 + isis-types:UNICAST + + + + + + + + + +''' + +class SanityTest(unittest.TestCase): + + def test_oc_nis_decode(self): + codec_provider = CodecServiceProvider(type='xml') + codec = CodecService() + + nis_top = oc_nis.NetworkInstances() + entity = codec.decode(codec_provider, nis_xml, nis_top); + self.assertIsNotNone(entity) + +if __name__ == '__main__': + import sys + suite = unittest.TestLoader().loadTestsFromTestCase(SanityTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/sdk/python/core/ydk/entity_utils/entity_utils.py b/sdk/python/core/ydk/entity_utils/entity_utils.py index 4116d5488..c107717e8 100644 --- a/sdk/python/core/ydk/entity_utils/entity_utils.py +++ b/sdk/python/core/ydk/entity_utils/entity_utils.py @@ -182,6 +182,11 @@ def _get_bundle_name(entity): m = importlib.import_module('.'.join([m, '_yang_ns'])) return m.__dict__['BUNDLE_NAME'] +def _traverse_to_top_entity(entity): + while entity.parent is not None: + entity = entity.parent + return entity + def _get_top_level_entity(read_filter, root_schema): if read_filter is None: return None @@ -199,16 +204,23 @@ def _get_top_level_entity(read_filter, root_schema): if read_filter is not None and read_filter.is_top_level_class: return read_filter - if read_filter.parent is None: - data_node = get_data_node_from_entity(read_filter, root_schema) - while data_node.get_parent() is not None: - parent_datanode = data_node.get_parent() - if parent_datanode.get_path() == '/': - break - data_node = parent_datanode - return _datanode_to_entity(data_node) + top_entity = _traverse_to_top_entity(read_filter) + if top_entity.is_top_level_class: + if read_filter.ignore_validation: + top_entity.ignore_validation = True + return top_entity; + + if read_filter.ignore_validation: + log.error("Cannot disable validation for non-top-level entity '%s'" % top_entity.yang_name) + + data_node = get_data_node_from_entity(top_entity, root_schema) + while data_node.get_parent() is not None: + parent_datanode = data_node.get_parent() + if parent_datanode.get_path() == '/': + return _datanode_to_entity(data_node) + data_node = parent_datanode - return _get_top_level_entity(read_filter.parent, root_schema) + return None # should never get here def _find_child_entity(parent_entity, filter_abs_path): parent_abs_path = parent_entity.get_absolute_path() @@ -248,10 +260,15 @@ def _get_child_entity_from_top(top_entity, filter_entity): if filter_entity is None: return top_entity - if isinstance(top_entity, list) and isinstance(filter_entity, list) and len(top_entity) == len(filter_entity): + if isinstance(top_entity, list) and isinstance(filter_entity, list): entities = [] - for i in range(len(top_entity)): - entity = _get_child_entity_from_top(top_entity[i], filter_entity[i]) + for filter in filter_entity: + filter_abs_path = filter.get_absolute_path() + entity = None + for ent in top_entity: + if ent.get_segment_path() in filter_abs_path: + entity = _get_child_entity_from_top(ent, filter) + break; entities.append(entity) return entities elif isinstance(top_entity, Entity) and isinstance(filter_entity, Entity): diff --git a/sdk/python/core/ydk/types/py_types.py b/sdk/python/core/ydk/types/py_types.py index d3177d017..0a44f6252 100644 --- a/sdk/python/core/ydk/types/py_types.py +++ b/sdk/python/core/ydk/types/py_types.py @@ -99,7 +99,7 @@ def __init__(self): self._is_frozen = False self.parent = None self.ylist_key = None - self.logger = logging.getLogger("ydk.types.EntityCollection") + self.logger = logging.getLogger("ydk.types.Entity") self._local_refs = {} self._children_name_map = OrderedDict() self._children_yang_names = set() @@ -108,7 +108,6 @@ def __init__(self): self._segment_path = lambda : '' self._absolute_path = lambda : '' self._python_type_validation_enabled = True - self.logger = logging.getLogger("ydk.types.Entity") def __eq__(self, other): if not isinstance(other, Entity): @@ -326,7 +325,12 @@ def path(self): return self.get_segment_path() def get_absolute_path(self): - return self._absolute_path() + path = self._absolute_path() + if len(path) == 0 and self.is_top_level_class: + path = self.get_segment_path() + if '[' in path: + path = path.split('[')[0] + return path def _get_child_by_seg_name(self, segs): for seg in segs: @@ -406,10 +410,10 @@ class EntityCollection(object): Each Entity instance has unique segment path value, which is used as a key in the dictionary. """ def __init__(self, *entities): + self.logger = logging.getLogger("ydk.types.EntityCollection") self._entity_map = OrderedDict() for entity in entities: self.append(entity) - self.logger = logging.getLogger("ydk.types.EntityCollection") def __eq__(self, other): if not isinstance(other, EntityCollection): @@ -432,7 +436,7 @@ def append(self, entities): - list of Entity class instances """ if entities is None: - self._log_error_and_raise_exception("Cannot add None object to the EntityCollection", YInvalidArgumentError) + self.logger.debug("Cannot add None object to the EntityCollection") elif isinstance(entities, Entity): key = self._key(entities) self._entity_map[key] = entities @@ -441,6 +445,8 @@ def append(self, entities): if isinstance(entity, Entity): key = self._key(entity) self._entity_map[key] = entity + elif entity is None: + self.logger.debug("Cannot add None object to the EntityCollection") else: msg = "Argument %s is not supported by EntityCollection class; data ignored"%type(entity) self._log_error_and_raise_exception(msg, YInvalidArgumentError) diff --git a/sdk/python/gnmi/setup.py b/sdk/python/gnmi/setup.py index b25ca2c19..2a9f507d8 100644 --- a/sdk/python/gnmi/setup.py +++ b/sdk/python/gnmi/setup.py @@ -32,7 +32,7 @@ VERSION = '0.4.0' -INSTALL_REQUIREMENTS = ['ydk==0.8.1', 'pybind11>=2.1.1'] +INSTALL_REQUIREMENTS = ['ydk>=0.8.2', 'pybind11>=2.1.1'] LONG_DESCRIPTION = ''' This package provides extension for YDK core - gNMI services. diff --git a/sdk/python/gnmi/tests/test_gnmi_crud.py b/sdk/python/gnmi/tests/test_gnmi_crud.py index 48696ef59..cd79d9f82 100644 --- a/sdk/python/gnmi/tests/test_gnmi_crud.py +++ b/sdk/python/gnmi/tests/test_gnmi_crud.py @@ -42,7 +42,7 @@ def setUpClass(self): self.codec_provider = CodecServiceProvider() self.codec = CodecService() self.repo = Repository(get_local_repo_dir()) - self.provider = gNMIServiceProvider( self.repo, "127.0.0.1", 50051, "admin", "admin") + self.provider = gNMIServiceProvider( self.repo, "127.0.0.1", "admin", "admin", port=50051) self.schema = self.provider.get_session().get_root_schema() self.crud = CRUDService() @@ -66,7 +66,7 @@ def test_gnmi_crud_all_operations(self): lo10.config.description = 'Test' res = self.crud.update(self.provider, lo10) self.assertTrue(res) - + # Read all read_list = self.crud.read(self.provider, [openconfig_interfaces.Interfaces(), openconfig_bgp.Bgp()]) @@ -82,7 +82,7 @@ def test_gnmi_crud_all_operations(self): self.assertEqual(len(read_list), 2) #for entity in read_list: # print_entity(entity, self.schema) - + # Read single container lo10 = openconfig_interfaces.Interfaces.Interface() lo10.name = 'Loopback10' @@ -98,7 +98,7 @@ def test_gnmi_crud_all_operations(self): ''' self.assertEqual( entity_to_string(ifc_config, self.schema), expected) - + # Read single leaf ifcs = openconfig_interfaces.Interfaces() lo10 = openconfig_interfaces.Interfaces.Interface() @@ -115,7 +115,95 @@ def test_gnmi_crud_all_operations(self): ''' self.assertEqual( entity_to_string(read_descr, self.schema), expected) - + + # Delete configuration + ifc = openconfig_interfaces.Interfaces.Interface() + ifc.name = 'Loopback10' + bgp = openconfig_bgp.Bgp() + res = self.crud.delete(self.provider, [ifc, bgp]) + + def test_gnmi_crud_with_no_validation(self): + # Configure interface + ifc_config = openconfig_interfaces.Interfaces() + lo10 = openconfig_interfaces.Interfaces.Interface() + lo10.name = 'Loopback10' + lo10.config.name = 'Loopback10' + lo10.ignore_validation = True + ifc_config.interface.append(lo10) + + # Configure BGP + bgp_config = openconfig_bgp.Bgp() + bgp_config.global_.config.as_ = 65172 + bgp_config.ignore_validation = True + + neighbor = openconfig_bgp.Bgp.Neighbors.Neighbor() + neighbor.neighbor_address = '172.16.255.2' + neighbor.config.neighbor_address = '172.16.255.2' + neighbor.config.peer_as = 65172 + bgp_config.neighbors.neighbor.append(neighbor) + + res = self.crud.create(self.provider, [lo10, bgp_config]) + + # Update configuration + lo10.config.description = 'Test' + res = self.crud.update(self.provider, lo10) + self.assertTrue(res) + + # Read config + ifc_filter = openconfig_interfaces.Interfaces() + ifc = openconfig_interfaces.Interfaces.Interface() + ifc.name = 'Loopback10' + ifc.ignore_validation = True + ifc_filter.interface.append(ifc) + + bgp_filter = openconfig_bgp.Bgp() + bgp_neighbor_filter = openconfig_bgp.Bgp.Neighbors.Neighbor() + bgp_neighbor_filter.neighbor_address = '172.16.255.2' + bgp_neighbor_filter.ignore_validation = True + bgp_filter.neighbors.neighbor.append(bgp_neighbor_filter) + + read_list = self.crud.read_config(self.provider, [ifc, bgp_neighbor_filter]) + self.assertIsNotNone(read_list) + self.assertEqual(isinstance(read_list, list), True) + self.assertEqual(len(read_list), 2) + + # Read single container + ifc_filter = openconfig_interfaces.Interfaces() + lo10 = openconfig_interfaces.Interfaces.Interface() + lo10.name = 'Loopback10' + lo10.config = YFilter.read + lo10.ignore_validation = True + ifc_filter.interface.append(lo10) + ifc_read = self.crud.read(self.provider, lo10) + + expected = ''' + Loopback10 + + Loopback10 + Test + + +''' + self.assertEqual( entity_to_string(ifc_read, self.schema), expected) + + # Read single leaf + ifcs = openconfig_interfaces.Interfaces() + lo10 = openconfig_interfaces.Interfaces.Interface() + lo10.name = 'Loopback10' + lo10.config.description = YFilter.read + ifcs.interface.append(lo10) + ifcs.ignore_validation = True + + read_descr = self.crud.read(self.provider, lo10) + expected = ''' + Loopback10 + + Test + + +''' + self.assertEqual( entity_to_string(read_descr, self.schema), expected) + # Delete configuration ifc = openconfig_interfaces.Interfaces.Interface() ifc.name = 'Loopback10' diff --git a/sdk/python/gnmi/tests/test_gnmi_service.py b/sdk/python/gnmi/tests/test_gnmi_service.py index e45e03300..f4d4f1450 100644 --- a/sdk/python/gnmi/tests/test_gnmi_service.py +++ b/sdk/python/gnmi/tests/test_gnmi_service.py @@ -66,7 +66,7 @@ def setUpClass(self): self.codec_provider = CodecServiceProvider() self.codec = CodecService() self.repo = Repository(get_local_repo_dir()) - self.provider = gNMIServiceProvider( self.repo, "127.0.0.1", 50051, "admin", "admin") + self.provider = gNMIServiceProvider( self.repo, "127.0.0.1", "admin", "admin", port=50051) self.schema = self.provider.get_session().get_root_schema() self.gs = gNMIService() diff --git a/sdk/python/gnmi/ydk/gnmi/providers/gnmi_provider.py b/sdk/python/gnmi/ydk/gnmi/providers/gnmi_provider.py index 20bc95c40..1a6391767 100644 --- a/sdk/python/gnmi/ydk/gnmi/providers/gnmi_provider.py +++ b/sdk/python/gnmi/ydk/gnmi/providers/gnmi_provider.py @@ -25,8 +25,8 @@ class gNMIServiceProvider(_gNMIServiceProvider): """ Python wrapper for gNMIServiceProvider """ - def __init__(self, repo, address, port, username, password, - server_certificate=None, private_key=None): + def __init__(self, repo, address, username, password, + port=57400, server_certificate=None, private_key=None): if port is None: port = 57400 diff --git a/sdk/version.json b/sdk/version.json index 806936ffa..00b0b5e80 100644 --- a/sdk/version.json +++ b/sdk/version.json @@ -1,5 +1,5 @@ { - "core": "0.8.1", + "core": "0.8.2", "ietf": "0.1.5-post2", "openconfig": "0.1.6-post1", "cisco_ios_xr": "6.5.1", diff --git a/test/dependencies_centos_basic.sh b/test/dependencies_centos_basic.sh index c20bf0a21..1048f9d79 100755 --- a/test/dependencies_centos_basic.sh +++ b/test/dependencies_centos_basic.sh @@ -59,10 +59,9 @@ function install_dependencies { yum update -y > /dev/null yum install epel-release -y > /dev/null yum install https://centos7.iuscommunity.org/ius-release.rpm -y > /dev/null - yum install git which libxml2-devel libxslt-devel libssh-devel libtool gcc-c++ pcre-devel \ - cmake3 wget curl-devel unzip python-devel python-pip make java sudo \ - python36u-devel python36u-pip rpm-build redhat-lsb lcov -y \ - > /dev/null + yum install git which libxml2-devel libxslt-devel libssh-devel libtool gcc-c++ pcre-devel -y > /dev/null + yum install cmake3 wget curl-devel unzip make java sudo -y > /dev/null + yum install python-devel python-pip python36u-devel python36u-pip rpm-build redhat-lsb lcov -y > /dev/null } function check_install_go { diff --git a/test/dependencies_osx.sh b/test/dependencies_osx.sh index b9dd0cb56..0404aeeb6 100755 --- a/test/dependencies_osx.sh +++ b/test/dependencies_osx.sh @@ -24,7 +24,26 @@ function print_msg { echo -e "${MSG_COLOR}*** $(date) *** dependencies_osx.sh | $@ ${NOCOLOR}" } +function run_cmd { + local cmd=$@ + print_msg "Running: $cmd" + $@ + local status=$? + if [ $status -ne 0 ]; then + MSG_COLOR=$RED + print_msg "Exiting '$@' with status=$status" + exit $status + fi + return $status +} + function install_libssh { + print_msg "Checking installation of libssh" + locate libssh_threads.dylib + local status=$? + if [[ ${status} == 0 ]]; then + return + fi print_msg "Installing libssh-0.7.6" brew reinstall openssl export OPENSSL_ROOT_DIR=/usr/local/opt/openssl @@ -67,27 +86,29 @@ function install_golang { } function check_python_installation { - print_msg "Checking python3 and pip3 installation" - #brew rm -f --ignore-dependencies python python3 - python3 -V &> /dev/null + print_msg "Checking python libraries location" + locate libpython2.7.dylib + + print_msg "Checking python and pip installation" + python3 -V status=$? if [ $status -ne 0 ]; then print_msg "Installing python3" - brew install python@3 + brew install python fi - pip3 -V &> /dev/null + pip3 -V status=$? if [ $status -ne 0 ]; then - print_msg "Installing pip3" - sudo easy_install pip3 + print_msg "Installing pip${PYTHON_VERSION}" + run_cmd curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + run_cmd sudo -H python3 get-pip.py fi - sudo pip3 install virtualenv } ########################## EXECUTION STARTS HERE ############################# # Terminal colors -NOCOLOR="\033[0m" +NOCOLOR='\033[0m' YELLOW='\033[1;33m' MSG_COLOR=$YELLOW diff --git a/test/gnmi_tests.sh b/test/gnmi_tests.sh index 94de2b38f..993433d61 100755 --- a/test/gnmi_tests.sh +++ b/test/gnmi_tests.sh @@ -89,24 +89,23 @@ function pip_check_install { ###################################################################### function check_python_installation { - + if [[ ${os_type} == "Darwin" ]] ; then PYTHON_VERSION=3 PYTHON_BIN=python3 PIP_BIN=pip3 else PYTHON_BIN=python${PYTHON_VERSION} - if [[ ${PYTHON_VERSION} = *"2"* ]]; then + if [[ ${PYTHON_VERSION} = "2"* ]]; then PIP_BIN=pip - elif [[ ${PYTHON_VERSION} = *"3.5"* ]]; then + elif [[ ${PYTHON_VERSION} = "3.5"* ]]; then PIP_BIN=pip3 else PIP_BIN=pip${PYTHON_VERSION} fi fi - print_msg "Checking installation of ${PYTHON_BIN}" - ${PYTHON_BIN} --version &> /dev/null + ${PYTHON_BIN} -V status=$? if [ $status -ne 0 ]; then MSG_COLOR=$RED @@ -114,7 +113,7 @@ function check_python_installation { exit $status fi print_msg "Checking installation of ${PIP_BIN}" - ${PIP_BIN} -V &> /dev/null + ${PIP_BIN} -V status=$? if [ $status -ne 0 ]; then MSG_COLOR=$RED @@ -128,16 +127,10 @@ function check_python_installation { function init_py_env { check_python_installation print_msg "Initializing Python requirements" - sudo ${PIP_BIN} install -r requirements.txt pybind11==2.2.2 + ${PIP_BIN} install -r requirements.txt pybind11==2.2.2 if [[ $run_with_coverage ]] ; then - sudo ${PIP_BIN} install coverage + ${PIP_BIN} install coverage fi - - #else - #print_msg "Initializing Python3 virtual environment" - #virtualenv macos_pyenv -p python3 - #source macos_pyenv/bin/activate - #fi } function init_go_env { @@ -159,6 +152,7 @@ function init_go_env { print_msg "Running $(go version)" go get github.com/stretchr/testify + export CGO_ENABLED=1 } ###################################################################### @@ -178,7 +172,7 @@ function install_cpp_core { else run_exec_test ${CMAKE_BIN} .. fi - run_exec_test make > /dev/null + run_exec_test make &> /dev/null sudo make install } @@ -205,7 +199,7 @@ function install_cpp_ydktest_bundle { cd $YDKGEN_HOME run_test generate.py --bundle profiles/test/ydktest-cpp.json --cpp cd gen-api/cpp/ydktest-bundle/build - run_exec_test make > /dev/null + run_exec_test make &> /dev/null sudo make install cd - } @@ -220,7 +214,7 @@ function build_gnmi_cpp_core_library { else run_exec_test ${CMAKE_BIN} .. fi - run_exec_test make > /dev/null + run_exec_test make &> /dev/null sudo make install cd $YDKGEN_HOME } @@ -235,7 +229,7 @@ function build_and_run_cpp_gnmi_tests { else run_exec_test ${CMAKE_BIN} .. fi - run_exec_test make > /dev/null + run_exec_test make &> /dev/null start_gnmi_server @@ -275,7 +269,7 @@ function start_gnmi_server { print_msg "Building YDK gNMI server" mkdir -p build && cd build ${CMAKE_BIN} .. - run_exec_test make > /dev/null + run_exec_test make &> /dev/null fi print_msg "Starting YDK gNMI server" @@ -314,7 +308,7 @@ function install_go_bundle { function install_go_gnmi { print_msg "Installing Go gNMI package" cd $YDKGEN_HOME - run_test generate.py -i --service profiles/services/gnmi-0.4.0_post1.json --go + run_test generate.py -i --service profiles/services/gnmi-0.4.0_post2.json --go } function run_go_gnmi_tests { @@ -389,7 +383,7 @@ function build_python_gnmi_package { print_msg "Installing gNMI package for Python" cd $YDKGEN_HOME - run_test generate.py --service profiles/services/gnmi-0.4.0_post1.json + run_test generate.py --service profiles/services/gnmi-0.4.0_post2.json ${PIP_BIN} install gen-api/python/ydk-service-gnmi/dist/ydk*.tar.gz print_msg "Verifying Python gNMI package installation" diff --git a/test/tests.sh b/test/tests.sh index 395a1a817..9217eac25 100755 --- a/test/tests.sh +++ b/test/tests.sh @@ -25,9 +25,6 @@ NOCOLOR="\033[0m" YELLOW='\033[1;33m' MSG_COLOR=$YELLOW -PY_GENERATE="python2" -PY_TEST="python3" - ###################################################################### # Utility functions ###################################################################### @@ -126,22 +123,21 @@ function stop_tcp_server { } function check_python_installation { - + if [[ ${os_type} == "Darwin" ]] ; then PYTHON_VERSION=3 PYTHON_BIN=python3 PIP_BIN=pip3 else PYTHON_BIN=python${PYTHON_VERSION} - if [[ ${PYTHON_VERSION} = *"2"* ]]; then + if [[ ${PYTHON_VERSION} = "2"* ]]; then PIP_BIN=pip - elif [[ ${PYTHON_VERSION} = *"3.5"* ]]; then + elif [[ ${PYTHON_VERSION} = "3.5"* ]]; then PIP_BIN=pip3 else PIP_BIN=pip${PYTHON_VERSION} fi fi - print_msg "Checking installation of ${PYTHON_BIN}" ${PYTHON_BIN} --version &> /dev/null status=$? @@ -165,16 +161,10 @@ function check_python_installation { function init_py_env { check_python_installation print_msg "Initializing Python requirements" - sudo ${PIP_BIN} install -r requirements.txt pybind11==2.2.2 + ${PIP_BIN} install -r requirements.txt pybind11==2.2.2 if [[ $run_with_coverage ]] ; then - sudo ${PIP_BIN} install coverage + ${PIP_BIN} install coverage fi - - #else - #print_msg "Initializing Python3 virtual environment" - #virtualenv macos_pyenv -p python3 - #source macos_pyenv/bin/activate - #fi } function init_go_env { @@ -185,7 +175,7 @@ function init_go_env { gvm use go1.9.2 print_msg "GOROOT: $GOROOT" print_msg "GOPATH: $GOPATH" - else + else cd $YDKGEN_HOME export GOPATH="$(pwd)/golang" export GOROOT=/usr/local/go @@ -196,6 +186,7 @@ function init_go_env { print_msg "Running $(go version)" go get github.com/stretchr/testify + export CGO_ENABLED=1 } ###################################################################### @@ -225,7 +216,8 @@ function install_cpp_core { else run_exec_test ${CMAKE_BIN} .. fi - run_exec_test make > /dev/null + print_msg "Compiling C++ core library" + run_exec_test make &> /dev/null sudo make install } @@ -296,9 +288,9 @@ function generate_install_specified_cpp_bundle { bundle_profile=$1 bundle_name=$2 - run_test generate.py --bundle ${bundle_profile} --cpp --generate-doc &> /dev/null + run_test generate.py --bundle ${bundle_profile} --cpp &> /dev/null cd gen-api/cpp/${bundle_name}/build - run_exec_test make > /dev/null + run_exec_test make &> /dev/null sudo make install cd - } @@ -309,6 +301,9 @@ function cpp_sanity_ydktest_gen_install { print_msg "Generating and installing new C++ ydktest bundle" generate_install_specified_cpp_bundle profiles/test/ydktest-cpp-new.json ydktest_new-bundle + + print_msg "Generating and installing C++ ydktest-oc-nis bundle" + generate_install_specified_cpp_bundle profiles/test/ydktest-oc-nis.json ydktest_oc_nis-bundle } function cpp_sanity_ydktest_test { @@ -329,7 +324,7 @@ function cpp_sanity_ydktest_test { else run_exec_test ${CMAKE_BIN} .. fi - run_exec_test make > /dev/null + run_exec_test make &> /dev/null #export CTEST_OUTPUT_ON_FAILURE=1 #make test @@ -353,7 +348,7 @@ function cpp_test_gen_test { mkdir -p gen-api/cpp/models_test-bundle/ydk/models/models_test/test/build cd gen-api/cpp/models_test-bundle/ydk/models/models_test/test/build run_exec_test ${CMAKE_BIN} .. - run_exec_test make > /dev/null + run_exec_test make &> /dev/null ctest --output-on-failure } @@ -363,7 +358,7 @@ function cpp_test_gen { cd $YDKGEN_HOME run_test generate.py --bundle profiles/test/ydk-models-test.json --generate-tests --cpp &> /dev/null cd gen-api/cpp/models_test-bundle/build/ - run_exec_test make > /dev/null + run_exec_test make &> /dev/null sudo make install # cpp_test_gen_test @@ -437,9 +432,11 @@ function run_go_sanity_tests { function run_python_bundle_tests { print_msg "Running python bundle tests" py_sanity_ydktest - py_sanity_deviation + if [[ ${os_type} != "Darwin" ]] ; then + py_sanity_deviation + py_sanity_common_cache + fi py_sanity_augmentation - py_sanity_common_cache py_sanity_one_class_per_module py_sanity_backward_compatibility } @@ -492,7 +489,7 @@ function py_sanity_ydktest_test { print_msg "Uninstall ydk py core from pip for testing with coverage" ${PIP_BIN} uninstall ydk -y - + export OLDPYTHONPATH=$PYTHONPATH print_msg "Setting OLDPYTHONPATH to $OLDPYTHONPATH" @@ -524,13 +521,15 @@ function run_py_sanity_ydktest_tests { run_test sdk/python/core/tests/test_sanity_codec.py py_sanity_ydktest_test_netconf_ssh - py_sanity_ydktest_test_tcp + if [[ ${os_type} != "Darwin" ]] ; then + py_sanity_ydktest_test_tcp + fi stop_tcp_server } function py_sanity_ydktest_test_netconf_ssh { - print_msg "py_sanity_ydktest_test_netconf_ssh" + print_msg "Running py_sanity_ydktest_test_netconf_ssh" run_test sdk/python/core/tests/test_netconf_operations.py run_test sdk/python/core/tests/test_opendaylight.py @@ -548,8 +547,8 @@ function py_sanity_ydktest_test_netconf_ssh { run_test sdk/python/core/tests/test_sanity_types.py run_test sdk/python/core/tests/test_non_top_operations.py # run_test_no_coverage sdk/python/core/tests/test_sanity_executor_rpc.py - - print_msg "py_sanity_ydktest_test_netconf_ssh no on-demand" + if [[ ${os_type} != "Darwin" ]] ; then + print_msg "Running py_sanity_ydktest_test_netconf_ssh with no on-demand" run_test sdk/python/core/tests/test_netconf_operations.py --non-demand run_test sdk/python/core/tests/test_sanity_delete.py --non-demand run_test sdk/python/core/tests/test_sanity_errors.py --non-demand @@ -564,6 +563,7 @@ function py_sanity_ydktest_test_netconf_ssh { run_test sdk/python/core/tests/test_sanity_types.py --non-demand # run_test_no_coverage sdk/python/core/tests/test_sanity_executor_rpc.py # --non-demand + fi } function py_sanity_ydktest_test_tcp { @@ -592,7 +592,7 @@ function py_sanity_deviation { } function py_sanity_deviation_ydktest_gen { - print_msg "py_sanity_deviation_ydktest_gen" + print_msg "Running py_sanity_deviation_ydktest_gen" rm -rf gen-api/python/* cd $YDKGEN_HOME @@ -600,22 +600,22 @@ function py_sanity_deviation_ydktest_gen { } function py_sanity_deviation_ydktest_install { - print_msg "py_sanity_deviation_ydktest_install" + print_msg "Running py_sanity_deviation_ydktest_install" ${PIP_BIN} uninstall ydk-models-ydktest -y pip_check_install gen-api/python/ydktest-bundle/dist/ydk*.tar.gz } function py_sanity_deviation_ydktest_test { - print_msg "py_sanity_deviation_ydktest_test" + print_msg "Running py_sanity_deviation_ydktest_test" init_confd $YDKGEN_HOME/sdk/cpp/core/tests/confd/deviation run_test sdk/python/core/tests/test_sanity_deviation.py - run_test sdk/python/core/tests/test_sanity_deviation.py --non-demand +# run_test sdk/python/core/tests/test_sanity_deviation.py --non-demand } function py_sanity_deviation_bgp_gen { - print_msg "py_sanity_deviation_bgp_gen" + print_msg "Running py_sanity_deviation_bgp_gen" rm -rf gen-api/python/* cd $YDKGEN_HOME @@ -623,24 +623,24 @@ function py_sanity_deviation_bgp_gen { } function py_sanity_deviation_bgp_install { - print_msg "py_sanity_deviation_bgp_install" + print_msg "Running py_sanity_deviation_bgp_install" cd $YDKGEN_HOME pip_check_install gen-api/python/deviation-bundle/dist/*.tar.gz } function py_sanity_deviation_bgp_test { - print_msg "py_sanity_deviation_bgp_test" + print_msg "Running py_sanity_deviation_bgp_test" run_test sdk/python/core/tests/test_sanity_deviation_bgp.py - run_test sdk/python/core/tests/test_sanity_deviation_bgp.py --non-demand +# run_test sdk/python/core/tests/test_sanity_deviation_bgp.py --non-demand } #-------------------------- # Python augmentation bundle #-------------------------- function py_sanity_augmentation { - print_msg "py_sanity_augmentation" + print_msg "Running py_sanity_augmentation" rm -rf $HOME/.ydk/* py_sanity_augmentation_gen @@ -650,7 +650,7 @@ function py_sanity_augmentation { } function py_sanity_augmentation_gen { - print_msg "py_sanity_augmentation_gen" + print_msg "Running py_sanity_augmentation_gen" cd $YDKGEN_HOME && rm -rf gen-api/python/* run_test generate.py --core @@ -658,7 +658,7 @@ function py_sanity_augmentation_gen { } function py_sanity_augmentation_install { - print_msg "py_sanity_augmentation_install" + print_msg "Running py_sanity_augmentation_install" cd $YDKGEN_HOME ${PIP_BIN} uninstall ydk -y @@ -667,17 +667,17 @@ function py_sanity_augmentation_install { } function py_sanity_augmentation_test { - print_msg "py_sanity_augmentation_test" + print_msg "Running py_sanity_augmentation_test" init_confd $YDKGEN_HOME/sdk/cpp/core/tests/confd/augmentation run_test sdk/python/core/tests/test_sanity_augmentation.py - run_test sdk/python/core/tests/test_sanity_augmentation.py --non-demand +# run_test sdk/python/core/tests/test_sanity_augmentation.py --non-demand run_test sdk/python/core/tests/test_on_demand.py } function py_sanity_common_cache { - print_msg "py_sanity_common_cache" + print_msg "Running py_sanity_common_cache" rm -rf $HOME/.ydk/* init_confd $YDKGEN_HOME/sdk/cpp/core/tests/confd/deviation @@ -757,6 +757,20 @@ function py_test_gen { # py_test_gen_test } +#------------------------------------- +# oc-network-instance tests +#------------------------------------- + +function run_python_oc_nis_tests { + print_msg "Installing ydktest_oc_nis bundle" + cd $YDKGEN_HOME + run_test generate.py --bundle profiles/test/ydktest-oc-nis.json + pip_check_install gen-api/python/ydktest_oc_nis-bundle/dist/ydk*.tar.gz + + print_msg "Running ydktest_oc_nis bundle tests" + run_test sdk/python/core/tests/test_oc_nis.py +} + #------------------------------------- # Meta-data test #------------------------------------- @@ -776,12 +790,19 @@ function run_py_metadata_test { #------------------------------------- function sanity_doc_gen { - print_msg "Generating docs" print_msg "Removing previously generated code with sudo to avoid permission issues" - sudo rm -rf gen-api/cpp/ydk - run_test generate.py --core --cpp --generate-doc &> /dev/null - run_test generate.py --core --go --generate-doc &> /dev/null - run_test generate.py --core --python --generate-doc &> /dev/null + sudo rm -rf gen-api/cpp/ydk* + sudo rm -rf gen-api/go/ydk* + sudo rm -rf gen-api/python/ydk* + + print_msg "Generating C++ docs" + run_test generate.py --core --cpp --generate-doc > /dev/null + + print_msg "Generating Go docs" + run_test generate.py --core --go --generate-doc > /dev/null + + print_msg "Generating Python docs" + run_test generate.py --core --python --generate-doc > /dev/null } function sanity_doc_gen_cache { @@ -854,6 +875,7 @@ run_go_bundle_tests ###################################### install_py_core run_python_bundle_tests +run_python_oc_nis_tests run_py_metadata_test # test_gen_tests @@ -861,8 +883,8 @@ run_py_metadata_test ###################################### # Documentation tests ###################################### -sanity_doc_gen -sanity_doc_gen_cache +#sanity_doc_gen +#sanity_doc_gen_cache cd $YDKGEN_HOME find . -name '*gcda*'|xargs rm -f diff --git a/yang/openconfig-nis/iana-if-type.yang b/yang/openconfig-nis/iana-if-type.yang new file mode 100644 index 000000000..5dd821950 --- /dev/null +++ b/yang/openconfig-nis/iana-if-type.yang @@ -0,0 +1,1547 @@ +module iana-if-type { + namespace "urn:ietf:params:xml:ns:yang:iana-if-type"; + prefix ianaift; + + import ietf-interfaces { + prefix if; + } + + organization "IANA"; + contact + " Internet Assigned Numbers Authority + + Postal: ICANN + 4676 Admiralty Way, Suite 330 + Marina del Rey, CA 90292 + + Tel: +1 310 823 9358 + "; + description + "This YANG module defines YANG identities for IANA-registered + interface types. + + This YANG module is maintained by IANA and reflects the + 'ifType definitions' registry. + + The latest revision of this YANG module can be obtained from + the IANA web site. + + Requests for new values should be made to IANA via + email (iana@iana.org). + + Copyright (c) 2014 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + The initial version of this YANG module is part of RFC 7224; + see the RFC itself for full legal notices."; + reference + "IANA 'ifType definitions' registry. + "; + + revision 2014-05-08 { + description + "Initial revision."; + reference + "RFC 7224: IANA Interface Type YANG Module"; + } + + identity iana-interface-type { + base if:interface-type; + description + "This identity is used as a base for all interface types + defined in the 'ifType definitions' registry."; + } + + + + + + + identity other { + base iana-interface-type; + } + identity regular1822 { + base iana-interface-type; + } + identity hdh1822 { + base iana-interface-type; + } + identity ddnX25 { + base iana-interface-type; + } + identity rfc877x25 { + base iana-interface-type; + reference + "RFC 1382 - SNMP MIB Extension for the X.25 Packet Layer"; + } + identity ethernetCsmacd { + base iana-interface-type; + description + "For all Ethernet-like interfaces, regardless of speed, + as per RFC 3635."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity iso88023Csmacd { + base iana-interface-type; + status deprecated; + description + "Deprecated via RFC 3635. + Use ethernetCsmacd(6) instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity iso88024TokenBus { + base iana-interface-type; + } + identity iso88025TokenRing { + base iana-interface-type; + } + identity iso88026Man { + base iana-interface-type; + } + identity starLan { + base iana-interface-type; + status deprecated; + description + "Deprecated via RFC 3635. + Use ethernetCsmacd(6) instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity proteon10Mbit { + base iana-interface-type; + } + identity proteon80Mbit { + base iana-interface-type; + } + identity hyperchannel { + base iana-interface-type; + } + identity fddi { + base iana-interface-type; + reference + "RFC 1512 - FDDI Management Information Base"; + } + identity lapb { + base iana-interface-type; + reference + "RFC 1381 - SNMP MIB Extension for X.25 LAPB"; + } + identity sdlc { + base iana-interface-type; + } + identity ds1 { + base iana-interface-type; + description + "DS1-MIB."; + reference + "RFC 4805 - Definitions of Managed Objects for the + DS1, J1, E1, DS2, and E2 Interface Types"; + } + identity e1 { + base iana-interface-type; + status obsolete; + description + "Obsolete; see DS1-MIB."; + reference + "RFC 4805 - Definitions of Managed Objects for the + DS1, J1, E1, DS2, and E2 Interface Types"; + } + + + identity basicISDN { + base iana-interface-type; + description + "No longer used. See also RFC 2127."; + } + identity primaryISDN { + base iana-interface-type; + description + "No longer used. See also RFC 2127."; + } + identity propPointToPointSerial { + base iana-interface-type; + description + "Proprietary serial."; + } + identity ppp { + base iana-interface-type; + } + identity softwareLoopback { + base iana-interface-type; + } + identity eon { + base iana-interface-type; + description + "CLNP over IP."; + } + identity ethernet3Mbit { + base iana-interface-type; + } + identity nsip { + base iana-interface-type; + description + "XNS over IP."; + } + identity slip { + base iana-interface-type; + description + "Generic SLIP."; + } + identity ultra { + base iana-interface-type; + description + "Ultra Technologies."; + } + identity ds3 { + base iana-interface-type; + description + "DS3-MIB."; + reference + "RFC 3896 - Definitions of Managed Objects for the + DS3/E3 Interface Type"; + } + identity sip { + base iana-interface-type; + description + "SMDS, coffee."; + reference + "RFC 1694 - Definitions of Managed Objects for SMDS + Interfaces using SMIv2"; + } + identity frameRelay { + base iana-interface-type; + description + "DTE only."; + reference + "RFC 2115 - Management Information Base for Frame Relay + DTEs Using SMIv2"; + } + identity rs232 { + base iana-interface-type; + reference + "RFC 1659 - Definitions of Managed Objects for RS-232-like + Hardware Devices using SMIv2"; + } + identity para { + base iana-interface-type; + description + "Parallel-port."; + reference + "RFC 1660 - Definitions of Managed Objects for + Parallel-printer-like Hardware Devices using + SMIv2"; + } + identity arcnet { + base iana-interface-type; + description + "ARCnet."; + } + identity arcnetPlus { + base iana-interface-type; + description + "ARCnet Plus."; + } + + + + identity atm { + base iana-interface-type; + description + "ATM cells."; + } + identity miox25 { + base iana-interface-type; + reference + "RFC 1461 - SNMP MIB extension for Multiprotocol + Interconnect over X.25"; + } + identity sonet { + base iana-interface-type; + description + "SONET or SDH."; + } + identity x25ple { + base iana-interface-type; + reference + "RFC 2127 - ISDN Management Information Base using SMIv2"; + } + identity iso88022llc { + base iana-interface-type; + } + identity localTalk { + base iana-interface-type; + } + identity smdsDxi { + base iana-interface-type; + } + identity frameRelayService { + base iana-interface-type; + description + "FRNETSERV-MIB."; + reference + "RFC 2954 - Definitions of Managed Objects for Frame + Relay Service"; + } + identity v35 { + base iana-interface-type; + } + identity hssi { + base iana-interface-type; + } + identity hippi { + base iana-interface-type; + } + + identity modem { + base iana-interface-type; + description + "Generic modem."; + } + identity aal5 { + base iana-interface-type; + description + "AAL5 over ATM."; + } + identity sonetPath { + base iana-interface-type; + } + identity sonetVT { + base iana-interface-type; + } + identity smdsIcip { + base iana-interface-type; + description + "SMDS InterCarrier Interface."; + } + identity propVirtual { + base iana-interface-type; + description + "Proprietary virtual/internal."; + reference + "RFC 2863 - The Interfaces Group MIB"; + } + identity propMultiplexor { + base iana-interface-type; + description + "Proprietary multiplexing."; + reference + "RFC 2863 - The Interfaces Group MIB"; + } + identity ieee80212 { + base iana-interface-type; + description + "100BaseVG."; + } + identity fibreChannel { + base iana-interface-type; + description + "Fibre Channel."; + } + + + + identity hippiInterface { + base iana-interface-type; + description + "HIPPI interfaces."; + } + identity frameRelayInterconnect { + base iana-interface-type; + status obsolete; + description + "Obsolete; use either + frameRelay(32) or frameRelayService(44)."; + } + identity aflane8023 { + base iana-interface-type; + description + "ATM Emulated LAN for 802.3."; + } + identity aflane8025 { + base iana-interface-type; + description + "ATM Emulated LAN for 802.5."; + } + identity cctEmul { + base iana-interface-type; + description + "ATM Emulated circuit."; + } + identity fastEther { + base iana-interface-type; + status deprecated; + description + "Obsoleted via RFC 3635. + ethernetCsmacd(6) should be used instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity isdn { + base iana-interface-type; + description + "ISDN and X.25."; + reference + "RFC 1356 - Multiprotocol Interconnect on X.25 and ISDN + in the Packet Mode"; + } + + + + identity v11 { + base iana-interface-type; + description + "CCITT V.11/X.21."; + } + identity v36 { + base iana-interface-type; + description + "CCITT V.36."; + } + identity g703at64k { + base iana-interface-type; + description + "CCITT G703 at 64Kbps."; + } + identity g703at2mb { + base iana-interface-type; + status obsolete; + description + "Obsolete; see DS1-MIB."; + } + identity qllc { + base iana-interface-type; + description + "SNA QLLC."; + } + identity fastEtherFX { + base iana-interface-type; + status deprecated; + description + "Obsoleted via RFC 3635. + ethernetCsmacd(6) should be used instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity channel { + base iana-interface-type; + description + "Channel."; + } + identity ieee80211 { + base iana-interface-type; + description + "Radio spread spectrum."; + } + identity ibm370parChan { + base iana-interface-type; + description + "IBM System 360/370 OEMI Channel."; + } + identity escon { + base iana-interface-type; + description + "IBM Enterprise Systems Connection."; + } + identity dlsw { + base iana-interface-type; + description + "Data Link Switching."; + } + identity isdns { + base iana-interface-type; + description + "ISDN S/T interface."; + } + identity isdnu { + base iana-interface-type; + description + "ISDN U interface."; + } + identity lapd { + base iana-interface-type; + description + "Link Access Protocol D."; + } + identity ipSwitch { + base iana-interface-type; + description + "IP Switching Objects."; + } + identity rsrb { + base iana-interface-type; + description + "Remote Source Route Bridging."; + } + identity atmLogical { + base iana-interface-type; + description + "ATM Logical Port."; + reference + "RFC 3606 - Definitions of Supplemental Managed Objects + for ATM Interface"; + } + identity ds0 { + base iana-interface-type; + description + "Digital Signal Level 0."; + reference + "RFC 2494 - Definitions of Managed Objects for the DS0 + and DS0 Bundle Interface Type"; + } + identity ds0Bundle { + base iana-interface-type; + description + "Group of ds0s on the same ds1."; + reference + "RFC 2494 - Definitions of Managed Objects for the DS0 + and DS0 Bundle Interface Type"; + } + identity bsc { + base iana-interface-type; + description + "Bisynchronous Protocol."; + } + identity async { + base iana-interface-type; + description + "Asynchronous Protocol."; + } + identity cnr { + base iana-interface-type; + description + "Combat Net Radio."; + } + identity iso88025Dtr { + base iana-interface-type; + description + "ISO 802.5r DTR."; + } + identity eplrs { + base iana-interface-type; + description + "Ext Pos Loc Report Sys."; + } + identity arap { + base iana-interface-type; + description + "Appletalk Remote Access Protocol."; + } + identity propCnls { + base iana-interface-type; + description + "Proprietary Connectionless Protocol."; + } + identity hostPad { + base iana-interface-type; + description + "CCITT-ITU X.29 PAD Protocol."; + } + identity termPad { + base iana-interface-type; + description + "CCITT-ITU X.3 PAD Facility."; + } + identity frameRelayMPI { + base iana-interface-type; + description + "Multiproto Interconnect over FR."; + } + identity x213 { + base iana-interface-type; + description + "CCITT-ITU X213."; + } + identity adsl { + base iana-interface-type; + description + "Asymmetric Digital Subscriber Loop."; + } + identity radsl { + base iana-interface-type; + description + "Rate-Adapt. Digital Subscriber Loop."; + } + identity sdsl { + base iana-interface-type; + description + "Symmetric Digital Subscriber Loop."; + } + identity vdsl { + base iana-interface-type; + description + "Very H-Speed Digital Subscrib. Loop."; + } + identity iso88025CRFPInt { + base iana-interface-type; + description + "ISO 802.5 CRFP."; + } + identity myrinet { + base iana-interface-type; + description + "Myricom Myrinet."; + } + identity voiceEM { + base iana-interface-type; + description + "Voice recEive and transMit."; + } + identity voiceFXO { + base iana-interface-type; + description + "Voice Foreign Exchange Office."; + } + identity voiceFXS { + base iana-interface-type; + description + "Voice Foreign Exchange Station."; + } + identity voiceEncap { + base iana-interface-type; + description + "Voice encapsulation."; + } + identity voiceOverIp { + base iana-interface-type; + description + "Voice over IP encapsulation."; + } + identity atmDxi { + base iana-interface-type; + description + "ATM DXI."; + } + identity atmFuni { + base iana-interface-type; + description + "ATM FUNI."; + } + identity atmIma { + base iana-interface-type; + description + "ATM IMA."; + } + identity pppMultilinkBundle { + base iana-interface-type; + description + "PPP Multilink Bundle."; + } + identity ipOverCdlc { + base iana-interface-type; + description + "IBM ipOverCdlc."; + } + identity ipOverClaw { + base iana-interface-type; + description + "IBM Common Link Access to Workstn."; + } + identity stackToStack { + base iana-interface-type; + description + "IBM stackToStack."; + } + identity virtualIpAddress { + base iana-interface-type; + description + "IBM VIPA."; + } + identity mpc { + base iana-interface-type; + description + "IBM multi-protocol channel support."; + } + identity ipOverAtm { + base iana-interface-type; + description + "IBM ipOverAtm."; + reference + "RFC 2320 - Definitions of Managed Objects for Classical IP + and ARP Over ATM Using SMIv2 (IPOA-MIB)"; + } + identity iso88025Fiber { + base iana-interface-type; + description + "ISO 802.5j Fiber Token Ring."; + } + identity tdlc { + base iana-interface-type; + description + "IBM twinaxial data link control."; + } + identity gigabitEthernet { + base iana-interface-type; + status deprecated; + + + description + "Obsoleted via RFC 3635. + ethernetCsmacd(6) should be used instead."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + identity hdlc { + base iana-interface-type; + description + "HDLC."; + } + identity lapf { + base iana-interface-type; + description + "LAP F."; + } + identity v37 { + base iana-interface-type; + description + "V.37."; + } + identity x25mlp { + base iana-interface-type; + description + "Multi-Link Protocol."; + } + identity x25huntGroup { + base iana-interface-type; + description + "X25 Hunt Group."; + } + identity transpHdlc { + base iana-interface-type; + description + "Transp HDLC."; + } + identity interleave { + base iana-interface-type; + description + "Interleave channel."; + } + identity fast { + base iana-interface-type; + description + "Fast channel."; + } + + identity ip { + base iana-interface-type; + description + "IP (for APPN HPR in IP networks)."; + } + identity docsCableMaclayer { + base iana-interface-type; + description + "CATV Mac Layer."; + } + identity docsCableDownstream { + base iana-interface-type; + description + "CATV Downstream interface."; + } + identity docsCableUpstream { + base iana-interface-type; + description + "CATV Upstream interface."; + } + identity a12MppSwitch { + base iana-interface-type; + description + "Avalon Parallel Processor."; + } + identity tunnel { + base iana-interface-type; + description + "Encapsulation interface."; + } + identity coffee { + base iana-interface-type; + description + "Coffee pot."; + reference + "RFC 2325 - Coffee MIB"; + } + identity ces { + base iana-interface-type; + description + "Circuit Emulation Service."; + } + identity atmSubInterface { + base iana-interface-type; + description + "ATM Sub Interface."; + } + + identity l2vlan { + base iana-interface-type; + description + "Layer 2 Virtual LAN using 802.1Q."; + } + identity l3ipvlan { + base iana-interface-type; + description + "Layer 3 Virtual LAN using IP."; + } + identity l3ipxvlan { + base iana-interface-type; + description + "Layer 3 Virtual LAN using IPX."; + } + identity digitalPowerline { + base iana-interface-type; + description + "IP over Power Lines."; + } + identity mediaMailOverIp { + base iana-interface-type; + description + "Multimedia Mail over IP."; + } + identity dtm { + base iana-interface-type; + description + "Dynamic synchronous Transfer Mode."; + } + identity dcn { + base iana-interface-type; + description + "Data Communications Network."; + } + identity ipForward { + base iana-interface-type; + description + "IP Forwarding Interface."; + } + identity msdsl { + base iana-interface-type; + description + "Multi-rate Symmetric DSL."; + } + identity ieee1394 { + base iana-interface-type; + + description + "IEEE1394 High Performance Serial Bus."; + } + identity if-gsn { + base iana-interface-type; + description + "HIPPI-6400."; + } + identity dvbRccMacLayer { + base iana-interface-type; + description + "DVB-RCC MAC Layer."; + } + identity dvbRccDownstream { + base iana-interface-type; + description + "DVB-RCC Downstream Channel."; + } + identity dvbRccUpstream { + base iana-interface-type; + description + "DVB-RCC Upstream Channel."; + } + identity atmVirtual { + base iana-interface-type; + description + "ATM Virtual Interface."; + } + identity mplsTunnel { + base iana-interface-type; + description + "MPLS Tunnel Virtual Interface."; + } + identity srp { + base iana-interface-type; + description + "Spatial Reuse Protocol."; + } + identity voiceOverAtm { + base iana-interface-type; + description + "Voice over ATM."; + } + identity voiceOverFrameRelay { + base iana-interface-type; + description + "Voice Over Frame Relay."; + } + identity idsl { + base iana-interface-type; + description + "Digital Subscriber Loop over ISDN."; + } + identity compositeLink { + base iana-interface-type; + description + "Avici Composite Link Interface."; + } + identity ss7SigLink { + base iana-interface-type; + description + "SS7 Signaling Link."; + } + identity propWirelessP2P { + base iana-interface-type; + description + "Prop. P2P wireless interface."; + } + identity frForward { + base iana-interface-type; + description + "Frame Forward Interface."; + } + identity rfc1483 { + base iana-interface-type; + description + "Multiprotocol over ATM AAL5."; + reference + "RFC 1483 - Multiprotocol Encapsulation over ATM + Adaptation Layer 5"; + } + identity usb { + base iana-interface-type; + description + "USB Interface."; + } + identity ieee8023adLag { + base iana-interface-type; + description + "IEEE 802.3ad Link Aggregate."; + } + identity bgppolicyaccounting { + base iana-interface-type; + description + "BGP Policy Accounting."; + } + identity frf16MfrBundle { + base iana-interface-type; + description + "FRF.16 Multilink Frame Relay."; + } + identity h323Gatekeeper { + base iana-interface-type; + description + "H323 Gatekeeper."; + } + identity h323Proxy { + base iana-interface-type; + description + "H323 Voice and Video Proxy."; + } + identity mpls { + base iana-interface-type; + description + "MPLS."; + } + identity mfSigLink { + base iana-interface-type; + description + "Multi-frequency signaling link."; + } + identity hdsl2 { + base iana-interface-type; + description + "High Bit-Rate DSL - 2nd generation."; + } + identity shdsl { + base iana-interface-type; + description + "Multirate HDSL2."; + } + identity ds1FDL { + base iana-interface-type; + description + "Facility Data Link (4Kbps) on a DS1."; + } + identity pos { + base iana-interface-type; + description + "Packet over SONET/SDH Interface."; + } + + + + identity dvbAsiIn { + base iana-interface-type; + description + "DVB-ASI Input."; + } + identity dvbAsiOut { + base iana-interface-type; + description + "DVB-ASI Output."; + } + identity plc { + base iana-interface-type; + description + "Power Line Communications."; + } + identity nfas { + base iana-interface-type; + description + "Non-Facility Associated Signaling."; + } + identity tr008 { + base iana-interface-type; + description + "TR008."; + } + identity gr303RDT { + base iana-interface-type; + description + "Remote Digital Terminal."; + } + identity gr303IDT { + base iana-interface-type; + description + "Integrated Digital Terminal."; + } + identity isup { + base iana-interface-type; + description + "ISUP."; + } + identity propDocsWirelessMaclayer { + base iana-interface-type; + description + "Cisco proprietary Maclayer."; + } + + + + identity propDocsWirelessDownstream { + base iana-interface-type; + description + "Cisco proprietary Downstream."; + } + identity propDocsWirelessUpstream { + base iana-interface-type; + description + "Cisco proprietary Upstream."; + } + identity hiperlan2 { + base iana-interface-type; + description + "HIPERLAN Type 2 Radio Interface."; + } + identity propBWAp2Mp { + base iana-interface-type; + description + "PropBroadbandWirelessAccesspt2Multipt (use of this value + for IEEE 802.16 WMAN interfaces as per IEEE Std 802.16f + is deprecated, and ieee80216WMAN(237) should be used + instead)."; + } + identity sonetOverheadChannel { + base iana-interface-type; + description + "SONET Overhead Channel."; + } + identity digitalWrapperOverheadChannel { + base iana-interface-type; + description + "Digital Wrapper."; + } + identity aal2 { + base iana-interface-type; + description + "ATM adaptation layer 2."; + } + identity radioMAC { + base iana-interface-type; + description + "MAC layer over radio links."; + } + identity atmRadio { + base iana-interface-type; + description + "ATM over radio links."; + } + identity imt { + base iana-interface-type; + description + "Inter-Machine Trunks."; + } + identity mvl { + base iana-interface-type; + description + "Multiple Virtual Lines DSL."; + } + identity reachDSL { + base iana-interface-type; + description + "Long Reach DSL."; + } + identity frDlciEndPt { + base iana-interface-type; + description + "Frame Relay DLCI End Point."; + } + identity atmVciEndPt { + base iana-interface-type; + description + "ATM VCI End Point."; + } + identity opticalChannel { + base iana-interface-type; + description + "Optical Channel."; + } + identity opticalTransport { + base iana-interface-type; + description + "Optical Transport."; + } + identity propAtm { + base iana-interface-type; + description + "Proprietary ATM."; + } + identity voiceOverCable { + base iana-interface-type; + description + "Voice Over Cable Interface."; + } + + + + identity infiniband { + base iana-interface-type; + description + "Infiniband."; + } + identity teLink { + base iana-interface-type; + description + "TE Link."; + } + identity q2931 { + base iana-interface-type; + description + "Q.2931."; + } + identity virtualTg { + base iana-interface-type; + description + "Virtual Trunk Group."; + } + identity sipTg { + base iana-interface-type; + description + "SIP Trunk Group."; + } + identity sipSig { + base iana-interface-type; + description + "SIP Signaling."; + } + identity docsCableUpstreamChannel { + base iana-interface-type; + description + "CATV Upstream Channel."; + } + identity econet { + base iana-interface-type; + description + "Acorn Econet."; + } + identity pon155 { + base iana-interface-type; + description + "FSAN 155Mb Symetrical PON interface."; + } + + + + identity pon622 { + base iana-interface-type; + description + "FSAN 622Mb Symetrical PON interface."; + } + identity bridge { + base iana-interface-type; + description + "Transparent bridge interface."; + } + identity linegroup { + base iana-interface-type; + description + "Interface common to multiple lines."; + } + identity voiceEMFGD { + base iana-interface-type; + description + "Voice E&M Feature Group D."; + } + identity voiceFGDEANA { + base iana-interface-type; + description + "Voice FGD Exchange Access North American."; + } + identity voiceDID { + base iana-interface-type; + description + "Voice Direct Inward Dialing."; + } + identity mpegTransport { + base iana-interface-type; + description + "MPEG transport interface."; + } + identity sixToFour { + base iana-interface-type; + status deprecated; + description + "6to4 interface (DEPRECATED)."; + reference + "RFC 4087 - IP Tunnel MIB"; + } + identity gtp { + base iana-interface-type; + description + "GTP (GPRS Tunneling Protocol)."; + } + identity pdnEtherLoop1 { + base iana-interface-type; + description + "Paradyne EtherLoop 1."; + } + identity pdnEtherLoop2 { + base iana-interface-type; + description + "Paradyne EtherLoop 2."; + } + identity opticalChannelGroup { + base iana-interface-type; + description + "Optical Channel Group."; + } + identity homepna { + base iana-interface-type; + description + "HomePNA ITU-T G.989."; + } + identity gfp { + base iana-interface-type; + description + "Generic Framing Procedure (GFP)."; + } + identity ciscoISLvlan { + base iana-interface-type; + description + "Layer 2 Virtual LAN using Cisco ISL."; + } + identity actelisMetaLOOP { + base iana-interface-type; + description + "Acteleis proprietary MetaLOOP High Speed Link."; + } + identity fcipLink { + base iana-interface-type; + description + "FCIP Link."; + } + identity rpr { + base iana-interface-type; + description + "Resilient Packet Ring Interface Type."; + } + + + + identity qam { + base iana-interface-type; + description + "RF Qam Interface."; + } + identity lmp { + base iana-interface-type; + description + "Link Management Protocol."; + reference + "RFC 4327 - Link Management Protocol (LMP) Management + Information Base (MIB)"; + } + identity cblVectaStar { + base iana-interface-type; + description + "Cambridge Broadband Networks Limited VectaStar."; + } + identity docsCableMCmtsDownstream { + base iana-interface-type; + description + "CATV Modular CMTS Downstream Interface."; + } + identity adsl2 { + base iana-interface-type; + status deprecated; + description + "Asymmetric Digital Subscriber Loop Version 2 + (DEPRECATED/OBSOLETED - please use adsl2plus(238) + instead)."; + reference + "RFC 4706 - Definitions of Managed Objects for Asymmetric + Digital Subscriber Line 2 (ADSL2)"; + } + identity macSecControlledIF { + base iana-interface-type; + description + "MACSecControlled."; + } + identity macSecUncontrolledIF { + base iana-interface-type; + description + "MACSecUncontrolled."; + } + identity aviciOpticalEther { + base iana-interface-type; + description + "Avici Optical Ethernet Aggregate."; + } + identity atmbond { + base iana-interface-type; + description + "atmbond."; + } + identity voiceFGDOS { + base iana-interface-type; + description + "Voice FGD Operator Services."; + } + identity mocaVersion1 { + base iana-interface-type; + description + "MultiMedia over Coax Alliance (MoCA) Interface + as documented in information provided privately to IANA."; + } + identity ieee80216WMAN { + base iana-interface-type; + description + "IEEE 802.16 WMAN interface."; + } + identity adsl2plus { + base iana-interface-type; + description + "Asymmetric Digital Subscriber Loop Version 2 - + Version 2 Plus and all variants."; + } + identity dvbRcsMacLayer { + base iana-interface-type; + description + "DVB-RCS MAC Layer."; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + identity dvbTdm { + base iana-interface-type; + description + "DVB Satellite TDM."; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + identity dvbRcsTdma { + base iana-interface-type; + description + "DVB-RCS TDMA."; + reference + "RFC 5728 - The SatLabs Group DVB-RCS MIB"; + } + identity x86Laps { + base iana-interface-type; + description + "LAPS based on ITU-T X.86/Y.1323."; + } + identity wwanPP { + base iana-interface-type; + description + "3GPP WWAN."; + } + identity wwanPP2 { + base iana-interface-type; + description + "3GPP2 WWAN."; + } + identity voiceEBS { + base iana-interface-type; + description + "Voice P-phone EBS physical interface."; + } + identity ifPwType { + base iana-interface-type; + description + "Pseudowire interface type."; + reference + "RFC 5601 - Pseudowire (PW) Management Information Base (MIB)"; + } + identity ilan { + base iana-interface-type; + description + "Internal LAN on a bridge per IEEE 802.1ap."; + } + identity pip { + base iana-interface-type; + description + "Provider Instance Port on a bridge per IEEE 802.1ah PBB."; + } + identity aluELP { + base iana-interface-type; + description + "Alcatel-Lucent Ethernet Link Protection."; + } + identity gpon { + base iana-interface-type; + description + "Gigabit-capable passive optical networks (G-PON) as per + ITU-T G.948."; + } + identity vdsl2 { + base iana-interface-type; + description + "Very high speed digital subscriber line Version 2 + (as per ITU-T Recommendation G.993.2)."; + reference + "RFC 5650 - Definitions of Managed Objects for Very High + Speed Digital Subscriber Line 2 (VDSL2)"; + } + identity capwapDot11Profile { + base iana-interface-type; + description + "WLAN Profile Interface."; + reference + "RFC 5834 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Binding MIB for + IEEE 802.11"; + } + identity capwapDot11Bss { + base iana-interface-type; + description + "WLAN BSS Interface."; + reference + "RFC 5834 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Binding MIB for + IEEE 802.11"; + } + identity capwapWtpVirtualRadio { + base iana-interface-type; + description + "WTP Virtual Radio Interface."; + reference + "RFC 5833 - Control and Provisioning of Wireless Access + Points (CAPWAP) Protocol Base MIB"; + } + identity bits { + base iana-interface-type; + description + "bitsport."; + } + identity docsCableUpstreamRfPort { + base iana-interface-type; + description + "DOCSIS CATV Upstream RF Port."; + } + + + identity cableDownstreamRfPort { + base iana-interface-type; + description + "CATV downstream RF Port."; + } + identity vmwareVirtualNic { + base iana-interface-type; + description + "VMware Virtual Network Interface."; + } + identity ieee802154 { + base iana-interface-type; + description + "IEEE 802.15.4 WPAN interface."; + reference + "IEEE 802.15.4-2006"; + } + identity otnOdu { + base iana-interface-type; + description + "OTN Optical Data Unit."; + } + identity otnOtu { + base iana-interface-type; + description + "OTN Optical channel Transport Unit."; + } + identity ifVfiType { + base iana-interface-type; + description + "VPLS Forwarding Instance Interface Type."; + } + identity g9981 { + base iana-interface-type; + description + "G.998.1 bonded interface."; + } + identity g9982 { + base iana-interface-type; + description + "G.998.2 bonded interface."; + } + identity g9983 { + base iana-interface-type; + description + "G.998.3 bonded interface."; + } + + identity aluEpon { + base iana-interface-type; + description + "Ethernet Passive Optical Networks (E-PON)."; + } + identity aluEponOnu { + base iana-interface-type; + description + "EPON Optical Network Unit."; + } + identity aluEponPhysicalUni { + base iana-interface-type; + description + "EPON physical User to Network interface."; + } + identity aluEponLogicalLink { + base iana-interface-type; + description + "The emulation of a point-to-point link over the EPON + layer."; + } + identity aluGponOnu { + base iana-interface-type; + description + "GPON Optical Network Unit."; + reference + "ITU-T G.984.2"; + } + identity aluGponPhysicalUni { + base iana-interface-type; + description + "GPON physical User to Network interface."; + reference + "ITU-T G.984.2"; + } + identity vmwareNicTeam { + base iana-interface-type; + description + "VMware NIC Team."; + } +} diff --git a/yang/openconfig-nis/ietf-inet-types@2013-07-15.yang b/yang/openconfig-nis/ietf-inet-types@2013-07-15.yang new file mode 100644 index 000000000..eacefb636 --- /dev/null +++ b/yang/openconfig-nis/ietf-inet-types@2013-07-15.yang @@ -0,0 +1,458 @@ +module ietf-inet-types { + + namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types"; + prefix "inet"; + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: David Kessens + + + WG Chair: Juergen Schoenwaelder + + + Editor: Juergen Schoenwaelder + "; + + description + "This module contains a collection of generally useful derived + YANG data types for Internet addresses and related things. + + Copyright (c) 2013 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 6991; see + the RFC itself for full legal notices."; + + revision 2013-07-15 { + description + "This revision adds the following new data types: + - ip-address-no-zone + - ipv4-address-no-zone + - ipv6-address-no-zone"; + reference + "RFC 6991: Common YANG Data Types"; + } + + revision 2010-09-24 { + description + "Initial revision."; + reference + "RFC 6021: Common YANG Data Types"; + } + + /*** collection of types related to protocol fields ***/ + + typedef ip-version { + type enumeration { + enum unknown { + value "0"; + description + "An unknown or unspecified version of the Internet + protocol."; + } + enum ipv4 { + value "1"; + description + "The IPv4 protocol as defined in RFC 791."; + } + enum ipv6 { + value "2"; + description + "The IPv6 protocol as defined in RFC 2460."; + } + } + description + "This value represents the version of the IP protocol. + + In the value set and its semantics, this type is equivalent + to the InetVersion textual convention of the SMIv2."; + reference + "RFC 791: Internet Protocol + RFC 2460: Internet Protocol, Version 6 (IPv6) Specification + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + typedef dscp { + type uint8 { + range "0..63"; + } + description + "The dscp type represents a Differentiated Services Code Point + that may be used for marking packets in a traffic stream. + In the value set and its semantics, this type is equivalent + to the Dscp textual convention of the SMIv2."; + reference + "RFC 3289: Management Information Base for the Differentiated + Services Architecture + RFC 2474: Definition of the Differentiated Services Field + (DS Field) in the IPv4 and IPv6 Headers + RFC 2780: IANA Allocation Guidelines For Values In + the Internet Protocol and Related Headers"; + } + + typedef ipv6-flow-label { + type uint32 { + range "0..1048575"; + } + description + "The ipv6-flow-label type represents the flow identifier or Flow + Label in an IPv6 packet header that may be used to + discriminate traffic flows. + + In the value set and its semantics, this type is equivalent + to the IPv6FlowLabel textual convention of the SMIv2."; + reference + "RFC 3595: Textual Conventions for IPv6 Flow Label + RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"; + } + + typedef port-number { + type uint16 { + range "0..65535"; + } + description + "The port-number type represents a 16-bit port number of an + Internet transport-layer protocol such as UDP, TCP, DCCP, or + SCTP. Port numbers are assigned by IANA. A current list of + all assignments is available from . + + Note that the port number value zero is reserved by IANA. In + situations where the value zero does not make sense, it can + be excluded by subtyping the port-number type. + In the value set and its semantics, this type is equivalent + to the InetPortNumber textual convention of the SMIv2."; + reference + "RFC 768: User Datagram Protocol + RFC 793: Transmission Control Protocol + RFC 4960: Stream Control Transmission Protocol + RFC 4340: Datagram Congestion Control Protocol (DCCP) + RFC 4001: Textual Conventions for Internet Network Addresses"; + } + + /*** collection of types related to autonomous systems ***/ + + typedef as-number { + type uint32; + description + "The as-number type represents autonomous system numbers + which identify an Autonomous System (AS). An AS is a set + of routers under a single technical administration, using + an interior gateway protocol and common metrics to route + packets within the AS, and using an exterior gateway + protocol to route packets to other ASes. IANA maintains + the AS number space and has delegated large parts to the + regional registries. + + Autonomous system numbers were originally limited to 16 + bits. BGP extensions have enlarged the autonomous system + number space to 32 bits. This type therefore uses an uint32 + base type without a range restriction in order to support + a larger autonomous system number space. + + In the value set and its semantics, this type is equivalent + to the InetAutonomousSystemNumber textual convention of + the SMIv2."; + reference + "RFC 1930: Guidelines for creation, selection, and registration + of an Autonomous System (AS) + RFC 4271: A Border Gateway Protocol 4 (BGP-4) + RFC 4001: Textual Conventions for Internet Network Addresses + RFC 6793: BGP Support for Four-Octet Autonomous System (AS) + Number Space"; + } + + /*** collection of types related to IP addresses and hostnames ***/ + + typedef ip-address { + type union { + type inet:ipv4-address; + type inet:ipv6-address; + } + description + "The ip-address type represents an IP address and is IP + version neutral. The format of the textual representation + implies the IP version. This type supports scoped addresses + by allowing zone identifiers in the address format."; + reference + "RFC 4007: IPv6 Scoped Address Architecture"; + } + + typedef ipv4-address { + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' + + '(%[\p{N}\p{L}]+)?'; + } + description + "The ipv4-address type represents an IPv4 address in + dotted-quad notation. The IPv4 address may include a zone + index, separated by a % sign. + + The zone index is used to disambiguate identical address + values. For link-local addresses, the zone index will + typically be the interface index number or the name of an + interface. If the zone index is not present, the default + zone of the device will be used. + + The canonical format for the zone index is the numerical + format"; + } + + typedef ipv6-address { + type string { + pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' + + '(%[\p{N}\p{L}]+)?'; + pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' + + '(%.+)?'; + } + description + "The ipv6-address type represents an IPv6 address in full, + mixed, shortened, and shortened-mixed notation. The IPv6 + address may include a zone index, separated by a % sign. + + The zone index is used to disambiguate identical address + values. For link-local addresses, the zone index will + typically be the interface index number or the name of an + interface. If the zone index is not present, the default + zone of the device will be used. + + The canonical format of IPv6 addresses uses the textual + representation defined in Section 4 of RFC 5952. The + canonical format for the zone index is the numerical + format as described in Section 11.2 of RFC 4007."; + reference + "RFC 4291: IP Version 6 Addressing Architecture + RFC 4007: IPv6 Scoped Address Architecture + RFC 5952: A Recommendation for IPv6 Address Text + Representation"; + } + + typedef ip-address-no-zone { + type union { + type inet:ipv4-address-no-zone; + type inet:ipv6-address-no-zone; + } + description + "The ip-address-no-zone type represents an IP address and is + IP version neutral. The format of the textual representation + implies the IP version. This type does not support scoped + addresses since it does not allow zone identifiers in the + address format."; + reference + "RFC 4007: IPv6 Scoped Address Architecture"; + } + + typedef ipv4-address-no-zone { + type inet:ipv4-address { + pattern '[0-9\.]*'; + } + description + "An IPv4 address without a zone index. This type, derived from + ipv4-address, may be used in situations where the zone is + known from the context and hence no zone index is needed."; + } + + typedef ipv6-address-no-zone { + type inet:ipv6-address { + pattern '[0-9a-fA-F:\.]*'; + } + description + "An IPv6 address without a zone index. This type, derived from + ipv6-address, may be used in situations where the zone is + known from the context and hence no zone index is needed."; + reference + "RFC 4291: IP Version 6 Addressing Architecture + RFC 4007: IPv6 Scoped Address Architecture + RFC 5952: A Recommendation for IPv6 Address Text + Representation"; + } + + typedef ip-prefix { + type union { + type inet:ipv4-prefix; + type inet:ipv6-prefix; + } + description + "The ip-prefix type represents an IP prefix and is IP + version neutral. The format of the textual representations + implies the IP version."; + } + + typedef ipv4-prefix { + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' + + '/(([0-9])|([1-2][0-9])|(3[0-2]))'; + } + description + "The ipv4-prefix type represents an IPv4 address prefix. + The prefix length is given by the number following the + slash character and must be less than or equal to 32. + + A prefix length value of n corresponds to an IP address + mask that has n contiguous 1-bits from the most + significant bit (MSB) and all other bits set to 0. + + The canonical format of an IPv4 prefix has all bits of + the IPv4 address set to zero that are not part of the + IPv4 prefix."; + } + + typedef ipv6-prefix { + type string { + pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' + + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' + + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' + + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' + + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'; + pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' + + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' + + '(/.+)'; + } + + description + "The ipv6-prefix type represents an IPv6 address prefix. + The prefix length is given by the number following the + slash character and must be less than or equal to 128. + + A prefix length value of n corresponds to an IP address + mask that has n contiguous 1-bits from the most + significant bit (MSB) and all other bits set to 0. + + The IPv6 address should have all bits that do not belong + to the prefix set to zero. + + The canonical format of an IPv6 prefix has all bits of + the IPv6 address set to zero that are not part of the + IPv6 prefix. Furthermore, the IPv6 address is represented + as defined in Section 4 of RFC 5952."; + reference + "RFC 5952: A Recommendation for IPv6 Address Text + Representation"; + } + + /*** collection of domain name and URI types ***/ + + typedef domain-name { + type string { + pattern + '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' + + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' + + '|\.'; + length "1..253"; + } + description + "The domain-name type represents a DNS domain name. The + name SHOULD be fully qualified whenever possible. + + Internet domain names are only loosely specified. Section + 3.5 of RFC 1034 recommends a syntax (modified in Section + 2.1 of RFC 1123). The pattern above is intended to allow + for current practice in domain name use, and some possible + future expansion. It is designed to hold various types of + domain names, including names used for A or AAAA records + (host names) and other records, such as SRV records. Note + that Internet host names have a stricter syntax (described + in RFC 952) than the DNS recommendations in RFCs 1034 and + 1123, and that systems that want to store host names in + schema nodes using the domain-name type are recommended to + adhere to this stricter standard to ensure interoperability. + + The encoding of DNS names in the DNS protocol is limited + to 255 characters. Since the encoding consists of labels + prefixed by a length bytes and there is a trailing NULL + byte, only 253 characters can appear in the textual dotted + notation. + + The description clause of schema nodes using the domain-name + type MUST describe when and how these names are resolved to + IP addresses. Note that the resolution of a domain-name value + may require to query multiple DNS records (e.g., A for IPv4 + and AAAA for IPv6). The order of the resolution process and + which DNS record takes precedence can either be defined + explicitly or may depend on the configuration of the + resolver. + + Domain-name values use the US-ASCII encoding. Their canonical + format uses lowercase US-ASCII characters. Internationalized + domain names MUST be A-labels as per RFC 5890."; + reference + "RFC 952: DoD Internet Host Table Specification + RFC 1034: Domain Names - Concepts and Facilities + RFC 1123: Requirements for Internet Hosts -- Application + and Support + RFC 2782: A DNS RR for specifying the location of services + (DNS SRV) + RFC 5890: Internationalized Domain Names in Applications + (IDNA): Definitions and Document Framework"; + } + + typedef host { + type union { + type inet:ip-address; + type inet:domain-name; + } + description + "The host type represents either an IP address or a DNS + domain name."; + } + + typedef uri { + type string; + description + "The uri type represents a Uniform Resource Identifier + (URI) as defined by STD 66. + + Objects using the uri type MUST be in US-ASCII encoding, + and MUST be normalized as described by RFC 3986 Sections + 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary + percent-encoding is removed, and all case-insensitive + characters are set to lowercase except for hexadecimal + digits, which are normalized to uppercase as described in + Section 6.2.2.1. + + The purpose of this normalization is to help provide + unique URIs. Note that this normalization is not + sufficient to provide uniqueness. Two URIs that are + textually distinct after this normalization may still be + equivalent. + + Objects using the uri type may restrict the schemes that + they permit. For example, 'data:' and 'urn:' schemes + might not be appropriate. + + A zero-length URI is not a valid URI. This can be used to + express 'URI absent' where required. + + In the value set and its semantics, this type is equivalent + to the Uri SMIv2 textual convention defined in RFC 5017."; + reference + "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax + RFC 3305: Report from the Joint W3C/IETF URI Planning Interest + Group: Uniform Resource Identifiers (URIs), URLs, + and Uniform Resource Names (URNs): Clarifications + and Recommendations + RFC 5017: MIB Textual Conventions for Uniform Resource + Identifiers (URIs)"; + } + +} diff --git a/yang/openconfig-nis/ietf-interfaces.yang b/yang/openconfig-nis/ietf-interfaces.yang new file mode 100644 index 000000000..ad64425f7 --- /dev/null +++ b/yang/openconfig-nis/ietf-interfaces.yang @@ -0,0 +1,725 @@ +module ietf-interfaces { + + namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces"; + prefix if; + + import ietf-yang-types { + prefix yang; + } + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: Thomas Nadeau + + + WG Chair: Juergen Schoenwaelder + + + Editor: Martin Bjorklund + "; + + description + "This module contains a collection of YANG definitions for + managing network interfaces. + + Copyright (c) 2014 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 7223; see + the RFC itself for full legal notices."; + + revision 2014-05-08 { + description + "Initial revision."; + reference + "RFC 7223: A YANG Data Model for Interface Management"; + } + + /* + * Typedefs + */ + + typedef interface-ref { + type leafref { + path "/if:interfaces/if:interface/if:name"; + } + description + "This type is used by data models that need to reference + configured interfaces."; + } + + typedef interface-state-ref { + type leafref { + path "/if:interfaces-state/if:interface/if:name"; + } + description + "This type is used by data models that need to reference + the operationally present interfaces."; + } + + /* + * Identities + */ + + identity interface-type { + description + "Base identity from which specific interface types are + derived."; + } + + /* + * Features + */ + + feature arbitrary-names { + description + "This feature indicates that the device allows user-controlled + interfaces to be named arbitrarily."; + } + feature pre-provisioning { + description + "This feature indicates that the device supports + pre-provisioning of interface configuration, i.e., it is + possible to configure an interface whose physical interface + hardware is not present on the device."; + } + + feature if-mib { + description + "This feature indicates that the device implements + the IF-MIB."; + reference + "RFC 2863: The Interfaces Group MIB"; + } + + /* + * Configuration data nodes + */ + + container interfaces { + description + "Interface configuration parameters."; + + list interface { + key "name"; + + description + "The list of configured interfaces on the device. + + The operational state of an interface is available in the + /interfaces-state/interface list. If the configuration of a + system-controlled interface cannot be used by the system + (e.g., the interface hardware present does not match the + interface type), then the configuration is not applied to + the system-controlled interface shown in the + /interfaces-state/interface list. If the configuration + of a user-controlled interface cannot be used by the system, + the configured interface is not instantiated in the + /interfaces-state/interface list."; + + leaf name { + type string; + description + "The name of the interface. + + A device MAY restrict the allowed values for this leaf, + possibly depending on the type of the interface. + For system-controlled interfaces, this leaf is the + device-specific name of the interface. The 'config false' + list /interfaces-state/interface contains the currently + existing interfaces on the device. + + If a client tries to create configuration for a + system-controlled interface that is not present in the + /interfaces-state/interface list, the server MAY reject + the request if the implementation does not support + pre-provisioning of interfaces or if the name refers to + an interface that can never exist in the system. A + NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case. + + If the device supports pre-provisioning of interface + configuration, the 'pre-provisioning' feature is + advertised. + + If the device allows arbitrarily named user-controlled + interfaces, the 'arbitrary-names' feature is advertised. + + When a configured user-controlled interface is created by + the system, it is instantiated with the same name in the + /interface-state/interface list."; + } + + leaf description { + type string; + description + "A textual description of the interface. + + A server implementation MAY map this leaf to the ifAlias + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifAlias. The definition of + such a mechanism is outside the scope of this document. + + Since ifAlias is defined to be stored in non-volatile + storage, the MIB implementation MUST map ifAlias to the + value of 'description' in the persistently stored + datastore. + + Specifically, if the device supports ':startup', when + ifAlias is read the device MUST return the value of + 'description' in the 'startup' datastore, and when it is + written, it MUST be written to the 'running' and 'startup' + datastores. Note that it is up to the implementation to + + decide whether to modify this single leaf in 'startup' or + perform an implicit copy-config from 'running' to + 'startup'. + + If the device does not support ':startup', ifAlias MUST + be mapped to the 'description' leaf in the 'running' + datastore."; + reference + "RFC 2863: The Interfaces Group MIB - ifAlias"; + } + + leaf type { + type identityref { + base interface-type; + } + mandatory true; + description + "The type of the interface. + + When an interface entry is created, a server MAY + initialize the type leaf with a valid value, e.g., if it + is possible to derive the type from the name of the + interface. + + If a client tries to set the type of an interface to a + value that can never be used by the system, e.g., if the + type is not supported or if the type does not match the + name of the interface, the server MUST reject the request. + A NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf enabled { + type boolean; + default "true"; + description + "This leaf contains the configured, desired state of the + interface. + + Systems that implement the IF-MIB use the value of this + leaf in the 'running' datastore to set + IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry + has been initialized, as described in RFC 2863. + + + + Changes in this leaf in the 'running' datastore are + reflected in ifAdminStatus, but if ifAdminStatus is + changed over SNMP, this leaf is not affected."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf link-up-down-trap-enable { + if-feature if-mib; + type enumeration { + enum enabled { + value 1; + } + enum disabled { + value 2; + } + } + description + "Controls whether linkUp/linkDown SNMP notifications + should be generated for this interface. + + If this node is not configured, the value 'enabled' is + operationally used by the server for interfaces that do + not operate on top of any other interface (i.e., there are + no 'lower-layer-if' entries), and 'disabled' otherwise."; + reference + "RFC 2863: The Interfaces Group MIB - + ifLinkUpDownTrapEnable"; + } + } + } + + /* + * Operational state data nodes + */ + + container interfaces-state { + config false; + description + "Data nodes for the operational state of interfaces."; + + list interface { + key "name"; + + + + + + description + "The list of interfaces on the device. + + System-controlled interfaces created by the system are + always present in this list, whether they are configured or + not."; + + leaf name { + type string; + description + "The name of the interface. + + A server implementation MAY map this leaf to the ifName + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifName. The definition of + such a mechanism is outside the scope of this document."; + reference + "RFC 2863: The Interfaces Group MIB - ifName"; + } + + leaf type { + type identityref { + base interface-type; + } + mandatory true; + description + "The type of the interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf admin-status { + if-feature if-mib; + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "Not ready to pass packets and not in some test mode."; + } + + + + enum testing { + value 3; + description + "In some test mode."; + } + } + mandatory true; + description + "The desired state of the interface. + + This leaf has the same read semantics as ifAdminStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf oper-status { + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "The interface does not pass any packets."; + } + enum testing { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum unknown { + value 4; + description + "Status cannot be determined for some reason."; + } + enum dormant { + value 5; + description + "Waiting for some external event."; + } + enum not-present { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum lower-layer-down { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + mandatory true; + description + "The current operational state of the interface. + + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + } + + leaf last-change { + type yang:date-and-time; + description + "The time the interface entered its current operational + state. If the current state was entered prior to the + last re-initialization of the local network management + subsystem, then this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifLastChange"; + } + + leaf if-index { + if-feature if-mib; + type int32 { + range "1..2147483647"; + } + mandatory true; + description + "The ifIndex value for the ifEntry represented by this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifIndex"; + } + + leaf phys-address { + type yang:phys-address; + description + "The interface's address at its protocol sub-layer. For + example, for an 802.x interface, this object normally + contains a Media Access Control (MAC) address. The + interface's media-specific modules must define the bit + + + and byte ordering and the format of the value of this + object. For interfaces that do not have such an address + (e.g., a serial line), this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifPhysAddress"; + } + + leaf-list higher-layer-if { + type interface-state-ref; + description + "A list of references to interfaces layered on top of this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf-list lower-layer-if { + type interface-state-ref; + description + "A list of references to interfaces layered underneath this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf speed { + type yang:gauge64; + units "bits/second"; + description + "An estimate of the interface's current bandwidth in bits + per second. For interfaces that do not vary in + bandwidth or for those where no accurate estimation can + be made, this node should contain the nominal bandwidth. + For interfaces that have no concept of bandwidth, this + node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - + ifSpeed, ifHighSpeed"; + } + + + + + + + + + + container statistics { + description + "A collection of interface-related statistics objects."; + + leaf discontinuity-time { + type yang:date-and-time; + mandatory true; + description + "The time on the most recent occasion at which any one or + more of this interface's counters suffered a + discontinuity. If no such discontinuities have occurred + since the last re-initialization of the local management + subsystem, then this node contains the time the local + management subsystem re-initialized itself."; + } + + leaf in-octets { + type yang:counter64; + description + "The total number of octets received on the interface, + including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + + leaf in-unicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were not addressed to a + multicast or broadcast address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + + + + + leaf in-broadcast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a broadcast + address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + + leaf in-multicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a multicast + address at this sub-layer. For a MAC-layer protocol, + this includes both Group and Functional addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + + leaf in-discards { + type yang:counter32; + description + "The number of inbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + + + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + + leaf in-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + + leaf in-unknown-protos { + type yang:counter32; + description + "For packet-oriented interfaces, the number of packets + received via the interface that were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing, the number of + transmission units received via the interface that were + discarded because of an unknown or unsupported protocol. + For any interface that does not support protocol + multiplexing, this counter is not present. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + + + + + leaf out-octets { + type yang:counter64; + description + "The total number of octets transmitted out of the + interface, including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + + leaf out-unicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + + leaf out-broadcast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + + + leaf out-multicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC-layer + protocol, this includes both Group and Functional + addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + + leaf out-discards { + type yang:counter32; + description + "The number of outbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + + leaf out-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + + + + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + } + } + } +} diff --git a/yang/openconfig-nis/ietf-netconf@2011-06-01.yang b/yang/openconfig-nis/ietf-netconf@2011-06-01.yang new file mode 100644 index 000000000..3a0fc3da7 --- /dev/null +++ b/yang/openconfig-nis/ietf-netconf@2011-06-01.yang @@ -0,0 +1,825 @@ +module ietf-netconf { + // the namespace for NETCONF XML definitions is unchanged + // from RFC 4741, which this document replaces + namespace "urn:ietf:params:xml:ns:netconf:base:1.0"; + prefix nc; + import ietf-inet-types { + prefix inet; + } + organization + "IETF NETCONF (Network Configuration) Working Group"; + contact + "WG Web: + WG List: + WG Chair: Bert Wijnen + + WG Chair: Mehmet Ersue + + Editor: Martin Bjorklund + + Editor: Juergen Schoenwaelder + + Editor: Andy Bierman + "; + description + "NETCONF Protocol Data Types and Protocol Operations. + Copyright (c) 2011 IETF Trust and the persons identified as + the document authors. All rights reserved. + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + This version of this YANG module is part of RFC 6241; see + the RFC itself for full legal notices."; + revision 2011-06-01 { + description + "Initial revision"; + reference + "RFC 6241: Network Configuration Protocol"; + } + extension get-filter-element-attributes { + description + "If this extension is present within an 'anyxml' + statement named 'filter', which must be conceptually + defined within the RPC input section for the + and protocol operations, then the + following unqualified XML attribute is supported + within the element, within a or + protocol operation: + type : optional attribute with allowed + value strings 'subtree' and 'xpath'. + If missing, the default value is 'subtree'. + If the 'xpath' feature is supported, then the + following unqualified XML attribute is + also supported: + select: optional attribute containing a + string representing an XPath expression. + The 'type' attribute must be equal to 'xpath' + if this attribute is present."; + } + // NETCONF capabilities defined as features + feature writable-running { + description + "NETCONF :writable-running capability; + If the server advertises the :writable-running + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.2"; + } + feature candidate { + description + "NETCONF :candidate capability; + If the server advertises the :candidate + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.3"; + } + feature confirmed-commit { + if-feature candidate; + description + "NETCONF :confirmed-commit:1.1 capability; + If the server advertises the :confirmed-commit:1.1 + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.4"; + } + feature rollback-on-error { + description + "NETCONF :rollback-on-error capability; + If the server advertises the :rollback-on-error + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.5"; + } + feature validate { + description + "NETCONF :validate:1.1 capability; + If the server advertises the :validate:1.1 + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.6"; + } + feature startup { + description + "NETCONF :startup capability; + If the server advertises the :startup + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.7"; + } + feature url { + description + "NETCONF :url capability; + If the server advertises the :url + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.8"; + } + feature xpath { + description + "NETCONF :xpath capability; + If the server advertises the :xpath + capability for a session, then this feature must + also be enabled for that session. Otherwise, + this feature must not be enabled."; + reference "RFC 6241, Section 8.9"; + } + // NETCONF Simple Types + typedef session-id-type { + type uint32 { + range "1..max"; + } + description + "NETCONF Session Id"; + } + typedef session-id-or-zero-type { + type uint32; + description + "NETCONF Session Id or Zero to indicate none"; + } + typedef error-tag-type { + type enumeration { + enum in-use { + description + "The request requires a resource that + already is in use."; + } + enum invalid-value { + description + "The request specifies an unacceptable value for one + or more parameters."; + } + enum too-big { + description + "The request or response (that would be generated) is + too large for the implementation to handle."; + } + enum missing-attribute { + description + "An expected attribute is missing."; + } + enum bad-attribute { + description + "An attribute value is not correct; e.g., wrong type, + out of range, pattern mismatch."; + } + enum unknown-attribute { + description + "An unexpected attribute is present."; + } + enum missing-element { + description + "An expected element is missing."; + } + enum bad-element { + description + "An element value is not correct; e.g., wrong type, + out of range, pattern mismatch."; + } + enum unknown-element { + description + "An unexpected element is present."; + } + enum unknown-namespace { + description + "An unexpected namespace is present."; + } + enum access-denied { + description + "Access to the requested protocol operation or + data model is denied because authorization failed."; + } + enum lock-denied { + description + "Access to the requested lock is denied because the + lock is currently held by another entity."; + } + enum resource-denied { + description + "Request could not be completed because of + insufficient resources."; + } + enum rollback-failed { + description + "Request to roll back some configuration change (via + rollback-on-error or operations) + was not completed for some reason."; + } + enum data-exists { + description + "Request could not be completed because the relevant + data model content already exists. For example, + a 'create' operation was attempted on data that + already exists."; + } + enum data-missing { + description + "Request could not be completed because the relevant + data model content does not exist. For example, + a 'delete' operation was attempted on + data that does not exist."; + } + enum operation-not-supported { + description + "Request could not be completed because the requested + operation is not supported by this implementation."; + } + enum operation-failed { + description + "Request could not be completed because the requested + operation failed for some reason not covered by + any other error condition."; + } + enum partial-operation { + description + "This error-tag is obsolete, and SHOULD NOT be sent + by servers conforming to this document."; + } + enum malformed-message { + description + "A message could not be handled because it failed to + be parsed correctly. For example, the message is not + well-formed XML or it uses an invalid character set."; + } + } + description "NETCONF Error Tag"; + reference "RFC 6241, Appendix A"; + } + typedef error-severity-type { + type enumeration { + enum error { + description "Error severity"; + } + enum warning { + description "Warning severity"; + } + } + description "NETCONF Error Severity"; + reference "RFC 6241, Section 4.3"; + } + typedef edit-operation-type { + type enumeration { + enum merge { + description + "The configuration data identified by the + element containing this attribute is merged + with the configuration at the corresponding + level in the configuration datastore identified + by the target parameter."; + } + enum replace { + description + "The configuration data identified by the element + containing this attribute replaces any related + configuration in the configuration datastore + identified by the target parameter. If no such + configuration data exists in the configuration + datastore, it is created. Unlike a + operation, which replaces the + entire target configuration, only the configuration + actually present in the config parameter is affected."; + } + enum create { + description + "The configuration data identified by the element + containing this attribute is added to the + configuration if and only if the configuration + data does not already exist in the configuration + datastore. If the configuration data exists, an + element is returned with an + value of 'data-exists'."; + } + enum delete { + description + "The configuration data identified by the element + containing this attribute is deleted from the + configuration if and only if the configuration + data currently exists in the configuration + datastore. If the configuration data does not + exist, an element is returned with + an value of 'data-missing'."; + } + enum remove { + description + "The configuration data identified by the element + containing this attribute is deleted from the + configuration if the configuration + data currently exists in the configuration + datastore. If the configuration data does not + exist, the 'remove' operation is silently ignored + by the server."; + } + } + default "merge"; + description "NETCONF 'operation' attribute values"; + reference "RFC 6241, Section 7.2"; + } + // NETCONF Standard Protocol Operations + rpc get-config { + description + "Retrieve all or part of a specified configuration."; + reference "RFC 6241, Section 7.1"; + input { + container source { + description + "Particular configuration to retrieve."; + choice config-source { + mandatory true; + description + "The configuration to retrieve."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config source."; + } + leaf running { + type empty; + description + "The running configuration is the config source."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config source. + This is optional-to-implement on the server because + not all servers will support filtering for this + datastore."; + } + } + } + anyxml filter { + description + "Subtree or XPath filter to use."; + nc:get-filter-element-attributes; + } + } + output { + anyxml data { + description + "Copy of the source datastore subset that matched + the filter criteria (if any). An empty data container + indicates that the request did not produce any results."; + } + } + } + rpc edit-config { + description + "The operation loads all or part of a specified + configuration to the specified target configuration."; + reference "RFC 6241, Section 7.2"; + input { + container target { + description + "Particular configuration to edit."; + choice config-target { + mandatory true; + description + "The configuration target."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config target."; + } + leaf running { + if-feature writable-running; + type empty; + description + "The running configuration is the config source."; + } + } + } + leaf default-operation { + type enumeration { + enum merge { + description + "The default operation is merge."; + } + enum replace { + description + "The default operation is replace."; + } + enum none { + description + "There is no default operation."; + } + } + default "merge"; + description + "The default operation to use."; + } + leaf test-option { + if-feature validate; + type enumeration { + enum test-then-set { + description + "The server will test and then set if no errors."; + } + enum set { + description + "The server will set without a test first."; + } + enum test-only { + description + "The server will only test and not set, even + if there are no errors."; + } + } + default "test-then-set"; + description + "The test option to use."; + } + leaf error-option { + type enumeration { + enum stop-on-error { + description + "The server will stop on errors."; + } + enum continue-on-error { + description + "The server may continue on errors."; + } + enum rollback-on-error { + description + "The server will roll back on errors. + This value can only be used if the 'rollback-on-error' + feature is supported."; + } + } + default "stop-on-error"; + description + "The error option to use."; + } + choice edit-content { + mandatory true; + description + "The content for the edit operation."; + anyxml config { + description + "Inline Config content."; + } + leaf url { + if-feature url; + type inet:uri; + description + "URL-based config content."; + } + } + } + } + rpc copy-config { + description + "Create or replace an entire configuration datastore with the + contents of another complete configuration datastore."; + reference "RFC 6241, Section 7.3"; + input { + container target { + description + "Particular configuration to copy to."; + choice config-target { + mandatory true; + description + "The configuration target of the copy operation."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config target."; + } + leaf running { + if-feature writable-running; + type empty; + description + "The running configuration is the config target. + This is optional-to-implement on the server."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config target."; + } + leaf url { + if-feature url; + type inet:uri; + description + "The URL-based configuration is the config target."; + } + } + } + container source { + description + "Particular configuration to copy from."; + choice config-source { + mandatory true; + description + "The configuration source for the copy operation."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config source."; + } + leaf running { + type empty; + description + "The running configuration is the config source."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config source."; + } + leaf url { + if-feature url; + type inet:uri; + description + "The URL-based configuration is the config source."; + } + anyxml config { + description + "Inline Config content: element. Represents + an entire configuration datastore, not + a subset of the running datastore."; + } + } + } + } + } + rpc delete-config { + description + "Delete a configuration datastore."; + reference "RFC 6241, Section 7.4"; + input { + container target { + description + "Particular configuration to delete."; + choice config-target { + mandatory true; + description + "The configuration target to delete."; + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config target."; + } + leaf url { + if-feature url; + type inet:uri; + description + "The URL-based configuration is the config target."; + } + } + } + } + } + rpc lock { + description + "The lock operation allows the client to lock the configuration + system of a device."; + reference "RFC 6241, Section 7.5"; + input { + container target { + description + "Particular configuration to lock."; + choice config-target { + mandatory true; + description + "The configuration target to lock."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config target."; + } + leaf running { + type empty; + description + "The running configuration is the config target."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config target."; + } + } + } + } + } + rpc unlock { + description + "The unlock operation is used to release a configuration lock, + previously obtained with the 'lock' operation."; + reference "RFC 6241, Section 7.6"; + input { + container target { + description + "Particular configuration to unlock."; + choice config-target { + mandatory true; + description + "The configuration target to unlock."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config target."; + } + leaf running { + type empty; + description + "The running configuration is the config target."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config target."; + } + } + } + } + } + rpc get { + description + "Retrieve running configuration and device state information."; + reference "RFC 6241, Section 7.7"; + input { + anyxml filter { + description + "This parameter specifies the portion of the system + configuration and state data to retrieve."; + nc:get-filter-element-attributes; + } + } + output { + anyxml data { + description + "Copy of the running datastore subset and/or state + data that matched the filter criteria (if any). + An empty data container indicates that the request did not + produce any results."; + } + } + } + rpc close-session { + description + "Request graceful termination of a NETCONF session."; + reference "RFC 6241, Section 7.8"; + } + rpc kill-session { + description + "Force the termination of a NETCONF session."; + reference "RFC 6241, Section 7.9"; + input { + leaf session-id { + type session-id-type; + mandatory true; + description + "Particular session to kill."; + } + } + } + rpc commit { + if-feature candidate; + description + "Commit the candidate configuration as the device's new + current configuration."; + reference "RFC 6241, Section 8.3.4.1"; + input { + leaf confirmed { + if-feature confirmed-commit; + type empty; + description + "Requests a confirmed commit."; + reference "RFC 6241, Section 8.3.4.1"; + } + leaf confirm-timeout { + if-feature confirmed-commit; + type uint32 { + range "1..max"; + } + units "seconds"; + default "600"; // 10 minutes + description + "The timeout interval for a confirmed commit."; + reference "RFC 6241, Section 8.3.4.1"; + } + leaf persist { + if-feature confirmed-commit; + type string; + description + "This parameter is used to make a confirmed commit + persistent. A persistent confirmed commit is not aborted + if the NETCONF session terminates. The only way to abort + a persistent confirmed commit is to let the timer expire, + or to use the operation. + The value of this parameter is a token that must be given + in the 'persist-id' parameter of or + operations in order to confirm or cancel + the persistent confirmed commit. + The token should be a random string."; + reference "RFC 6241, Section 8.3.4.1"; + } + leaf persist-id { + if-feature confirmed-commit; + type string; + description + "This parameter is given in order to commit a persistent + confirmed commit. The value must be equal to the value + given in the 'persist' parameter to the operation. + If it does not match, the operation fails with an + 'invalid-value' error."; + reference "RFC 6241, Section 8.3.4.1"; + } + } + } + rpc discard-changes { + if-feature candidate; + description + "Revert the candidate configuration to the current + running configuration."; + reference "RFC 6241, Section 8.3.4.2"; + } + rpc cancel-commit { + if-feature confirmed-commit; + description + "This operation is used to cancel an ongoing confirmed commit. + If the confirmed commit is persistent, the parameter + 'persist-id' must be given, and it must match the value of the + 'persist' parameter."; + reference "RFC 6241, Section 8.4.4.1"; + input { + leaf persist-id { + type string; + description + "This parameter is given in order to cancel a persistent + confirmed commit. The value must be equal to the value + given in the 'persist' parameter to the operation. + If it does not match, the operation fails with an + 'invalid-value' error."; + } + } + } + rpc validate { + if-feature validate; + description + "Validates the contents of the specified configuration."; + reference "RFC 6241, Section 8.6.4.1"; + input { + container source { + description + "Particular configuration to validate."; + choice config-source { + mandatory true; + description + "The configuration source to validate."; + leaf candidate { + if-feature candidate; + type empty; + description + "The candidate configuration is the config source."; + } + leaf running { + type empty; + description + "The running configuration is the config source."; + } + leaf startup { + if-feature startup; + type empty; + description + "The startup configuration is the config source."; + } + leaf url { + if-feature url; + type inet:uri; + description + "The URL-based configuration is the config source."; + } + anyxml config { + description + "Inline Config content: element. Represents + an entire configuration datastore, not + a subset of the running datastore."; + } + } + } + } + } + + } \ No newline at end of file diff --git a/yang/openconfig-nis/ietf-yang-types@2013-07-15.yang b/yang/openconfig-nis/ietf-yang-types@2013-07-15.yang new file mode 100644 index 000000000..ee58fa3ab --- /dev/null +++ b/yang/openconfig-nis/ietf-yang-types@2013-07-15.yang @@ -0,0 +1,474 @@ +module ietf-yang-types { + + namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types"; + prefix "yang"; + + organization + "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; + + contact + "WG Web: + WG List: + + WG Chair: David Kessens + + + WG Chair: Juergen Schoenwaelder + + + Editor: Juergen Schoenwaelder + "; + + description + "This module contains a collection of generally useful derived + YANG data types. + + Copyright (c) 2013 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject + to the license terms contained in, the Simplified BSD License + set forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (http://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 6991; see + the RFC itself for full legal notices."; + + revision 2013-07-15 { + description + "This revision adds the following new data types: + - yang-identifier + - hex-string + - uuid + - dotted-quad"; + reference + "RFC 6991: Common YANG Data Types"; + } + + revision 2010-09-24 { + description + "Initial revision."; + reference + "RFC 6021: Common YANG Data Types"; + } + + /*** collection of counter and gauge types ***/ + + typedef counter32 { + type uint32; + description + "The counter32 type represents a non-negative integer + that monotonically increases until it reaches a + maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Counters have no defined 'initial' value, and thus, a + single value of a counter has (in general) no information + content. Discontinuities in the monotonically increasing + value normally occur at re-initialization of the + management system, and at other times as specified in the + description of a schema node using this type. If such + other times can occur, for example, the creation of + a schema node of type counter32 at times other than + re-initialization, then a corresponding schema node + should be defined, with an appropriate type, to indicate + the last discontinuity. + + The counter32 type should not be used for configuration + schema nodes. A default statement SHOULD NOT be used in + combination with the type counter32. + + In the value set and its semantics, this type is equivalent + to the Counter32 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 + (SMIv2)"; + } + + typedef zero-based-counter32 { + type yang:counter32; + default "0"; + description + "The zero-based-counter32 type represents a counter32 + that has the defined 'initial' value zero. + + A schema node of this type will be set to zero (0) on creation + and will thereafter increase monotonically until it reaches + a maximum value of 2^32-1 (4294967295 decimal), when it + wraps around and starts increasing again from zero. + + Provided that an application discovers a new schema node + of this type within the minimum time to wrap, it can use the + 'initial' value as a delta. It is important for a management + station to be aware of this minimum time and the actual time + between polls, and to discard data if the actual time is too + long or there is no defined minimum time. + + In the value set and its semantics, this type is equivalent + to the ZeroBasedCounter32 textual convention of the SMIv2."; + reference + "RFC 4502: Remote Network Monitoring Management Information + Base Version 2"; + } + + typedef counter64 { + type uint64; + description + "The counter64 type represents a non-negative integer + that monotonically increases until it reaches a + maximum value of 2^64-1 (18446744073709551615 decimal), + when it wraps around and starts increasing again from zero. + + Counters have no defined 'initial' value, and thus, a + single value of a counter has (in general) no information + content. Discontinuities in the monotonically increasing + value normally occur at re-initialization of the + management system, and at other times as specified in the + description of a schema node using this type. If such + other times can occur, for example, the creation of + a schema node of type counter64 at times other than + re-initialization, then a corresponding schema node + should be defined, with an appropriate type, to indicate + the last discontinuity. + + The counter64 type should not be used for configuration + schema nodes. A default statement SHOULD NOT be used in + combination with the type counter64. + + In the value set and its semantics, this type is equivalent + to the Counter64 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 + (SMIv2)"; + } + + typedef zero-based-counter64 { + type yang:counter64; + default "0"; + description + "The zero-based-counter64 type represents a counter64 that + has the defined 'initial' value zero. + + A schema node of this type will be set to zero (0) on creation + and will thereafter increase monotonically until it reaches + a maximum value of 2^64-1 (18446744073709551615 decimal), + when it wraps around and starts increasing again from zero. + + Provided that an application discovers a new schema node + of this type within the minimum time to wrap, it can use the + 'initial' value as a delta. It is important for a management + station to be aware of this minimum time and the actual time + between polls, and to discard data if the actual time is too + long or there is no defined minimum time. + + In the value set and its semantics, this type is equivalent + to the ZeroBasedCounter64 textual convention of the SMIv2."; + reference + "RFC 2856: Textual Conventions for Additional High Capacity + Data Types"; + } + + typedef gauge32 { + type uint32; + description + "The gauge32 type represents a non-negative integer, which + may increase or decrease, but shall never exceed a maximum + value, nor fall below a minimum value. The maximum value + cannot be greater than 2^32-1 (4294967295 decimal), and + the minimum value cannot be smaller than 0. The value of + a gauge32 has its maximum value whenever the information + being modeled is greater than or equal to its maximum + value, and has its minimum value whenever the information + being modeled is smaller than or equal to its minimum value. + If the information being modeled subsequently decreases + below (increases above) the maximum (minimum) value, the + gauge32 also decreases (increases). + + In the value set and its semantics, this type is equivalent + to the Gauge32 type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 + (SMIv2)"; + } + + typedef gauge64 { + type uint64; + description + "The gauge64 type represents a non-negative integer, which + may increase or decrease, but shall never exceed a maximum + value, nor fall below a minimum value. The maximum value + cannot be greater than 2^64-1 (18446744073709551615), and + the minimum value cannot be smaller than 0. The value of + a gauge64 has its maximum value whenever the information + being modeled is greater than or equal to its maximum + value, and has its minimum value whenever the information + being modeled is smaller than or equal to its minimum value. + If the information being modeled subsequently decreases + below (increases above) the maximum (minimum) value, the + gauge64 also decreases (increases). + + In the value set and its semantics, this type is equivalent + to the CounterBasedGauge64 SMIv2 textual convention defined + in RFC 2856"; + reference + "RFC 2856: Textual Conventions for Additional High Capacity + Data Types"; + } + + /*** collection of identifier-related types ***/ + + typedef object-identifier { + type string { + pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))' + + '(\.(0|([1-9]\d*)))*'; + } + description + "The object-identifier type represents administratively + assigned names in a registration-hierarchical-name tree. + + Values of this type are denoted as a sequence of numerical + non-negative sub-identifier values. Each sub-identifier + value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers + are separated by single dots and without any intermediate + whitespace. + + The ASN.1 standard restricts the value space of the first + sub-identifier to 0, 1, or 2. Furthermore, the value space + of the second sub-identifier is restricted to the range + 0 to 39 if the first sub-identifier is 0 or 1. Finally, + the ASN.1 standard requires that an object identifier + has always at least two sub-identifiers. The pattern + captures these restrictions. + + Although the number of sub-identifiers is not limited, + module designers should realize that there may be + implementations that stick with the SMIv2 limit of 128 + sub-identifiers. + + This type is a superset of the SMIv2 OBJECT IDENTIFIER type + since it is not restricted to 128 sub-identifiers. Hence, + this type SHOULD NOT be used to represent the SMIv2 OBJECT + IDENTIFIER type; the object-identifier-128 type SHOULD be + used instead."; + reference + "ISO9834-1: Information technology -- Open Systems + Interconnection -- Procedures for the operation of OSI + Registration Authorities: General procedures and top + arcs of the ASN.1 Object Identifier tree"; + } + + typedef object-identifier-128 { + type object-identifier { + pattern '\d*(\.\d*){1,127}'; + } + description + "This type represents object-identifiers restricted to 128 + sub-identifiers. + + In the value set and its semantics, this type is equivalent + to the OBJECT IDENTIFIER type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 + (SMIv2)"; + } + + typedef yang-identifier { + type string { + length "1..max"; + pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*'; + pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*'; + } + description + "A YANG identifier string as defined by the 'identifier' + rule in Section 12 of RFC 6020. An identifier must + start with an alphabetic character or an underscore + followed by an arbitrary sequence of alphabetic or + numeric characters, underscores, hyphens, or dots. + + A YANG identifier MUST NOT start with any possible + combination of the lowercase or uppercase character + sequence 'xml'."; + reference + "RFC 6020: YANG - A Data Modeling Language for the Network + Configuration Protocol (NETCONF)"; + } + + /*** collection of types related to date and time***/ + + typedef date-and-time { + type string { + pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?' + + '(Z|[\+\-]\d{2}:\d{2})'; + } + description + "The date-and-time type is a profile of the ISO 8601 + standard for representation of dates and times using the + Gregorian calendar. The profile is defined by the + date-time production in Section 5.6 of RFC 3339. + + The date-and-time type is compatible with the dateTime XML + schema type with the following notable exceptions: + + (a) The date-and-time type does not allow negative years. + + (b) The date-and-time time-offset -00:00 indicates an unknown + time zone (see RFC 3339) while -00:00 and +00:00 and Z + all represent the same time zone in dateTime. + + (c) The canonical format (see below) of data-and-time values + differs from the canonical format used by the dateTime XML + schema type, which requires all times to be in UTC using + the time-offset 'Z'. + + This type is not equivalent to the DateAndTime textual + convention of the SMIv2 since RFC 3339 uses a different + separator between full-date and full-time and provides + higher resolution of time-secfrac. + + The canonical format for date-and-time values with a known time + zone uses a numeric time zone offset that is calculated using + the device's configured known offset to UTC time. A change of + the device's offset to UTC time will cause date-and-time values + to change accordingly. Such changes might happen periodically + in case a server follows automatically daylight saving time + (DST) time zone offset changes. The canonical format for + date-and-time values with an unknown time zone (usually + referring to the notion of local time) uses the time-offset + -00:00."; + reference + "RFC 3339: Date and Time on the Internet: Timestamps + RFC 2579: Textual Conventions for SMIv2 + XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; + } + + typedef timeticks { + type uint32; + description + "The timeticks type represents a non-negative integer that + represents the time, modulo 2^32 (4294967296 decimal), in + hundredths of a second between two epochs. When a schema + node is defined that uses this type, the description of + the schema node identifies both of the reference epochs. + + In the value set and its semantics, this type is equivalent + to the TimeTicks type of the SMIv2."; + reference + "RFC 2578: Structure of Management Information Version 2 + (SMIv2)"; + } + + typedef timestamp { + type yang:timeticks; + description + "The timestamp type represents the value of an associated + timeticks schema node at which a specific occurrence + happened. The specific occurrence must be defined in the + description of any schema node defined using this type. When + the specific occurrence occurred prior to the last time the + associated timeticks attribute was zero, then the timestamp + value is zero. Note that this requires all timestamp values + to be reset to zero when the value of the associated timeticks + attribute reaches 497+ days and wraps around to zero. + + The associated timeticks schema node must be specified + in the description of any schema node using this type. + + In the value set and its semantics, this type is equivalent + to the TimeStamp textual convention of the SMIv2."; + reference + "RFC 2579: Textual Conventions for SMIv2"; + } + + /*** collection of generic address types ***/ + + typedef phys-address { + type string { + pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; + } + + description + "Represents media- or physical-level addresses represented + as a sequence octets, each octet represented by two hexadecimal + numbers. Octets are separated by colons. The canonical + representation uses lowercase characters. + + In the value set and its semantics, this type is equivalent + to the PhysAddress textual convention of the SMIv2."; + reference + "RFC 2579: Textual Conventions for SMIv2"; + } + + typedef mac-address { + type string { + pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; + } + description + "The mac-address type represents an IEEE 802 MAC address. + The canonical representation uses lowercase characters. + + In the value set and its semantics, this type is equivalent + to the MacAddress textual convention of the SMIv2."; + reference + "IEEE 802: IEEE Standard for Local and Metropolitan Area + Networks: Overview and Architecture + RFC 2579: Textual Conventions for SMIv2"; + } + + /*** collection of XML-specific types ***/ + + typedef xpath1.0 { + type string; + description + "This type represents an XPATH 1.0 expression. + + When a schema node is defined that uses this type, the + description of the schema node MUST specify the XPath + context in which the XPath expression is evaluated."; + reference + "XPATH: XML Path Language (XPath) Version 1.0"; + } + + /*** collection of string types ***/ + + typedef hex-string { + type string { + pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; + } + description + "A hexadecimal string with octets represented as hex digits + separated by colons. The canonical representation uses + lowercase characters."; + } + + typedef uuid { + type string { + pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-' + + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'; + } + description + "A Universally Unique IDentifier in the string representation + defined in RFC 4122. The canonical representation uses + lowercase characters. + + The following is an example of a UUID in string representation: + f81d4fae-7dec-11d0-a765-00a0c91e6bf6 + "; + reference + "RFC 4122: A Universally Unique IDentifier (UUID) URN + Namespace"; + } + + typedef dotted-quad { + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; + } + description + "An unsigned 32-bit number expressed in the dotted-quad + notation, i.e., four octets written as decimal numbers + and separated with the '.' (full stop) character."; + } +} diff --git a/yang/openconfig-nis/openconfig-aft-common@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-common@2017-05-10.yang new file mode 100644 index 000000000..b74036964 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-common@2017-05-10.yang @@ -0,0 +1,222 @@ +submodule openconfig-aft-common { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-interfaces { prefix "oc-if"; } + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-yang-types { prefix "oc-yang"; } + import openconfig-inet-types { prefix "oc-inet"; } + import openconfig-mpls-types { prefix "oc-mplst"; } + import openconfig-policy-types { prefix "oc-pol-types"; } + import openconfig-aft-types { prefix "oc-aftt"; } + + oc-ext:openconfig-version "0.3.0"; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings that are re-used + across multiple contexts within the AFT model."; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-common-nhop-structural { + description + "Structural grouping describing a next-hop entry."; + + container next-hops { + description + "The list of next-hops that are to be used for entry within + the AFT table. The structure of each next-hop is address + family independent, such that it is possible to resolve fully + how the next-hop is treated. For example: + + - Where ingress IPv4 unicast packets are to be forwarded via + an MPLS LSP, the next-hop list should indicate the MPLS + label stack that is used to the next-hop. + - Where ingress MPLS labelled packets are to be forwarded to + an IPv6 nexthop (for example, a CE within a VPN, then the + popped label stack, and IPv6 next-hop address should be + indicated)."; + + list next-hop { + key "index"; + + description + "A next-hop associated with the forwarding instance. The + entries within the next-hop list should only reflect + next-hops that are actively used by the local system. + That is to say inactive, backup or FRR next-hops should + not be included within this list."; + + leaf index { + type leafref { + path "../config/index"; + } + description + "A unique index identifying the next-hop entry for the + AFT entry"; + + } + + container config { + description + "Configuration parameters relating to the AFT next-hop + entry"; + + uses aft-common-entry-nexthop-config; + } + + container state { + config false; + description + "Operational state parameters relating to the AFT + next-hop entry"; + + uses aft-common-entry-nexthop-config; + uses aft-common-entry-nexthop-state; + } + + uses oc-if:interface-ref; + } + } + } + + grouping aft-common-entry-state { + description + "Operational state parameters relating to a forwarding entry"; + + leaf packets-forwarded { + type oc-yang:counter64; + description + "The number of packets which have matched, and been forwarded, + based on the AFT entry."; + } + + leaf octets-forwarded { + type oc-yang:counter64; + description + "The number of octets which have matched, and been forwarded, + based on the AFT entry"; + } + } + + grouping aft-common-entry-nexthop-config { + description + "Configuration parameters relating to a next-hop entry for a AFT + entry"; + + leaf index { + type uint64; + description + "A unique entry for the next-hop."; + } + } + + grouping aft-common-entry-nexthop-state { + description + "Parameters relating to a next-hop within the AFT entry"; + + leaf weight { + type uint32; + description + "The weight of the next-hop. Traffic is balanced according to + the ratio described by the relative weights of the next hops + that exist for the AFT entry. Note that all next-hops that are + specified are assumed to be active next-hops and therefore + eligible (and selected) to be installed in the FIB, and hence + used for packet forwarding."; + } + + leaf ip-address { + type oc-inet:ip-address; + description + "The IP address of the next-hop system."; + } + + leaf mac-address { + type oc-yang:mac-address; + description + "The MAC address of the next-hop if resolved by the local + network instance."; + } + + leaf-list popped-mpls-label-stack { + type oc-mplst:mpls-label; + description + "The MPLS label stack to be popped from the packet when + switched by the system. The stack is encoded as a leaf-list + such that the first entry is the label that is outer-most (i.e., + furthest from the bottom of the stack) label + stack to be popped. + + If the local system pops the outer-most label 400, then the + value of this list is [400,]. If the local system removes two + labels, the outer-most being 500, and the second of which is + 400, then the value of the list is [500, 400]. + + A swap operation is reflected by entries in the + popped-mpls-label-stack and pushed-mpls-label-stack nodes."; + } + + leaf-list pushed-mpls-label-stack { + type oc-mplst:mpls-label; + ordered-by user; + description + "The MPLS label stack imposed when forwarding packets to the + next-hop + - the stack is encoded as a leaf list whereby the order of the + entries is such that the first entry in the list is the + label at the bottom of the stack to be pushed. + + To this end, a packet which is to forwarded to a device using + a service label of 42, and a transport label of 8072 will be + represented with a label stack list of [42, 8072]. + + The MPLS label stack list is ordered by the user, such that no + system re-ordering of leaves is permitted by the system. + + A swap operation is reflected by entries in the + popped-mpls-label-stack and pushed-mpls-label-stack nodes."; + + } + + leaf decapsulate-header { + type oc-aftt:encapsulation-header-type; + description + "When forwarding a packet to the specified next-hop, the local + system performs a decapsulation of the packet - removing the + specified header type. In the case that no next-hop is + specified, the packet header is removed, and a subsequent + forwarding lookup is performed on the packet encapsulated + within the header, matched within the relevant AFT within the + specified network-instance."; + } + + leaf encapsulate-header { + type oc-aftt:encapsulation-header-type; + description + "When forwarding a packet to the specified next-hop the local + system performs an encapsulation of the packet - adding the + specified header type."; + } + + leaf origin-protocol { + type identityref { + base "oc-pol-types:INSTALL_PROTOCOL_TYPE"; + } + description + "The protocol from which the AFT entry was learned."; + } + } +} \ No newline at end of file diff --git a/yang/openconfig-nis/openconfig-aft-ethernet@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-ethernet@2017-05-10.yang new file mode 100644 index 000000000..37deb9c08 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-ethernet@2017-05-10.yang @@ -0,0 +1,89 @@ +submodule openconfig-aft-ethernet { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-yang-types { prefix "oc-yang"; } + + // Include common cross-AFT groupings from the common submodule. + include openconfig-aft-common; + + oc-ext:openconfig-version "0.3.0"; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings for the abstract + forwarding tables for Ethernet."; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-ethernet-structural { + description + "Structural grouping defining the schema for the Ethernet + abstract forwarding table."; + + list mac-entry { + key "mac-address"; + + description + "List of the Ethernet entries within the abstract + forwarding table. This list is keyed by the outer MAC address + of the Ethernet frame."; + + leaf mac-address { + type leafref { + path "../config/mac-address"; + } + description + "Reference to the outer MAC address matched by the + entry."; + } + + container config { + description + "Configuration parameters for the Ethernet AFT entry."; + uses aft-ethernet-entry-config; + } + + container state { + config false; + description + "Operational state parameters for the Ethernet AFT + entry."; + uses aft-ethernet-entry-config; + uses aft-ethernet-entry-state; + } + + uses aft-common-nhop-structural; + } + } + + grouping aft-ethernet-entry-config { + description + "Configuration parameters for the Ethernet AFT entry."; + + leaf mac-address { + type oc-yang:mac-address; + description + "The outer MAC address of the Ethernet frame that must + be matched for the AFT entry to be utilised."; + } + } + + grouping aft-ethernet-entry-state { + description + "Operational state parameters for the Ethernet AFT entry."; + uses aft-common-entry-state; + } +} diff --git a/yang/openconfig-nis/openconfig-aft-ipv4@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-ipv4@2017-05-10.yang new file mode 100644 index 000000000..bc4279ff7 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-ipv4@2017-05-10.yang @@ -0,0 +1,89 @@ +submodule openconfig-aft-ipv4 { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-inet-types { prefix "oc-inet"; } + + // Include common cross-AFT groupings from the common submodule. + include openconfig-aft-common; + + oc-ext:openconfig-version "0.3.0"; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings for the abstract + forwarding tables for IPv4."; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-ipv4-unicast-structural { + description + "Structural grouping defining the schema for the IPv4 unicast + abstract forwarding table."; + + list ipv4-entry { + key "prefix"; + + description + "List of the IPv4 unicast entries within the abstract + forwarding table. This list is keyed by the destination IPv4 + prefix."; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the IPv4 unicast destination prefix which + must be matched to utilise the AFT entry."; + } + + container config { + description + "Configuration parameters for the IPv4 unicast AFT entry."; + uses aft-ipv4-unicast-entry-config; + } + + container state { + config false; + description + "Operational state parameters for the IPv4 unicast AFT + entry."; + uses aft-ipv4-unicast-entry-config; + uses aft-ipv4-unicast-entry-state; + } + + uses aft-common-nhop-structural; + } + } + + grouping aft-ipv4-unicast-entry-config { + description + "Configuration parameters for the IPv4 unicast entry."; + + leaf prefix { + type oc-inet:ipv4-prefix; + description + "The IPv4 destination prefix that should be matched to + utilise the AFT entry."; + } + } + + grouping aft-ipv4-unicast-entry-state { + description + "Operational state parameters for the IPv4 unicast entry."; + uses aft-common-entry-state; + } +} diff --git a/yang/openconfig-nis/openconfig-aft-ipv6@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-ipv6@2017-05-10.yang new file mode 100644 index 000000000..dd32c1e4c --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-ipv6@2017-05-10.yang @@ -0,0 +1,89 @@ +submodule openconfig-aft-ipv6 { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-inet-types { prefix "oc-inet"; } + + // Include common cross-AFT groupings from the common submodule. + include openconfig-aft-common; + + oc-ext:openconfig-version "0.3.0"; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings for the abstract + forwarding tables for IPv6."; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-ipv6-unicast-structural { + description + "Structural grouping defining the schema for the IPv6 unicast + abstract forwarding table."; + + list ipv6-entry { + key "prefix"; + + description + "List of the IPv6 unicast entries within the abstract + forwarding table. This list is keyed by the destination IPv6 + prefix."; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the IPv6 unicast destination prefix which + must be matched to utilise the AFT entry."; + } + + container config { + description + "Configuration parameters for the IPv6 unicast AFT entry."; + uses aft-ipv6-unicast-entry-config; + } + + container state { + config false; + description + "Operational state parameters for the IPv6 unicast AFT + entry."; + uses aft-ipv6-unicast-entry-config; + uses aft-ipv6-unicast-entry-state; + } + + uses aft-common-nhop-structural; + } + } + + grouping aft-ipv6-unicast-entry-config { + description + "Configuration parameters for the IPv6 unicast entry."; + + leaf prefix { + type oc-inet:ipv6-prefix; + description + "The IPv6 destination prefix that should be matched to + utilise the AFT entry."; + } + } + + grouping aft-ipv6-unicast-entry-state { + description + "Operational state parameters for the IPv6 unicast entry."; + uses aft-common-entry-state; + } +} diff --git a/yang/openconfig-nis/openconfig-aft-mpls@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-mpls@2017-05-10.yang new file mode 100644 index 000000000..38e5cc09b --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-mpls@2017-05-10.yang @@ -0,0 +1,89 @@ +submodule openconfig-aft-mpls { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-mpls-types { prefix "oc-mpls-types"; } + + // Include common cross-AFT groupings from the common submodule. + include openconfig-aft-common; + + oc-ext:openconfig-version "0.3.0"; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings for the abstract + forwarding table for MPLS label forwarding."; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-mpls-structural { + description + "Structural grouping defining the schema for the MPLS + abstract forwarding table."; + + list label-entry { + key "label"; + + description + "List of the MPLS entries within the abstract + forwarding table. This list is keyed by the top-most MPLS + label."; + + leaf label { + type leafref { + path "../config/label"; + } + description + "Reference to the top-most MPLS label matched by the + entry."; + } + + container config { + description + "Configuration parameters for the MPLS AFT entry."; + uses aft-mpls-entry-config; + } + + container state { + config false; + description + "Operational state parameters for the MPLS AFT + entry."; + uses aft-mpls-entry-config; + uses aft-mpls-entry-state; + } + + uses aft-common-nhop-structural; + } + } + + grouping aft-mpls-entry-config { + description + "Configuration parameters for the MPLS entry."; + + leaf label { + type oc-mpls-types:mpls-label; + description + "The top-most MPLS label that should be matched to + utilise the AFT entry."; + } + } + + grouping aft-mpls-entry-state { + description + "Operational state parameters for the MPLS entry."; + uses aft-common-entry-state; + } +} \ No newline at end of file diff --git a/yang/openconfig-nis/openconfig-aft-pf@2017-05-10.yang b/yang/openconfig-nis/openconfig-aft-pf@2017-05-10.yang new file mode 100644 index 000000000..30b4f38a6 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-pf@2017-05-10.yang @@ -0,0 +1,168 @@ +submodule openconfig-aft-pf { + belongs-to "openconfig-aft" { + prefix "oc-aft"; + } + + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-inet-types { prefix "oc-inet"; } + import openconfig-yang-types { prefix "oc-yang"; } + import openconfig-mpls-types { prefix "oc-mplst"; } + import openconfig-packet-match-types { + prefix "oc-pkt-match-types"; + } + + // Include common cross-AFT groupings from the common submodule. + include openconfig-aft-common; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Submodule containing definitions of groupings for the abstract + forwarding table(s) for policy forwarding entries. These are + defined to be forwarding tables that allow matches on + fields other than the destination address that is used in + other forwarding tables."; + + oc-ext:openconfig-version "0.3.0"; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + grouping aft-pf-structural { + description + "Structural grouping defining the schema for the policy + forwarding abstract forwarding table."; + + list policy-forwarding-entry { + key "index"; + + description + "List of the policy forwarding entries within the abstract + forwarding table. Each entry is uniquely identified by an + index on the system, due to the arbitrary match conditions + that may be implemented within the policy forwarding AFT. + The index may change upon changes of the entry if, and only + if, the device exporting the AFT replaces the entire entry + by removing the previous entry and replacing it with a + subsequent updated version."; + + leaf index { + type leafref { + path "../config/index"; + } + description + "Reference to the arbitary index for the policy forwarding + AFT entry."; + } + + container config { + description + "Configuration parameters for the Policy forwarding + AFT entry."; + uses aft-pf-entry-config; + } + + container state { + config false; + description + "Operational state parameters for the Policy Forwarding + AFT entry."; + uses aft-pf-entry-config; + uses aft-pf-entry-state; + } + + uses aft-common-nhop-structural; + } + } + + grouping aft-pf-entry-config { + description + "Configuration parameters for the Policy Forwarding + AFT entry."; + + leaf index { + type uint64; + description + "An arbitrary 64-bit index identifying the policy forwarding + AFT entry."; + } + + leaf ip-prefix { + type oc-inet:ip-prefix; + description + "The IP prefix that the forwarding entry matches."; + } + + leaf mac-address { + type oc-yang:mac-address; + description + "The MAC address that the forwarding entry matches. Used for + Layer 2 forwarding entries, e.g., within a VSI instance."; + } + + leaf mpls-label { + type oc-mplst:mpls-label; + description + "The MPLS label that the forwarding entry matches. Used for + MPLS forwarding entries, whereby the local device acts as an + LSR."; + } + + leaf mpls-tc { + type oc-mplst:mpls-tc; + description + "The value of the MPLS Traffic Class bits (formerly known as + the MPLS experimental bits) that are to be matched by the AFT + entry."; + reference + "RFC5462: Multiprotocol Label Switching (MPLS) Label Stack + Entry: 'EXP' Field Renamed to 'Traffic Class' Field"; } + + leaf ip-dscp { + type oc-inet:dscp; + description + "The value of the differentiated services code point (DSCP) to + be matched for the forwarding entry. The value is specified in + cases where specific class-based forwarding based on IP is + implemented by the device."; + } + + leaf ip-protocol { + type oc-pkt-match-types:ip-protocol-type; + description + "The value of the IP protocol field of an IPv4 packet, or the + next-header field of an IPv6 packet which is to be matched by + the AFT entry. This field is utilised where forwarding is + performed based on L4 information."; + } + + leaf l4-src-port { + type oc-inet:port-number; + description + "The value of the source port field of the transport header + that is to be matched by the AFT entry."; + } + + leaf l4-dst-port { + type oc-inet:port-number; + description + "The value of the destination port field of the transport + header that is to be matched by the AFT entry."; + } + } + + grouping aft-pf-entry-state { + description + "Operational state parameters for the Policy Forwarding + AFT entry."; + uses aft-common-entry-state; + } +} diff --git a/yang/openconfig-nis/openconfig-aft-types.yang b/yang/openconfig-nis/openconfig-aft-types.yang new file mode 100644 index 000000000..1476ea085 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft-types.yang @@ -0,0 +1,52 @@ +module openconfig-aft-types { + + namespace "http://openconfig.net/yang/fib-types"; + prefix "oc-aftt"; + + import openconfig-extensions { prefix "oc-ext"; } + + organization + "OpenConfig Working Group"; + + contact + "OpenConfig Working Group + www.openconfig.net"; + + description + "Types related to the OpenConfig Abstract Forwarding + Table (AFT) model"; + + oc-ext:openconfig-version "0.3.0"; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + typedef encapsulation-header-type { + type enumeration { + enum GRE { + description + "The encapsulation header is a Generic Routing Encapsulation + header."; + } + enum IPV4 { + description + "The encapsulation header is an IPv4 packet header"; + } + enum IPV6 { + description + "The encapsulation header is an IPv6 packet header"; + } + enum MPLS { + description + "The encapsulation header is one or more MPLS labels indicated + by the pushed and popped label stack lists."; + } + } + description + "Types of tunnel encapsulation that are supported by systems as either + head- or tail-end."; + } +} diff --git a/yang/openconfig-nis/openconfig-aft.yang b/yang/openconfig-nis/openconfig-aft.yang new file mode 100644 index 000000000..98b936286 --- /dev/null +++ b/yang/openconfig-nis/openconfig-aft.yang @@ -0,0 +1,136 @@ +module openconfig-aft { + + yang-version "1"; + + namespace "http://openconfig.net/yang/aft"; + + prefix "oc-aft"; + + import openconfig-extensions { prefix "oc-ext"; } + + // Include IPv4 AFT submodule. + include openconfig-aft-ipv4; + // Include IPv6 AFT submodule. + include openconfig-aft-ipv6; + // Include MPLS AFT submodule. + include openconfig-aft-mpls; + // Include policy forwarding AFT submodule. + include openconfig-aft-pf; + // Include the ethernet AFT submodule. + include openconfig-aft-ethernet; + // Include the common cross-AFT entities. + include openconfig-aft-common; + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "A model describing the forwarding entries installed on a network + element. It should be noted that this model is not expected to + align 1:1 with the underlying structure used directly by a + forwarding element (e.g., linecard), but rather provide an + abstraction that can be consumed by an NMS to observe, and in some + cases manipulate, the internal forwarding database in a simplified + manner. Since the underlying model of the forwarding table is not + expected to align with this model, the structure described herein + is referred to as an Abstract Forwarding Table (AFT), rather than + the FIB."; + + oc-ext:openconfig-version "0.3.0"; + + revision 2017-05-10 { + description + "Refactor to provide concretised per-AF schemas per AFT."; + reference "0.3.0"; + } + + // config + state groupings + + // structural groupings + + grouping aft-top { + description + "Top-level grouping allowing per-protocol instantiation of the + AFT."; + + container afts { + description + "The abstract forwarding tables (AFTs) that are associated + with the network instance. An AFT is instantiated per-protocol + running within the network-instance - such that one exists for + IPv4 Unicast, IPv6 Unicast, MPLS, L2 forwarding entries, etc. + A forwarding entry within the FIB has a set of next-hops, + which may be a reference to an entry within another table - + e.g., where a Layer 3 next-hop has an associated Layer 2 + forwarding entry."; + + container ipv4-unicast { + description + + "The abstract forwarding table for IPv4 unicast. Entries + within this table are uniquely keyed on the IPv4 unicast + destination prefix which is matched by ingress packets. + + The data set represented by the IPv4 Unicast AFT is the set + of entries from the IPv4 unicast RIB that have been selected + for installation into the FIB of the device exporting the + data structure."; + + uses aft-ipv4-unicast-structural; + } + + container ipv6-unicast { + description + "The abstract forwarding table for IPv6 unicast. Entries + within this table are uniquely keyed on the IPv6 unicast + destination prefix which is matched by ingress packets. + + The data set represented by the IPv6 Unicast AFTis the set + of entries within the IPv6 RIB that "; + + uses aft-ipv6-unicast-structural; + + } + + container policy-forwarding { + description + "The abstract forwarding table for policy-based forwarding + entries. Since multiple match criteria can be utilised + within a policy-based forwarding rule, this AFT provides a + flexible match criteria, and is indexed based on an + arbitrary 64-bit index. Entries within the AFT may match on + multiple field types (e.g., L4 header fields, as well as L2 + fields). + + Examples of entries within this table are: + - IPv4 policy-based routing based on DSCP. + - MPLS policy-based forwarding entries."; + + uses aft-pf-structural; + } + + container mpls { + description + "The abstract forwarding table for MPLS label based + forwarding entries. Entries within the table are keyed based + on the top-most MPLS label in the stack on the ingress + packet."; + + uses aft-mpls-structural; + } + + container ethernet { + description + "The abstract forwarding table for Ethernet based forwarding + entries. Entries within the table are keyed based on the + destination MAC address on the ingress packet."; + + uses aft-ethernet-structural; + } + } + } +} diff --git a/yang/openconfig-nis/openconfig-bgp-common-multiprotocol@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-common-multiprotocol@2017-02-02.yang new file mode 100644 index 000000000..1cbc8bf41 --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-common-multiprotocol@2017-02-02.yang @@ -0,0 +1,445 @@ +submodule openconfig-bgp-common-multiprotocol { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + import openconfig-bgp-types { prefix oc-bgp-types; } + import openconfig-routing-policy { prefix oc-rpol; } + import openconfig-types { prefix oc-types; } + + include openconfig-bgp-common; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains groupings that are related to support + for multiple protocols in BGP. The groupings are common across + multiple contexts."; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-common-mp-afi-safi-graceful-restart-config { + description + "BGP graceful restart parameters that apply on a per-AFI-SAFI + basis"; + + leaf enabled { + type boolean; + default false; + description + "This leaf indicates whether graceful-restart is enabled for + this AFI-SAFI"; + } + } + + grouping bgp-common-mp-afi-safi-config { + description + "Configuration parameters used for all BGP AFI-SAFIs"; + + leaf afi-safi-name { + type identityref { + base oc-bgp-types:AFI_SAFI_TYPE; + } + description "AFI,SAFI"; + } + + leaf enabled { + type boolean; + default false; + description + "This leaf indicates whether the IPv4 Unicast AFI,SAFI is + enabled for the neighbour or group"; + } + } + + grouping bgp-common-mp-all-afi-safi-list-contents { + description + "A common grouping used for contents of the list that is used + for AFI-SAFI entries"; + + // import and export policy included for the afi/safi + uses oc-rpol:apply-policy-group; + + uses bgp-common-mp-ipv4-unicast-group; + uses bgp-common-mp-ipv6-unicast-group; + uses bgp-common-mp-ipv4-labeled-unicast-group; + uses bgp-common-mp-ipv6-labeled-unicast-group; + uses bgp-common-mp-l3vpn-ipv4-unicast-group; + uses bgp-common-mp-l3vpn-ipv6-unicast-group; + uses bgp-common-mp-l3vpn-ipv4-multicast-group; + uses bgp-common-mp-l3vpn-ipv6-multicast-group; + uses bgp-common-mp-l2vpn-vpls-group; + uses bgp-common-mp-l2vpn-evpn-group; + } + + // Groupings relating to each address family + grouping bgp-common-mp-ipv4-unicast-group { + description + "Group for IPv4 Unicast configuration options"; + + container ipv4-unicast { + when "../afi-safi-name = 'oc-bgp-types:IPV4_UNICAST'" { + description + "Include this container for IPv4 Unicast specific + configuration"; + } + + description "IPv4 unicast configuration options"; + + // include common IPv[46] unicast options + uses bgp-common-mp-ipv4-ipv6-unicast-common; + + // placeholder for IPv4 unicast specific configuration + } + } + + grouping bgp-common-mp-ipv6-unicast-group { + description + "Group for IPv6 Unicast configuration options"; + + container ipv6-unicast { + when "../afi-safi-name = 'oc-bgp-types:IPV6_UNICAST'" { + description + "Include this container for IPv6 Unicast specific + configuration"; + } + + description "IPv6 unicast configuration options"; + + // include common IPv[46] unicast options + uses bgp-common-mp-ipv4-ipv6-unicast-common; + + // placeholder for IPv6 unicast specific configuration + // options + } + } + + grouping bgp-common-mp-ipv4-labeled-unicast-group { + description + "Group for IPv4 Labeled Unicast configuration options"; + + container ipv4-labeled-unicast { + when "../afi-safi-name = 'oc-bgp-types:IPV4_LABELED_UNICAST'" { + description + "Include this container for IPv4 Labeled Unicast specific + configuration"; + } + + description "IPv4 Labeled Unicast configuration options"; + + uses bgp-common-mp-all-afi-safi-common; + + // placeholder for IPv4 Labeled Unicast specific config + // options + } + } + + grouping bgp-common-mp-ipv6-labeled-unicast-group { + description + "Group for IPv6 Labeled Unicast configuration options"; + + container ipv6-labeled-unicast { + when "../afi-safi-name = 'oc-bgp-types:IPV6_LABELED_UNICAST'" { + description + "Include this container for IPv6 Labeled Unicast specific + configuration"; + } + + description "IPv6 Labeled Unicast configuration options"; + + uses bgp-common-mp-all-afi-safi-common; + + // placeholder for IPv6 Labeled Unicast specific config + // options. + } + } + + grouping bgp-common-mp-l3vpn-ipv4-unicast-group { + description + "Group for IPv4 Unicast L3VPN configuration options"; + + container l3vpn-ipv4-unicast { + when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV4_UNICAST'" { + description + "Include this container for IPv4 Unicast L3VPN specific + configuration"; + } + + description "Unicast IPv4 L3VPN configuration options"; + + // include common L3VPN configuration options + uses bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common; + + // placeholder for IPv4 Unicast L3VPN specific config options. + } + } + + grouping bgp-common-mp-l3vpn-ipv6-unicast-group { + description + "Group for IPv6 Unicast L3VPN configuration options"; + + container l3vpn-ipv6-unicast { + when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV6_UNICAST'" { + description + "Include this container for unicast IPv6 L3VPN specific + configuration"; + } + + description "Unicast IPv6 L3VPN configuration options"; + + // include common L3VPN configuration options + uses bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common; + + // placeholder for IPv6 Unicast L3VPN specific configuration + // options + } + } + + grouping bgp-common-mp-l3vpn-ipv4-multicast-group { + description + "Group for IPv4 L3VPN multicast configuration options"; + + container l3vpn-ipv4-multicast { + when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV4_MULTICAST'" { + description + "Include this container for multicast IPv6 L3VPN specific + configuration"; + } + + description "Multicast IPv4 L3VPN configuration options"; + + // include common L3VPN multicast options + uses bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common; + + // placeholder for IPv4 Multicast L3VPN specific configuration + // options + } + } + + grouping bgp-common-mp-l3vpn-ipv6-multicast-group { + description + "Group for IPv6 L3VPN multicast configuration options"; + + container l3vpn-ipv6-multicast { + when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV6_MULTICAST'" { + description + "Include this container for multicast IPv6 L3VPN specific + configuration"; + } + + description "Multicast IPv6 L3VPN configuration options"; + + // include common L3VPN multicast options + uses bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common; + + // placeholder for IPv6 Multicast L3VPN specific configuration + // options + } + } + + grouping bgp-common-mp-l2vpn-vpls-group { + description + "Group for BGP-signalled VPLS configuration options"; + + container l2vpn-vpls { + when "../afi-safi-name = 'oc-bgp-types:L2VPN_VPLS'" { + description + "Include this container for BGP-signalled VPLS specific + configuration"; + } + + description "BGP-signalled VPLS configuration options"; + + // include common L2VPN options + uses bgp-common-mp-l2vpn-common; + + // placeholder for BGP-signalled VPLS specific configuration + // options + } + } + + grouping bgp-common-mp-l2vpn-evpn-group { + description + "Group for BGP EVPN configuration options"; + + container l2vpn-evpn { + when "../afi-safi-name = 'oc-bgp-types:L2VPN_EVPN'" { + description + "Include this container for BGP EVPN specific + configuration"; + } + + description "BGP EVPN configuration options"; + + // include common L2VPN options + uses bgp-common-mp-l2vpn-common; + + // placeholder for BGP EVPN specific configuration options + } + } + + // Common groupings across multiple AFI,SAFIs + grouping bgp-common-mp-all-afi-safi-common { + description + "Grouping for configuration common to all AFI,SAFI"; + + container prefix-limit { + description + "Configure the maximum number of prefixes that will be + accepted from a peer"; + + container config { + description + "Configuration parameters relating to the prefix + limit for the AFI-SAFI"; + uses bgp-common-mp-all-afi-safi-common-prefix-limit-config; + } + + container state { + config false; + description + "State information relating to the prefix-limit for the + AFI-SAFI"; + uses bgp-common-mp-all-afi-safi-common-prefix-limit-config; + } + } + } + + grouping bgp-common-mp-ipv4-ipv6-unicast-common { + description + "Common configuration that is applicable for IPv4 and IPv6 + unicast"; + + // include common afi-safi options. + uses bgp-common-mp-all-afi-safi-common; + + // configuration options that are specific to IPv[46] unicast + container config { + description + "Configuration parameters for common IPv4 and IPv6 unicast + AFI-SAFI options"; + uses bgp-common-mp-ipv4-ipv6-unicast-common-config; + } + container state { + config false; + description + "State information for common IPv4 and IPv6 unicast + parameters"; + uses bgp-common-mp-ipv4-ipv6-unicast-common-config; + } + } + + grouping bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common { + description + "Common configuration applied across L3VPN for IPv4 + and IPv6"; + + // placeholder -- specific configuration options that are generic + // across IPv[46] unicast address families. + uses bgp-common-mp-all-afi-safi-common; + } + + grouping bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common { + description + "Common configuration applied across L3VPN for IPv4 + and IPv6"; + + // placeholder -- specific configuration options that are + // generic across IPv[46] multicast address families. + uses bgp-common-mp-all-afi-safi-common; + } + + grouping bgp-common-mp-l2vpn-common { + description + "Common configuration applied across L2VPN address + families"; + + // placeholder -- specific configuration options that are + // generic across L2VPN address families + uses bgp-common-mp-all-afi-safi-common; + } + + // Config groupings for common groups + grouping bgp-common-mp-all-afi-safi-common-prefix-limit-config { + description + "Configuration parameters relating to prefix-limits for an + AFI-SAFI"; + + leaf max-prefixes { + type uint32; + description + "Maximum number of prefixes that will be accepted + from the neighbour"; + } + + leaf prevent-teardown { + type boolean; + default false; + description + "Do not tear down the BGP session when the maximum + prefix limit is exceeded, but rather only log a + warning. The default of this leaf is false, such + that when it is not specified, the session is torn + down."; + } + + leaf shutdown-threshold-pct { + type oc-types:percentage; + description + "Threshold on number of prefixes that can be received + from a neighbour before generation of warning messages + or log entries. Expressed as a percentage of + max-prefixes"; + } + + leaf restart-timer { + type decimal64 { + fraction-digits 2; + } + units "seconds"; + description + "Time interval in seconds after which the BGP session + is re-established after being torn down due to exceeding + the max-prefix limit."; + } + } + + grouping bgp-common-mp-ipv4-ipv6-unicast-common-config { + description + "Common configuration parameters for IPv4 and IPv6 Unicast + address families"; + + leaf send-default-route { + type boolean; + default "false"; + description + "If set to true, send the default-route to the neighbour(s)"; + } + } +} diff --git a/yang/openconfig-nis/openconfig-bgp-common-structure@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-common-structure@2017-02-02.yang new file mode 100644 index 000000000..06335f301 --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-common-structure@2017-02-02.yang @@ -0,0 +1,166 @@ +submodule openconfig-bgp-common-structure { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + + include openconfig-bgp-common-multiprotocol; + include openconfig-bgp-common; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains groupings that are common across multiple BGP + contexts and provide structure around other primitive groupings."; + + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-common-structure-neighbor-group-logging-options { + description + "Structural grouping used to include error handling configuration and + state for both BGP neighbors and groups"; + + container logging-options { + description + "Logging options for events related to the BGP neighbor or + group"; + container config { + description + "Configuration parameters enabling or modifying logging + for events relating to the BGPgroup"; + uses bgp-common-neighbor-group-logging-options-config; + } + container state { + config false; + description + "State information relating to logging for the BGP neighbor + or group"; + uses bgp-common-neighbor-group-logging-options-config; + } + } + } + + grouping bgp-common-structure-neighbor-group-ebgp-multihop { + description + "Structural grouping used to include eBGP multihop configuration and + state for both BGP neighbors and peer groups"; + + container ebgp-multihop { + description + "eBGP multi-hop parameters for the BGPgroup"; + container config { + description + "Configuration parameters relating to eBGP multihop for the + BGP group"; + uses bgp-common-neighbor-group-multihop-config; + } + container state { + config false; + description + "State information for eBGP multihop, for the BGP neighbor + or group"; + uses bgp-common-neighbor-group-multihop-config; + } + } + } + + grouping bgp-common-structure-neighbor-group-route-reflector { + description + "Structural grouping used to include route reflector configuration and + state for both BGP neighbors and peer groups"; + + container route-reflector { + description + "Route reflector parameters for the BGPgroup"; + container config { + description + "Configuraton parameters relating to route reflection + for the BGPgroup"; + uses bgp-common-neighbor-group-route-reflector-config; + } + container state { + config false; + description + "State information relating to route reflection for the + BGPgroup"; + uses bgp-common-neighbor-group-route-reflector-config; + } + } + } + + grouping bgp-common-structure-neighbor-group-as-path-options { + description + "Structural grouping used to include AS_PATH manipulation configuration + and state for both BGP neighbors and peer groups"; + + container as-path-options { + description + "AS_PATH manipulation parameters for the BGP neighbor or + group"; + container config { + description + "Configuration parameters relating to AS_PATH manipulation + for the BGP peer or group"; + uses bgp-common-neighbor-group-as-path-options-config; + } + container state { + config false; + description + "State information relating to the AS_PATH manipulation + mechanisms for the BGP peer or group"; + uses bgp-common-neighbor-group-as-path-options-config; + } + } + } + + grouping bgp-common-structure-neighbor-group-add-paths { + description + "Structural grouping used to include ADD-PATHs configuration and state + for both BGP neighbors and peer groups"; + + container add-paths { + description + "Parameters relating to the advertisement and receipt of + multiple paths for a single NLRI (add-paths)"; + container config { + description + "Configuration parameters relating to ADD_PATHS"; + uses bgp-common-neighbor-group-add-paths-config; + } + container state { + config false; + description + "State information associated with ADD_PATHS"; + uses bgp-common-neighbor-group-add-paths-config; + } + } + } + +} diff --git a/yang/openconfig-nis/openconfig-bgp-common@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-common@2017-02-02.yang new file mode 100644 index 000000000..9dcd3ca5c --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-common@2017-02-02.yang @@ -0,0 +1,611 @@ +submodule openconfig-bgp-common { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + import openconfig-bgp-types { prefix oc-bgp-types; } + import openconfig-routing-policy { prefix oc-rpol; } + import openconfig-types { prefix oc-types; } + import openconfig-inet-types { prefix oc-inet; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains common groupings that are common across + multiple contexts within the BGP module. That is to say that they + may be application to a subset of global, peer-group or neighbor + contexts."; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-common-neighbor-group-timers-config { + description + "Config parameters related to timers associated with the BGP + peer"; + + leaf connect-retry { + type decimal64 { + fraction-digits 2; + } + default 30; + description + "Time interval in seconds between attempts to establish a + session with the peer."; + } + + leaf hold-time { + type decimal64 { + fraction-digits 2; + } + default 90; + description + "Time interval in seconds that a BGP session will be + considered active in the absence of keepalive or other + messages from the peer. The hold-time is typically + set to 3x the keepalive-interval."; + reference + "RFC 4271 - A Border Gateway Protocol 4, Sec. 10"; + } + + leaf keepalive-interval { + type decimal64 { + fraction-digits 2; + } + default 30; + description + "Time interval in seconds between transmission of keepalive + messages to the neighbor. Typically set to 1/3 the + hold-time."; + } + + leaf minimum-advertisement-interval { + type decimal64 { + fraction-digits 2; + } + default 30; + description + "Minimum time which must elapse between subsequent UPDATE + messages relating to a common set of NLRI being transmitted + to a peer. This timer is referred to as + MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to + reduce the number of UPDATE messages transmitted when a + particular set of NLRI exhibit instability."; + reference + "RFC 4271 - A Border Gateway Protocol 4, Sec 9.2.1.1"; + } + } + + grouping bgp-common-neighbor-group-config { + description + "Neighbor level configuration items."; + + leaf peer-as { + type oc-inet:as-number; + description + "AS number of the peer."; + } + + leaf local-as { + type oc-inet:as-number; + description + "The local autonomous system number that is to be used + when establishing sessions with the remote peer or peer + group, if this differs from the global BGP router + autonomous system number."; + } + + leaf peer-type { + type oc-bgp-types:peer-type; + description + "Explicitly designate the peer or peer group as internal + (iBGP) or external (eBGP)."; + } + + leaf auth-password { + type oc-types:routing-password; + description + "Configures an MD5 authentication password for use with + neighboring devices."; + } + + leaf remove-private-as { + // could also make this a container with a flag to enable + // remove-private and separate option. here, option implies + // remove-private is enabled. + type oc-bgp-types:remove-private-as-option; + description + "Remove private AS numbers from updates sent to peers - when + this leaf is not specified, the AS_PATH attribute should be + sent to the peer unchanged"; + } + + leaf route-flap-damping { + type boolean; + default false; + description + "Enable route flap damping."; + } + + leaf send-community { + type oc-bgp-types:community-type; + default "NONE"; + description + "Specify which types of community should be sent to the + neighbor or group. The default is to not send the + community attribute"; + } + + leaf description { + type string; + description + "An optional textual description (intended primarily for use + with a peer or group"; + } + } + + grouping bgp-common-neighbor-group-transport-config { + description + "Configuration parameters relating to the transport protocol + used by the BGP session to the peer"; + + leaf tcp-mss { + type uint16; + description + "Sets the max segment size for BGP TCP sessions."; + } + + leaf mtu-discovery { + type boolean; + default false; + description + "Turns path mtu discovery for BGP TCP sessions on (true) + or off (false)"; + } + + leaf passive-mode { + type boolean; + default false; + description + "Wait for peers to issue requests to open a BGP session, + rather than initiating sessions from the local router."; + } + + leaf local-address { + type union { + type oc-inet:ip-address; + type string; + } + //TODO: the string should be converted to a leafref type + //to point to an interface when YANG 1.1 is available with + //leafrefs in union types. + description + "Set the local IP (either IPv4 or IPv6) address to use + for the session when sending BGP update messages. This + may be expressed as either an IP address or reference + to the name of an interface."; + } + } + + grouping bgp-common-neighbor-group-error-handling-config { + description + "Configuration parameters relating to enhanced error handling + behaviours for BGP"; + + leaf treat-as-withdraw { + type boolean; + default "false"; + description + "Specify whether erroneous UPDATE messages for which the + NLRI can be extracted are reated as though the NLRI is + withdrawn - avoiding session reset"; + reference "draft-ietf-idr-error-handling-16"; + } + } + + grouping bgp-common-neighbor-group-logging-options-config { + description + "Configuration parameters specifying the logging behaviour for + BGP sessions to the peer"; + + leaf log-neighbor-state-changes { + type boolean; + default "true"; + description + "Configure logging of peer state changes. Default is + to enable logging of peer state changes."; + } + } + + grouping bgp-common-neighbor-group-multihop-config { + description + "Configuration parameters specifying the multihop behaviour for + BGP sessions to the peer"; + + leaf enabled { + type boolean; + default "false"; + description + "When enabled the referenced group or neighbors are permitted + to be indirectly connected - including cases where the TTL + can be decremented between the BGP peers"; + } + + leaf multihop-ttl { + type uint8; + description + "Time-to-live value to use when packets are sent to the + referenced group or neighbors and ebgp-multihop is enabled"; + } + } + + grouping bgp-common-neighbor-group-route-reflector-config { + description + "Configuration parameters determining whether the behaviour of + the local system when acting as a route-reflector"; + + leaf route-reflector-cluster-id { + type oc-bgp-types:rr-cluster-id-type; + description + "route-reflector cluster id to use when local router is + configured as a route reflector. Commonly set at the group + level, but allows a different cluster + id to be set for each neighbor."; + } + + leaf route-reflector-client { + type boolean; + default "false"; + description + "Configure the neighbor as a route reflector client."; + } + } + + grouping bgp-common-neighbor-group-as-path-options-config { + description + "Configuration parameters allowing manipulation of the AS_PATH + attribute"; + + leaf allow-own-as { + type uint8; + default 0; + description + "Specify the number of occurrences of the local BGP speaker's + AS that can occur within the AS_PATH before it is rejected."; + } + + leaf replace-peer-as { + type boolean; + default "false"; + description + "Replace occurrences of the peer's AS in the AS_PATH + with the local autonomous system number"; + } + } + + grouping bgp-common-neighbor-group-add-paths-config { + description + "Configuration parameters specfying whether the local system + will send or receive multiple paths using ADD_PATHS"; + + leaf receive { + type boolean; + default false; + description + "Enable ability to receive multiple path advertisements + for an NLRI from the neighbor or group"; + } + + leaf send-max { + type uint8; + description + "The maximum number of paths to advertise to neighbors + for a single NLRI"; + } + + leaf eligible-prefix-policy { + type leafref { + path "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" + + "oc-rpol:policy-definition/oc-rpol:name"; + } + description + "A reference to a routing policy which can be used to + restrict the prefixes for which add-paths is enabled"; + } + } + + grouping bgp-common-graceful-restart-config { + description + "Configuration parameters relating to BGP graceful restart."; + + leaf enabled { + type boolean; + description + "Enable or disable the graceful-restart capability."; + } + + leaf restart-time { + type uint16 { + range 0..4096; + } + description + "Estimated time (in seconds) for the local BGP speaker to + restart a session. This value is advertise in the graceful + restart BGP capability. This is a 12-bit value, referred to + as Restart Time in RFC4724. Per RFC4724, the suggested + default value is <= the hold-time value."; + } + + leaf stale-routes-time { + type decimal64 { + fraction-digits 2; + } + description + "An upper-bound on the time thate stale routes will be + retained by a router after a session is restarted. If an + End-of-RIB (EOR) marker is received prior to this timer + expiring stale-routes will be flushed upon its receipt - if + no EOR is received, then when this timer expires stale paths + will be purged. This timer is referred to as the + Selection_Deferral_Timer in RFC4724"; + } + + leaf helper-only { + type boolean; + description + "Enable graceful-restart in helper mode only. When this + leaf is set, the local system does not retain forwarding + its own state during a restart, but supports procedures + for the receiving speaker, as defined in RFC4724."; + } + } + + grouping bgp-common-use-multiple-paths-config { + description + "Generic configuration options relating to use of multiple + paths for a referenced AFI-SAFI, group or neighbor"; + + leaf enabled { + type boolean; + default false; + description + "Whether the use of multiple paths for the same NLRI is + enabled for the neighbor. This value is overridden by + any more specific configuration value."; + } + } + + grouping bgp-common-use-multiple-paths-ebgp-as-options-config { + description + "Configuration parameters specific to eBGP multipath applicable + to all contexts"; + + leaf allow-multiple-as { + type boolean; + default "false"; + description + "Allow multipath to use paths from different neighbouring + ASes. The default is to only consider multiple paths from + the same neighbouring AS."; + } + } + + grouping bgp-common-global-group-use-multiple-paths { + description + "Common grouping used for both global and groups which provides + configuration and state parameters relating to use of multiple + paths"; + + container use-multiple-paths { + description + "Parameters related to the use of multiple paths for the + same NLRI"; + + container config { + description + "Configuration parameters relating to multipath"; + uses bgp-common-use-multiple-paths-config; + } + container state { + config false; + description + "State parameters relating to multipath"; + uses bgp-common-use-multiple-paths-config; + } + + container ebgp { + description + "Multipath parameters for eBGP"; + container config { + description + "Configuration parameters relating to eBGP multipath"; + uses bgp-common-use-multiple-paths-ebgp-config; + } + container state { + config false; + description + "State information relating to eBGP multipath"; + uses bgp-common-use-multiple-paths-ebgp-config; + } + } + + container ibgp { + description + "Multipath parameters for iBGP"; + container config { + description + "Configuration parameters relating to iBGP multipath"; + uses bgp-common-use-multiple-paths-ibgp-config; + } + container state { + config false; + description + "State information relating to iBGP multipath"; + uses bgp-common-use-multiple-paths-ibgp-config; + } + } + } + } + + grouping bgp-common-use-multiple-paths-ebgp-config { + description + "Configuration parameters relating to multipath for eBGP"; + + leaf allow-multiple-as { + type boolean; + default "false"; + description + "Allow multipath to use paths from different neighbouring + ASes. The default is to only consider multiple paths from + the same neighbouring AS."; + } + + leaf maximum-paths { + type uint32; + default 1; + description + "Maximum number of parallel paths to consider when using + BGP multipath. The default is use a single path."; + } + } + + grouping bgp-common-use-multiple-paths-ibgp-config { + description + "Configuration parmaeters relating to multipath for iBGP"; + + leaf maximum-paths { + type uint32; + default 1; + description + "Maximum number of parallel paths to consider when using + iBGP multipath. The default is to use a single path"; + } + } + + grouping bgp-common-route-selection-options-config { + description + "Set of configuration options that govern best + path selection."; + + leaf always-compare-med { + type boolean; + default "false"; + description + "Compare multi-exit discriminator (MED) value from + different ASes when selecting the best route. The + default behavior is to only compare MEDs for paths + received from the same AS."; + } + + leaf ignore-as-path-length { + type boolean; + default "false"; + description + "Ignore the AS path length when selecting the best path. + The default is to use the AS path length and prefer paths + with shorter length."; + } + + leaf external-compare-router-id { + type boolean; + default "true"; + description + "When comparing similar routes received from external + BGP peers, use the router-id as a criterion to select + the active path."; + } + + leaf advertise-inactive-routes { + type boolean; + default "false"; + description + "Advertise inactive routes to external peers. The + default is to only advertise active routes."; + } + + leaf enable-aigp { + type boolean; + default false; + description + "Flag to enable sending / receiving accumulated IGP + attribute in routing updates"; + } + + leaf ignore-next-hop-igp-metric { + type boolean; + default "false"; + description + "Ignore the IGP metric to the next-hop when calculating + BGP best-path. The default is to select the route for + which the metric to the next-hop is lowest"; + } + } + + grouping bgp-common-route-selection-options { + description + "Configuration and state relating to route selection options"; + + container route-selection-options { + description + "Parameters relating to options for route selection"; + container config { + description + "Configuration parameters relating to route selection + options"; + uses bgp-common-route-selection-options-config; + } + container state { + config false; + description + "State information for the route selection options"; + uses bgp-common-route-selection-options-config; + } + } + } + + grouping bgp-common-state { + description + "Grouping containing common counters relating to prefixes and + paths"; + + leaf total-paths { + type uint32; + description + "Total number of BGP paths within the context"; + } + + leaf total-prefixes { + type uint32; + description + "Total number of BGP prefixes received within the context"; + } + } + + +} + diff --git a/yang/openconfig-nis/openconfig-bgp-global@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-global@2017-02-02.yang new file mode 100644 index 000000000..dd17b7b7d --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-global@2017-02-02.yang @@ -0,0 +1,365 @@ +submodule openconfig-bgp-global { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + import openconfig-yang-types { prefix oc-yang; } + import openconfig-inet-types { prefix oc-inet; } + + // Include common submodule + include openconfig-bgp-common; + include openconfig-bgp-common-multiprotocol; + include openconfig-bgp-peer-group; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains groupings that are specific to the + global context of the OpenConfig BGP module"; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-global-config { + description + "Global configuration options for the BGP router."; + + leaf as { + type oc-inet:as-number; + mandatory true; + description + "Local autonomous system number of the router. Uses + the 32-bit as-number type from the model in RFC 6991."; + } + + leaf router-id { + type oc-yang:dotted-quad; + description + "Router id of the router - an unsigned 32-bit integer + expressed in dotted quad notation."; + reference + "RFC4271 - A Border Gateway Protocol 4 (BGP-4), + Section 4.2"; + } + } + + grouping bgp-global-state { + description + "Operational state parameters for the BGP neighbor"; + + uses bgp-common-state; + } + + grouping bgp-global-default-route-distance-config { + description + "Configuration options relating to the administrative distance + (or preference) assigned to routes received from different + sources (external, internal, and local)."; + + leaf external-route-distance { + type uint8 { + range "1..255"; + } + description + "Administrative distance for routes learned from external + BGP (eBGP)."; + } + leaf internal-route-distance { + type uint8 { + range "1..255"; + } + description + "Administrative distance for routes learned from internal + BGP (iBGP)."; + } + } + + grouping bgp-global-confederation-config { + description + "Configuration options specifying parameters when the local + router is within an autonomous system which is part of a BGP + confederation."; + + leaf enabled { + type boolean; + description + "When this leaf is set to true it indicates that + the local-AS is part of a BGP confederation"; + } + + leaf identifier { + type oc-inet:as-number; + description + "Confederation identifier for the autonomous system."; + } + + leaf-list member-as { + type oc-inet:as-number; + description + "Remote autonomous systems that are to be treated + as part of the local confederation."; + } + } + + grouping bgp-global-dynamic-neighbors { + description + "Grouping containing configuration relating to dynamic peers."; + + container dynamic-neighbor-prefixes { + description + "A list of IP prefixes from which the system should: + - Accept connections to the BGP daemon + - Dynamically configure a BGP neighbor corresponding to the + source address of the remote system, using the parameters + of the specified peer-group. + For such neighbors, an entry within the neighbor list should + be created, indicating that the peer was dynamically + configured, and referencing the peer-group from which the + configuration was derived."; + + list dynamic-neighbor-prefix { + key "prefix"; + description + "An individual prefix from which dynamic neighbor + connections are allowed."; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the IP prefix from which source connections + are allowed for the dynamic neighbor group."; + } + + container config { + description + "Configuration parameters relating to the source prefix + for the dynamic BGP neighbor connections."; + + uses bgp-global-dynamic-neighbor-config; + } + + container state { + config false; + description + "Operational state parameters relating to the source + prefix for the dynamic BGP neighbor connections."; + + uses bgp-global-dynamic-neighbor-config; + } + } + } + } + + grouping bgp-global-dynamic-neighbor-config { + description + "Configuration parameters relating to an individual prefix from + which dynamic neighbors are accepted."; + + leaf prefix { + type oc-inet:ip-prefix; + description + "The IP prefix within which the source address of the remote + BGP speaker must fall to be considered eligible to the + dynamically configured."; } + + leaf peer-group { + type leafref { + // At bgp/global/dynamic-neighbor-prefixes/dynamic-neighbor + // prefix/config/peer-group + path "../../../../../peer-groups/peer-group/config/" + + "peer-group-name"; + } + description + "The peer-group within which the dynamic neighbor will be + configured. The configuration parameters used for the dynamic + neighbor are those specified within the referenced peer + group."; + } + } + + grouping bgp-global-mp-all-afi-safi-list-contents { + description + "A grouping used for contents of the list of AFI-SAFI + entries at the global BGP level."; + + // import and export policy included for the afi/safi + + uses bgp-common-mp-ipv4-unicast-group; + uses bgp-common-mp-ipv6-unicast-group; + uses bgp-common-mp-ipv4-labeled-unicast-group; + uses bgp-common-mp-ipv6-labeled-unicast-group; + uses bgp-common-mp-l3vpn-ipv4-unicast-group; + uses bgp-common-mp-l3vpn-ipv6-unicast-group; + uses bgp-common-mp-l3vpn-ipv4-multicast-group; + uses bgp-common-mp-l3vpn-ipv6-multicast-group; + uses bgp-common-mp-l2vpn-vpls-group; + uses bgp-common-mp-l2vpn-evpn-group; + } + + grouping bgp-global-afi-safi-list { + description + "List of address-families associated with the BGP instance"; + + list afi-safi { + key "afi-safi-name"; + + description + "AFI,SAFI configuration available for the + neighbour or group"; + + leaf afi-safi-name { + type leafref { + path "../config/afi-safi-name"; + } + description + "Reference to the AFI-SAFI name used as a key + for the AFI-SAFI list"; + } + + container config { + description + "Configuration parameters for the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + } + container state { + config false; + description + "State information relating to the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + uses bgp-common-state; + } + + container graceful-restart { + description + "Parameters relating to BGP graceful-restart"; + container config { + description + "Configuration options for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + } + container state { + config false; + description + "State information for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + } + } + + uses bgp-common-route-selection-options; + uses bgp-common-global-group-use-multiple-paths; + uses bgp-global-mp-all-afi-safi-list-contents; + } + } + + // Structural groupings + grouping bgp-global-base { + description + "Global configuration parameters for the BGP router"; + + container config { + description + "Configuration parameters relating to the global BGP router"; + uses bgp-global-config; + } + container state { + config false; + description + "State information relating to the global BGP router"; + uses bgp-global-config; + uses bgp-global-state; + } + + container default-route-distance { + description + "Administrative distance (or preference) assigned to + routes received from different sources + (external, internal, and local)."; + + container config { + description + "Configuration parameters relating to the default route + distance"; + uses bgp-global-default-route-distance-config; + } + container state { + config false; + description + "State information relating to the default route distance"; + uses bgp-global-default-route-distance-config; + } + } + + container confederation { + description + "Parameters indicating whether the local system acts as part + of a BGP confederation"; + + container config { + description + "Configuration parameters relating to BGP confederations"; + uses bgp-global-confederation-config; + } + container state { + config false; + description + "State information relating to the BGP confederations"; + uses bgp-global-confederation-config; + } + } + + container graceful-restart { + description + "Parameters relating the graceful restart mechanism for BGP"; + container config { + description + "Configuration parameters relating to graceful-restart"; + uses bgp-common-graceful-restart-config; + } + container state { + config false; + description + "State information associated with graceful-restart"; + uses bgp-common-graceful-restart-config; + } + } + + uses bgp-common-global-group-use-multiple-paths; + uses bgp-common-route-selection-options; + + container afi-safis { + description + "Address family specific configuration"; + uses bgp-global-afi-safi-list; + } + + uses bgp-global-dynamic-neighbors; + } + +} diff --git a/yang/openconfig-nis/openconfig-bgp-neighbor@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-neighbor@2017-02-02.yang new file mode 100644 index 000000000..5bb2d0eee --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-neighbor@2017-02-02.yang @@ -0,0 +1,641 @@ +submodule openconfig-bgp-neighbor { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + import openconfig-routing-policy { prefix oc-rpol; } + import openconfig-types { prefix oc-types; } + import openconfig-bgp-types { prefix oc-bgp-types; } + import openconfig-inet-types { prefix oc-inet; } + import openconfig-yang-types { prefix oc-yang; } + + // Include the common submodule + include openconfig-bgp-common; + include openconfig-bgp-common-multiprotocol; + include openconfig-bgp-peer-group; + include openconfig-bgp-common-structure; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains groupings that are specific to the + neighbor context of the OpenConfig BGP module."; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-neighbor-config { + description + "Configuration parameters relating to a base BGP neighbor that + are not also applicable to any other context + (e.g., peer group)"; + + leaf peer-group { + type leafref { + path "../../../../peer-groups/peer-group/peer-group-name"; + } + description + "The peer-group with which this neighbor is associated"; + } + + leaf neighbor-address { + type oc-inet:ip-address; + description + "Address of the BGP peer, either in IPv4 or IPv6"; + } + + leaf enabled { + type boolean; + default true; + description + "Whether the BGP peer is enabled. In cases where the + enabled leaf is set to false, the local system should not + initiate connections to the neighbor, and should not + respond to TCP connections attempts from the neighbor. If + the state of the BGP session is ESTABLISHED at the time + that this leaf is set to false, the BGP session should be + ceased."; + } + } + + grouping bgp-neighbor-use-multiple-paths { + description + "Multipath configuration and state applicable to a BGP + neighbor"; + + container use-multiple-paths { + description + "Parameters related to the use of multiple-paths for the same + NLRI when they are received only from this neighbor"; + + container config { + description + "Configuration parameters relating to multipath"; + uses bgp-common-use-multiple-paths-config; + } + container state { + config false; + description + "State parameters relating to multipath"; + uses bgp-common-use-multiple-paths-config; + } + + container ebgp { + description + "Multipath configuration for eBGP"; + container config { + description + "Configuration parameters relating to eBGP multipath"; + uses bgp-common-use-multiple-paths-ebgp-as-options-config; + } + container state { + config false; + description + "State information relating to eBGP multipath"; + uses bgp-common-use-multiple-paths-ebgp-as-options-config; + } + } + } + } + + grouping bgp-neighbor-state { + description + "Operational state parameters relating only to a BGP neighbor"; + + leaf session-state { + type enumeration { + enum IDLE { + description + "neighbor is down, and in the Idle state of the + FSM"; + } + enum CONNECT { + description + "neighbor is down, and the session is waiting for + the underlying transport session to be established"; + } + enum ACTIVE { + description + "neighbor is down, and the local system is awaiting + a conncetion from the remote peer"; + } + enum OPENSENT { + description + "neighbor is in the process of being established. + The local system has sent an OPEN message"; + } + enum OPENCONFIRM { + description + "neighbor is in the process of being established. + The local system is awaiting a NOTIFICATION or + KEEPALIVE message"; + } + enum ESTABLISHED { + description + "neighbor is up - the BGP session with the peer is + established"; + } + } + description + "Operational state of the BGP peer"; + } + + leaf last-established { + type oc-types:timeticks64; + description + "This timestamp indicates the time that the + BGP session last transitioned in or out of the Established + state. The value is the timestamp in seconds relative to + the Unix Epoch (Jan 1, 1970 00:00:00 UTC). + + The BGP session uptime can be computed by clients as the + difference between this value and the current time in UTC + (assuming the session is in the ESTABLISHED state, per the + session-state leaf)."; + } + + leaf established-transitions { + type oc-yang:counter64; + description + "Number of transitions to the Established state for + the neighbor session. This value is analogous to the + bgpPeerFsmEstablishedTransitions object from the standard + BGP-4 MIB"; + reference + "RFC 4273 - Definitions of Managed Objects for BGP-4"; + } + + leaf-list supported-capabilities { + type identityref { + base oc-bgp-types:BGP_CAPABILITY; + } + description + "BGP capabilities negotiated as supported with the peer"; + } + + container messages { + description + "Counters for BGP messages sent and received from the + neighbor"; + container sent { + description + "Counters relating to BGP messages sent to the neighbor"; + uses bgp-neighbor-counters-message-types-state; + } + + container received { + description + "Counters for BGP messages received from the neighbor"; + uses bgp-neighbor-counters-message-types-state; + } + } + + container queues { + description + "Counters related to queued messages associated with the + BGP neighbor"; + uses bgp-neighbor-queue-counters-state; + } + + leaf dynamically-configured { + type boolean; + default false; + description + "When this leaf is set to true, the peer was configured dynamically + due to an inbound connection request from a specified source prefix + within a dynamic-neighbor-prefix."; + } + } + + grouping bgp-neighbor-counters-message-types-state { + description + "Grouping of BGP message types, included for re-use + across counters"; + + leaf UPDATE { + type uint64; + description + "Number of BGP UPDATE messages announcing, withdrawing + or modifying paths exchanged."; + } + + leaf NOTIFICATION { + type uint64; + description + "Number of BGP NOTIFICATION messages indicating an + error condition has occurred exchanged."; + } + } + + grouping bgp-neighbor-queue-counters-state { + description + "Counters relating to the message queues associated with the + BGP peer"; + + leaf input { + type uint32; + description + "The number of messages received from the peer currently + queued"; + } + + leaf output { + type uint32; + description + "The number of messages queued to be sent to the peer"; + } + } + + grouping bgp-neighbor-transport-state { + description + "Operational state parameters relating to the transport session + used for the BGP session"; + + leaf local-port { + type oc-inet:port-number; + description + "Local TCP port being used for the TCP session supporting + the BGP session"; + } + + leaf remote-address { + type oc-inet:ip-address; + description + "Remote address to which the BGP session has been + established"; + } + + leaf remote-port { + type oc-inet:port-number; + description + "Remote port being used by the peer for the TCP session + supporting the BGP session"; + } + } + + grouping bgp-neighbor-error-handling-state { + description + "Operational state parameters relating to enhanced error + error handling for BGP"; + + leaf erroneous-update-messages { + type uint32; + description + "The number of BGP UPDATE messages for which the + treat-as-withdraw mechanism has been applied based + on erroneous message contents"; + } + } + + grouping bgp-neighbor-timers-state { + description + "Operational state parameters relating to BGP timers associated + with the BGP session"; + + leaf negotiated-hold-time { + type decimal64 { + fraction-digits 2; + } + description + "The negotiated hold-time for the BGP session"; + } + } + + grouping bgp-neighbor-afi-safi-graceful-restart-state { + description + "Operational state variables relating to the graceful-restart + mechanism on a per-AFI-SAFI basis"; + + leaf received { + type boolean; + description + "This leaf indicates whether the neighbor advertised the + ability to support graceful-restart for this AFI-SAFI"; + } + + leaf advertised { + type boolean; + description + "This leaf indicates whether the ability to support + graceful-restart has been advertised to the peer"; + } + } + + grouping bgp-neighbor-graceful-restart-state { + description + "Operational state information relevant to graceful restart + for BGP"; + + leaf peer-restart-time { + type uint16 { + range 0..4096; + } + description + "The period of time (advertised by the peer) that + the peer expects a restart of a BGP session to + take"; + } + + leaf peer-restarting { + type boolean; + description + "This flag indicates whether the remote neighbor is currently + in the process of restarting, and hence received routes are + currently stale"; + } + + leaf local-restarting { + type boolean; + description + "This flag indicates whether the local neighbor is currently + restarting. The flag is unset after all NLRI have been + advertised to the peer, and the End-of-RIB (EOR) marker has + been unset"; + } + + leaf mode { + type enumeration { + enum HELPER_ONLY { + description + "The local router is operating in helper-only mode, and + hence will not retain forwarding state during a local + session restart, but will do so during a restart of the + remote peer"; + } + enum BILATERAL { + description + "The local router is operating in both helper mode, and + hence retains forwarding state during a remote restart, + and also maintains forwarding state during local session + restart"; + } + enum REMOTE_HELPER { + description + "The local system is able to retain routes during restart + but the remote system is only able to act as a helper"; + } + } + description + "Ths leaf indicates the mode of operation of BGP graceful + restart with the peer"; + } + } + + grouping bgp-neighbor-afi-safi-state { + description + "Operational state parameters relating to an individual AFI, + SAFI for a neighbor"; + + leaf active { + type boolean; + description + "This value indicates whether a particular AFI-SAFI has + been succesfully negotiated with the peer. An AFI-SAFI + may be enabled in the current running configuration, but a + session restart may be required in order to negotiate the new + capability."; + } + + container prefixes { + description "Prefix counters for the BGP session"; + leaf received { + type uint32; + description + "The number of prefixes received from the neighbor"; + } + + leaf sent { + type uint32; + description + "The number of prefixes advertised to the neighbor"; + } + + leaf installed { + type uint32; + description + "The number of advertised prefixes installed in the + Loc-RIB"; + } + } + } + + grouping bgp-neighbor-afi-safi-list { + description + "List of address-families associated with the BGP neighbor"; + + list afi-safi { + key "afi-safi-name"; + + description + "AFI,SAFI configuration available for the + neighbour or group"; + + + leaf afi-safi-name { + type leafref { + path "../config/afi-safi-name"; + } + description + "Reference to the AFI-SAFI name used as a key + for the AFI-SAFI list"; + } + + container config { + description + "Configuration parameters for the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + } + container state { + config false; + description + "State information relating to the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + uses bgp-neighbor-afi-safi-state; + } + + + container graceful-restart { + description + "Parameters relating to BGP graceful-restart"; + container config { + description + "Configuration options for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + } + container state { + config false; + description + "State information for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + uses bgp-neighbor-afi-safi-graceful-restart-state; + } + } + + uses bgp-common-mp-all-afi-safi-list-contents; + uses bgp-neighbor-use-multiple-paths; + } + } + + grouping bgp-neighbor-base { + description + "Parameters related to a BGP neighbor"; + + container config { + description + "Configuration parameters relating to the BGP neighbor or + group"; + uses bgp-neighbor-config; + uses bgp-common-neighbor-group-config; + } + container state { + config false; + description + "State information relating to the BGP neighbor"; + uses bgp-neighbor-config; + uses bgp-common-neighbor-group-config; + uses bgp-neighbor-state; + } + + container timers { + description + "Timers related to a BGP neighbor"; + container config { + description + "Configuration parameters relating to timers used for the + BGP neighbor"; + uses bgp-common-neighbor-group-timers-config; + } + container state { + config false; + description + "State information relating to the timers used for the BGP + neighbor"; + uses bgp-common-neighbor-group-timers-config; + uses bgp-neighbor-timers-state; + } + } + + container transport { + description + "Transport session parameters for the BGP neighbor"; + container config { + description + "Configuration parameters relating to the transport + session(s) used for the BGP neighbor"; + uses bgp-common-neighbor-group-transport-config; + } + container state { + config false; + description + "State information relating to the transport session(s) + used for the BGP neighbor"; + uses bgp-common-neighbor-group-transport-config; + uses bgp-neighbor-transport-state; + } + } + + container error-handling { + description + "Error handling parameters used for the BGP neighbor or + group"; + container config { + description + "Configuration parameters enabling or modifying the + behavior or enhanced error handling mechanisms for the BGP + neighbor"; + uses bgp-common-neighbor-group-error-handling-config; + } + container state { + config false; + description + "State information relating to enhanced error handling + mechanisms for the BGP neighbor"; + uses bgp-common-neighbor-group-error-handling-config; + uses bgp-neighbor-error-handling-state; + } + } + + container graceful-restart { + description + "Parameters relating the graceful restart mechanism for BGP"; + container config { + description + "Configuration parameters relating to graceful-restart"; + uses bgp-common-graceful-restart-config; + } + container state { + config false; + description + "State information associated with graceful-restart"; + uses bgp-common-graceful-restart-config; + uses bgp-neighbor-graceful-restart-state; + } + } + + uses bgp-common-structure-neighbor-group-logging-options; + uses bgp-common-structure-neighbor-group-ebgp-multihop; + uses bgp-common-structure-neighbor-group-route-reflector; + uses bgp-common-structure-neighbor-group-as-path-options; + uses bgp-common-structure-neighbor-group-add-paths; + uses bgp-neighbor-use-multiple-paths; + uses oc-rpol:apply-policy-group; + + container afi-safis { + description + "Per-address-family configuration parameters associated with + the neighbor"; + uses bgp-neighbor-afi-safi-list; + } + } + + grouping bgp-neighbor-list { + description + "The list of BGP neighbors"; + + list neighbor { + key "neighbor-address"; + description + "List of BGP neighbors configured on the local system, + uniquely identified by peer IPv[46] address"; + + leaf neighbor-address { + type leafref { + path "../config/neighbor-address"; + } + description + "Reference to the address of the BGP neighbor used as + a key in the neighbor list"; + } + + uses bgp-neighbor-base; + } + + } + + +} diff --git a/yang/openconfig-nis/openconfig-bgp-peer-group@2017-02-02.yang b/yang/openconfig-nis/openconfig-bgp-peer-group@2017-02-02.yang new file mode 100644 index 000000000..2c60bd84e --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-peer-group@2017-02-02.yang @@ -0,0 +1,247 @@ +submodule openconfig-bgp-peer-group { + + belongs-to openconfig-bgp { + prefix "oc-bgp"; + } + + import openconfig-extensions { prefix oc-ext; } + import openconfig-routing-policy { prefix oc-rpol; } + + // Include the common submodule + include openconfig-bgp-common; + include openconfig-bgp-common-multiprotocol; + include openconfig-bgp-common-structure; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This sub-module contains groupings that are specific to the + peer-group context of the OpenConfig BGP module."; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + grouping bgp-peer-group-config { + description + "Configuration parameters relating to a base BGP peer group that + are not also applicable to any other context (e.g., neighbor)"; + + leaf peer-group-name { + type string; + description + "Name of the BGP peer-group"; + } + + } + + grouping bgp-peer-group-afi-safi-list { + description + "List of address-families associated with the BGP peer-group"; + + list afi-safi { + key "afi-safi-name"; + + description + "AFI,SAFI configuration available for the + neighbour or group"; + + leaf afi-safi-name { + type leafref { + path "../config/afi-safi-name"; + } + description + "Reference to the AFI-SAFI name used as a key + for the AFI-SAFI list"; + } + + container config { + description + "Configuration parameters for the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + } + container state { + config false; + description + "State information relating to the AFI-SAFI"; + uses bgp-common-mp-afi-safi-config; + } + + container graceful-restart { + description + "Parameters relating to BGP graceful-restart"; + container config { + description + "Configuration options for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + } + container state { + config false; + description + "State information for BGP graceful-restart"; + uses bgp-common-mp-afi-safi-graceful-restart-config; + } + } + + uses bgp-common-route-selection-options; + uses bgp-common-global-group-use-multiple-paths; + uses bgp-common-mp-all-afi-safi-list-contents; + } + } + + grouping bgp-peer-group-base { + description + "Parameters related to a BGP group"; + + container config { + description + "Configuration parameters relating to the BGP neighbor or + group"; + uses bgp-peer-group-config; + uses bgp-common-neighbor-group-config; + } + container state { + config false; + description + "State information relating to the BGP peer-group"; + uses bgp-peer-group-config; + uses bgp-common-neighbor-group-config; + uses bgp-common-state; + } + + container timers { + description + "Timers related to a BGP peer-group"; + + container config { + description + "Configuration parameters relating to timers used for the + BGP neighbor or peer group"; + uses bgp-common-neighbor-group-timers-config; + } + container state { + config false; + description + "State information relating to the timers used for the BGP + group"; + uses bgp-common-neighbor-group-timers-config; + } + } + + container transport { + description + "Transport session parameters for the BGP peer-group"; + + container config { + description + "Configuration parameters relating to the transport + session(s) used for the BGP neighbor or group"; + uses bgp-common-neighbor-group-transport-config; + } + container state { + config false; + description + "State information relating to the transport session(s) + used for the BGP neighbor or group"; + uses bgp-common-neighbor-group-transport-config; + } + } + + container error-handling { + description + "Error handling parameters used for the BGP peer-group"; + + container config { + description + "Configuration parameters enabling or modifying the + behavior or enhanced error handling mechanisms for the BGP + group"; + uses bgp-common-neighbor-group-error-handling-config; + } + container state { + config false; + description + "State information relating to enhanced error handling + mechanisms for the BGP group"; + uses bgp-common-neighbor-group-error-handling-config; + } + } + + container graceful-restart { + description + "Parameters relating the graceful restart mechanism for BGP"; + container config { + description + "Configuration parameters relating to graceful-restart"; + uses bgp-common-graceful-restart-config; + } + container state { + config false; + description + "State information associated with graceful-restart"; + uses bgp-common-graceful-restart-config; + } + } + + uses bgp-common-structure-neighbor-group-logging-options; + uses bgp-common-structure-neighbor-group-ebgp-multihop; + uses bgp-common-structure-neighbor-group-route-reflector; + uses bgp-common-structure-neighbor-group-as-path-options; + uses bgp-common-structure-neighbor-group-add-paths; + uses bgp-common-global-group-use-multiple-paths; + uses oc-rpol:apply-policy-group; + + container afi-safis { + description + "Per-address-family configuration parameters associated with + thegroup"; + uses bgp-peer-group-afi-safi-list; + } + } + + grouping bgp-peer-group-list { + description + "The list of BGP peer groups"; + + list peer-group { + key "peer-group-name"; + description + "List of BGP peer-groups configured on the local system - + uniquely identified by peer-group name"; + + leaf peer-group-name { + type leafref { + path "../config/peer-group-name"; + } + description + "Reference to the name of the BGP peer-group used as a + key in the peer-group list"; + } + + uses bgp-peer-group-base; + } + } + +} diff --git a/yang/openconfig-nis/openconfig-bgp-types.yang b/yang/openconfig-nis/openconfig-bgp-types.yang new file mode 100644 index 000000000..e29f0e4b3 --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp-types.yang @@ -0,0 +1,538 @@ +module openconfig-bgp-types { + yang-version "1"; + + namespace "http://openconfig.net/yang/bgp-types"; + + prefix "oc-bgp-types"; + + import openconfig-types { prefix "oc-types"; } + import openconfig-inet-types { prefix "oc-inet"; } + import openconfig-extensions { prefix "oc-ext"; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module contains general data definitions for use in BGP + policy. It can be imported by modules that make use of BGP + attributes"; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + + identity BGP_CAPABILITY { + description "Base identity for a BGP capability"; + } + + identity MPBGP { + base BGP_CAPABILITY; + description + "Multi-protocol extensions to BGP"; + reference "RFC2858"; + } + + identity ROUTE_REFRESH { + base BGP_CAPABILITY; + description + "The BGP route-refresh functionality"; + reference "RFC2918"; + } + + identity ASN32 { + base BGP_CAPABILITY; + description + "4-byte (32-bit) AS number functionality"; + reference "RFC6793"; + } + + identity GRACEFUL_RESTART { + base BGP_CAPABILITY; + description + "Graceful restart functionality"; + reference "RFC4724"; + } + + identity ADD_PATHS { + base BGP_CAPABILITY; + description + "BGP add-paths"; + reference "draft-ietf-idr-add-paths"; + } + + identity AFI_SAFI_TYPE { + description + "Base identity type for AFI,SAFI tuples for BGP-4"; + reference "RFC4760 - multiprotocol extensions for BGP-4"; + } + + identity IPV4_UNICAST { + base AFI_SAFI_TYPE; + description + "IPv4 unicast (AFI,SAFI = 1,1)"; + reference "RFC4760"; + } + + identity IPV6_UNICAST { + base AFI_SAFI_TYPE; + description + "IPv6 unicast (AFI,SAFI = 2,1)"; + reference "RFC4760"; + } + + identity IPV4_LABELED_UNICAST { + base AFI_SAFI_TYPE; + description + "Labeled IPv4 unicast (AFI,SAFI = 1,4)"; + reference "RFC3107"; + } + + identity IPV6_LABELED_UNICAST { + base AFI_SAFI_TYPE; + description + "Labeled IPv6 unicast (AFI,SAFI = 2,4)"; + reference "RFC3107"; + } + + identity L3VPN_IPV4_UNICAST { + base AFI_SAFI_TYPE; + description + "Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)"; + reference "RFC4364"; + } + + identity L3VPN_IPV6_UNICAST { + base AFI_SAFI_TYPE; + description + "Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)"; + reference "RFC4659"; + } + + identity L3VPN_IPV4_MULTICAST { + base AFI_SAFI_TYPE; + description + "Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)"; + reference "RFC6514"; + } + + identity L3VPN_IPV6_MULTICAST { + base AFI_SAFI_TYPE; + description + "Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)"; + reference "RFC6514"; + } + + identity L2VPN_VPLS { + base AFI_SAFI_TYPE; + description + "BGP-signalled VPLS (AFI,SAFI = 25,65)"; + reference "RFC4761"; + } + + identity L2VPN_EVPN { + base AFI_SAFI_TYPE; + description + "BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)"; + } + + identity BGP_WELL_KNOWN_STD_COMMUNITY { + description + "Reserved communities within the standard community space + defined by RFC1997. These communities must fall within the + range 0x00000000 to 0xFFFFFFFF"; + reference "RFC1997"; + } + + identity NO_EXPORT { + base BGP_WELL_KNOWN_STD_COMMUNITY; + description + "Do not export NLRI received carrying this community outside + the bounds of this autonomous system, or this confederation if + the local autonomous system is a confederation member AS. This + community has a value of 0xFFFFFF01."; + reference "RFC1997"; + } + + identity NO_ADVERTISE { + base BGP_WELL_KNOWN_STD_COMMUNITY; + description + "All NLRI received carrying this community must not be + advertised to other BGP peers. This community has a value of + 0xFFFFFF02."; + reference "RFC1997"; + } + + identity NO_EXPORT_SUBCONFED { + base BGP_WELL_KNOWN_STD_COMMUNITY; + description + "All NLRI received carrying this community must not be + advertised to external BGP peers - including over confederation + sub-AS boundaries. This community has a value of 0xFFFFFF03."; + reference "RFC1997"; + } + + identity NOPEER { + base BGP_WELL_KNOWN_STD_COMMUNITY; + description + "An autonomous system receiving NLRI tagged with this community + is advised not to readvertise the NLRI to external bi-lateral + peer autonomous systems. An AS may also filter received NLRI + from bilateral peer sessions when they are tagged with this + community value"; + reference "RFC3765"; + } + + typedef bgp-session-direction { + type enumeration { + enum INBOUND { + description + "Refers to all NLRI received from the BGP peer"; + } + enum OUTBOUND { + description + "Refers to all NLRI advertised to the BGP peer"; + } + } + description + "Type to describe the direction of NLRI transmission"; + } + + typedef bgp-well-known-community-type { + type identityref { + base BGP_WELL_KNOWN_STD_COMMUNITY; + } + description + "Type definition for well-known IETF community attribute + values"; + reference + "IANA Border Gateway Protocol (BGP) Well Known Communities"; + } + + + typedef bgp-std-community-type { + // TODO: further refine restrictions and allowed patterns + // 4-octet value: + // 2 octets + // 2 octets + type union { + type uint32 { + // per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 - + // 0xFFFFFFFF are reserved + range "65536..4294901759"; // 0x00010000..0xFFFEFFFF + } + type string { + pattern '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + } + description + "Type definition for standard commmunity attributes represented as + a integer value, or a string of the form N:M where N and M are + integers between 0 and 65535."; + reference "RFC 1997 - BGP Communities Attribute"; + } + + typedef bgp-ext-community-type { + type union { + type string { + // Type 1: 2-octet global and 4-octet local + // (AS number) (Integer) + pattern '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' + + '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9])'; + } + type string { + // Type 2: 4-octet global and 2-octet local + // (ipv4-address) (integer) + pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' + + '2[0-4][0-9]|25[0-5]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + type string { + // RFC5668: 4-octet global and 2-octet local + // (AS number) (integer) + pattern '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + type string { + // route-target with Type 1 + // route-target:(ASN):(local-part) + pattern 'route\-target:' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' + + '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9])'; + } + type string { + // route-target with Type 2 + // route-target:(IPv4):(local-part) + pattern 'route\-target:' + + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' + + '2[0-4][0-9]|25[0-5]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + type string { + // 4-byte AS Type 1 route-target + pattern 'route\-target:' + + '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + type string { + // route-origin with Type 1 + pattern 'route\-origin:' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9]):' + + '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9])'; + } + type string { + // route-origin with Type 2 + pattern 'route\-origin:' + + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' + + '2[0-4][0-9]|25[0-5]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + type string { + // 4-byte AS Type 1 route-origin + pattern 'route\-origin:' + + '(429496729[0-5]|42949672[0-8][0-9]|4294967[0-1][0-9]{2}' + + '|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|' + + '429[0-3][0-9]{6}|4[0-1][0-9]{7}|[1-3][0-9]{9}|' + + '[1-9][0-9]{1,8}|[0-9]):' + + '(6553[0-5]|655[0-2][0-9]|654[0-9]{2}|65[0-4][0-9]{2}' + + '|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{1,3}|[0-9])'; + } + } + description + "Type definition for extended community attributes. In the case that + common communities are utilised, they are represented as a string + of the form: + - <2b AS>:<4b value> per RFC4360 section 3.1 + - <4b IPv4>:<2b value> per RFC4360 section 3.2 + - <4b AS>:<2b value> per RFC5668 section 2. + - route-target:<2b AS>:<4b value> per RFC4360 section 4 + - route-target:<4b IPv4>:<2b value> per RFC4360 section 4 + - route-origin:<2b ASN>:<4b value> per RFC4360 section 5 + - route-origin:<4b IPv4>:<2b value> per RFC4360 section 5"; + reference + "RFC 4360 - BGP Extended Communities Attribute + RFC 5668 - 4-Octet AS Specific BGP Extended Community"; + } + + typedef bgp-ext-community-recv-type { + type union { + type bgp-ext-community-type; + type binary { + length 8; + } + } + description + "A type definition utilised to define the extended community in a + context where the system is receiving the extended community from + an external source, such that the value may be unknown. In the case + that the received extended community is unknown it is defined to be + a 8-octet quantity formatted according to RFC4360: + + Type Field: 1 or 2 octets. + Value Field: Remaining octets. + + The high-order octet of the type field is encoded such that bit 0 + indicates whether the extended community type is IANA assigned; + and bit 1 indicates whether the extended community is transitive. + The remaining bits of the high-order type field must be interpreted + to determine whether the low-order type field should be parsed, + or whether the entire remainder of the extended community is a + value."; + reference + "RFC 4360 - BGP Extended Communities Attribute + RFC 5668 - 4-Octet AS Specific BGP Extended Community"; + } + + typedef bgp-community-regexp-type { + // TODO: needs more work to decide what format these regexps can + // take. + type oc-types:std-regexp; + description + "Type definition for communities specified as regular + expression patterns"; + } + + typedef bgp-origin-attr-type { + type enumeration { + enum IGP { + description + "Origin of the NLRI is internal"; + } + enum EGP { + description + "Origin of the NLRI is EGP"; + } + enum INCOMPLETE { + description + "Origin of the NLRI is neither IGP or EGP"; + } + } + description + "Type definition for standard BGP origin attribute"; + reference "RFC 4271 - A Border Gateway Protocol 4 (BGP-4), + Sec 4.3"; + } + + typedef peer-type { + type enumeration { + enum INTERNAL { + description + "Internal (iBGP) peer"; + } + enum EXTERNAL { + description + "External (eBGP) peer"; + } + } + description + "Labels a peer or peer group as explicitly internal or + external"; + } + + identity REMOVE_PRIVATE_AS_OPTION { + description + "Base identity for options for removing private autonomous + system numbers from the AS_PATH attribute"; + } + + identity PRIVATE_AS_REMOVE_ALL { + base REMOVE_PRIVATE_AS_OPTION; + description + "Strip all private autonmous system numbers from the AS_PATH. + This action is performed regardless of the other content of the + AS_PATH attribute, and for all instances of private AS numbers + within that attribute."; + } + + identity PRIVATE_AS_REPLACE_ALL { + base REMOVE_PRIVATE_AS_OPTION; + description + "Replace all instances of private autonomous system numbers in + the AS_PATH with the local BGP speaker's autonomous system + number. This action is performed regardless of the other + content of the AS_PATH attribute, and for all instances of + private AS number within that attribute."; + } + + typedef remove-private-as-option { + type identityref { + base REMOVE_PRIVATE_AS_OPTION; + } + description + "Set of options for configuring how private AS path numbers + are removed from advertisements"; + } + + typedef rr-cluster-id-type { + type union { + type uint32; + type oc-inet:ipv4-address; + } + description + "Union type for route reflector cluster ids: + option 1: 4-byte number + option 2: IP address"; + } + + typedef community-type { + type enumeration { + enum STANDARD { + description "Send only standard communities"; + } + enum EXTENDED { + description "Send only extended communities"; + } + enum BOTH { + description "Send both standard and extended communities"; + } + enum NONE { + description "Do not send any community attribute"; + } + } + description + "type describing variations of community attributes: + STANDARD: standard BGP community [rfc1997] + EXTENDED: extended BGP community [rfc4360] + BOTH: both standard and extended community"; + } + + + typedef as-path-segment-type { + type enumeration { + enum AS_SEQ { + description + "Ordered set of autonomous systems that a route in + the UPDATE message has traversed"; + } + enum AS_SET { + description + "Unordered set of autonomous systems that a route in + the UPDATE message has traversed"; + } + enum AS_CONFED_SEQUENCE { + description + "Ordered set of Member Autonomous + Systems in the local confederation that the UPDATE message + has traversed"; + } + enum AS_CONFED_SET { + description + "Unordered set of Member Autonomous Systems + in the local confederation that the UPDATE message has + traversed"; + } + } + description + "Defines the types of BGP AS path segments."; + } +} diff --git a/yang/openconfig-nis/openconfig-bgp.yang b/yang/openconfig-nis/openconfig-bgp.yang new file mode 100644 index 000000000..96579a182 --- /dev/null +++ b/yang/openconfig-nis/openconfig-bgp.yang @@ -0,0 +1,124 @@ +module openconfig-bgp { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/bgp"; + + prefix "oc-bgp"; + + // import some basic inet types + import openconfig-extensions { prefix oc-ext; } + + // Include the OpenConfig BGP submodules + // Common: defines the groupings that are common across more than + // one context (where contexts are neighbor, group, global) + include openconfig-bgp-common; + // Multiprotocol: defines the groupings that are common across more + // than one context, and relate to Multiprotocol + include openconfig-bgp-common-multiprotocol; + // Structure: defines groupings that are shared but are solely used for + // structural reasons. + include openconfig-bgp-common-structure; + // Include peer-group/neighbor/global - these define the groupings + // that are specific to one context + include openconfig-bgp-peer-group; + include openconfig-bgp-neighbor; + include openconfig-bgp-global; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module describes a YANG model for BGP protocol + configuration.It is a limited subset of all of the configuration + parameters available in the variety of vendor implementations, + hence it is expected that it would be augmented with vendor- + specific configuration data as needed. Additional modules or + submodules to handle other aspects of BGP configuration, + including policy, VRFs, VPNs, and additional address families + are also expected. + + This model supports the following BGP configuration level + hierarchy: + + BGP + | + +-> [ global BGP configuration ] + +-> AFI / SAFI global + +-> peer group + +-> [ peer group config ] + +-> AFI / SAFI [ per-AFI overrides ] + +-> neighbor + +-> [ neighbor config ] + +-> [ optional pointer to peer-group ] + +-> AFI / SAFI [ per-AFI overrides ]"; + + oc-ext:openconfig-version "3.0.1"; + + revision "2017-02-02" { + description + "Bugfix to remove remaining global-level policy data"; + reference "3.0.1"; + } + + revision "2017-01-26" { + description + "Add dynamic neighbor support, migrate to OpenConfig types"; + reference "3.0.0"; + } + + revision "2016-06-21" { + description + "OpenConfig BGP refactor"; + reference "2.1.1"; + } + + revision "2016-06-06" { + description + "OpenConfig public release"; + reference "2.1.0"; + } + + revision "2016-03-31" { + description + "OpenConfig public release"; + reference "2.0.1"; + } + + grouping bgp-top { + description + "Top-level grouping for the BGP model data"; + + container bgp { + description + "Top-level configuration and state for the BGP router"; + + container global { + description + "Global configuration for the BGP router"; + uses bgp-global-base; + } + + container neighbors { + description + "Configuration for BGP neighbors"; + uses bgp-neighbor-list; + } + + container peer-groups { + description + "Configuration for BGP peer-groups"; + uses bgp-peer-group-list; + } + } + } + + uses bgp-top; + +} diff --git a/yang/openconfig-nis/openconfig-extensions.yang b/yang/openconfig-nis/openconfig-extensions.yang new file mode 100644 index 000000000..179b9ea91 --- /dev/null +++ b/yang/openconfig-nis/openconfig-extensions.yang @@ -0,0 +1,89 @@ +module openconfig-extensions { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/openconfig-ext"; + + prefix "oc-ext"; + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module provides extensions to the YANG language to allow + OpenConfig specific functionality and meta-data to be defined."; + + revision "2017-01-29" { + description + "Added extension for annotating encrypted values."; + reference "TBD"; + } + + revision "2015-10-09" { + description + "Initial OpenConfig public release"; + reference "TBD"; + } + + revision "2015-10-05" { + description + "Initial revision"; + reference "TBD"; + } + + // extension statements + extension openconfig-version { + argument "semver" { + yin-element false; + } + description + "The OpenConfig version number for the module. This is + expressed as a semantic version number of the form: + x.y.z + where: + * x corresponds to the major version, + * y corresponds to a minor version, + * z corresponds to a patch version. + This version corresponds to the model file within which it is + defined, and does not cover the whole set of OpenConfig models. + Where several modules are used to build up a single block of + functionality, the same module version is specified across each + file that makes up the module. + + A major version number of 0 indicates that this model is still + in development (whether within OpenConfig or with industry + partners), and is potentially subject to change. + + Following a release of major version 1, all modules will + increment major revision number where backwards incompatible + changes to the model are made. + + The minor version is changed when features are added to the + model that do not impact current clients use of the model. + + The patch-level version is incremented when non-feature changes + (such as bugfixes or clarifications to human-readable + descriptions that do not impact model functionality) are made + that maintain backwards compatibility. + + The version number is stored in the module meta-data."; + } + + extension openconfig-encrypted-value { + description + "This extension provides an annotation on schema nodes to + indicate that the corresponding value should be stored and + reported in encrypted form. + + Clients reading the configuration or applied configuration + for the node should expect to receive only the encrypted value. + This annotation may be used on nodes such as secure passwords + in which the device never reports a cleartext value, even + if the input is provided as cleartext."; + } +} \ No newline at end of file diff --git a/yang/openconfig-nis/openconfig-if-aggregate.yang b/yang/openconfig-nis/openconfig-if-aggregate.yang new file mode 100644 index 000000000..e1d6fa102 --- /dev/null +++ b/yang/openconfig-nis/openconfig-if-aggregate.yang @@ -0,0 +1,192 @@ +module openconfig-if-aggregate { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces/aggregate"; + + prefix "oc-lag"; + + // import some basic types + import openconfig-interfaces { prefix oc-if; } + import openconfig-if-ethernet { prefix oc-eth; } + import iana-if-type { prefix ift; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing aggregated (aka bundle, LAG) interfaces."; + + oc-ext:openconfig-version "1.0.2"; + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + + + typedef aggregation-type { + type enumeration { + enum LACP { + description "LAG managed by LACP"; + } + enum STATIC { + description "Statically configured bundle / LAG"; + } + } + description + "Type to define the lag-type, i.e., how the LAG is + defined and managed"; + } + + // grouping statements + + + grouping aggregation-logical-config { + description + "Configuration data for aggregate interfaces"; + + + leaf lag-type { + type aggregation-type; + description + "Sets the type of LAG, i.e., how it is + configured / maintained"; + } + + leaf min-links { + type uint16; + description + "Specifies the mininum number of member + interfaces that must be active for the aggregate interface + to be available"; + } + } + + grouping aggregation-logical-state { + description + "Operational state data for aggregate interfaces"; + + leaf lag-speed { + type uint32; + units Mbps; + description + "Reports effective speed of the aggregate interface, + based on speed of active member interfaces"; + } + + leaf-list member { + when "oc-lag:lag-type = 'STATIC'" { + description + "The simple list of member interfaces is active + when the aggregate is statically configured"; + } + type oc-if:base-interface-ref; + description + "List of current member interfaces for the aggregate, + expressed as references to existing interfaces"; + } + } + + grouping aggregation-logical-top { + description "Top-level data definitions for LAGs"; + + container aggregation { + + description + "Options for logical interfaces representing + aggregates"; + + container config { + description + "Configuration variables for logical aggregate / + LAG interfaces"; + + uses aggregation-logical-config; + } + + container state { + + config false; + description + "Operational state variables for logical + aggregate / LAG interfaces"; + + uses aggregation-logical-config; + uses aggregation-logical-state; + + } + } + } + + grouping ethernet-if-aggregation-config { + description + "Adds configuration items for Ethernet interfaces + belonging to a logical aggregate / LAG"; + + leaf aggregate-id { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Specify the logical aggregate interface to which + this interface belongs"; + } + } + + // data definition statements + + // augment statements + + augment "/oc-if:interfaces/oc-if:interface" { + when "oc-if:type = 'ift:ieee8023adLag'" { + description "active when the interface is set to type LAG"; + } + description "Adds LAG configuration to the interface module"; + + uses aggregation-logical-top; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/" + + "oc-eth:config" { + when "oc-if:type = 'ift:ethernetCsmacd'" { + description "active when the interface is Ethernet"; + } + description "Adds LAG settings to individual Ethernet + interfaces"; + + uses ethernet-if-aggregation-config; + } + + augment "/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/" + + "oc-eth:state" { + when "oc-if:type = 'ift:ethernetCsmacd'" { + description "active when the interface is Ethernet"; + } + description "Adds LAG settings to individual Ethernet + interfaces"; + + uses ethernet-if-aggregation-config; + } + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-if-ethernet.yang b/yang/openconfig-nis/openconfig-if-ethernet.yang new file mode 100644 index 000000000..cfe3965de --- /dev/null +++ b/yang/openconfig-nis/openconfig-if-ethernet.yang @@ -0,0 +1,319 @@ +module openconfig-if-ethernet { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces/ethernet"; + + prefix "oc-eth"; + + // import some basic types + import openconfig-interfaces { prefix oc-if; } + import iana-if-type { prefix ift; } + import ietf-yang-types { prefix yang; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing Ethernet interfaces -- augments the IETF YANG + model for interfaces described by RFC 7223"; + + oc-ext:openconfig-version "1.0.2"; + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + // extension statements + + // feature statements + + // identity statements + + identity ETHERNET_SPEED { + description "base type to specify available Ethernet link + speeds"; + } + + identity SPEED_10MB { + base ETHERNET_SPEED; + description "10 Mbps Ethernet"; + } + + identity SPEED_100MB { + base ETHERNET_SPEED; + description "100 Mbps Ethernet"; + } + + identity SPEED_1GB { + base ETHERNET_SPEED; + description "1 GBps Ethernet"; + } + + identity SPEED_10GB { + base ETHERNET_SPEED; + description "10 GBps Ethernet"; + } + + identity SPEED_25GB { + base ETHERNET_SPEED; + description "25 GBps Ethernet"; + } + + identity SPEED_40GB { + base ETHERNET_SPEED; + description "40 GBps Ethernet"; + } + + identity SPEED_50GB { + base ETHERNET_SPEED; + description "50 GBps Ethernet"; + } + + identity SPEED_100GB { + base ETHERNET_SPEED; + description "100 GBps Ethernet"; + } + + identity SPEED_UNKNOWN { + base ETHERNET_SPEED; + description + "Interface speed is unknown. Systems may report + speed UNKNOWN when an interface is down or unpopuplated (e.g., + pluggable not present)."; + } + + // typedef statements + + + // grouping statements + + grouping ethernet-interface-config { + description "Configuration items for Ethernet interfaces"; + + leaf mac-address { + type yang:mac-address; + description + "Assigns a MAC address to the Ethernet interface. If not + specified, the corresponding operational state leaf is + expected to show the system-assigned MAC address."; + } + + leaf auto-negotiate { + type boolean; + default true; + description + "Set to TRUE to request the interface to auto-negotiate + transmission parameters with its peer interface. When + set to FALSE, the transmission parameters are specified + manually."; + reference + "IEEE 802.3-2012 auto-negotiation transmission parameters"; + } + + leaf duplex-mode { + type enumeration { + enum FULL { + description "Full duplex mode"; + } + enum HALF { + description "Half duplex mode"; + } + } + description + "When auto-negotiate is TRUE, this optionally sets the + duplex mode that will be advertised to the peer. If + unspecified, the interface should negotiate the duplex mode + directly (typically full-duplex). When auto-negotiate is + FALSE, this sets the duplex mode on the interface directly."; + } + + leaf port-speed { + type identityref { + base ETHERNET_SPEED; + } + description + "When auto-negotiate is TRUE, this optionally sets the + port-speed mode that will be advertised to the peer for + negotiation. If unspecified, it is expected that the + interface will select the highest speed available based on + negotiation. When auto-negotiate is set to FALSE, sets the + link speed to a fixed value -- supported values are defined + by ETHERNET_SPEED identities"; + } + + leaf enable-flow-control { + type boolean; + default false; + description + "Enable or disable flow control for this interface. + Ethernet flow control is a mechanism by which a receiver + may send PAUSE frames to a sender to stop transmission for + a specified time. + + This setting should override auto-negotiated flow control + settings. If left unspecified, and auto-negotiate is TRUE, + flow control mode is negotiated with the peer interface."; + reference + "IEEE 802.3x"; + } + } + + grouping ethernet-interface-state-counters { + description + "Ethernet-specific counters and statistics"; + + // ingress counters + + leaf in-mac-control-frames { + type yang:counter64; + description + "MAC layer control frames received on the interface"; + } + + leaf in-mac-pause-frames { + type yang:counter64; + description + "MAC layer PAUSE frames received on the interface"; + } + + leaf in-oversize-frames { + type yang:counter64; + description + "Number of oversize frames received on the interface"; + } + + leaf in-jabber-frames { + type yang:counter64; + description + "Number of jabber frames received on the + interface. Jabber frames are typically defined as oversize + frames which also have a bad CRC. Implementations may use + slightly different definitions of what constitutes a jabber + frame. Often indicative of a NIC hardware problem."; + } + + leaf in-fragment-frames { + type yang:counter64; + description + "Number of fragment frames received on the interface."; + } + + leaf in-8021q-frames { + type yang:counter64; + description + "Number of 802.1q tagged frames received on the interface"; + } + + leaf in-crc-errors { + type yang:counter64; + description + "Number of receive error events due to FCS/CRC check + failure"; + } + + // egress counters + + leaf out-mac-control-frames { + type yang:counter64; + description + "MAC layer control frames sent on the interface"; + } + + leaf out-mac-pause-frames { + type yang:counter64; + description + "MAC layer PAUSE frames sent on the interface"; + } + + leaf out-8021q-frames { + type yang:counter64; + description + "Number of 802.1q tagged frames sent on the interface"; + } + } + + grouping ethernet-interface-state { + description + "Grouping for defining Ethernet-specific operational state"; + + leaf hw-mac-address { + type yang:mac-address; + description + "Represenets the 'burned-in', or system-assigned, MAC + address for the Ethernet interface."; + } + + leaf effective-speed { + type uint32; + units Mbps; + description + "Reports the effective speed of the interface, e.g., the + negotiated speed if auto-negotiate is enabled"; + } + + container counters { + description "Ethernet interface counters"; + + uses ethernet-interface-state-counters; + + } + + } + + // data definition statements + + grouping ethernet-top { + description "top-level Ethernet config and state containers"; + + container ethernet { + description + "Top-level container for ethernet configuration + and state"; + + container config { + description "Configuration data for ethernet interfaces"; + + uses ethernet-interface-config; + + } + + container state { + + config false; + description "State variables for Ethernet interfaces"; + + uses ethernet-interface-config; + uses ethernet-interface-state; + + } + + } + } + + // augment statements + + augment "/oc-if:interfaces/oc-if:interface" { + when "oc-if:state/oc-if:type = 'ift:ethernetCsmacd'" { + description "Additional interface configuration parameters when + the interface type is Ethernet"; + } + description "Adds addtional Ethernet-specific configuration to + interfaces model"; + + uses ethernet-top; + } + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-inet-types.yang b/yang/openconfig-nis/openconfig-inet-types.yang new file mode 100644 index 000000000..6d73bdd57 --- /dev/null +++ b/yang/openconfig-nis/openconfig-inet-types.yang @@ -0,0 +1,189 @@ +module openconfig-inet-types { + + yang-version "1"; + namespace "http://openconfig.net/yang/types/inet"; + prefix "oc-inet"; + + import openconfig-extensions { prefix "oc-ext"; } + + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains a set of Internet address related + types for use in OpenConfig modules. + + Portions of this code were derived from IETF RFC 6021. + Please reproduce this note if possible. + + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "0.1.1"; + + revision 2017-04-03 { + description + "Update copyright notice."; + reference "0.1.1"; + } + + revision 2017-01-26 { + description + "Initial module for inet types"; + reference "0.1.0"; + } + + // IPv4 and IPv6 types. + + typedef ipv4-address { + type string { + pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4]' + + '[0-9]|25[0-5])'; + } + description + "An IPv4 address in dotted quad notation."; + } + + typedef ipv6-address { + type string { + pattern + // Must support compression through different lengths + // therefore this regexp is complex. + '(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')'; + } + description + "An IPv6 address represented as either a full address; shortened + or mixed-shortened formats."; + } + + typedef ipv4-prefix { + type string { + pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' + + '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4]' + + '[0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2]))'; + } + description + "An IPv4 prefix represented in dotted quad notation followed by + a slash and a CIDR mask (0 <= mask <= 32)."; + } + + typedef ipv6-prefix { + type string { + pattern + '(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|' + + '([0-9a-fA-F]{1,4}:){1,7}:|' + + '([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}' + + '([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|' + + '([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|' + + '([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|' + + '([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|' + + '[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|' + + ':((:[0-9a-fA-F]{1,4}){1,7}|:)' + + ')/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9])'; + } + description + "An IPv6 prefix represented in full, shortened, or mixed + shortened format followed by a slash and CIDR mask (0 <= mask <= + 128)."; + } + + typedef ip-address { + type union { + type ipv4-address; + type ipv6-address; + } + description + "An IPv4 or IPv6 address with no prefix specified."; + } + + typedef ip-prefix { + type union { + type ipv4-prefix; + type ipv6-prefix; + } + description + "An IPv4 or IPv6 prefix."; + } + + typedef as-number { + type uint32; + description + "A numeric identifier for an autonomous system (AS). An AS is a + single domain, under common administrative control, which forms + a unit of routing policy. Autonomous systems can be assigned a + 2-byte identifier, or a 4-byte identifier which may have public + or private scope. Private ASNs are assigned from dedicated + ranges. Public ASNs are assigned from ranges allocated by IANA + to the regional internet registries (RIRs)."; + reference + "RFC 1930 Guidelines for creation, selection, and registration + of an Autonomous System (AS) + RFC 4271 A Border Gateway Protocol 4 (BGP-4)"; + } + + typedef dscp { + type uint8 { + range "0..63"; + } + description + "A differentiated services code point (DSCP) marking within the + IP header."; + reference + "RFC 2474 Definition of the Differentiated Services Field + (DS Field) in the IPv4 and IPv6 Headers"; + } + + typedef ipv6-flow-label { + type uint32 { + range "0..1048575"; + } + description + "The IPv6 flow-label is a 20-bit value within the IPv6 header + which is optionally used by the source of the IPv6 packet to + label sets of packets for which special handling may be + required."; + reference + "RFC 2460 Internet Protocol, Version 6 (IPv6) Specification"; + } + + typedef port-number { + type uint16; + description + "A 16-bit port number used by a transport protocol such as TCP + or UDP."; + reference + "RFC 768 User Datagram Protocol + RFC 793 Transmission Control Protocol"; + } + + typedef uri { + type string; + description + "An ASCII-encoded Uniform Resource Identifier (URI) as defined + in RFC 3986."; + reference + "RFC 3986 Uniform Resource Identifier (URI): Generic Syntax"; + } +} diff --git a/yang/openconfig-nis/openconfig-interfaces.yang b/yang/openconfig-nis/openconfig-interfaces.yang new file mode 100644 index 000000000..332f7e1c4 --- /dev/null +++ b/yang/openconfig-nis/openconfig-interfaces.yang @@ -0,0 +1,933 @@ +module openconfig-interfaces { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/interfaces"; + + prefix "oc-if"; + + // import some basic types + import ietf-interfaces { prefix ietf-if; } + import ietf-yang-types { prefix yang; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Model for managing network interfaces and subinterfaces. This + module also defines convenience types / groupings for other + models to create references to interfaces: + + base-interface-ref (type) - reference to a base interface + interface-ref (grouping) - container for reference to a + interface + subinterface + interface-ref-state (grouping) - container for read-only + (opstate) reference to interface + subinterface + + This model reuses data items defined in the IETF YANG model for + interfaces described by RFC 7223 with an alternate structure + (particularly for operational state data) and and with + additional configuration items."; + + oc-ext:openconfig-version "1.0.2"; + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + + // typedef statements + + typedef base-interface-ref { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Reusable type for by-name reference to a base interface. + This type may be used in cases where ability to reference + a subinterface is not required."; + } + + typedef interface-id { + type string; + description + "User-defined identifier for an interface, generally used to + name a interface reference. The id can be arbitrary but a + useful convention is to use a combination of base interface + name and subinterface index."; + } + + // grouping statements + + grouping interface-ref-common { + description + "Reference leafrefs to interface / subinterface"; + + leaf interface { + type leafref { + path "/oc-if:interfaces/oc-if:interface/oc-if:name"; + } + description + "Reference to a base interface. If a reference to a + subinterface is required, this leaf must be specified + to indicate the base interface."; + } + + leaf subinterface { + type leafref { + path "/oc-if:interfaces/" + + "oc-if:interface[oc-if:name=current()/../interface]/" + + "oc-if:subinterfaces/oc-if:subinterface/oc-if:index"; + } + description + "Reference to a subinterface -- this requires the base + interface to be specified using the interface leaf in + this container. If only a reference to a base interface + is requuired, this leaf should not be set."; + } + } + + grouping interface-ref-state-container { + description + "Reusable opstate w/container for a reference to an + interface or subinterface"; + + container state { + config false; + description + "Operational state for interface-ref"; + + uses interface-ref-common; + } + } + + grouping interface-ref { + description + "Reusable definition for a reference to an interface or + subinterface"; + + container interface-ref { + description + "Reference to an interface or subinterface"; + + container config { + description + "Configured reference to interface / subinterface"; + + uses interface-ref-common; + } + + uses interface-ref-state-container; + } + } + + grouping interface-ref-state { + description + "Reusable opstate w/container for a reference to an + interface or subinterface"; + + container interface-ref { + description + "Reference to an interface or subinterface"; + + uses interface-ref-state-container; + } + } + + + grouping interface-common-config { + description + "Configuration data data nodes common to physical interfaces + and subinterfaces"; + + leaf name { + type string; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The name of the interface. + + A device MAY restrict the allowed values for this leaf, + possibly depending on the type of the interface. + For system-controlled interfaces, this leaf is the + device-specific name of the interface. The 'config false' + list interfaces/interface[name]/state contains the currently + existing interfaces on the device. + + If a client tries to create configuration for a + system-controlled interface that is not present in the + corresponding state list, the server MAY reject + the request if the implementation does not support + pre-provisioning of interfaces or if the name refers to + an interface that can never exist in the system. A + NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case. + + The IETF model in RFC 7223 provides YANG features for the + following (i.e., pre-provisioning and arbitrary-names), + however they are omitted here: + + If the device supports pre-provisioning of interface + configuration, the 'pre-provisioning' feature is + advertised. + + If the device allows arbitrarily named user-controlled + interfaces, the 'arbitrary-names' feature is advertised. + + When a configured user-controlled interface is created by + the system, it is instantiated with the same name in the + /interfaces/interface[name]/state list."; + reference + "RFC 7223: A YANG Data Model for Interface Management"; + } + + leaf description { + type string; + description + "[adapted from IETF interfaces model (RFC 7223)] + + A textual description of the interface. + + A server implementation MAY map this leaf to the ifAlias + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifAlias. The definition of + such a mechanism is outside the scope of this document. + + Since ifAlias is defined to be stored in non-volatile + storage, the MIB implementation MUST map ifAlias to the + value of 'description' in the persistently stored + datastore. + + Specifically, if the device supports ':startup', when + ifAlias is read the device MUST return the value of + 'description' in the 'startup' datastore, and when it is + written, it MUST be written to the 'running' and 'startup' + datastores. Note that it is up to the implementation to + + decide whether to modify this single leaf in 'startup' or + perform an implicit copy-config from 'running' to + 'startup'. + + If the device does not support ':startup', ifAlias MUST + be mapped to the 'description' leaf in the 'running' + datastore."; + reference + "RFC 2863: The Interfaces Group MIB - ifAlias"; + } + + leaf enabled { + type boolean; + default "true"; + description + "[adapted from IETF interfaces model (RFC 7223)] + + This leaf contains the configured, desired state of the + interface. + + Systems that implement the IF-MIB use the value of this + leaf in the 'running' datastore to set + IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry + has been initialized, as described in RFC 2863. + + Changes in this leaf in the 'running' datastore are + reflected in ifAdminStatus, but if ifAdminStatus is + changed over SNMP, this leaf is not affected."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + } + + grouping interface-phys-config { + description + "Configuration data for physical interfaces"; + + leaf type { + type identityref { + base ietf-if:interface-type; + } + mandatory true; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The type of the interface. + + When an interface entry is created, a server MAY + initialize the type leaf with a valid value, e.g., if it + is possible to derive the type from the name of the + interface. + + If a client tries to set the type of an interface to a + value that can never be used by the system, e.g., if the + type is not supported or if the type does not match the + name of the interface, the server MUST reject the request. + A NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf mtu { + type uint16; + description + "Set the max transmission unit size in octets + for the physical interface. If this is not set, the mtu is + set to the operational default -- e.g., 1514 bytes on an + Ethernet interface."; + } + + uses interface-common-config; + } + + grouping interface-phys-holdtime-config { + description + "Configuration data for interface hold-time settings -- + applies to physical interfaces."; + + leaf up { + type uint32; + units milliseconds; + default 0; + description + "Dampens advertisement when the interface + transitions from down to up. A zero value means dampening + is turned off, i.e., immediate notification."; + } + + leaf down { + type uint32; + units milliseconds; + default 0; + description + "Dampens advertisement when the interface transitions from + up to down. A zero value means dampening is turned off, + i.e., immediate notification."; + } + } + + grouping interface-phys-holdtime-state { + description + "Operational state data for interface hold-time."; + } + + grouping interface-phys-holdtime-top { + description + "Top-level grouping for setting link transition + dampening on physical and other types of interfaces."; + + container hold-time { + description + "Top-level container for hold-time settings to enable + dampening advertisements of interface transitions."; + + container config { + description + "Configuration data for interface hold-time settings."; + + uses interface-phys-holdtime-config; + } + + container state { + + config false; + + description + "Operational state data for interface hold-time."; + + uses interface-phys-holdtime-config; + uses interface-phys-holdtime-state; + } + } + } + + grouping interface-common-state { + description + "Operational state data (in addition to intended configuration) + at the global level for this interface"; + + leaf ifindex { + type uint32; + description + "System assigned number for each interface. Corresponds to + ifIndex object in SNMP Interface MIB"; + reference + "RFC 2863 - The Interfaces Group MIB"; + } + + leaf admin-status { + type enumeration { + enum UP { + description + "Ready to pass packets."; + } + enum DOWN { + description + "Not ready to pass packets and not in some test mode."; + } + enum TESTING { + //TODO: This is generally not supported as a configured + //admin state, though it's in the standard interfaces MIB. + //Consider removing it. + description + "In some test mode."; + } + } + //TODO:consider converting to an identity to have the + //flexibility to remove some values defined by RFC 7223 that + //are not used or not implemented consistently. + mandatory true; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The desired state of the interface. In RFC 7223 this leaf + has the same read semantics as ifAdminStatus. Here, it + reflects the administrative state as set by enabling or + disabling the interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf oper-status { + type enumeration { + enum UP { + value 1; + description + "Ready to pass packets."; + } + enum DOWN { + value 2; + description + "The interface does not pass any packets."; + } + enum TESTING { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum UNKNOWN { + value 4; + description + "Status cannot be determined for some reason."; + } + enum DORMANT { + value 5; + description + "Waiting for some external event."; + } + enum NOT_PRESENT { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum LOWER_LAYER_DOWN { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + //TODO:consider converting to an identity to have the + //flexibility to remove some values defined by RFC 7223 that + //are not used or not implemented consistently. + mandatory true; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The current operational state of the interface. + + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + } + + leaf last-change { + type yang:timeticks; + description + "Date and time of the last state change of the interface + (e.g., up-to-down transition). This corresponds to the + ifLastChange object in the standard interface MIB."; + reference + "RFC 2863: The Interfaces Group MIB - ifLastChange"; + } + + } + + + grouping interface-counters-state { + description + "Operational state representing interface counters + and statistics. Some of these are adapted from RFC 7223"; + + //TODO: we may need to break this list of counters into those + //that would appear for physical vs. subinterface or logical + //interfaces. For now, just replicating the full stats + //grouping to both interface and subinterface. + + container counters { + description + "A collection of interface-related statistics objects."; + + reference + "RFC 7223 - A YANG Data Model for Interface + Management"; + + leaf in-octets { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The total number of octets received on the interface, + including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + + leaf in-unicast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were not addressed to a + multicast or broadcast address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + + leaf in-broadcast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a broadcast + address at this sub-layer. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + + leaf in-multicast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + + The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a multicast + address at this sub-layer. For a MAC-layer protocol, + this includes both Group and Functional addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + + leaf in-discards { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + The number of inbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + + + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + + leaf in-errors { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + + leaf in-unknown-protos { + type yang:counter32; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + For packet-oriented interfaces, the number of packets + received via the interface that were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing, the number of + transmission units received via the interface that were + discarded because of an unknown or unsupported protocol. + For any interface that does not support protocol + multiplexing, this counter is not present. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + leaf out-octets { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + The total number of octets transmitted out of the + interface, including framing characters. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + + leaf out-unicast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The total number of packets that higher-level protocols + requested be transmitted, and that were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + + leaf out-broadcast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + + The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + + + leaf out-multicast-pkts { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + The total number of packets that higher-level protocols + requested be transmitted, and that were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC-layer + protocol, this includes both Group and Functional + addresses. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + + leaf out-discards { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + The number of outbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + + leaf out-errors { + type yang:counter64; + description + "[adapted from IETF interfaces model (RFC 7223)] + Changed the counter type to counter64. + + For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + + Discontinuities in the value of this counter can occur + at re-initialization of the management system, and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + + leaf last-clear { + type yang:date-and-time; + description + "Indicates the last time the interface counters were + cleared."; + } + } + } + + // data definition statements + + grouping sub-unnumbered-config { + description + "Configuration data for unnumbered subinterfaces"; + + leaf enabled { + type boolean; + default false; + description + "Indicates that the subinterface is unnumbered. By default + the subinterface is numbered, i.e., expected to have an + IP address configuration."; + } + } + + grouping sub-unnumbered-state { + description + "Operational state data unnumbered subinterfaces"; + } + + grouping sub-unnumbered-top { + description + "Top-level grouping unnumbered subinterfaces"; + + container unnumbered { + description + "Top-level container for setting unnumbered interfaces. + Includes reference the interface that provides the + address information"; + + container config { + description + "Configuration data for unnumbered interface"; + + uses sub-unnumbered-config; + } + + container state { + + config false; + + description + "Operational state data for unnumbered interfaces"; + + uses sub-unnumbered-config; + uses sub-unnumbered-state; + } + + uses oc-if:interface-ref; + } + } + + grouping subinterfaces-config { + description + "Configuration data for subinterfaces"; + + leaf index { + type uint32; + default 0; + description + "The index of the subinterface, or logical interface number. + On systems with no support for subinterfaces, or not using + subinterfaces, this value should default to 0, i.e., the + default subinterface."; + } + + uses interface-common-config; + + } + + grouping subinterfaces-state { + description + "Operational state data for subinterfaces"; + + uses interface-common-state; + uses interface-counters-state; + } + + grouping subinterfaces-top { + description + "Subinterface data for logical interfaces associated with a + given interface"; + + container subinterfaces { + description + "Enclosing container for the list of subinterfaces associated + with a physical interface"; + + list subinterface { + key "index"; + + description + "The list of subinterfaces (logical interfaces) associated + with a physical interface"; + + leaf index { + type leafref { + path "../config/index"; + } + description + "The index number of the subinterface -- used to address + the logical interface"; + } + + container config { + description + "Configurable items at the subinterface level"; + + uses subinterfaces-config; + } + + container state { + + config false; + description + "Operational state data for logical interfaces"; + + uses subinterfaces-config; + uses subinterfaces-state; + } + } + } + } + + grouping interfaces-top { + description + "Top-level grouping for interface configuration and + operational state data"; + + container interfaces { + description + "Top level container for interfaces, including configuration + and state data."; + + + list interface { + key "name"; + + description + "The list of named interfaces on the device."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "References the configured name of the interface"; + //TODO: need to consider whether this should actually + //reference the name in the state subtree, which + //presumably would be the system-assigned name, or the + //configured name. Points to the config/name now + //because of YANG 1.0 limitation that the list + //key must have the same "config" as the list, and + //also can't point to a non-config node. + } + + container config { + description + "Configurable items at the global, physical interface + level"; + + uses interface-phys-config; + } + + container state { + + config false; + description + "Operational state data at the global interface level"; + + uses interface-phys-config; + uses interface-common-state; + uses interface-counters-state; + } + + uses interface-phys-holdtime-top; + uses subinterfaces-top; + } + } + } + + uses interfaces-top; + + +} diff --git a/yang/openconfig-nis/openconfig-isis-lsdb-types.yang b/yang/openconfig-nis/openconfig-isis-lsdb-types.yang new file mode 100644 index 000000000..3bb1e00a4 --- /dev/null +++ b/yang/openconfig-nis/openconfig-isis-lsdb-types.yang @@ -0,0 +1,642 @@ +module openconfig-isis-lsdb-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/isis-lsdb-types"; + + prefix "oc-isis-lsdb-types"; + + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains general LSDB type definitions for use in ISIS YANG + model. "; + + oc-ext:openconfig-version "0.3.0"; + + revision "2017-05-15" { + description + "Refactor LSDB."; + reference "0.3.0"; + } + + revision "2017-01-13" { + description + "Remove top-level /isis container"; + reference "0.2.1"; + } + + revision "2016-12-15" { + description + "Add segment routing to IS-IS module"; + reference "0.2.0"; + } + + revision "2016-10-18" { + description + "Initial revision of IS-IS models."; + reference "0.1.0"; + } + + identity ISIS_TLV_TYPE { + description + "Base identity for an ISIS TLV type."; + } + + identity ISIS_SUBTLV_TYPE { + description + "Base identity for an ISIS SUB-TLV type."; + } + + identity IS_REACHABILITY_SUBTLVS_TYPE { + base "ISIS_SUBTLV_TYPE"; + description + "Base identity for an ISIS TLV 22, 23, 222, 223, 141 SUB-TLV + type."; + } + + identity IP_REACHABILITY_SUBTLVS_TYPE { + base "ISIS_SUBTLV_TYPE"; + description + "Base identity for an ISIS TLV 135, 235, 236, 237 SUB-TLV + type."; + } + + identity ROUTER_CAPABILITY_SUBTLVS_TYPE { + base "ISIS_SUBTLV_TYPE"; + description + "Base identity for an ISIS TLV 242 SUB-TLV type."; + } + + identity AREA_ADDRESSES { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 1. Intermediate System to Intermediate System Intra- + Domain Routeing Exchange Protocol for use in Conjunction with + the Protocol for Providing the Connectionless-mode Network + Service (ISO 8473), International Standard 10589: 2002, Second + Edition, 2002."; + reference + "ISO 10589"; + } + + identity IIS_NEIGHBORS { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 2. Intermediate System to Intermediate System Intra- + Domain Routeing Exchange Protocol for use in Conjunction with + the Protocol for Providing the Connectionless-mode Network + Service (ISO 8473), International Standard 10589: 2002, Second + Edition, 2002."; + reference + "ISO 10589"; + } + + identity INSTANCE_ID { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 7. An Instance Identifier (IID) to uniquely + identify an IS-IS instance. When the IID = 0, the list of + supported ITIDs MUST NOT be present. An IID-TLV with IID = 0 + MUST NOT appear in an SNP or LSP. When the TLV appears (with a + non-zero IID) in an SNP or LSP, exactly one ITID. MUST be + present indicating the topology with which the PDU is + associated. If no ITIDs or multiple ITIDs are present or the + IID is zero, then the PDU MUST be ignored"; + reference + "RFC6822: IS-IS Multi-Instance"; + } + + identity AUTHENTICATION { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 10.Intermediate System to Intermediate System Intra- + Domain Routeing Exchange Protocol for use in Conjunction with + the Protocol for Providing the Connectionless-mode Network + Service (ISO 8473) International Standard 10589: 2002, Second + Edition, 2002."; + reference + "ISO 10589"; + } + + identity PURGE_OI { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 13. If an IS generates a purge, it SHOULD include + this TLV in the purge with its own system ID. If an IS + receives a purge that does not include this TLV, then it SHOULD + add this TLV with both its own system ID and the system ID of + the IS from which it received the purge. This allows ISs + receiving purges to log the system ID of the originator, or the + upstream source of the purge."; + reference + "RFC6232: Purge Originator Identification TLV"; + } + + identity EXTENDED_IS_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 22. An extended IS reachability TLV that has a + different data structure to TLV 2 that introduces the use of + sub-TLV object-group."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering"; + } + + identity IS_NEIGHBOR_ATTRIBUTE { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 23. Identical in format to TLV 22 and included in + Original LSPs or Extended LSPs. Regardless of the type of LSP + in which the TLVs appear, the information pertains to the + neighbor relationship between the Originating System and the IS + identified in the TLV"; + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) Space + for IS-IS"; + } + + identity ISIS_ALIAS_ID { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 24. IS-Alias TLV which extension-capable ISs to + recognize the Originating System of an Extended LSP set. It + identifies the Normal system-id of the Originating System"; + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) Space + for IS-IS"; + } + + identity IPV4_INTERNAL_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 128. TLV defines IP addresses within the routing + domain reachable directly via one or more interfaces on this + Intermediate system"; + reference + "RFC1195: OSI ISIS for IP and Dual Environments. RFC5302: + Domain-Wide Prefix Distribution with Two-Level IS-IS"; + } + + identity NLPID { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 129. TLV defines the set Network Layer Protocol + Identifiers for Network Layer protocols that this Intermediate + System is capable of relaying"; + reference + "RFC1195: Use of OSI IS-IS for Routing in TCP/IP and + Dual Environments"; + } + + identity IPV4_EXTERNAL_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 130. TLV defines IP addresses outside the routing domain + reachable via interfaces on this Intermediate system. This is permitted to + appear multiple times, and in an LSP with any LSP number. However, + this field must not appear in pseudonode LSPs"; + reference " + RFC1195: OSI ISIS for IP and Dual Environments. RFC5302: + Domain-Wide Prefix Distribution with Two-Level IS-IS"; + } + + identity IPV4_INTERFACE_ADDRESSES { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 132. The IP address of one or more interfaces corresponding to + the SNPAs enabled on this Intermediate system (i.e., one or more IP + addresses of this router). This is permitted to appear multiple times, + and in an LSP with any LSP number."; + reference + "RFC1195: Use of OSI IS-IS for Routing in TCP/IP and Dual Environments"; + } + + identity IPV4_TE_ROUTER_ID { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 134. Traffic Engineering router ID TLV that contains the 4-octet + router ID of the router originating the LSP"; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering"; + } + + identity EXTENDED_IPV4_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 135. Extended IP reachability TLV that provides for a 32-bit + metric and adds one bit to indicate that a prefix has been redistributed + _down_ in the hierarchy"; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering"; + } + + identity DYNAMIC_NAME { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 137. The Dynamic hostname TLV is optional. This TLV may be + present in any fragment of a non-pseudonode LSP. The value field + identifies the symbolic name of the router originating the LSP. This + symbolic name can be the FQDN for the router, it can be a subset of the + FQDN, or it can be any string operators want to use for the router."; + reference + "RFC6233: IS-IS Registry Extension for Purges, RFC 5301: Dynamic Hostname + Exchange Mechanism for IS-IS."; + } + + identity IPV4_SRLG { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 138. IPv4 Shared Risk Link Group TLV"; + reference + "RFC5307: IS-IS Extensions in Support of Generalized Multi-Protocol Label + Switching (GMPLS)"; + } + + identity IPV6_SRLG { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 139. IPv6 Shared Risk Link Group"; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS"; + } + + identity IPV6_TE_ROUTER_ID { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 140. The IPv6 TE Router ID TLV contains a 16-octet IPv6 address. + A stable global IPv6 address MUST be used, so that the router ID provides + a routable address, regardless of the state of a node's interfaces. If a + router does not implement traffic engineering, it MAY include or omit the + IPv6 TE Router ID TLV. If a router implements traffic engineering for + IPv6, it MUST include this TLV in its LSP. This TLV MUST NOT be included + more than once in an LSP."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS."; + } + + identity MT_ISN { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 222. TLV is aligned with extended IS reachability TLV type 22 + beside an additional two bytes in front at the beginning of the TLV that. + indicate MT membership."; + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in Intermediate System to + Intermediate Systems (IS-ISs)"; + } + + identity MT_IS_NEIGHBOR_ATTRIBUTE { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 223. Is is identical in format to TLV 222. In the event that + there is a need to advertise in Extended LSPs such information associated + with neighbors of the Originating System, it is necessary to define new + TLVs to carry the sub-TLV information."; + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) Space for IS-IS"; + } + + identity MULTI_TOPOLOGY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 229. This MT TLV can advertise up to 127 MTs. It is announced + in IIHs and LSP fragment 0, and can occur multiple times. The resulting + MT set SHOULD be the union of all the MT TLV occurrences in the packet. + Any other IS-IS PDU occurrence of this TLV MUST be ignored. Lack of MT + TLV in hellos and fragment zero LSPs MUST be interpreted as participation + of the advertising interface or router in MT ID #0 only. If a router + advertises MT TLV, it has to advertise all the MTs it participates in, + specifically including topology ID #0 also."; + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in Intermediate System to + Intermediate Systems (IS-ISs)"; + } + + identity IPV6_INTERFACE_ADDRESSES { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 232. IPv6 Interface Address TLV that maps directly to the IP + Interface Address TLV in [RFC1195]. We necessarily modify the contents to + be 0-15 16-octet IPv6 interface addresses instead of 0-63 4-octet IPv4 + interface addresses"; + reference "RFC5308: Routing IPv6 with IS-IS."; + } + + identity MT_IPV4_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 235. TLV is aligned with extended IP reachability TLV type 135 + beside an additional two bytes in front to indicate MT membership"; + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in Intermediate System to + Intermediate Systems (IS-ISs)"; + } + + identity IPV6_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 236. The IPv6 Reachability TLV describes network reachability + through the specification of a routing prefix, metric information, a bit + to indicate if the prefix is being advertised down from a higher level, a + bit to indicate if the prefix is being distributed from another routing + protocol, and OPTIONALLY the existence of Sub-TLVs to allow for later + extension."; + reference + "RFC5308: Routing IPv6 with IS-IS"; + } + + identity MT_IPV6_REACHABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 237. TLV is aligned with IPv6 Reachability TLV type 236 beside + an additional two bytes in front to indicate MT membership."; + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in Intermediate System to + Intermediate Systems (IS-ISs)."; + } + + identity ROUTER_CAPABILITY { + base "ISIS_TLV_TYPE"; + description + "ISIS TLV 242. IS-IS TLV named CAPABILITY, formed of multiple sub-TLVs, + which allows a router to announce its capabilities within an IS-IS level + or the entire routing domain."; + reference + "RFC4971: Intermediate System to Intermediate System (IS-IS) + Extensions for Advertising Router Information."; + } + + //sub-TLVs for TLVs 22, 23, 141, 222, 223 + + identity IS_REACHABILITY_ADMIN_GROUP { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 3. Administrative group(color)."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering"; + } + + identity IS_REACHABILITY_IPV4_INTERFACE_ADDRESS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 6. IPv4 Interface Address."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_IPV4_NEIGHBOR_ADDRESS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 6. IPv4 Neighbor Address."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_MAX_LINK_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 9. Maximum Link Bandwidth."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_MAX_RESERVABLE_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 10. Maximum Reservable Bandwidth."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_UNRESERVED_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 11. Unreserved bandwidth."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_IPV6_INTERFACE_ADDRESS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 12. IPv6 Interface Address."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS."; + } + + identity IS_REACHABILITY_IPV6_NEIGHBOR_ADDRESS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 13. IPv6 Neighbor Address."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS."; + } + + identity IS_REACHABILITY_EXTENDED_ADMIN_GROUP { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 14. Extended Administrative Group."; + reference + "RFC7308: Extended Administrative Groups in MPLS Traffic Engineering + (MPLS-TE)."; + } + + identity IS_REACHABILITY_TE_DEFAULT_METRIC { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 18. TE Default Metric."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering."; + } + + identity IS_REACHABILITY_LINK_ATTRIBUTES { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 19. Link Attributes."; + reference + "RFC5209: Definition of an IS-IS Link Attribute Sub-TLV."; + } + + identity IS_REACHABILITY_LINK_PROTECTION_TYPE { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 20. Link Protection Type."; + reference + "RFC5307: IS-IS Extensions in Support of Generalized + Multi-Protocol Label Switching (GMPLS)"; + } + + identity IS_REACHABILITY_BANDWIDTH_CONSTRAINTS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 22. Bandwidth Constraints."; + reference + "RFC4124: Protocol Extensions for Support of Diffserv-aware MPLS Traffic + Engineering."; + } + + identity IS_REACHABILITY_UNCONSTRAINED_LSP { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 23. Unconstrained LSP."; + reference + "RFC5330: A Link-Type sub-TLV to Convey the Number of Traffic + Engineering Label Switched Paths Signalled with Zero + Reserved Bandwidth across a Link."; + } + + identity IS_REACHABILITY_ADJ_SID { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 31. Adjacency Segment Identifier."; + reference + "draft-ietf-isis-segment-routing-extensions."; + } + + identity IS_REACHABILITY_ADJ_LAN_SID { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 32. Adjacency LAN Segment Identifier."; + reference + "draft-ietf-isis-segment-routing-extensions."; + } + + identity IS_REACHABILITY_LINK_DELAY { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 33. Unidirectional Link Delay."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_MIN_MAX_LINK_DELAY { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 34. Min/Max Unidirectional Link Delay."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_LINK_DELAY_VARIATION { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 35. Unidirectional Link Delay Variation."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_LINK_LOSS { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 36. Unidirectional Link Loss Delay."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_RESIDUAL_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 37. Unidirectional Residual Bandwidth."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_AVAILABLE_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 38. Unidirectional Available Bandwidth."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + identity IS_REACHABILITY_UTILIZED_BANDWIDTH { + base "IS_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 39. Unidirectional Utilized Bandwidth."; + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric Extensions."; + } + + //sub-TLVs for TLVs 135, 235, 236, 237 + identity IP_REACHABILITY_TAG { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 1. 32-bit Administrative Tag."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and IPv6 + Reachability."; + } + + identity IP_REACHABILITY_TAG64 { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 2. 64-bit Administrative Tag."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and IPv6 + Reachability."; + } + + identity IP_REACHABILITY_PREFIX_SID { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 3. Prefix Segment Identifier."; + reference + "draft-ietf-isis-segment-routing-extension."; + } + + identity IP_REACHABILITY_PREFIX_FLAGS { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 4. Prefix Attribute Flags."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and IPv6 + Reachability."; + } + + identity IP_REACHABILITY_IPV4_ROUTER_ID { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 11. IPv4 Source Router ID."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and IPv6 + Reachability."; + } + + identity IP_REACHABILITY_IPV6_ROUTER_ID { + base "IP_REACHABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 12. IPv6 Source Router ID."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and IPv6 + Reachability."; + } + + + //sub-TLVs for TLVs 242 + + identity ROUTER_CAPABILITY_SR_CAPABILITY { + base "ROUTER_CAPABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 2. Segment Routing Capability."; + reference + "draft-ietf-isis-segment-routing-extensions."; + } + + identity ROUTER_CAPABILITY_SR_ALGORITHM { + base "ROUTER_CAPABILITY_SUBTLVS_TYPE"; + description + "sub-TLV 19. Segment Routing Algorithm."; + reference + "draft-ietf-isis-segment-routing-extensions."; + } + +} diff --git a/yang/openconfig-nis/openconfig-isis-lsp@2017-05-15.yang b/yang/openconfig-nis/openconfig-isis-lsp@2017-05-15.yang new file mode 100644 index 000000000..944c1720c --- /dev/null +++ b/yang/openconfig-nis/openconfig-isis-lsp@2017-05-15.yang @@ -0,0 +1,3489 @@ +submodule openconfig-isis-lsp { + + belongs-to openconfig-isis { + prefix oc-isis; + } + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-inet-types { prefix "oc-inet"; } + import openconfig-isis-types { prefix "oc-isis-types"; } + import openconfig-isis-lsdb-types { prefix "oc-isis-lsdb-types"; } + import openconfig-types { prefix "oc-types"; } + import openconfig-mpls-types { prefix "oc-mpls-types"; } + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net "; + + description + "This sub-module describes a YANG model for the IS-IS Link State + Database (LSDB). + + Portions of this code were derived from IETF RFCs relating to the + IS-IS protocol. + Please reproduce this note if possible. + IETF code is subject to the following copyright and license: + Copyright (c) IETF Trust and the persons identified as authors of + the code. + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, is permitted pursuant to, and subject to the license + terms contained in, the Simplified BSD License set forth in + Section 4.c of the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info)."; + + oc-ext:openconfig-version "0.3.0"; + + revision "2017-05-15" { + description + "Refactor LSDB."; + reference "0.3.0"; + } + + revision "2017-01-13" { + description + "Remove top-level /isis container"; + reference "0.2.1"; + } + + revision "2016-12-15" { + description + "Add segment routing to IS-IS module"; + reference "0.2.0"; + } + + revision "2016-10-18" { + description + "Initial revision of IS-IS models."; + reference "0.1.0"; + } + + typedef isis-metric-flags { + type enumeration { + enum INTERNAL { + description + "When this flag is not set, internal metrics are in use."; + } + enum UNSUPPORTED { + description + "When this flag (referred to as the S-bit) is set, then + the metric is unsupported."; + } + } + description + "Type definition for flags used in IS-IS metrics"; + } + + grouping isis-lsdb-link-characteristics-a-bit { + description + "Definition of the A bit, as used in IS-IS link delay TLVs."; + + leaf a-bit { + type boolean; + description + "The A bit is set when the measured value of this parameter + exceeds its configured maximum threshold. The A bit is cleared + when the measured value falls below its configured reuse + threshold."; + } + } + + grouping isis-lsdb-tlv-nlpid-state { + description + "NLP ID parameters for IS-IS."; + + leaf-list nlpid { + type enumeration { + enum IPV4 { + description "IPv4 Address family."; + } + enum IPV6 { + description "IPv6 Address family."; + } + } + description + "Protocol supported. IPv4 is defined as (0xcc) and IPv6 - + (0x8e)"; + reference + "RFC1195: Use of OSI IS-IS for Routing in TCP/IP and + Dual Environments. TLV 129. "; + } + } + + grouping isis-lsdb-subtlv-type-state { + description + "Per-subTLV type operational state parameters for ISIS."; + + leaf type { + type identityref { + base oc-isis-lsdb-types:ISIS_SUBTLV_TYPE; + } + description + "The type of subTLV being described. The type of subTLV is + expressed as a canonical name."; + } + } + + grouping isis-lsdb-tlv-type-state { + description + "Per-subTLV type operational state parameters for ISIS."; + + leaf type { + type identityref { + base oc-isis-lsdb-types:ISIS_TLV_TYPE; + } + description + "The type of TLV being described. The type of TLV is + expressed as a canonical name."; + } + } + + grouping is-reachability-neighbor-state { + description + "This grouping defines is-reachability neighbor."; + + container subtlvs { + description + "This container describes IS Neighbor sub-TLVs."; + + list subtlv { + key "type"; + + description + "List of subTLV types in the LSDB for the specified TLV."; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the sub-TLV type."; + } + + container state { + description + "State parameters of IS neighbor state"; + + uses isis-lsdb-subtlv-type-state; + } + + container admin-group { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_ADMIN_GROUP'" { + description + "Only include the administrative group container when + the sub-TLV is type 3"; + } + description + "This container defines sub-TLV 3."; + + container state { + description + "State parameters of sub-TLV 3."; + + leaf-list admin-group { + type uint32; + description + "The administrative group sub-TLV contains a 4-octet + bit mask assigned by the network administrator. Each + set bit corresponds to one administrative group + assigned to the interface. By convention, the least + significant bit is referred to as group 0, and the + most significant bit is referred to as group 31."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + sub-TLV 3: TLV 22,23,141,222, 223."; + } + } + } + + container ipv4-interface-address { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_IPV4_INTERFACE_ADDRESS'" { + description + "Only include the IPv4 interface address group container + when the sub-TLV is type 6"; + } + description + "This container defines sub-TLV 6."; + + container state { + description + "State parameters of sub-TLV 6."; + + leaf-list ipv4-interface-address { + type oc-inet:ipv4-address; + description + "A 4-octet IPv4 address for the interface described by + the (main) TLV. This sub-TLV can occur multiple + times."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + sub-TLV 6: TLV 22,23,41,222,223."; + } + } + } + + container ipv4-neighbor-address { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_IPV4_NEIGHBOR_ADDRESS'" { + description + "Only include the IPv4 neighbor address container when + the sub-TLV is type 8."; + } + description + "This container defines sub-TLV 8."; + + container state { + description + "State parameters of sub-TLV 8."; + + leaf-list ipv4-neighbor-address { + type oc-inet:ipv4-address; + description + "A single IPv4 address for a neighboring router on + this link. This sub-TLV can occur multiple times."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + sub-TLV 8: TLV 22,23, 141,222,223."; + } + } + } + + container max-link-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_MAX_LINK_BANDWIDTH'" { + description + "Only include the maximum link bandwidth container when + the sub-TLV is type 9."; + } + description + "This container defines sub-TLV 9."; + + container state { + description + "State parameters of sub-TLV 9."; + + leaf max-link-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The maximum bandwidth that can be used on this link + in this direction (from the system originating the LSP + to its neighbors). It is encoded in 32 bits in IEEE + floating point format. The units are bytes (not + bits!) per second."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + sub-TLV 9: TLV 22,23,141,222,223."; + } + } + } + + container max-reservable-link-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_MAX_RESERVABLE_BANDWIDTH'" { + description + "Only include the maximum reservable link bandwidth + container when the sub-TLV type is 10."; + } + description + "This container defines sub-TLV 10."; + + container state { + description + "State parameters of sub-TLV 10."; + + leaf max-reservable-link-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The maximum amount of bandwidth that can be reserved + in this direction on this link. Note that for + oversubscription purposes, this can be greater than + the bandwidth of the link. It is encoded in 32 bits + in IEEE floating point format. The units are bytes + (not bits!) per second."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + Sub-TLV 10: TLV 22,23,141,222,223."; + } + } + } + + container unreserved-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_UNRESERVED_BANDWIDTH'" { + description + "Only include the unreserved bandwidth container when + the sub-TLV type is 11."; + } + description + "This container defines unreserved-bandwidth. The units + are bytes per second."; + + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. sub- + TLV 11: TLV 22,23,141,222,223"; + + list setup-priority { + key "priority"; + + leaf priority { + type leafref { + path "../state/priority"; + } + description + "Reference to the setup priority to which the + unreserved bandwidth corresponds."; + } + + description + "Setup priority (0 through 7) for unreserved + bandwidth."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 11."; + + leaf priority { + type uint8 { + range "0 .. 7"; + } + description + "Setup priority level of 0 through 7 to be used by + Unreserved Bandwidth sub-TLV 11."; + } + + leaf unreserved-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The amount of bandwidth reservable in this + direction on this link. Note that for + oversubscription purposes, this can be greater than + the bandwidth of the link. It contains eight 32-bit + IEEE floating point numbers(one for each priority). + The units are bytes (not bits!) per second. The + values correspond to the bandwidth that can be + reserved with a setup priority of 0 through 7, + arranged in increasing order with priority 0 + occurring at the start of the sub-TLV, and priority + 7 at the end of the sub-TLV."; + } + } + } + } + + container ipv6-interface-address { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_IPV6_INTERFACE_ADDRESS'" { + description + "Only include the IPv6 interface address when the + sub-TLV type is 12."; + } + description + "This container defines sub-TLV 12."; + + container state { + description + "State parameters of sub-TLV 12."; + + leaf-list ipv6-interface-address { + type oc-inet:ipv6-address; + description + "Contains a 16-octet IPv6 address for the interface + described by the containing Extended IS Reachability + TLV. This sub-TLV can occur multiple times."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS. sub-TLV + 12: TLV 22,23,141,222,223."; + } + } + } + + container ipv6-neighbor-address { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_IPV6_NEIGHBOR_ADDRESS'" { + description + "Only include the IPv6 neighbor address when the + sub-TLV type is 13."; + } + description + "This container defines sub-TLV 13."; + + container state { + description + "State parameters of sub-TLV 13."; + + leaf-list ipv6-neighbor-address { + type oc-inet:ipv6-address; + description + "Contains a 16-octet IPv6 address for a neighboring + router on the link described by the (main) TLV. This + sub-TLV can occur multiple times."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS. sub-TLV + 13: ISIS TLV 22,23,141,222,223."; + } + } + } + + container extended-admin-group { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_EXTENDED_ADMIN_GROUP'" { + description + "Only include the extended admin group when the + sub-TLV type is 14."; + } + description + "This container defines sub-TLV 14."; + container state { + description + "State parameters of sub-TLV 14."; + + leaf-list extended-admin-group { + type uint32; + description + "The extended-admin-group sub-TLV is used in addition + to the Administrative Groups when it is desirable to + make more than 32 colors available for advertisement + in a network."; + reference + "RFC7308: Extended Administrative Groups in MPLS + Traffic Engineering (MPLS-TE). sub-TLV 14: TLV + 22,23,141,222,223."; + } + } + } + + container te-default-metric { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_TE_DEFAULT_METRIC'" { + description + "Only include the default traffic engineering metric + container when the sub-TLV type is 18."; + } + description + "This container defines sub-TLV 18."; + container state { + description + "State parameters of sub-TLV 18."; + + leaf te-default-metric { + type uint32; + description + "This metric is administratively assigned and can be + used to present a differently weighted topology to + traffic engineering SPF calculations. To preclude + overflow within a traffic engineering SPF + implementation, all metrics greater than or equal to + MAX_PATH_METRIC SHALL be considered to have a metric + of MAX_PATH_METRIC."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. + sub-TLV 18: TLV 22,23,141,222,223."; + } + } + } + + container link-attributes { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_LINK_ATTRIBUTES'" { + description + "Only include the link attributes container when the + sub-TLV is type 19."; + } + description + "This container defines link-attributes."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 19."; + + leaf-list local-protection { + type enumeration { + enum LOCAL_PROTECTION { + description + "If set, local protection is available for the + link."; + } + enum LINK_EXCLUDED { + description + "If set, the link is excluded from local + protection."; + } + } + description + "Link local-protection attributes."; + + reference + "RFC5029: Definition of an IS-IS Link Attribute Sub- + TLV. TLV 22, sub-TLV 19."; + } + } + } + + container link-protection-type { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_LINK_PROTECTION_TYPE'" { + description + "Only include the link protection type container when + the sub-TLV type 20."; + } + description + "ISIS LSDB parameters relating to the type of link + protection offered."; + + container state { + description + "State parameters of sub-TLV 20."; + + leaf-list link-protection-type { + type enumeration { + enum EXTRA_TRAFFIC { + description + "If set the link has extra traffic protection. If + the link is of type Extra Traffic, it means that + the link is protecting another link or links. The + LSPs on a link of this type will be lost if any of + the links it is protecting fail."; + } + enum UNPROTECTED { + description + "If set, the link is unprotected. If the link is + of type Unprotected, it means that there is no + other link protecting this link. The LSPs on a + link of this type will be lost if the link + fails."; + } + enum SHARED { + description + "If set, the link has shared protection. If the + link is of type Shared, it means that there are + one or more disjoint links of type Extra Traffic + that are protecting this link. These Extra + Traffic links are shared between one or more links + of type Shared."; + } + enum ONE_ONE { + description + "If set, the link has dedicated 1:1 protection. If + the link is of type Dedicated 1:1, it means that + there is one dedicated disjoint link of type Extra + Traffic that is protecting this link."; + } + enum PLUS_ONE { + description + "If set, the link has dedicated 1+1 protection. If + the link is of type Dedicated 1+1, it means that a + dedicated disjoint link is protecting this link. + However, the protecting link is not advertised in + the link state database and is therefore not + available for the routing of LSPs."; + } + enum ENHANCED { + description + "If set the link has enhanced protection. If the + link is of type Enhanced, it means that a + protection scheme that is more reliable than + Dedicated 1+1, e.g., 4 fiber BLSR/MS-SPRING, is + being used to protect this link."; + } + } + description + "Link protection capabilities."; + reference + "RFC5307: IS-IS Extensions in Support of Generalized + Multi-Protocol Label Switching (GMPLS). sub-TLV 20: + TLV 22,23,141,222,223."; + } + } + } + + container bandwidth-constraints { + when "../state/type =" + + "'oc-isis-lsdb-types:IS_REACHABILITY_BANDWIDTH_CONSTRAINTS'" { + description + "Only include the bandwidth constraints container when + the sub-TLV is type 22."; + } + description + "This container defines bandwidth-constraints. For DS-TE, + the existing Maximum Reservable link bandwidth parameter + is retained, but its semantics is generalized and + interpreted as the aggregate bandwidth constraint across + all Class-Types"; + + reference + "RFC4124: Protocol Extensions for Support of Diffserv- + aware MPLS Traffic Engineering. sub-TLV 22: TLV 22, 23, + 141, 222,223"; + + list bandwidth-constraint { + key "model-id"; + + description + "List of the Bandwidth Constraints sub-TLV instances + present in the TLV."; + + leaf model-id { + type leafref { + path "../state/model-id"; + } + description + "Reference to the model ID associated with the + instance of the Bandwidth Constraints sub-TLV."; + } + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 22."; + + leaf model-id { + type uint8; + description + "Identifier for the Bandwidth Constraints Model + currently in use by the LSR initiating the IGP + advertisement."; + } + } + + container constraints { + description + "Constraints contained within the Bandwidth Constraints sub-TLV"; + + list constraint { + key "constraint-id"; + + description + "List of the constraints within the Bandwidth Constraints + sub-TLV. The BC0 level is indicated by the constraint-id + leaf being set to 0, with BCN being indicated by constraint-id + N."; + + leaf constraint-id { + type leafref { + path "../state/constraint-id"; + } + description + "Reference to the unique ID for the BCN level."; + } + + container state { + description + "Operational state parameters of the BCN level"; + + leaf constraint-id { + type uint32; + description + "Unique reference for the bandwidth constraint level. BC0 + is indicated by this leaf being set to zero, with BCN + represented by this leaf being set to N."; + } + + leaf bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The bandwidth constraint, expressed as a 32-bit IEEE + floating point number expressed in bytes per second."; + } + } + } + } + } + } + + container unconstrained-lsp { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_UNCONSTRAINED_LSP'" { + description + "Only include the unconstrained LSP container when the + sub-TLV is type 23."; + } + description + "This container defines sub-TLV 23."; + container state { + description + "State parameters of sub-TLV 23."; + + uses isis-lsdb-subtlv-type-state; + + leaf unconstrained-lsp { + type uint16; + description + "Unconstrained TE LSP count(TE Label Switched Paths + (LSPs) signalled with zero bandwidth)."; + reference + "RFC5330: A Link-Type sub-TLV to Convey the Number of + Traffic Engineering Label Switched Paths Signalled + with Zero Reserved Bandwidth across a Link. sub-TLV + 23: TLV 22,23,141,222,223"; + } + } + } + + container adjacency-sids { + when "../state/type = 'oc-isis-lsdb-types:IS_REACHABILITY_ADJ_SID'" { + description + "Only include the adjacency SIDs container when the + sub-TLV type is 31"; + } + + description + "This container defines segment routing adjacency SIDs."; + + list adjacency-sid { + key "value"; + + description + "Adjacency Segment-IDs List. An IGP-Adjacency Segment is + an IGP segment attached to a unidirectional adjacency or + a set of unidirectional adjacencies. By default, an IGP- + Adjacency Segment is local to the node which advertises + it."; + + leaf value { + type leafref { + path "../state/value"; + } + description + "Reference to the value of the Adjacency-SID."; + } + + container state { + description + "State parameters of Adjacency-SID."; + + leaf value { + type uint32; + description + "Adjacency-SID value."; + } + + leaf-list flags { + type enumeration { + enum ADDRESS_FAMILY { + description + "Address-family flag. When unset, the Adj-SID + refers to an adjacency with outgoing IPv4 + encapsulation. If set then the Adj-SID refers to + an adjacency with outgoing IPv6 encapsulation."; + } + enum BACKUP { + description + "Backup flag. When set, the Adj-SID refers to an + adjacency being protected (e.g.: using IPFRR or + MPLS-FRR)."; + } + enum VALUE { + description + "Value flag. When set, the SID carries a value + (instead of an index). By default the flag is + SET."; + } + enum LOCAL { + description + "Local flag. When set, the value/index carried + by the SID has local significance. By default + the flag is SET."; + } + enum SET { + description + "Set flag. When set, the S-Flag indicates that + the Adj-SID refers to a set of adjacencies."; + } + } + description + "Flags associated with Adj-Segment-ID."; + } + + leaf weight { + type uint8; + description + "Value that represents the weight of the Adj-SID for + the purpose of load balancing."; + } + } + } + + reference + "draft-ietf-isis-segment-routing-extensions. sub-TLV 31: + TLV 22, 222, 223, 141. "; + } + + container lan-adjacency-sids { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_ADJ_LAN_SID'" { + description + "Only include the LAN adjacency SID container when + the sub-TLV is type 32."; + } + description + "This container defines segment routing LAN adjacency + SIDs"; + + list lan-adjacency-sid { + key "value"; + + description + "Adjacency Segment-IDs List. An IGP-Adjacency Segment is + an IGP segment attached to a unidirectional adjacency or + a set of unidirectional adjacencies. By default, an IGP- + Adjacency Segment is local to the node which advertises + it."; + + leaf value { + type leafref { + path "../state/value"; + } + description + "Reference to the value of the LAN Adjacency-SID."; + } + + container state { + description + "State parameters of LAN Adjacency-SID."; + + leaf value { + type uint32; + description + "LAN Adjacency-SID value."; + } + + leaf-list flags { + type enumeration { + enum ADDRESS_FAMILY { + description + "Address-family flag. When unset, the Adj-SID + refers to an adjacency with outgoing IPv4 + encapsulation. If set then the Adj-SID refers to + an adjacency with outgoing IPv6 encapsulation."; + } + enum BACKUP { + description + "Backup flag. When set, the Adj-SID refers to an + adjacency being protected (e.g.: using IPFRR or + MPLS-FRR)."; + } + enum VALUE { + description + "Value flag. When set, the SID carries a value + (instead of an index). By default the flag is + SET."; + } + enum LOCAL { + description + "Local flag. When set, the value/index carried + by the SID has local significance. By default + the flag is SET."; + } + enum SET { + description + "Set flag. When set, the S-Flag indicates that + the Adj-SID refers to a set of adjacencies."; + } + } + description + "Flags associated with LAN-Adj-Segment-ID."; + } + + leaf weight { + type uint8; + description + "Value that represents the weight of the Adj-SID + for the purpose of load balancing."; + } + + leaf neighbor-id { + type oc-isis-types:system-id; + description + "System ID of the neighbor associated with the LAN- + Adj-Segment-ID value."; + } + } + } + + reference + "draft-ietf-isis-segment-routing-extensions. sub-TLV 32: + TLV 22, 222, 223, 141."; + } + + container link-delay { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_LINK_DELAY'" { + description + "Include the link delay container only when the sub-TLV + type is type 33."; + } + description + "This container defines unidirectional link delay."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 33: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 33."; + + uses isis-lsdb-link-characteristics-a-bit; + + leaf delay { + type uint32; + units microseconds; + description + "Average link delay value (in microseconds) between + two directly connected IS-IS neighbors over a + configurable interval."; + } + } + } + + container min-max-link-delay { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_MIN_MAX_LINK_DELAY'" { + description + "Only include the min/max link delay container when the + sub-TLV is type 34."; + } + description + "This container defines min/max link delay."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 34: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 34."; + + uses isis-lsdb-link-characteristics-a-bit; + + leaf min-delay { + type uint32; + units microseconds; + description + "Minimum measured link delay value(in microseconds) + between two directly connected IS-IS neighbors over a + configurable interval."; + } + + leaf max-delay { + type uint32; + units microseconds; + description + "Maximum measured link delay value(in microseconds) + between two directly connected IS-IS neighbors over a + configurable interval."; + } + } + } + + container link-delay-variation { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_LINK_DELAY_VARIATION'" { + description + "Only include the link delay variation container when + the sub-TLV is type 35."; + } + description + "This container defines unidirectional link delay + variation."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 35: TLV 22,23,141,222,223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 35."; + + leaf delay { + type uint32; + units microseconds; + description + "Average link delay between two directly connected IS- + IS neighbors over a configurable interval."; + } + } + } + + container link-loss { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_LINK_LOSS'" { + description + "Only include the link loss container when the sub-TLV + is type 36."; + } + description + "This container defines unidirectional link loss delay."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 36: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 36."; + + uses isis-lsdb-link-characteristics-a-bit; + + leaf link-loss { + type uint32; + description + "Link packet loss as a percentage of the total traffic + sent over a configurable interval. The basic unit is + 0.000003%, where (2^24 - 2) is 50.331642%. This value + is the highest packet-loss percentage that can be + expressed (the assumption being that precision is more + important on high-speed links than the ability to + advertise loss rates greater than this, and that high- + speed links with over 50% loss are unusable). + Therefore, measured values that are larger than the + field maximum SHOULD be encoded as the maximum + value."; + } + } + } + + container residual-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_RESIDUAL_BANDWIDTH'" { + description + "Only include the resdiual bandwidth container when the + sub-TLV is type 37."; + } + description + "This container defines unidirectional residual + bandwidth."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 37: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 37."; + + leaf residual-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "Residual bandwidth on a link,forwarding adjacency + [RFC4206], or bundled link in IEEE floating-point + format with units of bytes per second. For a link or + forwarding adjacency, residual bandwidth is defined to + be the Maximum Bandwidth [RFC5305] minus the bandwidth + currently allocated to RSVP-TE label switched paths. + For a bundled link, residual bandwidth is defined to + be the sum of the component link residual + bandwidths."; + } + } + } + + container available-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_AVAILABLE_BANDWIDTH'" { + description + "Only include the available bandwdith container when the + sub-TLV is type 38."; + } + description + "This container defines unidirectional lavailable + bandwidth."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 38: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 38."; + + uses isis-lsdb-subtlv-type-state; + + leaf available-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The available bandwidth on a link, forwarding + adjacency, or bundled link in IEEE floating-point + format with units of bytes per second. For a link or + forwarding adjacency, available bandwidth is defined + to be residual bandwidth minus the measured bandwidth + used for the actual forwarding of non-RSVP-TE label + switched path packets. For a bundled link, available + bandwidth is defined to be the sum of the component + link available bandwidths minus the measured bandwidth + used for the actual forwarding of non-RSVP-TE label + switched path packets. For a bundled link, available + bandwidth is defined to be the sum of the component + link available bandwidths."; + } + } + } + + container utilized-bandwidth { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_REACHABILITY_UTILIZED_BANDWIDTH'" { + description + "Only include the utilized bandwidth container when the + TLV is type 39."; + } + description + "This container defines unidirectional utilized + bandwidth."; + + reference + "RFC7810: IS-IS Traffic Engineering (TE) Metric + Extensions. sub-TLV 39: TLV 22, 23, 141, 222, 223."; + + container state { + description + "State parameters of IS Extended Reachability sub-TLV + 39."; + + uses isis-lsdb-subtlv-type-state; + + leaf utilized-bandwidth { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The bandwidth utilization on a link, forwarding + adjacency, or bundled link in IEEE floating-point + format with units of bytes per second. For a link or + forwarding adjacency, bandwidth utilization represents + the actual utilization of the link (i.e., as measured + by the advertising node). For a bundled link, + bandwidth utilization is defined to be the sum of the + component link bandwidth utilizations."; + } + } + } + } + } + + uses isis-lsdb-undefined-subtlv; + } + + grouping isis-lsdb-undefined-tlv { + description + "Grouping for unknown TLVs in the IS-IS LSDB"; + + container undefined-tlvs { + description + "Surrounding container for a list of unknown TLVs."; + + list undefined-tlv { + key "type"; + description + "List of TLVs that are not defined within the model, or are + not recognised by the system."; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the undefined TLV's type"; + } + + container state { + description + "State parameters of the undefined TLV."; + + uses undefined-tlv-state; + } + } + } + } + + grouping isis-lsdb-undefined-subtlv { + description + "Grouping for unknown Sub-TLVs in the IS-IS LSDB."; + + container undefined-subtlvs { + description + "This container describes undefined ISIS TLVs."; + + list undefined-subtlv { + key "type"; + + description + "Sub-TLVs that are not defined in the model or not + recognised by system."; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the type of the undefined sub-TLV"; + } + + container state { + description + "State parameters of the undefined sub-TLV."; + + uses undefined-subtlv-state; + } + } + } + } + + grouping isis-lsdb-prefix-state { + description + "This grouping defines prefix reachability."; + + container subtlvs { + description + "This container describes IS prefix sub-TLVs."; + + list subtlv { + key "type"; + + description + "List of subTLV types in the LSDB for the specified TLV."; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the sub-TLV type"; + } + + container state { + description + "State parameters for a prefix."; + + uses isis-lsdb-subtlv-type-state; + } + + container tag { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_TAG'" { + description + "Only include the tag container when the sub-TLV is type 1."; + } + description + "This container defines sub-TLV 1."; + + container state { + description + "State parameters of sub-TLV 1."; + + leaf-list tag32 { + type uint32; + description + "List of 32-bit tags associated with the prefix. Example + uses of these tags include carrying BGP standard (or + extended) communities and controlling redistribution + between levels and areas, different routing protocols, + or multiple instances of IS-IS running on the same + router."; + reference + "RFC5130: A Policy Control Mechanism in IS-IS Using + Administrative Tags. sub-TLV 1."; + } + } + } + + container tag64 { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_TAG64'" { + description + "Only include the tag64 container when the sub-TLV is type 2."; + } + description + "This container defines sub-TLV 2."; + + container state { + description + "State parameters of sub-TLV 2."; + + leaf-list tag64 { + type uint64; + description + "List of 64-bit tags associated with the prefix. Example + uses of these tags include carrying BGP standard (or + extended) communities and controlling redistribution + between levels and areas, different routing protocols, + or multiple instances of IS-IS running on the same + router."; + reference + "RFC5130: A Policy Control Mechanism in IS-IS Using + Administrative Tags. sub-TLV 2."; + } + } + } + + container flags { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_PREFIX_FLAGS'" { + description + "Only include the flags container when the sub-TLV is type 4."; + } + description + "This container defines sub-TLV 4."; + + container state { + description + "State parameters of sub-TLV 4."; + + uses isis-lsdb-subtlv-type-state; + + leaf-list flags { + type enumeration { + enum EXTERNAL_FLAG { + description + "External prefix flag. Set if the prefix has been + redistributed from another protocol. This includes + the case where multiple virtual routers are + supported and the source of the redistributed prefix + is another IS-IS instance."; + } + enum READVERTISEMENT_FLAG { + description + "Readvertisement flag. Set when the prefix has been + leaked from one level to another (upwards or + downwards)."; + } + enum NODE_FLAG { + description + "Node flag. Set when the prefix identifies the + advertising router, i.e., the prefix is a host + prefix advertising a globally reachable address + typically associated with a loopback address."; + } + } + description + "Additional prefix reachability flags."; + + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 and + IPv6 Reachability. sub-TLV 4."; + } + } + } + + container ipv4-source-router-id { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_IPV4_ROUTER_ID'" { + description + "Only include the IPv4 Source Router ID container when + the sub-TLV is type 11."; + } + description + "This container defines sub-TLV 11."; + + container state { + description + "State parameters of sub-TLV 11."; + + uses isis-lsdb-subtlv-type-state; + + leaf ipv4-source-router-id { + type oc-inet:ipv4-address; + description + "IPv4 Source router ID address. In cases where the + advertisement is an identifier for the advertising + router (e.g., with the N-flag set in the Prefix + Attribute Flags sub-TLV), it may be useful for other + routers to know the source of the advertisement. When + reachability advertisement is leaked from one level to + another, Router ID advertised is always the Router ID + of the IS-IS instance that originated the + advertisement. This would be true even if the prefix + had been learned from another protocol."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 + and IPv6 Reachability. sub-TLV 11"; + } + } + } + + container ipv6-source-router-id { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_IPV6_ROUTER_ID'" { + description + "Only include the IPv6 Source Router ID container when + the sub-TLV is type 12."; + } + description + "This container defines sub-TLV 12."; + + container state { + description + "State parameters of sub-TLV 12."; + + uses isis-lsdb-subtlv-type-state; + + leaf ipv6-source-router-id { + type oc-inet:ipv6-address; + description + "IPv6 Source router ID address. In cases where the + advertisement is an identifier for the advertising + router (e.g., with the N-flag set in the Prefix + Attribute Flags sub-TLV), it may be useful for other + routers to know the source of the advertisement. When + reachability advertisement is leaked from one level to + another, Router ID advertised is always the Router ID + of the IS-IS instance that originated the + advertisement. This would be true even if the prefix + had been learned from another protocol."; + reference + "RFC7794: IS-IS Prefix Attributes for Extended IPv4 + and IPv6 Reachability. sub-TLV 12."; + } + } + } + + uses isis-lsdb-prefix-sid-state; + } + } + + uses isis-lsdb-undefined-subtlv; + } + + grouping isis-lsdb-prefix-sid-state { + description + "This grouping defines ISIS Prefix SID."; + + container prefix-sids { + when "../state/type = " + + "'oc-isis-lsdb-types:IP_REACHABILITY_PREFIX_SID'" { + description + "Only include the Prefix SID container when + the sub-TLV is type 3."; + } + description + "This container defines segment routing extensions for + prefixes."; + + reference + "draft-ietf-isis-segment-routing-extensions. sub-TLV 3: TLV + 135, 235, 236, 237."; + + list prefix-sid { + key "value"; + + description + "Prefix Segment-ID list. IGP-Prefix Segment is an IGP segment + attached to an IGP prefix. An IGP-Prefix Segment is global + (unless explicitly advertised otherwise) within the SR/IGP + domain."; + + leaf value { + type leafref { + path "../state/value"; + } + description + "Reference to the value of the prefix SID."; + } + + container state { + description + "State parameters for Prefix-SID."; + + leaf value { + type uint32; + description + "IGP Prefix-SID value."; + } + + leaf-list flags { + type enumeration { + enum READVERTISEMENT { + description + "Readvertisment flag. When set, the prefix to which + this Prefix-SID is attached, has been propagated by + the router either from another level or from + redistribution."; + } + enum NODE { + description + "Node flag. When set, the Prefix-SID refers to the + router identified by the prefix. Typically, the + N-Flag is set on Prefix-SIDs attached to a router + loopback address."; + } + enum PHP { + description + "Penultimate-Hop-Popping flag. When set, then the + penultimate hop MUST NOT pop the Prefix-SID before + delivering the packet to the node that advertised + the Prefix-SID."; + } + enum EXPLICIT_NULL { + description + "Explicit-Null flag. When set, any upstream neighbor + of the Prefix-SID originator MUST replace the + Prefix-SID with a Prefix-SID having an Explicit-NULL + value (0 for IPv4 and 2 for IPv6) before forwarding + the packet."; + } + enum VALUE { + description + "Value flag. When set, the Prefix-SID carries a + value (instead of an index). By default the flag is + UNSET."; + } + enum LOCAL { + description + "Local flag. When set, the value/index carried by + the Prefix-SID has local significance. By default + the flag is UNSET."; + } + } + description + "Flags associated with Prefix Segment-ID."; + } + + leaf algorithm { + type uint8; + description + "Prefix-SID algorithm to be used for path computation."; + } + } + } + } + } + + grouping isis-lsdb-common-metric-specification { + description + "Common definitions of the metric in IS-IS."; + + container default-metric { + description + "This container defines ISIS Default Metric."; + + container state { + description + "State parameters for default-metric."; + + leaf flags { + type enumeration { + enum INTERNAL { + description + "When set to zero, indicates internal metrics."; + } + } + description + "ISIS Default-Metric Flags."; + } + + leaf default-metric { + type oc-isis-types:narrow-metric; + description + "ISIS default metric value. This is a metric understood by + every Intermediate system in the domain. Each circuit + shall have a positive integral value assigned for this + metric. The value may be associated with any objective + function of the circuit, but by convention is intended to + measure the capacity of the circuit for handling traffic, + for example, its throughput in bits-per-second. Higher + values indicate a lower capacity."; + } + } + } + + container delay-metric { + description + "This container defines the ISIS delay metric."; + + container state { + description + "State parameters of delay-metric."; + + leaf metric { + type oc-isis-types:narrow-metric; + description + "ISIS delay metric value. This metric measures the transit + delay of the associated circuit. It is an optional metric, + which if assigned to a circuit shall have a positive + integral value. Higher values indicate a longer transit + delay."; + } + + leaf-list flags { + type isis-metric-flags; + description + "ISIS Delay Metric Flags."; + } + } + } + + container expense-metric { + description + "This container defines the ISIS expense metric."; + + container state { + description + "State parameters of expense-metric."; + + leaf metric { + type oc-isis-types:narrow-metric; + description + "ISIS expense metric value. This metric measures the + monetary cost of utilising the associated circuit. It is + an optional metric, which if assigned to a circuit shall + have a positive integral value1). Higher values indicate a + larger monetary expense."; + } + + leaf-list flags { + type isis-metric-flags; + description + "ISIS Expense Metric Flags."; + } + } + } + + container error-metric { + description + "This container defines the ISIS error metric."; + + container state { + description + "State parameters of error-metric."; + + leaf metric { + type oc-isis-types:narrow-metric; + description + "ISIS error metric value. This metric measures the + residual error probability of the associated circuit. It + is an optional metric, which if assigned to a circuit + shall have a non-zero value. Higher values indicate a + larger probability of undetected errors on the circuit."; + } + + leaf-list flags { + type isis-metric-flags; + description + "IS-IS error metric flags."; + } + } + } + } + + grouping isis-lsdb-neighbor { + description + "This grouping defines attributes of an ISIS standard + neighbor."; + + container state { + description + "State parameters of IS standard neighbor."; + + leaf system-id { + type oc-isis-types:system-id; + description + "System-ID of IS neighbor."; + } + } + + uses isis-lsdb-common-metric-specification; + + } + + grouping ipv4-prefix-attributes-state { + description + "This group defines attributes of an IPv4 standard prefix."; + + container state { + description + "State parameters of IPv4 standard prefix."; + + leaf up-down { + type boolean; + description + "The up/down bit. Set if a prefix is advertised from a + higher level to a lower level (e.g., level 2 to level 1), + indicating that the prefix has traveled down the hierarchy. + Prefixes that have the up/down bit set may only be + advertised down the hierarchy, i.e., to lower levels. When a + prefix is first injected into IS-IS, the bit is UNSET."; + } + + leaf prefix { + type oc-inet:ipv4-prefix; + description + "IPv4 prefix contained within reachability TLVs."; + } + } + + uses isis-lsdb-common-metric-specification; + } + + grouping isis-lsdb-common-mt-id { + description + "Common definition of the multi-topology ID"; + + leaf mt-id { + type uint16 { + range "0..4095"; + } + description + "Multi-topology ID"; + } + } + + grouping ipv4-prefix-extended-state { + description + "This grouping defines attributes of an IPv4 extended prefix."; + + container state { + description + "State parameters of an IPv4 extended prefix."; + uses ipv4-prefix-extended-params-state; + } + + uses isis-lsdb-prefix-state; + } + + grouping ipv4-mt-prefix-extended-state { + description + "State parameters that relate to an IPv4 prefix in a + multi-topology context."; + + container state { + description + "State parameters of an IPv4 extended prefix."; + uses ipv4-prefix-extended-params-state; + uses isis-lsdb-common-mt-id; + } + + uses isis-lsdb-prefix-state; + } + + grouping ipv4-prefix-extended-params-state { + description + "State parameters that relate to an IPv4 prefix"; + + leaf up-down { + type boolean; + description + "The up/down bit. Set if a prefix is advertised from a + higher level to a lower level (e.g., level 2 to level 1), + indicating that the prefix has traveled down the hierarchy. + Prefixes that have the up/down bit set may only be + advertised down the hierarchy, i.e., to lower levels. When a + prefix is first injected into IS-IS, the bit is UNSET."; + } + + leaf s-bit { + type boolean; + description + "The Sub-TLV present bit. If UNSET, the octets of Sub-TLVs + are not present. Otherwise, the bit is set and the octet + following the prefix will contain the length of the Sub-TLV + portion of the structure."; + } + + leaf prefix { + type oc-inet:ipv4-prefix; + description + "IPv4 prefix contained within extended reachability TLVs."; + } + + leaf metric { + type oc-isis-types:wide-metric; + description + "ISIS metric value."; + } + } + + grouping ipv6-prefix-extended-state { + description + "State parameters relating to an IPv6 prefix."; + + container state { + description + "State parameters of IPv6 prefix attributes"; + + uses ipv4-prefix-extended-params-state; + } + + uses isis-lsdb-prefix-state; + } + + grouping ipv6-mt-prefix-extended-state { + description + "State parameters relating to a multi-topology IPv6 + prefix."; + + container state { + description + "State parameters relating an IPv6 prefix attribute"; + uses ipv6-prefix-extended-params-state; + uses isis-lsdb-common-mt-id; + } + + uses isis-lsdb-prefix-state; + } + + grouping ipv6-prefix-extended-params-state { + description + "Common parameters of an IPv6 extended prefix."; + + leaf up-down { + type boolean; + description + "The up/down bit. Set if a prefix is advertised from a + higher level to a lower level (e.g., level 2 to level 1), + indicating that the prefix has traveled down the hierarchy. + Prefixes that have the up/down bit set may only be + advertised down the hierarchy, i.e., to lower levels. When a + prefix is first injected into IS-IS, the bit is UNSET."; + } + + leaf x-bit { + type boolean; + description + "The external bit. Set when the prefix was distributed into + IS-IS from another routing protocol."; + } + + leaf s-bit { + type boolean; + description + "The sub-tlv present bit. If UNSET, the octets of Sub-TLVs + are not present. Otherwise, the bit is set and the octet + following the prefix will contain the length of the Sub-TLV + portion of the structure."; + } + + leaf prefix { + type oc-inet:ipv6-prefix; + description + "IPv6 prefix contained within extended reachability TLVs."; + } + + leaf metric { + type oc-isis-types:wide-metric; + description + "ISIS metric value."; + } + } + + grouping mt-isis-neighbor { + description + "This grouping defines list of ISIS multi-topology neighbors for + extended ISIS LSP(multiple system IDs)."; + + container state { + description + "State parameters of MT neighbor."; + + leaf mt-id { + type uint16 { + range "0..4095"; + } + description + "Identifier of a topology being announced."; + } + + leaf system-id { + type oc-isis-types:system-id; + description + "System-id of the IS neighbor."; + } + + leaf metric { + type oc-isis-types:wide-metric; + description + "ISIS metric value."; + } + } + uses is-reachability-neighbor-state; + } + + grouping isis-lsdb-generic-tlv { + description + "Generic TLV encoding grouping."; + + leaf type { + type uint8; + description + "TLV Type."; + } + + leaf length { + type uint8; + description + "TLV length."; + } + + leaf value { + type binary; + description + "TLV value."; + } + } + + grouping undefined-tlv-state { + description + "Generic grouping defining an unknown TLV."; + + uses isis-lsdb-generic-tlv; + } + + grouping undefined-subtlv-state { + description + "Generic grouping defining an unknown sub-TLV."; + + uses isis-lsdb-generic-tlv; + } + + grouping lsp-state { + description + "This grouping defines ISIS LSP state information."; + + leaf lsp-id { + type leafref { + path "../state/lsp-id"; + } + + description + "A reference to the Link State PDU ID."; + } + + container state { + description + "State parameters of Link State PDU."; + + leaf lsp-id { + type oc-isis-types:lsp-id; + description + "LSP ID of the LSP."; + } + + leaf maximum-area-addresses { + type uint8; + description + "Number of area addresses permitted for this ISs area. 0 + indicates the IS only supports three area addresses (by + default). Any number inclusive of 1 and 254 indicates the + number of areas allowed."; + } + + leaf version { + type uint8; + default 1; + description + "PDU version. This is set to 1."; + } + + leaf version2 { + type uint8; + default 1; + description + "PDU version2. This is set to 1"; + } + + leaf id-length { + type uint8; + description + "Length of the ID field of NSAP addresses and NETs used in + this routing domain."; + } + + leaf pdu-type { + type enumeration { + enum LEVEL_1 { + description "This enum describes ISIS level 1 PDU."; + } + enum LEVEL_2 { + description "This enum describes ISIS level 2 PDU."; + } + } + description + "Link State PDU type."; + } + + leaf remaining-lifetime { + type uint16; + units "seconds"; + description + "Remaining lifetime in seconds before the LSP expiration."; + } + + leaf sequence-number { + type uint32; + description + "Sequence number of the LSP."; + } + + leaf checksum { + type uint16; + description + "Checksum of the LSP."; + } + + leaf pdu-length { + type uint16; + description + "Total length of the LSP."; + } + + leaf-list flags { + type enumeration { + enum PARTITION_REPAIR { + description + "When set, the originator supports partition + repair."; + } + enum ATTACHED_ERROR { + description + "When set, the originator is attached to another + area using the referred metric."; + } + enum ATTACHED_EXPENSE { + description + "When set, the originator is attached to another + area using the referred metric."; + } + enum ATTACHED_DELAY { + description + "When set, the originator is attached to another + area using the referred metric."; + } + enum ATTACHED_DEFAULT { + description + "When set, the originator is attached to another + area using the referred metric."; + } + enum OVERLOAD { + description + "When set, the originator is overloaded, and must + be avoided in path calculation."; + } + } + description + "LSP Type-Block flags."; + } + + leaf is-type { + type oc-isis-types:level-number; + description + "Type of neighboring system."; + } + } + + container tlvs { + description + "This container defines Link State PDU State TLVs."; + + list tlv { + key "type"; + + description + "List of TLV types in the LSDB for the specified LSP."; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the TLV's type."; + } + + container state { + config false; + description + "Operational state parameters relating to the specified + LSP"; + + uses isis-lsdb-tlv-type-state; + } + + container area-address { + when "../state/type = 'oc-isis-lsdb-types:AREA_ADDRESSES'" { + description + "Include area address parameters only when the TLV type + is TLV 1."; + } + + description + "This container defines TLV 1."; + + container state { + description + "State parameters of ISIS TLV 1."; + + leaf-list area-address { + type oc-isis-types:area-address; + description + "Area adress(es) of the IS. Set of manual area + addresses of this IS."; + reference + "ISO 10589 Intermediate System to Intermediate System + Intra- Domain Routeing Exchange Protocol for use in + Conjunction with the Protocol for Providing the + Connectionless-mode Network Service (ISO 8473 ) + International Standard 10589: 2002, Second Edition, + 2002. TLV 1."; + } + } + } + + container lsp-buffer-size { + when "../state/type = " + + "'oc-isis-lsdb-types:LSP_BUFFER_SIZE'" { + description + "Include the LSP buffer size parameters only when the + TLV type is TLV 14."; + } + + description + "This container defines TLV 14 - the LSP Buffer Size TLV"; + + container state { + description + "State parameters of TLV 14."; + + leaf buffer-size { + type uint16; + units "bytes"; + description + "The maximum MTU that the advertising system can + receive, expressed in bytes."; + reference "ISO 10589"; + } + } + } + + container nlpid { + when "../state/type = 'oc-isis-lsdb-types:NLPID'" { + description + "Include NLPID specification only when the TLV type is + TLV 129."; + } + + description + "This container defines TLV 129."; + + container state { + description + "State parameters of ISIS TLV 129."; + + uses isis-lsdb-tlv-nlpid-state; + } + } + + container hostname { + when "../state/type = 'oc-isis-lsdb-types:DYNAMIC_NAME'" { + description + "Include the dynamic hostname TLV only when the TLV is + type 137."; + } + description + "This container defines TLV 137."; + + container state { + description + "State parameters of ISIS TLV 137."; + + leaf-list hostname { + type string; + description + "Name of the node."; + + reference + "RFC6233: IS-IS Registry Extension for Purges, RFC + 5301: Dynamic Hostname Exchange Mechanism for IS-IS. + TLV 137"; + } + } + } + + container ipv4-interface-addresses { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV4_INTERFACE_ADDRESSES'" { + description + "Include the IPv4 interface addresses TLV only when the + TLV is type 132."; + } + description + "This container defines TLV 132."; + + container state { + description + "State parameters of ISIS TLV 132."; + + leaf-list ipv4-interface-addresses { + type oc-inet:ipv4-address; + description + "IPv4 address(es) of the interface corresponding to + the SNPA over which this PDU is to be transmitted."; + reference + "RFC1195: Use of OSI IS-IS for Routing in TCP/IP and + Dual Environments. TLV 132."; + } + } + } + + container ipv6-interface-addresses { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV6_INTERFACE_ADDRESSES'" { + description + "Include the IPv6 interface addresses TLV only when the + TLV is type 232."; + } + description + "This container defines TLV 232."; + + container state { + description + "State parameters of ISIS TLV 232."; + + leaf-list ipv6-interface-addresses { + type oc-inet:ipv6-address; + description + "IPv6 interface addresses of the node. MUST contain + only the non-link-local IPv6 addresses assigned to the + IS."; + reference + "RFC5308: Routing IPv6 with IS-IS. TLV 232."; + } + } + } + + container ipv4-te-router-id { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV4_TE_ROUTER_ID'" { + description + "Include the IPv4 traffic engineering router ID TLV only + when the TLV is type 134."; + } + description + "This container defines TLV 134."; + + container state { + description + "State parameters of ISIS TLV 134."; + + leaf-list router-id { + type oc-inet:ipv4-address; + description + "IPv4 Traffic Engineering router ID of the node. For + traffic engineering, it guarantees that we have a + single stable address that can always be referenced in + a path that will be reachable from multiple hops away, + regardless of the state of the node's interfaces."; + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. TLV + 134."; + } + } + } + + container ipv6-te-router-id { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV6_TE_ROUTER_ID'" { + description + "Include the IPv6 traffic engineering router ID TLV only + when the TLV is type 140."; + } + description + "This container defines TLV 140."; + + container state { + description + "State parameters of ISIS TLV 140."; + + leaf-list router-id { + type oc-inet:ipv6-address; + description + "IPv6 Traffic Engineering router ID of the node. For + traffic engineering, it guarantees that we have a + single stable address that can always be referenced in + a path that will be reachable from multiple hops away, + regardless of the state of the node's interfaces."; + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS. TLV 140."; + } + } + } + + container instance-ids { + when "../state/type = 'oc-isis-lsdb-types:INSTANCE_ID'" { + description + "Include the ISIS Instance Identifier TLV only when the + TLV is type 7."; + } + description + "This container defines ISIS Instance Identifier TLV."; + reference "RFC6822: IS-IS Multi-Instance. TLV 7."; + + list instance-id { + key "instance-id"; + + description + "A list of instance IDs received within TLV 7 within an + IS-IS LSP. In the case that more than one instance of TLV 7 + is included in the LSP, the instance IDs specified within + the instances are concatenated within this list."; + + leaf instance-id { + type leafref { + path "../state/instance-id"; + } + description + "Reference to the unique instance ID."; + } + container state { + description + "State parameters of ISIS TLV 7."; + + leaf instance-id { + type uint16; + description + "An Instance Identifier (IID) to uniquely identify an + IS-IS instance. When the IID = 0, the list of + supported ITIDs MUST NOT be present. An IID-TLV with + IID = 0 MUST NOT appear in an SNP or LSP. When the TLV + appears (with a non-zero IID) in an SNP or LSP, + exactly one ITID. MUST be present indicating the + topology with which the PDU is associated. If no ITIDs + or multiple ITIDs are present or the IID is zero, then + the PDU MUST be ignored."; + } + + leaf-list topology-id { + type uint16; + description + "Instance-Specific Topology Identifiers (ITIDs)."; + } + } + } + } + + container ipv4-srlgs { + when "../state/type = 'oc-isis-lsdb-types:IPV4_SRLG'" { + description + "Include the IPv4 SRLG TLV only when the TLV is type + 138."; + } + description + "This container defines ISIS SRLG TLV 138."; + + reference + "RFC5307: IS-IS Extensions in Support of Generalized + Multi-Protocol Label Switching (GMPLS). TLV 138."; + + list ipv4-srlg { + key "instance-number"; + + description + "Instance of the IPv4 SRLG TLV"; + + leaf instance-number { + type leafref { + path "../state/instance-number"; + } + description + "Reference to the instance number of TLV 138."; + } + + container state { + description + "State parameters of TLV 138."; + + leaf instance-number { + type uint32; + description + "An arbitrary unsigned 32-bit integer used to + disambiguate the instance of TLV 138. The instance + identifier is synthesised by the system + and may be renumbered for the same SRLG definition + in subsequent advertised LSPs if (and only if) the + entire list of SRLGs is replaced."; + } + + leaf system-id { + type oc-isis-types:system-id; + description + "Neighbor system ID."; + } + + leaf psn-number { + type uint8; + description + "Pseudonode number if the neighbor is on a LAN + interface."; + } + + leaf-list flags { + type enumeration { + enum NUMBERED { + description + "When set, the interface is numbered, whereas if + unset indicates that the interface is + unnumbered."; + } + } + description + "SRLG flags."; + } + + leaf ipv4-interface-address { + type oc-inet:ipv4-address; + description + "IPv4 interface address."; + } + + leaf ipv4-neighbor-address { + type oc-inet:ipv4-address; + description + "IPv4 neighbor address."; + } + + leaf-list srlg-value { + type uint32; + description + "List of SRLG values."; + } + } + } + } + + container ipv6-srlgs { + when "../state/type = 'oc-isis-lsdb-types:IPV6_SRLG'" { + description + "Include the IPv6 SRLG TLV only when the TLV is type + 139."; + } + description + "This container defines ISIS SRLG TLV."; + + reference + "RFC6119: IPv6 Traffic Engineering in IS-IS. TLV 139."; + + list ipv6-srlg { + key "instance-number"; + + description + "Instance of the IPv6 SRLG TLV."; + + leaf instance-number { + type leafref { + path "../state/instance-number"; + } + description + "Reference to the instance number of the IPv6 Shared + Risk Link Group (SRLG) TLV."; + } + + container state { + description + "State parameters of TLV 139."; + + leaf instance-number { + type uint32; + description + "An arbitrary unsigned 32-bit integer used to + disambiguate the instance of TLV 138. The instance + identifier is synthesised by the system + and may be renumbered for the same SRLG definition + in subsequent advertised LSPs if (and only if) the + entire list of SRLGs is replaced."; + } + + leaf system-id { + type oc-isis-types:system-id; + description + "Neighbor system ID."; + } + + leaf psn-number { + type uint8; + description + "Pseudonode number if the neighbor is on a LAN + interface."; + } + + leaf-list flags { + type enumeration { + enum NA { + description + "When set, the IPv6 neighbour address is included, + whereas if unset, it is omitted"; + } + } + description + "IPv6 SRLG flags."; + } + + leaf ipv6-interface-address { + type oc-inet:ipv6-address; + description + "IPv6 interface address or Link Local Identifier."; + } + + leaf ipv6-neighbor-address { + type oc-inet:ipv6-address; + description + "IPv6 neighbor address or Link Remote Identifier."; + } + + leaf-list srlg-value { + type uint32; + description + "SRLG values."; + } + } + } + } + + container purge-oi { + when "../state/type = 'oc-isis-lsdb-types:PURGE_OI'" { + description + "Only include the purge originator identitication TLV + when the TLV type is 13."; + } + description + "This container defines ISIS purge TLV."; + + reference + "RFC6232: Purge Originator Identification TLV for IS-IS. + TLV 13."; + + container state { + description + "State parameters of TLV 13."; + + leaf system-id-count { + type uint8; + description + "Number of system IDs carried in this TLV."; + } + + leaf source-system-id { + type oc-isis-types:system-id; + description + "System ID of the Intermediate System that inserted + this TLV."; + } + + leaf received-system-id { + type oc-isis-types:system-id; + description + "System ID of the Intermediate System from which the + purge was received."; + } + } + } + + container router-capabilities { + when "../state/type = " + + "'oc-isis-lsdb-types:ROUTER_CAPABILITY'" { + description + "Only include the router capability TLV when the TLV is + type 242."; + } + description + "This container defines router capabilities."; + + list router-capability { + key "instance-number"; + + description + "This list describes IS Router capabilities."; + + reference + "RFC4971: Intermediate System to Intermediate System + (IS-IS) Extensions for Advertising Router Information. + TLV 242."; + + leaf instance-number { + type leafref { + path "../state/instance-number"; + } + description + "Reference to the instance number of the router + capability TLV."; + } + + container state { + description + "State parameters of TLV 242."; + + leaf instance-number { + type uint32; + description + "A unique instance number for the instance of the + router capabilities TLV. The instance number should + be autogenerated by the producer of the data and may + be renumbered if the entire LSP contents are replaced + in subsequent advertisements."; + } + + leaf router-id { + type oc-inet:ipv4-address; + description + "IPv4 router-id."; + } + + leaf-list flags { + type enumeration { + enum FLOOD { + description + "When the S bit is set(1), the IS - IS Router + CAPABILITY TLV MUST be flooded across the entire + routing domain. When the S bit is not set(0), + the TLV MUST NOT be leaked between levels . This + bit MUST NOT be altered during the TLV + leaking."; + } + enum DOWN { + description + "When the IS-IS Router CAPABILITY TLV is leaked + from level - 2 to level-1, the Down bit MUST be + set. Otherwise, this bit MUST be clear. IS - IS + Router capability TLVs with the Down bit set + MUST NOT be leaked from level - 1 to level-2. + This is to prevent TLV looping."; + } + } + description + "Router capability flags."; + } + } + + container subtlvs { + description + "This container describes router capability TLV + sub-TLVs"; + + list subtlv { + key "type"; + description + "List of subTLV types in the LSDB for the specified + TLV"; + + leaf type { + type leafref { + path "../state/type"; + } + description + "Reference to the sub-TLV type"; + } + + container state { + description + "State parameters of IS Router Capabilities"; + + uses isis-lsdb-subtlv-type-state; + } + + container segment-routing-algorithms { + when "../state/type = " + + "'oc-isis-lsdb-types:ROUTER_CAPABILITY_SR_ALGORITHM'" { + description + "Only include segment routing algorithm when the + sub-TLV is type 19."; + } + description + "This container defines SR algorithm sub-TLV 19."; + + reference + "draft-ietf-isis-segment-routing-extensions. + TLV 242, sub-TLV 19"; + + list segment-routing-algorithm { + key "algorithm"; + + description + "List of the segment routing algorithsm advertised within the TLV."; + + leaf algorithm { + type leafref { + path "../state/algorithm"; + } + description + "Reference to the SR algorithm that the subTLV + describes."; + } + + container state { + description + "State parameters of sub-TLV 19 - Segment + Routing Algorithm."; + + leaf algorithm { + type enumeration { + enum SPF { + value 0; + description + "Shortest Path First (SPF) algorithm based + on link metric. This is the well-known + shortest path algorithm as computed by + the IS-IS Decision process. Consistent + with the deployed practice for link- + state protocols, algorithm 0 permits any + node to overwrite the SPF + path with a different path based on local + policy."; + } + enum STRICT_SPF { + value 1; + description + "Strict Shortest Path First (SPF) + algorithm based on link metric. The + algorithm is identical to algorithm 0 but + algorithm 1 requires that all nodes + along the path will honor the SPF routing + decision. Local policy MUST NOT alter the + forwarding decision computed by algorithm + 1 at the node claiming to support + algorithm 1."; + } + } + description + "The Segment Routing algorithm that is described + by the TLV."; + } + } + } + } + + container segment-routing-capability { + when "../state/type = " + + "'oc-isis-lsdb-types:ROUTER_CAPABILITY_SR_CAPABILITY'" { + description + "Only include the SR capability sub-TLV when + the sub-TLV type is 2."; + } + description + "This container defines SR Capability sub-TLV 2."; + + reference + "draft-ietf-isis-segment-routing-extensions. TLV + 242, sub-TLV 2."; + + container state { + description + "State parameters of IS SR Router Capability"; + + leaf-list flags { + type enumeration { + enum IPV4_MPLS { + description + "When set, the router is capable of + processing SR MPLS encapsulated IPv4 + packets on all interfaces."; + } + enum IPV6_MPLS { + description + "When set, the router is capable of + processing SR MPLS encapsulated IPv6 + packets on all interfaces."; + } + enum IPV6_SR { + description + "When set, the router is capable of + processing the IPv6 Segment Routing Header + on all interfaces."; + } + } + description + "Segment Routing Capability Flags."; + } + } + + container srgb-descriptors { + description + "SRGB Descriptors included within the SR + capability sub-TLV"; + + list srgb-descriptor { + description + "Descriptor entry within the SR capabilty + sub-TLV"; + + container state { + description + "State parameters of the SR range"; + + leaf range { + type uint32; + description + "Number of SRGB elements. The range + value MUST be greater than 0."; + } + + leaf label { + type oc-mpls-types:mpls-label; + description + "The first value of the SRGB when + expressed as an MPLS label."; + } + } + } + } + } + } + } + uses isis-lsdb-undefined-subtlv; + } + } + + container is-reachability { + when "../state/type = 'oc-isis-lsdb-types:IIS_NEIGHBORS'" { + description + "Include IIS_NEIGHBORS sub-TLV when the TLV type is 2."; + } + description + "This container describes list of ISIS neighbors and + attributes."; + + reference + "ISO 10589, Intermediate System to Intermediate System + Intra- Domain Routeing Exchange Protocol for use in + Conjunction with the Protocol for Providing the + Connectionless-mode Network Service (ISO 8473), + International Standard 10589: 2002, Second Edition, + 2002. TLV 2."; + + container neighbors { + description + "This container describes IS neighbors."; + + list neighbors { + key "system-id"; + description + "IS reachability neighbor attributes."; + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the system ID of the neighbor."; + } + + uses isis-lsdb-neighbor; + } + } + } + + container ipv4-internal-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV4_INTERNAL_REACHABILITY'" { + description + "Include IPv4 internal reachability TLV when the TLV + type is specified as 128."; + } + description + "This container defines list of IPv4 internal reachability + information."; + + reference + "RFC1195: OSI ISIS for IP and Dual Environments. RFC5302: + Domain-Wide Prefix Distribution with Two-Level IS-IS. TLV + 128"; + + container prefixes { + description + "This container describes IS prefixes."; + + list prefixes { + key "prefix"; + + description + "IPv4 prefixes and internal reachability attributes."; + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the IPv4 prefix"; + } + + uses ipv4-prefix-attributes-state; + } + } + } + + container ipv4-external-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV4_EXTERNAL_REACHABILITY'" { + description + "Include IPv4 external reachability when the TLV type + is set to 130."; + } + description + "This container defines list of IPv4 external reachability + information."; + + reference + "RFC1195: OSI ISIS for IP and Dual Environments. RFC5302: + Domain-Wide Prefix Distribution with Two-Level IS-IS. TLV + 130"; + + container prefixes { + description + "This container describes IS neighbors."; + + list prefixes { + key "prefix"; + + description + "IPv4 external prefixes and reachability attributes."; + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the IPv4 prefix."; + } + + uses ipv4-prefix-attributes-state; + } + } + } + + container authentication { + when "../state/type = 'oc-isis-lsdb-types:AUTHENTICATION'" { + description + "Only include the authentication TLV when the TLV is + type 10."; + } + description + "This container defines authentication information of the + node."; + + reference + "ISO 10589 Intermediate System to Intermediate System + Intra- Domain Routeing Exchange Protocol for use in + Conjunction with the Protocol for Providing the + Connectionless-mode Network Service (ISO 8473) + International Standard 10589: 2002, Second Edition, 2002. + TLV 10."; + + container state { + description + "State parameters of TLV 10."; + + leaf crypto-type { + type enumeration { + enum HMAC_MD5 { + description + "HMAC-MD5 Authentication type."; + } + enum CLEARTEXT { + description + "Cleartext Authentication type."; + } + } + description + "Authentication type to be used."; + } + + leaf authentication-key { + type string; + description + "Authentication key to be used."; + } + } + } + + container extended-is-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:EXTENDED_IS_REACHABILITY'" { + description + "Only included the extended IS reachability TLV when the + TLV is type 22."; + } + + description + "This container defines list of ISIS extended reachability + neighbors."; + + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. TLV + 22."; + + container neighbors { + description + "This container describes IS neighbors."; + + list neighbors { + key "system-id"; + description + "This list describes ISIS extended neigbors and + reachability attributes."; + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the neighboring system's system ID."; + } + + container state { + description + "State parameters of extended neighbor"; + + leaf system-id { + type oc-isis-types:system-id; + description + "System-id of the neighbor."; + } + leaf metric { + type oc-isis-types:wide-metric; + description + "Metric value."; + } + } + uses is-reachability-neighbor-state; + } + } + } + + container extended-ipv4-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:EXTENDED_IPV4_REACHABILITY'" { + description + "Only include the extended IPv4 reachability container + when the TLV type is 135."; + } + description + "This container defines list of IPv4 extended reachability + information."; + + reference + "RFC5305: IS-IS Extensions for Traffic Engineering. TLV + 135"; + + container prefixes { + description + "This container describes IS prefixes."; + + list prefix { + key "prefix"; + + description + "This list describes IPv4 extended prefixes and + attributes."; + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the IPv4 prefix that the TLV describes + the attributes of."; + } + + uses ipv4-prefix-extended-state; + } + } + } + + container ipv6-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:IPV6_REACHABILITY'" { + description + "Only include the IPv6 reachability container when the + TLV type is 236."; + } + description + "This container defines list of IPv6 reachability + information."; + + reference + "RFC5308: Routing IPv6 with IS-IS. TLV 236"; + + container prefixes { + description + "This container describes IS prefixes."; + + list prefixes { + key "prefix"; + + description + "This list defines IPv6 extended prefix attributes."; + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the IPv6 prefix that the TLV corresponds + to."; + } + + uses ipv6-prefix-extended-state; + } + } + } + + container multi-topology { + when "../state/type = 'oc-isis-lsdb-types:MULTI_TOPOLOGY'" { + description + "Only include the multi-topology container when the TLV + is type 229."; + } + + description + "This container defines the topology supported."; + + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in + Intermediate System to Intermediate Systems (IS-ISs). TLV + 229"; + + container topologies { + description + "This container describes IS topologies."; + + list topology { + key "mt-id"; + + description + "This list describes a topology."; + + leaf mt-id { + type leafref { + path "../state/mt-id"; + } + description + "Reference to the multi-topology ID being described + by the list entry."; + } + + container state { + description + "State parameters of IS multi-topology TLV 229."; + + leaf mt-id { + type uint16 { + range "0 .. 4095"; + } + description + "Multi-topology ID."; + } + + leaf attributes { + type enumeration { + enum OVERLOAD { + description + "When set, node is overloaded, still part of + the topology but cannot be used for transit."; + } + enum ATTACHED { + description + "When set, node is attached to another area + using the referred metric and can be used as + default gateway."; + } + } + description + "Attributes of the LSP for the associated + topology."; + } + } + } + } + } + + container isis-neighbor-attribute { + when "../state/type = " + + "'oc-isis-lsdb-types:IS_NEIGHBOR_ATTRIBUTE'" { + description + "Only include the neighbor attribute container when the + TLV is type 23."; + } + description + "This container defines list of ISIS topology neighbors + for extended ISIS LSP (multiple system IDs). "; + + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) + Space for IS-IS. TLV 23. It is identical in format to the + extended IS reachability TLV 22."; + + container neighbors { + description + "This container describes IS neighbors."; + + list neighbor { + key "system-id"; + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the neighboring IS"; + } + + container state { + description + "State parameters of extended neighbor."; + + leaf system-id { + type oc-isis-types:system-id; + description + "System-id of the neighbor."; + } + leaf metric { + type oc-isis-types:wide-metric; + description + "Metric value."; + } + } + uses is-reachability-neighbor-state; + + description + "This list defines ISIS extended reachability neighbor + attributes."; + } + } + } + + container is-alias-id { + when "../state/type = 'oc-isis-lsdb-types:ISIS_ALIAS_ID'" { + description + "Only include the ISIS alias ID container when the TLV + is type 24."; + } + + description + "This container defines the IS-Alias TLV which allows + extension-capable ISs to recognize the Originating System + of an Extended LSP set. It identifies the Normal system- + id of the Originating System."; + + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) + Space for IS-IS TLV 24."; + + container state { + config false; + description + "State parameters of alias ID."; + + leaf alias-id { + type oc-isis-types:system-id; + description + "List of alias ID(s)."; + } + } + } + + container mt-isn { + when "../state/type = 'oc-isis-lsdb-types:MT_ISN'" { + description + "Only include the MT ISN container when the TLV is type + 222."; + } + description + "This container defines list of ISIS multi-topology + neighbors."; + + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in + Intermediate System to Intermediate Systems (IS-ISs). TLV + 222."; + + container neighbors { + description + "MT-IS neigbor attributes."; + + list neighbor { + key "mt-id system-id"; + description + "This container describes IS neighbors."; + + leaf mt-id { + type leafref { + path "../state/mt-id"; + } + description + " Reference to the topology that the neighbor is within."; + } + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the System ID of the neighbor."; + } + + uses mt-isis-neighbor; + } + } + } + + container mt-isis-neighbor-attribute { + when "../state/type = " + + "'oc-isis-lsdb-types:MT_IS_NEIGHBOR_ATTRIBUTE'" { + description + "Only include the MT ISIS neighbor attribute container + when the TLV is type 223."; + } + + description + "This container defines list of ISIS multi-topology + neighbors."; + + reference + "RFC5311: Simplified Extension of Link State PDU (LSP) + Space for IS-IS. TLV 223. It is identical in format to the + MT-ISN TLV 222."; + + container neighbors { + description + "This container describes IS neighbors."; + + list neighbor { + key "mt-id system-id"; + description + "List of multi-topology neighbors."; + + leaf mt-id { + type leafref { + path "../state/mt-id"; + } + description + "Reference to the topology that the neighbor is within."; + } + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the system ID of the neighbor"; + } + + uses mt-isis-neighbor; + } + } + } + + container mt-ipv4-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:MT_IPV4_REACHABILITY'" { + description + "Only include the multi-topology IPv4 reachability + container when the TLV is type 235."; + } + description + "This container defines list of IPv4 reachability + Information in multi-topology environment."; + + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in + Intermediate System to Intermediate Systems (IS-ISs). TLV + 235."; + + container prefixes { + description + "This container describes IS prefixes."; + + list prefix { + key "mt-id prefix"; + + leaf mt-id { + type leafref { + path "../state/mt-id"; + } + description + "Reference to the topology ID of the topology that the + prefix is within."; + } + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the prefix to which reachability is being + advertised."; + } + + description + "IPv4 prefixes that are contained within MT + reachability TLV."; + + uses ipv4-mt-prefix-extended-state; + } + } + } + + container mt-ipv6-reachability { + when "../state/type = " + + "'oc-isis-lsdb-types:MT_IPV6_REACHABILITY'" { + description + "Only include the multi-topology IPv6 reachability + container when the TLV is type 237."; + } + description + "This container defines list of IPv6 reachability + information in multi - topology environment."; + + reference + "RFC5120: M-ISIS: Multi Topology (MT) Routing in + Intermediate System to Intermediate Systems (IS-ISs). TLV + 237."; + + container prefixes { + description + "This container describes IS prefixes."; + + list prefix { + key "prefix mt-id"; + description + "List of IPv6 prefixes contained within MT + reachability TLV."; + + leaf prefix { + type leafref { + path "../state/prefix"; + } + description + "Reference to the IPv6 prefix described by the TLV."; + } + + leaf mt-id { + type leafref { + path "../state/mt-id"; + } + description + "Reference to the multi-topology ID."; + } + + uses ipv6-mt-prefix-extended-state; + } + } + } + } + } + + uses isis-lsdb-undefined-tlv; + } +} + diff --git a/yang/openconfig-nis/openconfig-isis-routing@2017-05-15.yang b/yang/openconfig-nis/openconfig-isis-routing@2017-05-15.yang new file mode 100644 index 000000000..6329314f1 --- /dev/null +++ b/yang/openconfig-nis/openconfig-isis-routing@2017-05-15.yang @@ -0,0 +1,369 @@ +submodule openconfig-isis-routing { + + belongs-to openconfig-isis { + prefix "oc-isis"; + } + + // import some basic types + import openconfig-isis-types { prefix oc-isis-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-mpls-types { prefix oc-mplst; } + import openconfig-segment-routing { prefix oc-sr; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module describes YANG model for ISIS Routing"; + + oc-ext:openconfig-version "0.3.0"; + + revision "2017-05-15" { + description + "Refactor LSDB."; + reference "0.3.0"; + } + + revision "2017-01-13" { + description + "Remove top-level /isis container"; + reference "0.2.1"; + } + + revision "2016-12-15" { + description + "Add segment routing to IS-IS module"; + reference "0.2.0"; + } + + revision "2016-10-18" { + description + "Initial revision of IS-IS models."; + reference "0.1.0"; + } + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping rt-admin-config { + description + "Re-usable grouping to enable or disable a particular IS-IS feature."; + + leaf enabled { + type boolean; + description + "When set to true, the functionality within which this leaf is + defined is enabled, when set to false it is explicitly disabled."; + } + } + + grouping isis-afi-safi-config { + description + "This grouping defines Address-Family configuration parameters"; + + leaf afi-name { + type identityref { + base oc-isis-types:AFI_TYPE; + } + description + "Address-family type."; + } + + leaf safi-name { + type identityref { + base oc-isis-types:SAFI_TYPE; + } + description + "Subsequent address-family type."; + } + } + + grouping isis-shortcuts-afi-config { + description + "This grouping defines ISIS Shortcuts configuration parameters"; + + leaf afi-name { + type identityref { + base oc-isis-types:AFI_TYPE; + } + description "Address-family type."; + } + + leaf-list nh-type { + type identityref { + base oc-mplst:PATH_SETUP_PROTOCOL; + } + description "Tunnel NH Type(RSVP,SR). When present it implies + that nh-type shortcut is enabled for a specified AFI."; + } + } + + grouping isis-shortcuts-config { + description + "This grouping defines ISIS Shortcuts consfiguration parameters"; + + container config { + description "This container defines ISIS shortcuts configuration."; + uses rt-admin-config; + } + + container state { + config false; + description "This container defines state for ISIS shortcuts."; + uses rt-admin-config; + } + } + + grouping isis-mt-config { + description + "This grouping defines ISIS multi-topology configuration parameters"; + + leaf afi-name { + type identityref { + base oc-isis-types:AFI_TYPE; + } + description + "Address-family type."; + } + leaf safi-name { + type identityref { + base oc-isis-types:SAFI_TYPE; + } + description + "Subsequent address-family type."; + } + //prefer single topology + } + + + + // *********** STRUCTURE GROUPINGS ********************** + + grouping isis-metric-config { + description + "This grouping defines ISIS metric configuration"; + + leaf metric { + type uint32; + default 10; + description "ISIS metric value(default=10)."; + } + } + + grouping isis-afi-safi-list { + description + "This grouping defines address-family configuration and state + information"; + + list af { + key "afi-name safi-name"; + + description + "Address-family/Subsequent Address-family list."; + + leaf afi-name { + type leafref { + path "../config/afi-name"; + } + description + "Reference to address-family type"; + } + + leaf safi-name { + type leafref { + path "../config/safi-name"; + } + description + "Reference to subsequent address-family type"; + } + + container config { + description + "This container defines AFI-SAFI configuration parameters"; + + uses isis-afi-safi-config; + uses isis-metric-config; + uses rt-admin-config; + } + + container state { + config false; + description + "This container defines AFI-SAFI State information"; + + uses isis-afi-safi-config; + uses isis-metric-config; + uses rt-admin-config; + } + + uses isis-mt-list; + } + } + + grouping isis-if-afi-safi-list { + description + "This grouping defines address-family configuration and state + information"; + + list af { + key "afi-name safi-name"; + + description + "Address-family/Subsequent Address-family list."; + + leaf afi-name { + type leafref { + path "../config/afi-name"; + } + description + "Reference to address-family type"; + } + + leaf safi-name { + type leafref { + path "../config/safi-name"; + } + description + "Reference to subsequent address-family type"; + } + + container config { + description + "This container defines AFI-SAFI configuration parameters. Single + topology is the default setting."; + uses isis-afi-safi-config; + uses isis-metric-config; + uses rt-admin-config; + } + + container state { + config false; + description + "This container defines AFI-SAFI State information"; + uses isis-afi-safi-config; + uses isis-metric-config; + uses rt-admin-config; + } + + uses oc-sr:sr-igp-interface-top; + } + } + + grouping isis-if-global-afi-safi-list { + description + "This grouping defines address-family configuration and state + information"; + + list af { + key "afi-name safi-name"; + + description + "Address-family/Subsequent Address-family list."; + + leaf afi-name { + type leafref { + path "../config/afi-name"; + } + description + "Reference to address-family type"; + } + + leaf safi-name { + type leafref { + path "../config/safi-name"; + } + description + "Reference to subsequent address-family type"; + } + + container config { + description + "This container defines AFI-SAFI configuration parameters. Single + topology is the default setting."; + uses isis-afi-safi-config; + uses rt-admin-config; + } + + container state { + config false; + description + "This container defines AFI-SAFI State information"; + uses isis-afi-safi-config; + uses rt-admin-config; + } + } + } + + grouping isis-shortcuts-afi-list { + description + "This grouping defines ISIS Shorcuts configuration and + state information"; + + list afi { + key "afi-name"; + + description + "Address-family list."; + + leaf afi-name { + type leafref { + path "../config/afi-name"; + } + description + "Reference to address-family type."; + } + + container config { + description + "This container defines ISIS Shortcuts configuration parameters"; + uses isis-shortcuts-afi-config; + } + + container state { + config false; + description + "This container defines ISIS Shortcuts state information"; + uses isis-shortcuts-afi-config; + } + } + } + + grouping isis-mt-list { + description + "This grouping defines multi-topology address-family configuration and + state information. MT0 - IPv4 Unicast, MT2 - IPv6 Unicast, MT3 - + IPv4 Multicast, MT4 - IPv6 Multicast"; + + container multi-topology { + description + "This container defines multi-topology address-family configuration + and state information. ISIS TLV 235, 237."; + + container config { + description + "This container defines AFI-SAFI multi-topology configuration + parameters"; + uses isis-mt-config; + } + + container state { + config false; + description + "This container defines AFI-SAFI multi-topology state information"; + uses isis-mt-config; + uses rt-admin-config; + } + } + } +} diff --git a/yang/openconfig-nis/openconfig-isis-types.yang b/yang/openconfig-nis/openconfig-isis-types.yang new file mode 100644 index 000000000..c3fcb049b --- /dev/null +++ b/yang/openconfig-nis/openconfig-isis-types.yang @@ -0,0 +1,324 @@ +module openconfig-isis-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/isis-types"; + + prefix "oc-isis-types"; + + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains general data definitions for use in ISIS YANG + model."; + + oc-ext:openconfig-version "0.3.0"; + + revision "2017-05-15" { + description + "Refactor LSDB."; + reference "0.3.0"; + } + + revision "2017-01-13" { + description + "Remove top-level /isis container"; + reference "0.2.1"; + } + + revision "2016-12-15" { + description + "Add segment routing to IS-IS module"; + reference "0.2.0"; + } + + revision "2016-10-18" { + description + "Initial revision of IS-IS models."; + reference "0.1.0"; + } + + // identity statements + identity OVERLOAD_RESET_TRIGGER_TYPE { + description + "Base identify type for triggers that reset Overload Bit"; + } + + identity WAIT_FOR_BGP { + base OVERLOAD_RESET_TRIGGER_TYPE; + description + "Base identity type for resetting Overload Bit when BGP has converged. "; + } + + identity WAIT_FOR_SYSTEM { + base OVERLOAD_RESET_TRIGGER_TYPE; + description + "Base identity type for resetting Overload Bit when system resources have + been restored. "; + } + + identity MT_TYPE { + description + "Base identify type for multi-topology"; + } + + identity SAFI_TYPE { + description + "Base identify type for SAFI"; + } + + identity AFI_TYPE { + description + "Base identify type for AFI"; + } + + identity AFI_SAFI_TYPE { + description + "Base identify type for AFI/SAFI"; + } + + identity IPV4_UNICAST { + base AFI_SAFI_TYPE; + description + "Base identify type for IPv4 Unicast address family"; + } + + identity IPV6_MULTICAST { + base AFI_SAFI_TYPE; + description + "Base identify type for IPv6 multicast address family"; + } + + identity IPV4_MULTICAST { + base AFI_SAFI_TYPE; + description + "Base identify type for IPv4 multicast address family"; + } + + identity IPV6_UNICAST { + base AFI_SAFI_TYPE; + description + "Base identify type for IPv6 unicast address family"; + } + + identity UNICAST { + base SAFI_TYPE; + description + "Base identify type for IPv4 Unicast address family"; + } + + identity MULTICAST { + base SAFI_TYPE; + description + "Base identify type for IPv6 multicast address family"; + } + + identity IPV4 { + base AFI_TYPE; + description + "Base identify type for IPv4 address family"; + } + + identity IPV6 { + base AFI_TYPE; + description + "Base identify type for IPv6 address family"; + } + + // typedef statements + typedef level-type { + type enumeration { + enum LEVEL_1 { + description "This enum describes ISIS level 1"; + } + enum LEVEL_2 { + description "This enum describes ISIS level 2"; + } + enum LEVEL_1_2 { + description "This enum describes ISIS level 1-2"; + } + } + description + "This type defines ISIS level types"; + } + + typedef level-number { + type uint8 { + range "1..2"; + } + description + "This type defines ISIS level."; + } + + typedef adaptive-timer-type { + type enumeration { + enum LINEAR { + description "This enum describes linear algorithm timer"; + } + enum EXPONENTIAL { + description "This enum describes exponential algorithm timer"; + } + } + description + "This type defines ISIS adaptive timer types"; + } + + typedef hello-padding-type { + type enumeration { + enum STRICT { + description "This enum describes strict padding"; + } + enum LOOSE { + description "This enum describes loose padding"; + } + enum ADAPTIVE { + description "This enum describes adaptive padding"; + } + enum DISABLE { + description "This enum disables padding"; + } + } + description + "This type defines ISIS hello padding type"; + } + + typedef circuit-type { + type enumeration { + enum POINT_TO_POINT { + description "This enum describes a point-to-point interface"; + } + enum BROADCAST { + description "This enum describes a broadcast interface"; + } + } + description + "This type defines ISIS interface types "; + } + + typedef metric-type { + type enumeration { + enum INTERNAL { + description "This enum describes internal route type"; + } + enum EXTERNAL { + description "This enum describes external route type"; + } + } + description + "This type defines ISIS metric type"; + } + + typedef wide-metric { + type uint32 { + range "1..16777215"; + } + description + "This type defines ISIS wide metric."; + } + + typedef narrow-metric { + type uint8 { + range "1..63"; + } + description + "This type defines ISIS narrow metric."; + } + + typedef metric-style { + type enumeration { + enum NARROW_METRIC { + description + "This enum describes narrow metric style"; + reference "RFC1195"; + } + enum WIDE_METRIC { + description + "This enum describes wide metric style"; + reference "RFC5305"; + } + } + description + "This type defines ISIS metric styles"; + } + + typedef isis-interface-adj-state { + type enumeration { + enum UP { + description + "This state describes that adjacency is established."; + } + enum DOWN { + description + "This state describes that adjacency is NOT established."; + } + enum INIT { + description + "This state describes that adjacency is establishing."; + } + enum FAILED { + description + "This state describes that adjacency is failed."; + } + } + description + "This type defines the state of the interface."; + } + + typedef net { + type string { + pattern '[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}'; + } + description + "This type defines OSI NET address. A NET should should be in + the form xx.yyyy.yyyy.yyyy.00 with up to 9 sets of yyyy."; + } + + typedef area-address { + type string { + pattern '[0-9A-Fa-f]{2}\.([0-9A-Fa-f]{4}\.){0,3}'; + } + description + "This type defines the ISIS area address."; + } + + typedef system-id { + type string { + pattern '[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}'; + } + description + "This type defines ISIS system id using pattern, system id looks + like : 0143.0438.AeF0"; + } + + typedef extended-circuit-id { + type uint32; + description + "This type defines interface circuit ID."; + } + + typedef lsp-id { + type string { + pattern + '[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}\.[0-9A-Fa-f]' + + '{4}\.[0-9][0-9]-[0-9][0-9]'; + } + description + "This type defines ISIS LSP ID. ISIS LSP ID type should be in + the form of xxxx.xxxx.xxxx.xx-xx"; + } + typedef snpa { + type string { + length "0 .. 20"; + } + description + "This type defines Subnetwork Point of Attachment format."; + } +} diff --git a/yang/openconfig-nis/openconfig-isis.yang b/yang/openconfig-nis/openconfig-isis.yang new file mode 100644 index 000000000..7e25add41 --- /dev/null +++ b/yang/openconfig-nis/openconfig-isis.yang @@ -0,0 +1,2026 @@ +module openconfig-isis { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/openconfig-isis"; + + prefix "oc-isis"; + + // import some basic types + import ietf-inet-types { prefix "inet"; } + import ietf-yang-types { prefix "yang"; } + import openconfig-types { prefix "oc-types"; } + import openconfig-isis-types { prefix "oc-isis-types"; } + import openconfig-routing-policy { prefix "oc-rpol"; } + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-interfaces { prefix "oc-if"; } + import openconfig-segment-routing { prefix "oc-sr"; } + // TODO(robjs): Import authentication and keychain following merge of these + // modules. + //import openconfig-authentication-types { prefix "oc-auth-types"; } + //import openconfig-keychain { prefix "oc-keychain"; } + + // Include submodules: + // IS-IS LSP is the LSDB for IS-IS. + include openconfig-isis-lsp; + // IS-IS RT is routing-related features for IS-IS + include openconfig-isis-routing; + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net "; + + description + "This module describes a YANG model for ISIS protocol configuration. + It is a limited subset of all of the configuration parameters + available in the variety of vendor implementations, hence it is + expected that it would be augmented with vendor - specific configuration + data as needed. Additional modules or submodules to handle other + aspects of ISIS configuration, including policy, routing, types, + LSDB and additional address families are also expected. This model + supports the following ISIS configuration level hierarchy: + + ISIS + +-> { global ISIS configuration} + +-> levels +-> { level config} + +-> { system-level-counters } + +-> { level link-state-database} + +-> interface +-> { interface config } + +-> { circuit-counters } + +-> { levels config } + +-> { level adjacencies }"; + + oc-ext:openconfig-version "0.3.0"; + + revision "2017-05-15" { + description + "Refactor LSDB."; + reference "0.3.0"; + } + + revision "2017-01-13" { + description + "Remove top-level /isis container"; + reference "0.2.1"; + } + + revision "2016-12-15" { + description + "Add segment routing to IS-IS module"; + reference "0.2.0"; + } + + revision "2016-10-18" { + description + "Initial revision of IS-IS models."; + reference "0.1.0"; + } + + // extension statements + + // feature statements + + // identity statements + + // typedef statements + + // grouping statements + + grouping isis-global-config { + description + "This grouping defines lobal configuration options for ISIS router."; + + // multi-instance + leaf instance { + type string; + default 0; + description + "ISIS Instance."; + } + + leaf-list net { + type oc-isis-types:net; + description + "ISIS network entity title (NET). The first 8 bits are usually + 49 (private AFI), next 16 bits represent area, next 48 bits represent + system id and final 8 bits are set to 0."; + reference + "International Organization for Standardization, Information + technology - Open Systems Interconnection-Network service + Definition - ISO/ IEC 8348:2002."; + } + + leaf maximum-area-addresses { + type uint8; + default 3; + description + "Maximum areas supported."; + } + + leaf level-capability { + type oc-isis-types:level-type; + default "LEVEL_1_2"; + description + "ISIS level capability(level-1, level-2,vlevel-1-2)."; + } + + leaf max-ecmp-paths { + type uint8; + description + "ISIS max-paths count."; + } + + leaf poi-tlv { + type boolean; + default false; + description + "ISIS purge TLV. When set to true, a TLV is added to purges to record + the system ID of the IS generating the purge."; + reference "RFC6232: Purge Originator Identification TLV for IS-IS. TLV 13."; + } + + leaf iid-tlv { + type boolean; + default false; + description + "ISIS Instance Identifier TLV. When set to trues, the IID-TLV identifies + the unique instance as well as the topology/topologies to which the + PDU applies."; + reference "RFC6822: IS-IS Multi-Instance. TLV 7"; + } + + leaf fast-flooding { + type boolean; + default true; + description + "When set to true, IS will always flood the LSP that triggered an SPF + before the router actually runs the SPF computation."; + } + } + + grouping admin-config { + description + "Re-usable grouping to enable or disable a particular IS-IS feature."; + + leaf enabled { + type boolean; + default false; + description + "When set to true, the functionality within which this leaf is + defined is enabled, when set to false it is explicitly disabled."; + } + } + + grouping isis-bfd-config { + description + "This grouping defines Bidirectionl-Forwarding-Detection + configuration."; + + //There is also BFD state under adjacency + leaf bfd-tlv { + type boolean; + description + "When set to true, BFD TLV is used. This enables support for the IS-IS + BFD TLV options, which specify that a BFD session must be established + before an IS-IS adjacency can transition to the established state. + This option should be enabled on all IS-IS neighbors on a shared + interface."; + reference "RFC6213. TLV 148"; + } + reference "RFC5880: Bidirectional Forwarding Detection (BFD)."; + } + + grouping isis-authentication-check-config { + description + "This grouping defines ISIS authentication check."; + + leaf authentication-check { + type boolean; + default true; + description + "When set to true, reject all ISIS protocol PDUs that either have a mismatch + in authentication-type or authentication-key."; + } + } + + grouping isis-metric-style-config { + description + "This grouping defines ISIS metric style."; + + leaf metric-style { + type oc-isis-types:metric-style; + description + "ISIS metric style types(narrow, wide)."; + } + } + + grouping authentication-key-config { + description + "This grouping defines authentication key configuration."; + + leaf auth-password { + type oc-types:routing-password; + description + "Authentication key string."; + } + } + + grouping keychain-base-group { + description + "This grouping defines keychain configuration."; + + container keychain { + description + "This container defines keychain parameters."; + + // TODO(robjs): Import keychain parameters following merge of the auth + // models. + //uses oc-keychain:keychain-common-base; + //uses oc-keychain:tolerance-base; + //uses oc-keychain:keychain-key-base; + } + } + + grouping isis-authentication-config { + description + "This grouping defines ISIS authentication configuration."; + + // TODO(robjs): Add authentication following merge of auth modules. + //leaf auth-type { + // type oc-auth-types:auth-type; + // description + // "ISIS authentication type (key, key-chain)."; + //} + + leaf csnp-authentication { + type boolean; + default false; + description + "Enable or disable for IS-IS CSNPs."; + } + + leaf psnp-authentication { + type boolean; + default false; + description + "Enable or disable authentication for IS-IS PSNPs."; + } + + leaf lsp-authentication { + type boolean; + default false; + description + "Enable or disable authentication for IS-IS LSPs."; + } + } + + grouping isis-authentication-group { + description + "This grouping defines ISIS authentication."; + + container config { + description + "This container defines ISIS authentication configuration."; + + uses isis-authentication-config; + } + + container state { + config false; + description + "This container defines ISIS authentication state."; + + uses isis-authentication-config; + } + + container key { + description + "This container defines ISIS authentication key"; + container config { + description + "This container defines ISIS authentication key configuration."; + + uses authentication-key-group-config { + //when "../auth-type = KEY"; + } + } + + container state { + config false; + description + "This container defines ISIS authentication key state."; + + uses authentication-key-group-config { + //when "../auth-type = KEY"; + } + } + } + + uses keychain-base-group { + //when "../auth-type = KEY_CHAIN"; + } + } + + grouping isis-hello-authentication-config { + description + "Configuration options for IS-IS hello authentication."; + + leaf hello-authentication { + type boolean; + default false; + description + "Enabled or disable ISIS Hello authentication."; + } + + // TODO(robjs): Add hello-auth-type following merge of auth models. + //leaf hello-auth-type { + // type oc-auth-types:auth-type; + // description + // "ISIS authentication type (key, key-chain)."; + //} + } + + grouping isis-hello-authentication-group { + description + "This grouping defines ISIS hello-authentication."; + + container config { + description + "This container defines ISIS authentication configuration."; + + uses isis-hello-authentication-config; + } + + container state { + config false; + description + "This container defines ISIS authentication state."; + + uses isis-hello-authentication-config; + } + + container key { + description + "This container defines ISIS authentication key"; + + container config { + description + "This container defines ISIS authentication key configuration."; + + uses authentication-key-group-config { + //when "../auth-type = KEY"; + } + } + + container state { + config false; + description + "This container defines ISIS authentication key state."; + + uses authentication-key-group-config { + //when "../auth-type = KEY"; + } + } + } + + uses keychain-base-group { + //when "../auth-type = KEY_CHAIN"; + } + } + + grouping isis-ldp-igp-config { + description + "This grouping defines ISIS/LDP Synchronization configuration."; + + leaf enabled { + type boolean; + default true; + description + "When set to true, rely on IGP/LDP synchronization. IGP cost for + link is maintained at max until LDP adjacencies are established "; + reference "RFC5443: LDP IGP Synchronization."; + } + + leaf post-session-up-delay { + type uint16; + units seconds; + description + "Specifies a delay, expressed in units of seconds, + between the LDP session to the IGP neighbor being established, and + it being considered synchronized by the IGP."; + } + } + + grouping isis-te-config { + description + "This grouping defines ISIS Traffic Engineering configuration."; + + leaf ipv4-router-id { + type inet:ipv4-address-no-zone; + description + "IPv4 MPLS Traffic Engineering Router-ID."; + } + + leaf ipv6-router-id { + type inet:ipv6-address-no-zone; + description + "IPv6 MPLS Traffic Engineering Router-ID."; + } + } + + grouping isis-reference-bandwidth-config { + description + "This grouping defines ISIS Reference Bandwidth Configuration."; + + leaf reference-bandwidth { + type uint32; + description + "ISIS Reference Bandwidth value"; + } + } + + grouping isis-overload-bit-set-config { + description + "This grouping defines ISIS Overload Bit."; + + leaf set-bit { + type boolean; + default false; + description + "When set to true, IS-IS overload bit is set."; + } + + leaf set-bit-on-boot { + type boolean; + default false; + description + "When set to true, the IS-IS overload bit is set on system boot."; + } + + leaf advertise-high-metric { + type boolean; + default false; + description + "When set to true, the local IS advertises links with the highest + available metric regardless of their configured metric. The metric + value is based on the metric style - if wide metrics are utilised + the metric is advertised as 16777214, otherwise they are advertised + with a value of 63."; + } + } + + grouping isis-overload-bit-reset-config { + description + "This grouping defines ISIS Overload Bit Reset Triggers"; + + leaf reset-trigger { + type identityref { + base oc-isis-types:OVERLOAD_RESET_TRIGGER_TYPE; + } + description + "In the case that the system sets the overload bit on start, the + system should reset the bit (i.e., clear the overload bit) upon + the specified trigger."; + } + + leaf delay { + type uint16; + units seconds; + description + "If a reset trigger is specified, the system should delay resetting + the overload bit for the specified number of seconds after the + trigger occurs."; + } + } + + grouping isis-attached-bit-config { + description + "This grouping defines ISIS Attached Bit"; + + leaf ignore-bit { + type boolean; + default false; + description + "When set to true, if the attached bit is set on an incoming Level 1 + IS-IS, the local system ignores it. In this case the local system + does not set a default route to the L1L2 router advertising the PDU + with the attached bit set."; + } + + leaf suppress-bit { + type boolean; + default false; + description + "When set to true, if the local IS acts as a L1L2 router, then the + attached bit is not advertised in locally generated PDUs."; + } + } + + grouping overload-bit-group { + description + "This grouping defines ISIS Overload Bit."; + + container config { + description + "This container defines ISIS Overload Bit configuration."; + + uses isis-overload-bit-set-config; + } + + container state { + config false; + description + "This container defines state for ISIS Overload Bit."; + + uses isis-overload-bit-set-config; + } + + container reset-triggers { + description + "This container defines state for ISIS Overload Bit reset triggers"; + + list reset-trigger { + key "reset-trigger"; + + description + "This list describes ISIS Overload reset trigger reasons."; + + leaf reset-trigger { + type leafref { + path "../config/reset-trigger"; + } + description + "Reference to the reset trigger reason"; + } + + container config { + description + "This container defines ISIS Overload Bit reset trigger + configuration."; + + uses isis-overload-bit-reset-config; + } + + container state { + config false; + description + "This container defines state for ISIS Overload Bit reset + triggers."; + + uses isis-overload-bit-reset-config; + } + } + } + } + + + grouping isis-base-level-config { + description + "This grouping defines ISIS Level configuration."; + + leaf level-number { + type oc-isis-types:level-number; + description + "ISIS level number (level-1, level-2)."; + } + } + + grouping isis-interface-level-config { + description + "This grouping defines ISIS Interface Level configuration."; + + leaf level-number { + type oc-isis-types:level-number; + description + "ISIS level number(level-1, level-2)."; + } + + leaf passive { + type boolean; + default false; + description + "ISIS passive interface admin enable/disable function."; + } + + leaf priority { + type uint8 { + range "0 .. 127"; + } + description + "ISIS neighbor priority(LAN hello PDU only)."; + } + } + + grouping isis-hello-timers-config { + description + "This grouping defines ISIS hello timers configuration."; + + leaf hello-interval { + type uint32; + description + "ISIS hello-interval value."; + } + + leaf hello-multiplier { + type uint8; + description + "ISIS hello-multiplier value."; + } + } + + grouping isis-interface-config { + description + "This grouping defines ISIS interface configuration."; + + leaf interface-id { + type oc-if:interface-id; + description + "Interface for which ISIS configuration is to be applied."; + } + + leaf passive { + type boolean; + default false; + description + "When set to true, the referenced interface is a passive interface + such that it is not eligible to establish adjacencies with other + systems, but is advertised into the IS-IS topology."; + } + + leaf hello-padding { + type oc-isis-types:hello-padding-type; + description + "This leaf controls padding type for IS-IS Hello PDUs."; + } + + leaf circuit-type { + type oc-isis-types:circuit-type; + description + "ISIS circuit type (p2p, broadcast)."; + } + } + + grouping isis-adaptive-timers-state { + description + "This grouping defines ISIS adaptive timers state"; + + leaf adaptive-timer { + type oc-isis-types:adaptive-timer-type; + description + "ISIS adaptive timer types (linear, exponential)."; + } + } + + grouping isis-lsp-generation-timers-config { + description + "This grouping defines ISIS LSP Generation timers configuration"; + + leaf lsp-max-wait-interval { + type uint64; + units milliseconds; + description + "Time interval in milliseconds that specifies max interval between + two consecutive occurrences of an LSP being generated."; + } + + leaf lsp-first-wait-interval { + type uint64; + units milliseconds; + description + "Time interval in milliseconds that specifies the first LSP generation + delay."; + } + + leaf lsp-second-wait-interval { + type uint64; + units milliseconds; + description + "Time interval in milliseconds that specifies the millisecond LSP + generation delay."; + } + } + + grouping isis-lsp-timers-config { + description + "This grouping defines ISIS LSP timers configuration"; + + leaf lsp-lifetime-interval { + type uint16; + units seconds; + default 1200; + description + "Time interval in seconds that specifies how long an LSP remains in + LSDB without being refreshed."; + } + + leaf lsp-refresh-interval { + type uint16; + units seconds; + description + "Time interval in seconds that specifies how often route topology + that a device originates is transmitted in LSPs."; + } + } + + grouping isis-spf-timers-config { + description + "This grouping defines ISIS SPF timers configuration."; + + leaf spf-hold-interval { + type uint64; + units milliseconds; + default 5000; + description + "SPF Hold Down time interval in milliseconds."; + } + + leaf spf-first-interval { + type uint64; + units milliseconds; + description + "Time interval in milliseconds between the + detection of topology change and when the SPF algorithm runs."; + } + leaf spf-second-interval { + type uint64; + units milliseconds; + description + "Time interval in milliseconds between the first and second + SPF calculation."; + } + } + + grouping isis-interface-timers-config { + description + "This grouping defines ISIS interface timers configuration."; + + leaf csnp-interval { + type uint16; + units seconds; + description + "The interval, specified in seconds, at which periodic CSNP packets + should be transmitted by the local IS."; + } + + leaf lsp-pacing-interval { + type uint64; + units milliseconds; + description + "The interval interval in milliseconds between the + detection of topology change and when the SPF algorithm runs."; + } + } + + grouping isis-transport-config { + description + "This grouping defines configuration parameters relating to the + transport protocol used by the ISIS."; + + leaf lsp-mtu-size { + type uint16; + description + "The maximum size in bytes of an IS-IS Link state PDU."; + } + } + + grouping isis-graceful-restart-config { + description + "This grouping defines ISIS graceful restart configuration."; + + leaf helper-only { + type boolean; + description + "Enable or disable the IS-IS graceful restart helper function. When + this leaf is set, the local system does not utilise the IS-IS + graceful restart procedures during its own restart, but supports + retaining forwarding information during a remote speaker's restart."; + } + reference "RFC 5306: Restart Signaling for IS-IS."; + } + + // configuration context containers + grouping inter-level-propagation-policies-structural { + description + "Propagate prefixes between IS-IS levels."; + + container inter-level-propagation-policies { + description + "Policies to propagate prefixes between IS-IS levels."; + + container level1-to-level2 { + description + "Policies relating to prefixes to be propagated from + Level 1 to Level 2."; + + container config { + description + "Configuration parameters relating to the propagation + of prefixes from IS-IS Level 1 to Level 2."; + + uses inter-level-propagation-policy-config; + } + + container state { + config false; + description + "Operational state parameters relating to the + propagation of prefixes from IS-IS Level 1 to Level 2."; + + uses inter-level-propagation-policy-config; + } + + } + + container level2-to-level1 { + description + "Policies relating to prefixes to be propagated from + Level2 to Level 1."; + + container config { + description + "Configuration parameters relating to the propagation + of prefixes from IS-IS Level 2 to Level 1."; + + uses inter-level-propagation-policy-config; + } + + container state { + config false; + description + "Operational state parameters relating to the propagation + of prefixes from IS-IS Level 2 to Level 1."; + + uses inter-level-propagation-policy-config; + } + } + } + } + + grouping inter-level-propagation-policy-config { + description + "Policy governing the propagation of prefixes between levels."; + + uses oc-rpol:apply-policy-import-config; + } + + grouping authentication-key-group-config { + description + "This grouping defines ISIS authentication key configuration."; + + uses authentication-key-config; + + // TODO(robjs): Add crypto-algorithm after merge of authentication modules. + //leaf crypto-algorithm { + // type identityref { + // base oc-auth-types:CRYPTO_TYPE; + // } + // description + // "Authentication key cryptographic algorithm to be used for key encryption."; + //} + } + + grouping isis-global-base { + description + "This grouping describes ISIS Global router."; + + container config { + description + "This container defines ISIS global configuration router."; + + uses isis-authentication-check-config; + uses isis-global-config; + } + + container state { + config false; + description + "This container defines state for ISIS global router."; + + uses isis-authentication-check-config; + uses isis-global-config; + } + + container lsp-bit { + description + "This container defines ISIS LSP Operational Bits."; + + container overload-bit { + description + "This container defines Overload Bit configuration."; + uses overload-bit-group; + } + + container attached-bit { + description + "This container defines Attached Bit."; + + container config { + description + "This container defines Attached Bit configuration."; + + uses isis-attached-bit-config; + } + + container state { + config false; + description + "This container defines state for Link State PDU Bit."; + + uses isis-attached-bit-config; + } + } + } + + container reference-bandwidth { + description + "This container defines ISIS Reference Bandwidth."; + + container config { + description + "This container defines Reference Bandwidth configuration"; + uses isis-reference-bandwidth-config; + } + + container state { + config false; + description + "This container defines state for Reference Bandwidth."; + + uses isis-reference-bandwidth-config; + } + } + + container nsr { + description + "This container defines ISIS Non-Stop Routing."; + + container config { + description + "This container defines Non-Stop-Routing configuration."; + + uses admin-config; + } + + container state { + config false; + description + "This container defines state for Non-Stop-Routing"; + + uses admin-config; + } + } + + container graceful-restart { + description + "This container defines ISIS Graceful Restart."; + + container config { + description + "This container defines ISIS graceful-restart configuration."; + + uses admin-config; + uses isis-graceful-restart-config; + } + + container state { + config false; + description + "This container defines state information for ISIS graceful-restart."; + + uses admin-config; + uses isis-graceful-restart-config; + } + } + + container timers { + description + "This container defines ISIS timers."; + + container config { + description + "This container defines ISIS global timers configuration."; + + uses isis-lsp-timers-config; + } + + container state { + config false; + description + "This container defines state information for ISIS global timers."; + + uses isis-lsp-timers-config; + } + + container spf { + description + "This container defines ISIS SPF timer settings."; + + container config { + description + "This container defines ISIS SPF timers configuration."; + + uses isis-spf-timers-config; + } + + container state { + config false; + description + "This container defines state information for ISIS SPF timers."; + + uses isis-spf-timers-config; + uses isis-adaptive-timers-state; + } + } + + container lsp-generation { + description + "This container defines ISIS LSP Generation."; + + container config { + description + "This container defines ISIS LSP Generation timers + configuration."; + + uses isis-lsp-generation-timers-config; + } + + container state { + config false; + description + "This container defines state information for ISIS LSP Generation + timers."; + + uses isis-lsp-generation-timers-config; + uses isis-adaptive-timers-state; + } + } + } + + container transport { + description + "This container defines ISIS transport."; + + container config { + description + "This container defines ISIS transport related configuration."; + + uses isis-transport-config; + } + + container state { + config false; + description + "This container defines state information for ISIS transport + parameters."; + + uses isis-transport-config; + } + } + + container mpls { + description + "Configuration and operational state relating to MPLS-related + features in IS-IS"; + + container igp-ldp-sync { + description + "Configuration and operational state relating to synchronisation + between the LDP and IS-IS"; + + container config { + description + "This container defines ISIS/IGP configuration."; + + uses isis-ldp-igp-config; + } + + container state { + config false; + description + "This container defines state information for ISIS/LDP Sync."; + + uses isis-ldp-igp-config; + } + } + } + + container igp-shortcuts { + description + "This container defines IGP shortcuts configuration and state + information."; + + uses isis-shortcuts-afi-list; + } + + container afi-safi { + description + "This container defines address-family specific configuration + and state information."; + + uses isis-afi-safi-list; + } + + uses oc-sr:sr-igp-top; + } + + grouping isis-route-preference-config { + description + "This grouping defines ISIS route preference configuration"; + + leaf external-route-preference { + type uint8 { + range "1..max"; + } + description + "Administrative Distance(preference) for external ISIS routes."; + } + + leaf internal-route-preference { + type uint8 { + range "1..max"; + } + description + "Administrative Distance(preference) for internal ISIS routes."; + } + } + + grouping isis-interfaces { + description + "This grouping defines ISIS interfaces configured on local system."; + + list interface { + key "interface-id"; + + description + "This list contains ISIS interfaces."; + + leaf interface-id { + type leafref { + path "../config/interface-id"; + } + description + "Reference to interface-id"; + } + + uses isis-interface-group; + uses oc-if:interface-ref; + } + } + + grouping isis-interface-group { + description + "This grouping defines ISIS interfaces configured on local system."; + + container config { + description + "This container defines ISIS interface configuration."; + + uses admin-config; + uses isis-interface-config; + } + + container state { + config false; + description + "This container defines state information for ISIS interfaces."; + + uses admin-config; + uses isis-interface-config; + } + + container circuit-counters { + description + "This container defines state information for ISIS circuit counters."; + + uses circuit-counters-structural; + } + + container authentication { + description + "This container defines ISIS authentication."; + + uses isis-hello-authentication-group; + } + + container afi-safi { + description + "This container defines address-family specific configuration + and state information."; + + uses isis-if-global-afi-safi-list; + } + + container levels { + description + "This container defines ISIS level specific configuration and + state information."; + + uses isis-interface-levels; + } + + container timers { + description + "This container describes ISIS interface timers configuration"; + + container config { + description + "Configuration parameters relating to interface + timers for IS-IS"; + + uses isis-interface-timers-config; + } + + container state { + config false; + description + "This container defines state information for ISIS interface timers."; + + uses isis-interface-timers-config; + } + } + + container bfd { + //TODO(bogdanov): Integrate BFD model/module + description + "This container defines BFD."; + + container config { + description + "This container defines BFD configuration parameters."; + + uses isis-bfd-config; + } + + container state { + config false; + description + "This container defines BFD state information."; + + uses isis-bfd-config; + } + } + } + + grouping isis-levels { + description + "This grouping defines global ISIS Levels."; + + list level { + key "level-number"; + + description + "Configuration and operational state parameters related to a + particular level within the IS-IS protocol instance"; + + leaf level-number { + type leafref { + path "../config/level-number"; + } + description + "Reference to ISIS level-number."; + } + + uses isis-level-group; + } + } + + grouping isis-interface-levels { + description + "This grouping defines ISIS interface Levels."; + + list level { + key "level-number"; + description + "Configuration and operational state parameters related to a + particular level on an IS-IS enabled interface."; + + leaf level-number { + type leafref { + path "../config/level-number"; + } + description + "Reference to ISIS level-number."; + } + + uses isis-interface-level-group; + } + } + + grouping isis-level-group { + description + "This grouping defines ISIS level configuration and state + information."; + + container config { + description + "This container defines ISIS level based configuration."; + + uses admin-config; + uses isis-base-level-config; + uses isis-metric-style-config; + uses isis-authentication-check-config; + } + + container state { + config false; + description + "This container defines ISIS level state information."; + + uses admin-config; + uses isis-base-level-config; + uses isis-metric-style-config; + uses isis-authentication-check-config; + } + + container system-level-counters { + description + "This container defines ISIS system level counters."; + + uses system-level-counters-structural; + } + + container link-state-database { + config false; + description + "This container defines ISIS LSDB."; + + list lsp { + key "lsp-id"; + description + "This list describes LSPs in the LSDB."; + uses lsp-state; + } + } + + container traffic-engineering { + description + "This container defines ISIS TE."; + + container config { + description + "This container defines ISIS TE configuration."; + + uses admin-config; + uses isis-te-config; + } + + container state { + config false; + description + "This container defines ISIS TE state information."; + + uses admin-config; + uses isis-te-config; + } + } + + container route-preference { + description + "This container defines Administrative Distance (or preference) + assigned to ISIS routes (level1 internal, level2 internal, level1 + external, level2 external)."; + + container config { + description + "This container defines route preference configuration."; + uses isis-route-preference-config; + } + + container state { + config false; + description + "This container defines ISIS route preference state information."; + uses isis-route-preference-config; + } + } + + container authentication { + description + "This container defines ISIS authentication."; + uses isis-authentication-group; + } + + } + + grouping isis-interface-level-group { + description + "This grouping defines ISIS interface level."; + + container config { + description + "This container defines interface ISIS level configuration."; + + uses isis-interface-level-config; + uses admin-config; + } + + container state { + config false; + description + "This container defines interface ISIS level state information."; + + uses isis-interface-level-config; + uses admin-config; + } + + container packet-counters { + description + "This container defines ISIS interface packet counters."; + + uses packet-counters-structural; + } + + container adjacencies { + config false; + description + "This container defines ISIS adjacencies."; + + list adjacency { + key "system-id"; + + description + "List of the local system's IS-IS adjacencies."; + + leaf system-id { + type leafref { + path "../state/system-id"; + } + description + "Reference to the IS neighbor."; + } + + container state { + description + "Operational state relating to the IS-IS adjacency with the + remote system"; + + uses adjacency-state; + } + } + } + + container timers { + description + "This container defines ISIS timers."; + + container config { + description + "This container defines ISIS interface hello-timers configuration."; + + uses isis-hello-timers-config; + } + + container state { + config false; + description + "This container defines ISIS interface hello-timers state."; + + uses isis-hello-timers-config; + } + } + + container afi-safi { + description + "This container defines address-family specific configuration + and state information."; + + uses isis-if-afi-safi-list; + } + + container hello-authentication { + description + "This container defines ISIS authentication."; + + uses isis-hello-authentication-group; + } + } + + + grouping isis-top { + description + "This grouping define top-level ISIS model data."; + + container isis { + description + "This container defines top-level ISIS configuration and state + information."; + + container global { + description + "This container defines global ISIS configuration and state + information."; + + uses isis-global-base; + uses inter-level-propagation-policies-structural; + } + + container levels { + description + "This container defines ISIS level configuration and state + information."; + uses isis-levels; + } + + container interfaces { + description + "This container defines global ISIS interface configuration and + state information."; + uses isis-interfaces; + } + } + } + + grouping adjacency-state { + description + "This grouping defines ISIS adjacency."; + + leaf system-id { + type oc-isis-types:system-id; + description + "ISIS neighbor system-id."; + } + + leaf neighbor-ipv4-address { + type inet:ipv4-address-no-zone; + description + "ISIS Neighbor IPv4 address."; + } + + leaf neighbor-ipv6-address { + type inet:ipv6-address-no-zone; + description + "ISIS Neighbor IPv6 address."; + } + + leaf neighbor-snpa { + type oc-isis-types:snpa; + description + "ISIS neighbor SNPA."; + } + + leaf local-extended-circuit-id { + type oc-isis-types:extended-circuit-id; + description + "Local extended circuit ID."; + } + leaf neighbor-extended-circuit-id { + type oc-isis-types:extended-circuit-id; + description + "ISIS neighbor extended circuit ID."; + } + + leaf priority { + type uint8 { + range "0..127"; + } + description + "Priority of the neighboring IS(LAN Hello only)."; + } + + leaf dis-system-id { + type oc-isis-types:system-id; + description + "DIS System ID(LAN hello only)."; + } + + leaf neighbor-circuit-type { + type oc-isis-types:level-type; + description + "Received ISIS circuit type (level-1, level-2, level-1-2)."; + } + + leaf adjacency-type { + type oc-isis-types:level-type; + description + "Formed ISIS adjacency type(level-1, level-2, level-1-2)."; + } + + leaf adjacency-state { + type oc-isis-types:isis-interface-adj-state; + description + "P2P 3-way ISIS adjacency state(up, down, init, failed)."; + reference "RFC4303. TLV 240."; + } + + leaf remaining-hold-time { + type uint16; + units seconds; + description + "Holding time in seconds for adjacency. This value is based on received + hello PDUs and the elapsed time since receipt."; + } + + leaf up-time { + type yang:timestamp; + description + "Adjacency up time."; + } + + leaf multi-topology { + type boolean; + description + "When set to true, ISIS multi-topology is supported."; + reference "RFC5129. TLV 229."; + } + + leaf-list topology { + type identityref { + base oc-isis-types:AFI_SAFI_TYPE; + } + description + "ISIS topology type support(ipv4-unicast, ipv6-unicast, + ipv4-multicast, ipv6-multicast)."; + } + + leaf restart-support { + type boolean; + description + "When set to true, Graceful-restart signaling is supported."; + } + + leaf restart-suppress { + type boolean; + description + "When set to true, adjacency is not advertised. The SA bit is used by a + starting router to request that its neighbor suppress advertisement of + the adjacency to the starting router in the neighbor's LSPs."; + } + + leaf restart-status { + type boolean; + description + "When set to true, neighbor is being helped. The RR bit is used by a + (re)starting router to signal to its neighbors that a (re)start is in + progress."; + } + + leaf-list area-address { + type oc-isis-types:area-address; + description + "List of ISIS area-address(es)."; + } + + leaf-list nlpid { + type enumeration { + enum IPV4 { + description + "IPv4 Address family."; + } + enum IPV6 { + description + "IPv6 Address family."; + } + } + description + "Supported Protocol. IPv4 is defined as (0xcc) + and IPv6 - (0x8e). ISIS reference is TLV 129."; + } + + // TODO(bogdanov): update when BFD model is integrated. + //leaf ipv4-bfd-status { + //type oc-isis-types:bfd-state; + //description + // "IPv4 BFD session status."; + //} + //leaf ipv6-bfd-status { + //type oc-isis-types:bfd-state; + //description + // "IPv4 BFD session status. "; + //} + + } + + grouping packet-counters-generic-state { + description + "Operational state parameters relating to LSP packet counters."; + + leaf received { + type yang:counter32; + description + "The number of the specified type of PDU received on the interface."; + } + leaf processed { + type yang:counter32; + description + "The number of the specified type of PDU received on the interface + that have been processed by the local system."; + } + leaf dropped { + type yang:counter32; + description + "The number of the specified type of PDU received on the interface + that have been dropped."; + } + + leaf sent { + type yang:counter32; + description + "The number of the specified type of PDU that have been sent by the + local system on the interface."; + } + + leaf retransmit { + type yang:counter32; + description + "The number of the specified type of PDU that that have been + retransmitted by the local system on the interface."; + } + } + + grouping packet-counters-structural { + description + "This grouping defines ISIS packet counter state."; + + container lsp { + description + "This container defines LSP packet counters."; + + container state { + config false; + description + "This container defines LSP PDU counters."; + + uses packet-counters-generic-state; + } + } + + container iih { + description + "This container defines IIH packet counters."; + + container state { + config false; + description + "Operational counters relating to IIH PDUs"; + + uses packet-counters-generic-state; + } + } + + container ish { + description + "This container defines ISH packet counters."; + + container state { + config false; + description + "Operational state relating to ISH PDUs."; + + uses packet-counters-generic-state; + } + } + + container esh { + description + "This container defines ESH packet counters."; + container state { + config false; + description + "Operational state relating to ESH PDUs"; + + uses packet-counters-generic-state; + } + } + + container psnp { + description + "This container defines PSNP packet counters."; + + container state { + config false; + description + "Packet counters relating to PSNPs."; + + uses packet-counters-generic-state; + } + } + + container cnsp { + description + "Operational state parameters relating to CNSPs."; + + container state { + config false; + description + "Packet counters relating to CNSPs."; + + uses packet-counters-generic-state; + } + } + + container unknown { + description + "Operational state parameters relating to IS-IS PDUs that are not + otherwise classified - referred to as Unknown PDUs."; + + container state { + config false; + description + "Packet counters relating to unknown PDUs."; + + uses packet-counters-generic-state; + } + } + } + + grouping system-level-counters-state { + description + "IS-IS counters that are relevant to the system IS-IS context."; + + leaf corrupted-lsps { + type yang:counter32; + description + "Number of corrupted in-memory LSPs detected. LSPs received from the + wire with a bad checksum are silently dropped and not counted. LSPs + received from the wire with parse errors are counted by lsp-errors. MIB + Entry: SysCorrLSPs."; + } + + leaf database-overloads { + type yang:counter32; + description + "Number of times the database has become + overloaded. + MIB entry: SysLSPL(Level)DbaseOloads."; + } + + leaf manual-address-drop-from-areas { + type yang:counter32; + description + "Number of times a manual address has been dropped from area. + MIB Entry: SysManAddrDropFromAreas."; + } + + leaf exceed-max-seq-nums { + type yang:counter32; + description + "The number of times the system has attempted to exceed the maximum + sequence number. MIB Entry: SysAttmptToExMaxSeqNums."; + } + leaf seq-num-skips { + type yang:counter32; + description + "Number of times a sequence number skip has occurred. MIB Entry: + SysSeqNumSkips."; + } + + leaf own-lsp-purges { + type yang:counter32; + description + "Number of times a zero-aged copy of the system's + own LSP is received from some other node. + MIB Entry: isisSysOwnLSPPurges."; + } + + leaf id-len-mismatch { + type yang:counter32; + description + "Number of times a PDU is received with a different value for ID field + length from that of the receiving system. MIB Entry: + isisSysIDFieldLenMismatches."; + } + + leaf part-changes { + type yang:counter32; + description + "The number of partition changes detected. MIB Entry: SysPartChanges."; + } + + leaf max-area-address-mismatches { + type yang:counter32; + description + "Number of times a PDU is received with a different value for + MaximumAreaAddresses from that of the receiving system. MIB Entry: + SysMaxAreaAddrMismatches."; + } + + leaf auth-fails { + type yang:counter32; + description + "The number of authentication key failures. + MIB Entry: SysAuthFails."; + } + + leaf spf-runs { + type yang:counter32; + description + "The number of times SPF was ran at this level."; + } + + leaf auth-type-fails { + type yang:counter32; + description + "The number of authentication type mismatches."; + } + + leaf lsp-errors { + type yang:counter32; + description + "The number of received LSPs with errors."; + } + } + + grouping system-level-counters-structural { + description + "This grouping defines system level counters."; + + container state { + config false; + description + "The container defines a list of system counters for the IS."; + + uses system-level-counters-state; + } + } + + grouping circuit-counters-state { + description + "Operational state parameters relating to counters specific to one + interface or circuit."; + + leaf adj-changes { + type yang:counter32; + description + "Number of times an adjacency state change has occurred on this circuit. + MIB Entry: CircAdjChanges."; + } + + leaf init-fails { + type yang:counter32; + description + "Number of times initialization of this circuit has failed. This counts + events such as PPP NCP failures. MIB Entry: CircInitFails."; + } + + leaf rejected-adj { + type yang:counter32; + description + "Number of times an adjacency has been rejected on this circuit. MIB + Entry: CircRejAdjs."; + } + + leaf id-field-len-mismatches { + type yang:counter32; + description + "Number of times an IS-IS control PDU with an ID field length different + from that for this system has been received. + MIB Entry: CircIDFieldLenMismatches."; + } + + leaf max-area-address-mismatches { + type yang:counter32; + description + "Number of times an IS-IS control PDU with a max area address field + different from that for this system has been received. MIB Entry: + CircMaxAreaAddrMismatches."; + } + + leaf auth-type-fails { + type yang:counter32; + description + "Number of times an IS-IS control PDU with an auth type field different + from that for this system has been received. MIB Entry: + CircAuthTypeFails."; + } + + leaf auth-fails { + type yang:counter32; + description + "Number of times an IS-IS control PDU with the correct auth type has + failed to pass authentication validation. MIB Entry: CircAuthFails."; + } + + leaf lan-dis-changes { + type yang:counter32; + description + "Number of times the Designated IS has changed on this circuit at this + level. If the circuit is point to point, this count is zero. MIB Entry: + CircLANDesISChanges."; + } + + leaf adj-number { + type uint32; + description + "Number of adjacencies on this circuit. + MIB Entry: CircNumAdj."; + } + } + + grouping circuit-counters-structural { + description + "This grouping defines circuit counters."; + + container state { + config false; + description + "The container defines a list of counters for IS circuit."; + + uses circuit-counters-state; + } + } +} diff --git a/yang/openconfig-nis/openconfig-local-routing.yang b/yang/openconfig-nis/openconfig-local-routing.yang new file mode 100644 index 000000000..5184fe7de --- /dev/null +++ b/yang/openconfig-nis/openconfig-local-routing.yang @@ -0,0 +1,408 @@ +module openconfig-local-routing { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/local-routing"; + + prefix "oc-loc-rt"; + + // import some basic types + import openconfig-inet-types { prefix inet; } + import openconfig-policy-types { prefix oc-pt; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-interfaces { prefix oc-if; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module describes configuration and operational state data + for routes that are locally generated, i.e., not created by + dynamic routing protocols. These include static routes, locally + created aggregate routes for reducing the number of constituent + routes that must be advertised, summary routes for IGPs, etc. + + This model expresses locally generated routes as generically as + possible, avoiding configuration of protocol-specific attributes + at the time of route creation. This is primarily to avoid + assumptions about how underlying router implementations handle + route attributes in various routing table data structures they + maintain. Hence, the definition of locally generated routes + essentially creates 'bare' routes that do not have any protocol- + specific attributes. + + When protocol-specific attributes must be attached to a route + (e.g., communities on a locally defined route meant to be + advertised via BGP), the attributes should be attached via a + protocol-specific policy after importing the route into the + protocol for distribution (again via routing policy)."; + + oc-ext:openconfig-version "1.0.1"; + + revision "2017-05-15" { + description + "Update to resolve style guide non-compliance."; + reference "1.0.1"; + } + + revision "2016-05-11" { + description + "OpenConfig public release"; + reference "1.0.0"; + } + + + // identity statements + + identity LOCAL_DEFINED_NEXT_HOP { + description + "A base identity type of local defined next-hops"; + } + + identity DROP { + base LOCAL_DEFINED_NEXT_HOP; + description + "Discard traffic for the corresponding destination"; + } + + identity LOCAL_LINK { + base LOCAL_DEFINED_NEXT_HOP; + description + "Treat traffic towards addresses within the specified + next-hop prefix as though they are connected to a local + link. When the LOCAL_LINK next-hop type is specified, + an interface must also be specified such that + the local system can determine which link to trigger + link-layer address discovery against"; + } + + // typedef statements + + typedef local-defined-next-hop { + type identityref { + base LOCAL_DEFINED_NEXT_HOP; + } + description + "Pre-defined next-hop designation for locally generated + routes"; + } + + // grouping statements + + grouping local-generic-settings { + description + "Generic options that can be set on local routes When + they are defined"; + + leaf set-tag { + type oc-pt:tag-type; + description + "Set a generic tag value on the route. This tag can be + used for filtering routes that are distributed to other + routing protocols."; + } + } + + grouping local-static-config { + description + "Configuration data for static routes."; + + leaf prefix { + type inet:ip-prefix; + description + "Destination prefix for the static route, either IPv4 or + IPv6."; + } + + uses local-generic-settings; + } + + grouping local-static-state { + description + "Operational state data for static routes"; + } + + + grouping local-static-nexthop-config { + description + "Configuration parameters related to each next-hop entry + specified for a static route"; + + leaf index { + type string; + description + "An user-specified identifier utilised to uniquely reference + the next-hop entry in the next-hop list. The value of this + index has no semantic meaning other than for referencing + the entry."; + } + + leaf next-hop { + type union { + type inet:ip-address; + type local-defined-next-hop; + } + description + "The next-hop that is to be used for the static route + - this may be specified as an IP address, an interface + or a pre-defined next-hop type - for instance, DROP or + LOCAL_LINK. When this leaf is not set, and the interface-ref + value is specified for the next-hop, then the system should + treat the prefix as though it is directly connected to the + interface."; + } + + leaf metric { + type uint32; + description + "A metric which is utilised to specify the preference of + the next-hop entry when it is injected into the RIB. The + lower the metric, the more preferable the prefix is. When + this value is not specified the metric is inherited from + the default metric utilised for static routes within the + network instance that the static routes are being + instantiated. When multiple next-hops are specified for a + static route, the metric is utilised to determine which of + the next-hops is to be installed in the RIB. When multiple + next-hops have the same metric (be it specified, or simply + the default) then these next-hops should all be installed + in the RIB"; + } + + leaf recurse { + type boolean; + default false; + description + "Determines whether the next-hop should be allowed to + be looked up recursively - i.e., via a RIB entry which has + been installed by a routing protocol, or another static route + - rather than needing to be connected directly to an + interface of the local system within the current network + instance. When the interface reference specified within the + next-hop entry is set (i.e., is not null) then forwarding is + restricted to being via the interface specified - and + recursion is hence disabled."; + } + } + + grouping local-static-nexthop-state { + description + "Operational state parameters relating to a next-hop entry + for a static route"; + } + + + grouping local-static-top { + description + "Top-level grouping for the list of static route definitions"; + + container static-routes { + description + "Enclosing container for the list of static routes"; + + list static { + key "prefix"; + description + "List of locally configured static routes"; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the destination prefix list key."; + } + + container config { + description + "Configuration data for static routes"; + + uses local-static-config; + } + + container state { + + config false; + + description + "Operational state data for static routes"; + + uses local-static-config; + uses local-static-state; + } + + container next-hops { + description + "Configuration and state parameters relating to the + next-hops that are to be utilised for the static + route being specified"; + + list next-hop { + key "index"; + + description + "A list of next-hops to be utilised for the static + route being specified."; + + leaf index { + type leafref { + path "../config/index"; + } + description + "A reference to the index of the current next-hop. + The index is intended to be a user-specified value + which can be used to reference the next-hop in + question, without any other semantics being + assigned to it."; + } + + container config { + description + "Configuration parameters relating to the next-hop + entry"; + + uses local-static-nexthop-config; + } + + container state { + config false; + description + "Operational state parameters relating to the + next-hop entry"; + + uses local-static-nexthop-config; + uses local-static-nexthop-state; + } + + uses oc-if:interface-ref; + } + } + } + } + } + + grouping local-aggregate-config { + description + "Configuration data for aggregate routes"; + + leaf prefix { + type inet:ip-prefix; + description + "Aggregate prefix to be advertised"; + } + + leaf discard { + type boolean; + default false; + description + "When true, install the aggregate route with a discard + next-hop -- traffic destined to the aggregate will be + discarded with no ICMP message generated. When false, + traffic destined to an aggregate address when no + constituent routes are present will generate an ICMP + unreachable message."; + } + + uses local-generic-settings; + + } + + grouping local-aggregate-state { + description + "Operational state data for local aggregate advertisement + definitions"; + } + + grouping local-aggregate-top { + description + "Top-level grouping for local aggregates"; + + container local-aggregates { + description + "Enclosing container for locally-defined aggregate + routes"; + + list aggregate { + key "prefix"; + description + "List of aggregates"; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the configured prefix for this aggregate"; + } + + container config { + description + "Configuration data for aggregate advertisements"; + + uses local-aggregate-config; + } + + container state { + + config false; + + description + "Operational state data for aggregate + advertisements"; + + uses local-aggregate-config; + uses local-aggregate-state; + } + } + } + } + + grouping local-routes-config { + description + "Configuration data for locally defined routes"; + } + + grouping local-routes-state { + description + "Operational state data for locally defined routes"; + } + + grouping local-routes-top { + description + "Top-level grouping for local routes"; + + container local-routes { + description + "Top-level container for local routes"; + + container config { + description + "Configuration data for locally defined routes"; + + uses local-routes-config; + } + + container state { + + config false; + + description + "Operational state data for locally defined routes"; + + uses local-routes-config; + uses local-routes-state; + } + + uses local-static-top; + uses local-aggregate-top; + } + } + + uses local-routes-top; + +} diff --git a/yang/openconfig-nis/openconfig-mpls-igp@2017-03-22.yang b/yang/openconfig-nis/openconfig-mpls-igp@2017-03-22.yang new file mode 100644 index 000000000..4caa5f43c --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-igp@2017-03-22.yang @@ -0,0 +1,92 @@ +submodule openconfig-mpls-igp { + + yang-version "1"; + + belongs-to "openconfig-mpls" { + prefix "oc-mpls"; + } + + + // import some basic types + import openconfig-mpls-ldp { prefix oc-ldp; } + import openconfig-extensions { prefix oc-ext; } + + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration generic configuration parameters for IGP-congruent + LSPs"; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // grouping statements + + + grouping igp-lsp-common { + description + "common definitions for IGP-congruent LSPs"; + + } + + + grouping igp-lsp-setup { + description + "signaling protocol definitions for IGP-based LSPs"; + + container path-setup-protocol { + description + "select and configure the signaling method for + the LSP"; + + // uses path-setup-common; + uses oc-ldp:igp-lsp-ldp-setup; + } + } + + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls-ldp.yang b/yang/openconfig-nis/openconfig-mpls-ldp.yang new file mode 100644 index 000000000..5a53f561e --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-ldp.yang @@ -0,0 +1,96 @@ +module openconfig-mpls-ldp { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/ldp"; + + prefix "ldp"; + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration of Label Distribution Protocol global and LSP- + specific parameters for IGP-congruent LSPs"; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // grouping statements + + grouping ldp-global { + description + "global LDP signaling configuration"; + + container ldp { + description + "LDP global signaling configuration"; + } + } + + + grouping igp-tunnel-ldp { + description + "common defintiions for LDP-signaled LSP tunnel + types"; + } + + grouping igp-lsp-ldp-setup { + description + "grouping for LDP setup attributes"; + + container ldp { + description + "LDP signaling setup for IGP-congruent LSPs"; + + uses igp-tunnel-ldp; + + } + } + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls-rsvp.yang b/yang/openconfig-nis/openconfig-mpls-rsvp.yang new file mode 100644 index 000000000..0aad2e672 --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-rsvp.yang @@ -0,0 +1,1134 @@ +module openconfig-mpls-rsvp { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/rsvp"; + + prefix "oc-rsvp"; + + // import some basic types + import openconfig-inet-types { prefix inet; } + import openconfig-mpls-types { prefix oc-mplst; } + import openconfig-yang-types { prefix yang; } + import openconfig-types { prefix oc-types; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-interfaces { prefix oc-if; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration for RSVP-TE signaling, including global protocol + parameters and LSP-specific configuration for constrained-path + LSPs"; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // grouping statements + + grouping mpls-rsvp-soft-preemption_config { + description + "Configuration for MPLS soft preemption"; + leaf enable { + type boolean; + default false; + description + "Enables soft preemption on a node."; + } + + leaf soft-preemption-timeout { + type uint16 { + range 0..max; + } + default 30; + description + "Timeout value for soft preemption to revert + to hard preemption. The default timeout for + soft-preemption is 30 seconds - after which + the local system reverts to hard pre-emption."; + reference "RFC5712 MPLS-TE soft preemption"; + } + } + + grouping mpls-rsvp-soft-preemption { + description + "Top level group for MPLS soft preemption"; + container soft-preemption { + description + "Protocol options relating to RSVP + soft preemption"; + container config { + description + "Configuration parameters relating to RSVP + soft preemption support"; + uses mpls-rsvp-soft-preemption_config; + } + container state { + config false; + description + "State parameters relating to RSVP + soft preemption support"; + uses mpls-rsvp-soft-preemption_config; + } + } + } + + grouping mpls-rsvp-hellos_config { + description + "RSVP protocol options configuration."; + + leaf hello-interval { + type uint16 { + range 1000..60000; + } + units milliseconds; + default 9000; + description + "set the interval in ms between RSVP hello + messages"; + reference + "RFC 3209: RSVP-TE: Extensions to RSVP for + LSP Tunnels. + RFC 5495: Description of the Resource + Reservation Protocol - Traffic-Engineered + (RSVP-TE) Graceful Restart Procedures"; + } + + leaf refresh-reduction { + type boolean; + default true; + description + "enables all RSVP refresh reduction message + bundling, RSVP message ID, reliable message delivery + and summary refresh"; + reference + "RFC 2961 RSVP Refresh Overhead Reduction + Extensions"; + } + } + + grouping mpls-rsvp-hellos { + description + "Top level grouping for RSVP hellos parameters"; + // TODO: confirm that the described semantics are supported + // on various implementations. Finer grain configuration + // will be vendor-specific + + container hellos { + description + "Top level container for RSVP hello parameters"; + + container config { + description + "Configuration parameters relating to RSVP + hellos"; + uses mpls-rsvp-hellos_config; + } + container state { + config false; + description + "State information associated with RSVP hellos"; + uses mpls-rsvp-hellos_config; + } + } + } + + grouping mpls-rsvp-subscription_config { + description + "RSVP subscription configuration"; + + leaf subscription { + type oc-types:percentage; + description + "percentage of the interface bandwidth that + RSVP can reserve"; + } + } + + grouping mpls-rsvp-subscription_state { + description + "Operational state parameters relating to the + bandwidth subscription on an interface"; + + leaf calculated-absolute-subscription-bw { + type uint64; + units "kbps"; + description + "The calculated absolute value of the bandwidth + which is reservable to RSVP-TE on the interface + prior to any adjustments that may be made from + external sources."; + } + } + + grouping mpls-rsvp-subscription { + description + "Top level group for RSVP subscription options"; + + container subscription { + description + "Bandwidth percentage reservable by RSVP + on an interface"; + + container config { + description + "Configuration parameters relating to RSVP + subscription options"; + uses mpls-rsvp-subscription_config; + } + + container state { + config false; + description + "State parameters relating to RSVP + subscription options"; + uses mpls-rsvp-subscription_config; + uses mpls-rsvp-subscription_state; + } + } + } + + grouping mpls-rsvp-graceful-restart_config { + description + "Configuration parameters relating to RSVP Graceful-Restart"; + + leaf enable { + type boolean; + default false; + description + "Enables graceful restart on the node."; + } + + leaf restart-time { + type uint32; + description + "Graceful restart time (seconds)."; + reference + "RFC 5495: Description of the Resource + Reservation Protocol - Traffic-Engineered + (RSVP-TE) Graceful Restart Procedures"; + } + leaf recovery-time { + type uint32; + description + "RSVP state recovery time"; + } + } + + grouping mpls-rsvp-graceful-restart { + description + "Top level group for RSVP graceful-restart + parameters"; + + container graceful-restart { + description + "Operational state and configuration parameters relating to + graceful-restart for RSVP"; + + container config { + description + "Configuration parameters relating to + graceful-restart"; + uses mpls-rsvp-graceful-restart_config; + } + + container state { + config false; + description + "State information associated with + RSVP graceful-restart"; + uses mpls-rsvp-graceful-restart_config; + } + } + } + + grouping mpls-rsvp-authentication_config { + description + "RSVP authentication parameters container."; + + leaf enable { + type boolean; + default false; + description + "Enables RSVP authentication on the node."; + } + + leaf authentication-key { + type string { + // Juniper supports 1..16 while + // Cisco has a much bigger range, up to 60. + length "1..32"; + } + description + "authenticate RSVP signaling + messages"; + reference + "RFC 2747: RSVP Cryptographic Authentication"; + } + } + + grouping mpls-rsvp-authentication { + description + "Top level group for RSVP authentication, + as per RFC2747"; + + container authentication { + description + "Configuration and state parameters relating to RSVP + authentication as per RFC2747"; + + container config { + description + "Configuration parameters relating + to authentication"; + uses mpls-rsvp-authentication_config; + } + + container state { + config false; + description + "State information associated + with authentication"; + uses mpls-rsvp-authentication_config; + } + } + } + + grouping mpls-rsvp-protection_config { + description + "RSVP facility (link/node) protection configuration"; + + leaf link-protection-style-requested { + type identityref { + base oc-mplst:PROTECTION_TYPE; + } + default oc-mplst:LINK_NODE_PROTECTION_REQUESTED; + description + "Style of mpls frr protection desired: + link, link-node, or unprotected"; + } + + leaf bypass-optimize-interval { + type uint16; + units seconds; + description + "interval between periodic optimization + of the bypass LSPs"; + // note: this is interface specific on juniper + // on iox, this is global. need to resolve. + } + // to be completed, things like enabling link protection, + // optimization times, etc. + } + + grouping mpls-rsvp-link-protection { + description + "Top level group for RSVP protection"; + container protection { + description + "link-protection (NHOP) related configuration"; + + container config { + description + "Configuration for link-protection"; + uses mpls-rsvp-protection_config; + } + + container state { + config false; + description + "State for link-protection"; + uses mpls-rsvp-protection_config; + } + } + } + + grouping mpls-rsvp-statistics { + description + "Top level grouping for RSVP protocol state"; + + uses mpls-rsvp-protocol-state; + } + + grouping rsvp-global { + description + "Global RSVP protocol configuration"; + container rsvp-te { + description + "RSVP-TE global signaling protocol configuration"; + + uses mpls-rsvp-session-state; + + container neighbors { + description + "Configuration and state for RSVP neighbors connecting + to the device"; + + list neighbor { + key "address"; + + config false; + + description + "List of RSVP neighbors of the local system"; + + leaf address { + type leafref { + path "../state/address"; + } + description + "Reference to the address of the RSVP neighbor"; + } + + container state { + config false; + description + "Operational state parameters relating to the + RSVP neighbor"; + uses mpls-rsvp-neighbor-state; + } + } + } + + container global { + description + "Platform wide RSVP configuration and state"; + uses mpls-rsvp-graceful-restart; + uses mpls-rsvp-soft-preemption; + uses mpls-rsvp-hellos; + + container state { + config false; + description + "Platform wide RSVP state, including counters"; + // TODO - reconcile global and per-interface + // protocol-related statistics + + container counters { + config false; + description + "Platform wide RSVP statistics and counters"; + uses mpls-rsvp-global-protocol-state; + uses mpls-rsvp-statistics; + } + } + } + + container interface-attributes { + // interfaces, bw percentages, hello timers, etc goes here"; + description + "Attributes relating to RSVP-TE enabled interfaces"; + + list interface { + key "interface-id"; + description + "list of per-interface RSVP configurations"; + + leaf interface-id { + type leafref { + path "../config/interface-id"; + } + description + "reference to the interface-id data"; + } + + + container config { + description + "Configuration of per-interface RSVP parameters"; + uses mpls-rsvp-interfaces-config; + } + + container state { + config false; + description + "Per-interface RSVP protocol and state information"; + + uses mpls-rsvp-interfaces-state; + uses mpls-rsvp-interfaces-config; + + container counters { + config false; + description + "Interface specific RSVP statistics and counters"; + uses mpls-rsvp-protocol-state; + } + } + + uses oc-if:interface-ref; + uses mpls-rsvp-interface-reservations; + uses mpls-rsvp-hellos; + uses mpls-rsvp-authentication; + uses mpls-rsvp-subscription; + uses mpls-rsvp-link-protection; + } + } + } + } + + grouping rsvp-p2p-tunnel-attributes_config { + description + "properties of RSPP point-to-point paths"; + + leaf source { + when "/mpls/lsps/constrained-path/tunnel/config" + + "/signaling-protocol = 'PATH_SETUP_RSVP'" { + description + "When the signaling protocol is RSVP-TE "; + } + type inet:ip-address; + description + "RSVP-TE tunnel source address"; + } + + leaf soft-preemption { + when "/mpls/lsps/constrained-path/tunnel/config" + + "/signaling-protocol = 'PATH_SETUP_RSVP'" { + description + "When the signaling protocol is RSVP-TE "; + } + type boolean; + default false; + description + "Enables RSVP soft-preemption on this LSP"; + } + + uses rsvp-priorities_config; + } + + grouping rsvp-priorities_config { + description + "Configuration paramters related to RSVP-TE priorities"; + + leaf setup-priority { + when "/mpls/lsps/constrained-path/tunnel/config" + + "/signaling-protocol = 'PATH_SETUP_RSVP'" { + description + "When the signaling protocol is RSVP-TE "; + } + type uint8 { + range 0..7; + } + default 7; + description + "RSVP-TE preemption priority during LSP setup, lower is + higher priority; default 7 indicates that LSP will not + preempt established LSPs during setup"; + reference "RFC 3209 - RSVP-TE: Extensions to RSVP for + LSP Tunnels"; + } + + leaf hold-priority { + when "/mpls/lsps/constrained-path/tunnel/config" + + "/signaling-protocol = 'PATH_SETUP_RSVP'" { + description + "When the signaling protocol is RSVP-TE "; + } + type uint8 { + range 0..7; + } + default 0; + description + "preemption priority once the LSP is established, + lower is higher priority; default 0 indicates other LSPs + will not preempt the LSPs once established"; + reference "RFC 3209 - RSVP-TE: Extensions to RSVP for + LSP Tunnels"; + } + } + + grouping rsvp-p2p-path-attributes_config { + description + "properties of RSPP point-to-point paths"; + + uses rsvp-priorities_config; + + leaf retry-timer { + when "/mpls/lsps/constrained-path/tunnel/config" + + "/signaling-protocol = 'PATH_SETUP_RSVP'" { + description + "When the signaling protocol is RSVP-TE "; + } + type uint16 { + range 1..600; + } + units seconds; + description + "sets the time between attempts to establish the + LSP"; + } + } + + grouping mpls-rsvp-neighbor-state { + description + "State information for RSVP neighbors"; + + leaf address { + type inet:ip-address; + description + "Address of RSVP neighbor"; + } + + leaf detected-interface { + type string; + description + "Interface where RSVP neighbor was detected"; + } + + leaf neighbor-status { + type enumeration { + enum UP { + description + "RSVP hello messages are detected from the neighbor"; + } + enum DOWN { + description + "RSVP neighbor not detected as up, due to a + communication failure or IGP notification + the neighbor is unavailable"; + } + } + description + "Enumuration of possible RSVP neighbor states"; + } + + leaf refresh-reduction { + type boolean; + description + "Suppport of neighbor for RSVP refresh reduction"; + reference + "RFC 2961 RSVP Refresh Overhead Reduction + Extensions"; + } + + } + + grouping mpls-rsvp-session-state { + description + "State information for RSVP TE sessions"; + + container sessions { + description + "Enclosing container for sessions"; + + list session { + key "local-index"; + config false; + + description + "List of RSVP sessions"; + + leaf local-index { + type leafref { + path "../state/local-index"; + } + description + "Reference to the local index for the RSVP + session"; + } + + uses mpls-rsvp-record-route-object-top; + + container state { + description + "Operational state parameters relating to the + RSVP session"; + + leaf local-index { + type uint64; + description + "The index used to identify the RSVP session + on the local network element. This index is + generated by the device and is unique only + to the local network element."; + } + + leaf source-address { + type inet:ip-address; + description + "Origin address of RSVP session"; + } + + leaf destination-address { + type inet:ip-address; + description + "Destination address of RSVP session"; + } + + leaf tunnel-id { + type uint16; + description + "The tunnel ID is an identifier used in the + RSVP session, which remains constant over + the life of the tunnel."; + reference "RFC 3209"; + } + + leaf lsp-id { + type uint16; + description + "The LSP ID distinguishes between two LSPs + originated from the same headend, and is + commonly used to distinguish RSVP sessions + during make before break operations."; + reference "RFC 3209"; + } + + leaf session-name { + type string; + description + "The signaled name of this RSVP session."; + } + + leaf status { + type enumeration { + enum UP { + description + "RSVP session is up"; + } + enum DOWN { + description + "RSVP session is down"; + } + } + description + "Enumeration of RSVP session states"; + } + + leaf type { + type identityref { + base oc-mplst:LSP_ROLE; + } + description + "The type/role of the RSVP session, signifing + the session's role on the current device, such as + a transit session vs. an ingress session."; + } + + leaf protection-requested { + type identityref { + base oc-mplst:PROTECTION_TYPE; + } + description + "The type of protection requested for the RSVP session"; + } + + leaf label-in { + type oc-mplst:mpls-label; + description + "Incoming MPLS label associated with this RSVP session"; + } + + leaf label-out { + type oc-mplst:mpls-label; + description + "Outgoing MPLS label associated with this RSVP session"; + } + + container sender-tspec { + description + "Operational state statistics relating to the SENDER_TSPEC + received for the RSVP session"; + + leaf rate { + type oc-types:ieeefloat32; + units "Bps"; + description + "The rate at which the head-end device generates traffic, + expressed in bytes per second."; + reference + "RFC2210: RSVP with INTSERV"; + } + + leaf size { + type oc-types:ieeefloat32; + units "bytes per second"; + description + "The size of the token bucket that is used to determine + the rate at which the head-end device generates traffic, + expressed in bytes per second."; + reference + "RFC2210: RSVP with INTSERV"; + } + + leaf peak-data-rate { + type union { + type oc-types:ieeefloat32; + type enumeration { + enum INFINITY { + description + "The head-end device has no maximum data rate."; + } + } + } + units "bytes per second"; + description + "The maximum traffic generation rate that the head-end + device sends traffic at."; + reference + "RFC2210: RSVP with INTSERV"; + } + } + } + } + } + } //rsvp-session-state + + grouping mpls-rsvp-interfaces-config { + description + "RSVP configuration information relevant to an interface"; + + leaf interface-id { + type oc-if:interface-id; + description + "Identifier for the interface"; + } + } + + grouping mpls-rsvp-interfaces-state { + description + "RSVP state information relevant to an interface"; + + // Placeholder grouping + } + + grouping mpls-rsvp-interface-reservations { + description + "Operational state related to interface bandwidth + reservations"; + + container bandwidth-reservations { + description + "Enclosing container for bandwidth reservation"; + list bandwidth-reservation { + key "priority"; + config false; + description + "Available and reserved bandwidth by priority on + the interface."; + + leaf priority { + type leafref { + path "../state/priority"; + } + description "Reference to the RSVP priority level"; + } + + container state { + description + "Operational state parameters relating to a + bandwidth reservation at a certain priority"; + + leaf priority { + type union { + type uint8 { + range 0..7; + } + type enumeration { + enum ALL { + description + "The ALL keyword represents the overall + state of the interface - i.e., the union + of all of the priority levels"; + } + } + } + description + "RSVP priority level for LSPs traversing the interface"; + } + + leaf available-bandwidth { + type oc-mplst:bandwidth-mbps; + description + "Bandwidth currently available with the priority level, + or for the entire interface when the priority is set to + ALL"; + } + + leaf reserved-bandwidth { + type oc-mplst:bandwidth-mbps; + description + "Bandwidth currently reserved within the priority level, + or the sum of all priority levels when the keyword is set + to ALL"; + } + + leaf active-reservations-count { + type yang:gauge64; + description + "Number of active RSVP reservations in the associated + priority, or the sum of all reservations when the priority + level is set to ALL"; + } + + leaf highwater-mark { + type oc-mplst:bandwidth-mbps; + description + "Maximum bandwidth reserved on the interface within the + priority, or across all priorities in the case that the + priority level is set to ALL"; + } + } + } + } + } + + grouping mpls-rsvp-global-protocol-state { + description + "RSVP protocol statistics which may not apply + on an interface, but are significant globally."; + + leaf path-timeouts { + type yang:counter64; + description + "TODO"; + } + + leaf reservation-timeouts { + type yang:counter64; + description + "TODO"; + } + + leaf rate-limited-messages { + type yang:counter64; + description + "RSVP messages dropped due to rate limiting"; + } + } + + grouping mpls-rsvp-protocol-state { + description + "RSVP protocol statistics and message counters"; + + leaf in-path-messages { + type yang:counter64; + description + "Number of received RSVP Path messages"; + } + + leaf in-path-error-messages { + type yang:counter64; + description + "Number of received RSVP Path Error messages"; + } + + leaf in-path-tear-messages { + type yang:counter64; + description + "Number of received RSVP Path Tear messages"; + } + + leaf in-reservation-messages { + type yang:counter64; + description + "Number of received RSVP Resv messages"; + } + + leaf in-reservation-error-messages { + type yang:counter64; + description + "Number of received RSVP Resv Error messages"; + } + + leaf in-reservation-tear-messages { + type yang:counter64; + description + "Number of received RSVP Resv Tear messages"; + } + + leaf in-hello-messages { + type yang:counter64; + description + "Number of received RSVP hello messages"; + } + + leaf in-srefresh-messages { + type yang:counter64; + description + "Number of received RSVP summary refresh messages"; + } + + leaf in-ack-messages { + type yang:counter64; + description + "Number of received RSVP refresh reduction ack + messages"; + } + + leaf out-path-messages { + type yang:counter64; + description + "Number of sent RSVP PATH messages"; + } + + leaf out-path-error-messages { + type yang:counter64; + description + "Number of sent RSVP Path Error messages"; + } + + leaf out-path-tear-messages { + type yang:counter64; + description + "Number of sent RSVP Path Tear messages"; + } + + leaf out-reservation-messages { + type yang:counter64; + description + "Number of sent RSVP Resv messages"; + } + + leaf out-reservation-error-messages { + type yang:counter64; + description + "Number of sent RSVP Resv Error messages"; + } + + leaf out-reservation-tear-messages { + type yang:counter64; + description + "Number of sent RSVP Resv Tear messages"; + } + + leaf out-hello-messages { + type yang:counter64; + description + "Number of sent RSVP hello messages"; + } + + leaf out-srefresh-messages { + type yang:counter64; + description + "Number of sent RSVP summary refresh messages"; + } + + leaf out-ack-messages { + type yang:counter64; + description + "Number of sent RSVP refresh reduction ack messages"; + } + } + + grouping mpls-rsvp-record-route-object-top { + description + "Top-level structure grouping for list of record route + objects."; + + container record-route-objects { + description + "Enclosing container for MPLS RRO objects associated with the + traffic engineered tunnel."; + + list record-route-object { + + key "index"; + config false; + description + "Read-only list of record route objects associated with the + traffic engineered tunnel. Each entry in the list + may contain a hop IP address, MPLS label allocated + at the hop, and the flags associated with the entry."; + + leaf index { + type leafref { + path "../state/index"; + } + description + "Reference to the index of the record route object. + The index is used to indicate the ordering of hops in + the path."; + } + + container state { + + config false; + + description + "Information related to RRO objects. The hop, label, and + optional flags are present for each entry in the list."; + + uses mpls-rsvp-record-route-object-state; + } + } + } + } + + grouping mpls-rsvp-record-route-object-state { + description + "Grouping to hold information relating to record route + objects relevant to a traffic engineering LSP."; + + leaf index { + type uint8; + description + "Index of object in the list. Used for ordering."; + } + + leaf address { + type inet:ip-address; + description + "IP router hop for RRO entry"; + } + + leaf reported-label { + type oc-mplst:mpls-label; + description + "Label reported for RRO hop"; + } + + leaf reported-flags { + type uint8; + description + "Subobject flags for MPLS label"; + } + } + + + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls-sr.yang b/yang/openconfig-nis/openconfig-mpls-sr.yang new file mode 100644 index 000000000..93900e087 --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-sr.yang @@ -0,0 +1,101 @@ +module openconfig-mpls-sr { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/mpls-sr"; + + prefix "oc-mpls-sr"; + + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration for MPLS with segment routing-based LSPs, + including global parameters, and LSP-specific configuration for + both constrained-path and IGP-congruent LSPs"; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + grouping sr-path-attributes_config { + description + "Configuration parameters relating to SR-TE LSPs"; + + leaf sid-selection-mode { + type enumeration { + enum ADJ_SID_ONLY { + description + "The SR-TE tunnel should only use adjacency SIDs + to build the SID stack to be pushed for the LSP"; + } + enum MIXED_MODE { + description + "The SR-TE tunnel can use a mix of adjacency + and prefix SIDs to build the SID stack to be pushed + to the LSP"; + } + } + default MIXED_MODE; + description + "The restrictions placed on the SIDs to be selected by the + calculation method for the explicit path when it is + instantiated for a SR-TE LSP"; + } + + leaf sid-protection-required { + type boolean; + default "false"; + description + "When this value is set to true, only SIDs that are + protected are to be selected by the calculating method + when the explicit path is instantiated by a SR-TE LSP."; + } + } + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls-static@2017-03-22.yang b/yang/openconfig-nis/openconfig-mpls-static@2017-03-22.yang new file mode 100644 index 000000000..20aeaac7d --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-static@2017-03-22.yang @@ -0,0 +1,274 @@ +submodule openconfig-mpls-static { + + yang-version "1"; + + belongs-to "openconfig-mpls" { + prefix "mpls"; + } + + // import some basic types + import openconfig-mpls-types {prefix oc-mplst; } + import openconfig-inet-types { prefix inet; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Defines static LSP configuration"; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // grouping statements + + grouping static-lsp-common-config { + description + "common definitions for static LSPs"; + + leaf next-hop { + type inet:ip-address; + description + "next hop IP address for the LSP"; + } + + leaf incoming-label { + type oc-mplst:mpls-label; + description + "label value on the incoming packet"; + } + + leaf push-label { + type oc-mplst:mpls-label; + description + "label value to push at the current hop for the + LSP"; + } + } + + grouping static-lsp-ingress-config { + description + "Configuration data for ingress LSPs"; + + uses static-lsp-common-config; + } + + grouping static-lsp-ingress-state { + description + "Operational state data for ingress LSPs"; + } + + grouping static-lsp-ingress-top { + description + "Top-level grouping for ingress LSP data"; + + container ingress { + description + "Static LSPs for which the router is an + ingress node"; + + container config { + description + "Configuration data for ingress LSPs"; + + uses static-lsp-ingress-config; + } + + container state { + + config false; + + description + "Operational state data for ingress LSPs"; + + uses static-lsp-ingress-config; + uses static-lsp-ingress-state; + } + } + } + + grouping static-lsp-transit-config { + description + "Configuration data for transit LSPs"; + + uses static-lsp-common-config; + } + + grouping static-lsp-transit-state { + description + "Operational state data for transit LSPs"; + } + + grouping static-lsp-transit-top { + description + "Top-level grouping for transit LSP data"; + + container transit { + description + "Static LSPs for which the router is an + transit node"; + + container config { + description + "Configuration data for transit LSPs"; + + uses static-lsp-transit-config; + } + + container state { + + config false; + + description + "Operational state data for transit LSPs"; + + uses static-lsp-transit-config; + uses static-lsp-transit-state; + } + } + } + + grouping static-lsp-egress-config { + description + "Configuration data for egress LSPs"; + + uses static-lsp-common-config; + } + + grouping static-lsp-egress-state { + description + "Operational state data for egress LSPs"; + } + + grouping static-lsp-egress-top { + description + "Top-level grouping for egress LSP data"; + + container egress { + description + "Static LSPs for which the router is an + egress node"; + + container config { + description + "Configuration data for egress LSPs"; + + uses static-lsp-egress-config; + } + + container state { + + config false; + + description + "Operational state data for egress LSPs"; + + uses static-lsp-egress-config; + uses static-lsp-egress-state; + } + } + } + + grouping static-lsp-config { + description + "Configuration data for static LSPs"; + + leaf name { + type string; + description + "name to identify the LSP"; + } + } + + grouping static-lsp-state { + description + "Operational state data for static LSPs"; + + } + + grouping static-lsp-top { + description + "grouping for top level list of static LSPs"; + + + list static-lsp { + key "name"; + description + "list of defined static LSPs"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference the name list key"; + } + + container config { + description + "Configuration data for the static lsp"; + + uses static-lsp-config; + } + + container state { + config false; + + description + "Operational state data for the static lsp"; + + uses static-lsp-config; + uses static-lsp-state; + + } + + // TODO: separation into ingress, transit, egress may help + // to figure out what exactly is configured, but need to + // consider whether implementations can support the + // separation + uses static-lsp-ingress-top; + uses static-lsp-transit-top; + uses static-lsp-egress-top; + } + } + + // data definition statements + + // augment statements + + +} diff --git a/yang/openconfig-nis/openconfig-mpls-te@2017-03-22.yang b/yang/openconfig-nis/openconfig-mpls-te@2017-03-22.yang new file mode 100644 index 000000000..75daddb8f --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-te@2017-03-22.yang @@ -0,0 +1,1291 @@ +submodule openconfig-mpls-te { + + yang-version "1"; + + belongs-to "openconfig-mpls" { + prefix "oc-mpls"; + } + + + // import some basic types + import openconfig-inet-types { prefix inet; } + import openconfig-mpls-rsvp { prefix oc-rsvp; } + import openconfig-mpls-sr { prefix oc-sr; } + import openconfig-mpls-types {prefix oc-mplst; } + import openconfig-types { prefix oc-types; } + import openconfig-yang-types { prefix yang; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration related to constrained-path LSPs and traffic + engineering. These definitions are not specific to a particular + signaling protocol or mechanism (see related submodules for + signaling protocol-specific configuration)."; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // typedef statements + + typedef te-bandwidth-type { + type enumeration { + enum SPECIFIED { + description + "Bandwidth is explicitly specified"; + } + enum AUTO { + description + "Bandwidth is automatically computed"; + } + } + description + "enumerated type for specifying whether bandwidth is + explicitly specified or automatically computed"; + } + + typedef mpls-srlg-flooding-type { + type enumeration { + enum FLOODED_SRLG { + description + "SRLG is flooded in the IGP"; + } + enum STATIC_SRLG { + description + "SRLG is not flooded, the members are + statically configured"; + } + } + description + "Enumerated bype for specifying how the SRLG is flooded"; + } + + typedef mpls-hop-type { + type enumeration { + enum LOOSE { + description + "loose hop in an explicit path"; + } + enum STRICT { + description + "strict hop in an explicit path"; + } + } + description + "enumerated type for specifying loose or strict + paths"; + } + + typedef te-metric-type { + type union { + type enumeration { + enum IGP { + description + "set the LSP metric to track the underlying + IGP metric"; + } + } + type uint32; + } + description + "union type for setting the LSP TE metric to a + static value, or to track the IGP metric"; + } + + typedef cspf-tie-breaking { + type enumeration { + enum RANDOM { + description + "CSPF calculation selects a random path among + multiple equal-cost paths to the destination"; + } + enum LEAST_FILL { + description + "CSPF calculation selects the path with greatest + available bandwidth"; + } + enum MOST_FILL { + description + "CSPF calculation selects the path with the least + available bandwidth"; + } + } + default RANDOM; + description + "type to indicate the CSPF selection policy when + multiple equal cost paths are available"; + } + + + // grouping statements + + grouping te-tunnel-reoptimize_config { + description + "Definition for reoptimize timer configuration"; + + leaf reoptimize-timer { + type uint16; + units seconds; + description + "frequency of reoptimization of + a traffic engineered LSP"; + } + } + + + grouping te-lsp-auto-bandwidth_config { + description + "Configuration parameters related to autobandwidth"; + + leaf enabled { + type boolean; + default false; + description + "enables mpls auto-bandwidth on the + lsp"; + } + + leaf min-bw { + type oc-mplst:bandwidth-kbps; + description + "set the minimum bandwidth in Kbps for an + auto-bandwidth LSP"; + } + + leaf max-bw { + type oc-mplst:bandwidth-kbps; + description + "set the maximum bandwidth in Kbps for an + auto-bandwidth LSP"; + } + + leaf adjust-interval { + type uint32; + description + "time in seconds between adjustments to + LSP bandwidth"; + } + + leaf adjust-threshold { + type oc-types:percentage; + description + "percentage difference between the LSP's + specified bandwidth and its current bandwidth + allocation -- if the difference is greater than the + specified percentage, auto-bandwidth adjustment is + triggered"; + } + } + + grouping te-lsp-overflow_config { + description + "configuration for mpls lsp bandwidth + overflow adjustment"; + + leaf enabled { + type boolean; + default false; + description + "enables mpls lsp bandwidth overflow + adjustment on the lsp"; + } + + leaf overflow-threshold { + type oc-types:percentage; + description + "bandwidth percentage change to trigger + an overflow event"; + + } + + leaf trigger-event-count { + type uint16; + description + "number of consecutive overflow sample + events needed to trigger an overflow adjustment"; + } + } + + grouping te-lsp-underflow_config { + description + "configuration for mpls lsp bandwidth + underflow adjustment"; + + leaf enabled { + type boolean; + default false; + description + "enables bandwidth underflow + adjustment on the lsp"; + } + + leaf underflow-threshold { + type oc-types:percentage; + description + "bandwidth percentage change to trigger + and underflow event"; + } + + leaf trigger-event-count { + type uint16; + description + "number of consecutive underflow sample + events needed to trigger an underflow adjustment"; + } + } + + grouping te-path-placement-constraints-config { + description + "Configuration data for link affinities"; + + leaf-list exclude-group { + type leafref { + path "../../../../../../../../../../te-global-attributes" + + "/mpls-admin-groups/admin-group/admin-group-name"; + } + description + "list of references to named admin-groups to exclude in + path calculation."; + } + + leaf-list include-all-group { + type leafref { + path "../../../../../../../../../../te-global-attributes" + + "/mpls-admin-groups/admin-group/admin-group-name"; + } + description + "list of references to named admin-groups of which all must + be included"; + } + + leaf-list include-any-group { + type leafref { + path "../../../../../../../../../../te-global-attributes" + + "/mpls-admin-groups/admin-group/admin-group-name"; + } + description + "list of references to named admin-groups of which one must + be included"; + } + } + + grouping te-path-placement-constraints-state { + description + "Operational state data for link affinities"; + //TODO: currently a placeholder + } + + grouping te-path-placement-constraints-top { + description + "Top-level grouping "; + + container admin-groups { + description + "Top-level container for include/exclude constraints for + link affinities"; + + container config { + description + "Configuration data "; + + uses te-path-placement-constraints-config; + } + + container state { + config false; + + description + "Operational state data "; + + uses te-path-placement-constraints-config; + uses te-path-placement-constraints-state; + } + } + } + + grouping te-tunnel-protection_config { + description + "Configuration parameters related to LSP + protection"; + leaf protection-style-requested { + type identityref { + base oc-mplst:PROTECTION_TYPE; + } + default oc-mplst:UNPROTECTED; + description + "style of mpls frr protection desired: can be + link, link-node or unprotected."; + } + } + + grouping explicit-route-subobject-config { + description + "The explicit route subobject grouping"; + + leaf address { + type inet:ip-address; + description + "router hop for the LSP path"; + } + + leaf hop-type { + type mpls-hop-type; + description + "strict or loose hop"; + } + + leaf index { + type uint8 { + range "0..255"; + } + description + "Index of this explicit route object to express + the order of hops in the path"; + } + + } + + grouping named-explicit-path-config { + description + "Configuration parameters relating to a named + explicit path"; + + leaf name { + type string; + description + "A string name that uniquely identifies an explicit + path"; + } + } + + // Explicit paths config somewhat following the IETF model + grouping explicit-paths_top { + description + "Top level global explicit path configuration + grouping"; + + container named-explicit-paths { + description + "Enclosing container for the named explicit paths"; + list named-explicit-path { + key "name"; + description + "A list of explicit paths"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "A string name that uniquely identifies + an explicit path"; + } + + container config { + description + "Configuration parameters relating to named explicit + paths"; + uses named-explicit-path-config; + uses oc-sr:sr-path-attributes_config; + } + + container state { + config false; + description + "Operational state parameters relating to the named + explicit paths"; + uses named-explicit-path-config; + uses oc-sr:sr-path-attributes_config; + } + + container explicit-route-objects { + description + "Enclosing container for EROs"; + + list explicit-route-object { + key "index"; + description + "List of explicit route objects"; + + leaf index { + type leafref { + path "../config/index"; + } + + description + "Index of this explicit route object, + to express the order of hops in path"; + } + + container config { + description + "Configuration parameters relating to an explicit + route"; + uses explicit-route-subobject-config; + } + + + container state { + config false; + description + "State parameters relating to an explicit route"; + uses explicit-route-subobject-config; + } + } + } + } + } + } + + grouping mpls-te-srlg_config { + description + "Configuration of various attributes associated + with the SRLG"; + + leaf name { + type string; + description + "SRLG group identifier"; + } + + leaf value { + type uint32; + description + "group ID for the SRLG"; + } + + leaf cost { + type uint32; + description + "The cost of the SRLG to the computation + algorithm"; + } + + leaf flooding-type { + type mpls-srlg-flooding-type; + default FLOODED_SRLG; + description + "The type of SRLG, either flooded in the IGP or + statically configured"; + } + } + + grouping mpls-te-srlg-members_config { + description + "Configuration of the membership of the SRLG"; + + leaf from-address { + type inet:ip-address; + description + "IP address of the a-side of the SRLG link"; + } + + leaf to-address { + type inet:ip-address; + description + "IP address of the z-side of the SRLG link"; + } + } + + grouping mpls-te-srlg-top { + description + "Top level grouping for MPLS shared + risk link groups."; + + container srlgs { + description + "Shared risk link groups attributes"; + list srlg { + key "name"; + description + "List of shared risk link groups"; + + leaf name { + type leafref { + path "../config/name"; + // Requires YANG 1.1 + //require-instance true; + } + description + "The SRLG group identifier"; + } + + container config { + description + "Configuration parameters related to the SRLG"; + uses mpls-te-srlg_config; + } + + container state { + config false; + description + "State parameters related to the SRLG"; + uses mpls-te-srlg_config; + } + + container static-srlg-members { + when "../config/flooding-type = 'STATIC_SRLG'" { + description + "Include this container for static + SRLG specific configuration"; + } + description + "SRLG members for static (not flooded) SRLGs "; + + list members-list { + key "from-address"; + description + "List of SRLG members, which are expressed + as IP address endpoints of links contained in the + SRLG"; + + leaf from-address { + type leafref { + path "../config/from-address"; + // Requires YANG 1.1 + //require-instance true; + } + description + "The from address of the link in the SRLG"; + } + + container config { + description + "Configuration parameters relating to the + SRLG members"; + uses mpls-te-srlg-members_config; + } + + container state { + config false; + description + "State parameters relating to the SRLG + members"; + uses mpls-te-srlg-members_config; + } + } + } + } + } + } + + grouping te-global-tunnel_config { + description + "Configuration parameters relevant to a single + traffic engineered tunnel."; + + leaf name { + type string; + description + "The tunnel name"; + } + + leaf type { + type identityref { + base oc-mplst:TUNNEL_TYPE; + } + description + "Tunnel type, p2p or p2mp"; + } + + leaf signaling-protocol { + type identityref { + base oc-mplst:PATH_SETUP_PROTOCOL; + } + description + "Signaling protocol used to set up this tunnel"; + } + + leaf description { + type string; + description + "optional text description for the tunnel"; + } + + leaf admin-status { + type identityref { + base oc-mplst:TUNNEL_ADMIN_STATUS; + } + default oc-mplst:ADMIN_UP; + description + "TE tunnel administrative state."; + } + + leaf preference { + type uint8 { + range "1..255"; + } + description + "Specifies a preference for this tunnel. + A lower number signifies a better preference"; + } + + leaf metric-type { + type identityref { + base oc-mplst:LSP_METRIC_TYPE; + } + default oc-mplst:LSP_METRIC_INHERITED; + description + "The type of metric specification that should be used to set + the LSP(s) metric"; + } + + leaf metric { + type int32; + description + "The value of the metric that should be specified. The value + supplied in this leaf is used in conjunction with the metric + type to determine the value of the metric used by the system. + Where the metric-type is set to LSP_METRIC_ABSOLUTE - the + value of this leaf is used directly; where it is set to + LSP_METRIC_RELATIVE, the relevant (positive or negative) + offset is used to formulate the metric; where metric-type + is LSP_METRIC_INHERITED, the value of this leaf is not + utilised"; + } + + leaf shortcut-eligible { + type boolean; + default "true"; + description + "Whether this LSP is considered to be eligible for us as a + shortcut in the IGP. In the case that this leaf is set to + true, the IGP SPF calculation uses the metric specified to + determine whether traffic should be carried over this LSP"; + } + + leaf protection-style-requested { + type identityref { + base oc-mplst:PROTECTION_TYPE; + } + default oc-mplst:UNPROTECTED; + description + "style of mpls frr protection desired: can be + link, link-node or unprotected."; + } + + uses te-tunnel-reoptimize_config; + uses oc-rsvp:rsvp-p2p-tunnel-attributes_config; + + } + + grouping tunnel-p2p-attributes_config { + description + "Configuration related to p2p LSPs"; + leaf destination { + type inet:ip-address; + description + "P2P tunnel destination address"; + } + } + + grouping p2p-path_state { + description + "Operational state parameters for p2p paths"; + + leaf associated-rsvp-session { + type leafref { + path "../../../../../../../../../signaling-protocols/" + + "rsvp-te/sessions/session/local-index"; + } + description + "If the signalling protocol specified for this path is + RSVP-TE, this leaf provides a reference to the associated + session within the RSVP-TE protocol sessions list, such + that details of the signaling can be retrieved."; + } + } + + grouping p2p-path_config { + description + "Configuration parameters for p2p paths"; + + leaf name { + type string; + description + "Path name"; + } + + leaf path-computation-method { + type identityref { + base oc-mplst:PATH_COMPUTATION_METHOD; + } + default oc-mplst:LOCALLY_COMPUTED; + description + "The method used for computing the path, either + locally computed, queried from a server or not + computed at all (explicitly configured)."; + } + + leaf use-cspf { + when "../path-computation-method = 'LOCALLY_COMPUTED'" { + description + "The use of cspf when the path-computation method is + local computation"; + } + type boolean; + description + "Flag to enable CSPF for locally computed LSPs"; + } + + leaf cspf-tiebreaker { + when "../path-computation-method = 'LOCALLY_COMPUTED'" { + description + "The cspf tiebreaking method when the path is + locally computed"; + } + type cspf-tie-breaking; + description + "Determine the tie-breaking method to choose between + equally desirable paths during CSFP computation"; + } + + + leaf path-computation-server { + when "../path-computation-method = 'EXTERNALLY_QUERIED'" { + description + "The path-computation server when the path is + externally queried"; + } + type inet:ip-address; + description + "Address of the external path computation + server"; + } + + leaf explicit-path-name { + when "../path-computation-method = 'EXPLICITLY_DEFINED'" { + description + "The name of the explicitly defined path used"; + } + + type leafref { + path "../../../../../../../" + + "named-explicit-paths/named-explicit-path/" + + "config/name"; + // Requires YANG 1.1 + //require-instance true; + } + description + "reference to a defined path"; + } + + leaf preference { + type uint8 { + range "1..255"; + } + description + "Specifies a preference for this path. The lower the + number higher the preference"; + } + + uses oc-rsvp:rsvp-p2p-path-attributes_config; + } + + + grouping te-tunnel-p2p_top { + description + "Top level grouping for p2p configuration"; + + container p2p-tunnel-attributes { + when "../config/type = 'P2P'" { + description + "Include this container for LSPs of type P2P"; + } + description + "Parameters related to LSPs of type P2P"; + + container config { + description + "Configuration parameters for P2P LSPs"; + uses tunnel-p2p-attributes_config; + } + + container state { + config false; + description + "State parameters for P2P LSPs"; + uses tunnel-p2p-attributes_config; + } + + uses p2p-primary-paths_top; + uses p2p-secondary-paths_top; + } + } + + + grouping te-tunnel_state { + description + "Counters and statistical data relevent to a single + tunnel."; + + leaf oper-status { + type identityref { + base oc-mplst:LSP_OPER_STATUS; + } + description + "The operational status of the TE tunnel"; + } + + leaf role { + type identityref { + base oc-mplst:LSP_ROLE; + } + description + "The lsp role at the current node, whether it is headend, + transit or tailend."; + } + + container counters { + description + "State data for MPLS label switched paths. This state + data is specific to a single label switched path."; + + leaf bytes { + type yang:counter64; + description + "Number of bytes that have been forwarded over the + label switched path."; + } + + leaf packets { + type yang:counter64; + description + "Number of pacets that have been forwarded over the + label switched path."; + } + + leaf path-changes { + type yang:counter64; + description + "Number of path changes for the label switched path"; + } + + leaf state-changes { + type yang:counter64; + description + "Number of state changes for the label switched path"; + } + + leaf online-time { + type yang:date-and-time; + description + "Indication of the time the label switched path + transitioned to an Oper Up or in-service state"; + } + + leaf current-path-time { + type yang:date-and-time; + description + "Indicates the time the LSP switched onto its + current path. This is reset upon a LSP path + change."; + } + + leaf next-reoptimization-time { + type yang:date-and-time; + description + "Indicates the next scheduled time the LSP + will be reoptimized."; + } + } + } + + grouping te-tunnel-bandwidth_config { + description + "Configuration parameters related to bandwidth for a tunnel"; + + leaf specification-type { + type te-bandwidth-type; + default SPECIFIED; + description + "The method used for settign the bandwidth, either explicitly + specified or configured"; + } + + leaf set-bandwidth { + when "../specification-type = 'SPECIFIED'" { + description + "The bandwidth value when bandwidth is explicitly + specified"; + } + type oc-mplst:bandwidth-kbps; + description + "set bandwidth explicitly, e.g., using + offline calculation"; + } + } + + grouping te-tunnel-bandwidth_state { + description + "Operational state parameters relating to bandwidth for a tunnel"; + + leaf signaled-bandwidth { + type oc-mplst:bandwidth-kbps; + description + "The currently signaled bandwidth of the LSP. In the case where + the bandwidth is specified explicitly, then this will match the + value of the set-bandwidth leaf; in cases where the bandwidth is + dynamically computed by the system, the current value of the + bandwidth should be reflected."; + } + } + + grouping te-tunnel-bandwidth_top { + description + "Top level grouping for specifying bandwidth for a tunnel"; + + container bandwidth { + description + "Bandwidth configuration for TE LSPs"; + + container config { + description + "Configuration parameters related to bandwidth on TE + tunnels:"; + uses te-tunnel-bandwidth_config; + } + + container state { + config false; + description + "State parameters related to bandwidth + configuration of TE tunnels"; + uses te-tunnel-bandwidth_config; + uses te-tunnel-bandwidth_state; + } + + container auto-bandwidth { + when "../config/specification-type = 'AUTO'" { + description + "Include this container for auto bandwidth + specific configuration"; + } + description + "Parameters related to auto-bandwidth"; + + container config { + description + "Configuration parameters relating to MPLS + auto-bandwidth on the tunnel."; + uses te-lsp-auto-bandwidth_config; + } + + container state { + config false; + description + "State parameters relating to MPLS + auto-bandwidth on the tunnel."; + uses te-lsp-auto-bandwidth_config; + } + + container overflow { + description + "configuration of MPLS overflow bandwidth + adjustement for the LSP"; + + container config { + description + "Config information for MPLS overflow bandwidth + adjustment"; + uses te-lsp-overflow_config; + } + + container state { + config false; + description + "Config information for MPLS overflow bandwidth + adjustment"; + uses te-lsp-overflow_config; + } + } + + container underflow { + description + "configuration of MPLS underflow bandwidth + adjustement for the LSP"; + + container config { + description + "Config information for MPLS underflow bandwidth + adjustment"; + uses te-lsp-underflow_config; + } + + container state { + config false; + description + "State information for MPLS underflow bandwidth + adjustment"; + uses te-lsp-underflow_config; + } + } + } + } + } + + grouping p2p-path-candidate-secondary-path-config { + description + "Configuration parameters relating to a secondary path which + is a candidate for a particular primary path"; + + leaf secondary-path { + type leafref { + path "../../../../../../p2p-secondary-paths/" + + "p2p-secondary-path/config/name"; + } + description + "A reference to the secondary path that should be utilised + when the containing primary path option is in use"; + } + + leaf priority { + type uint16; + description + "The priority of the specified secondary path option. Higher + priority options are less preferable - such that a secondary + path reference with a priority of 0 is the most preferred"; + } + } + + grouping p2p-path-candidate-secondary-path-state { + description + "Operational state parameters relating to a secondary path + which is a candidate for a particular primary path"; + + leaf active { + type boolean; + description + "Indicates the current active path option that has + been selected of the candidate secondary paths"; + } + } + + grouping p2p-primary-paths_top { + description + "Top level grouping for p2p primary paths"; + + container p2p-primary-path { + description + "Primary paths associated with the LSP"; + + list p2p-primary-path { + key "name"; + description + "List of p2p primary paths for a tunnel"; + + leaf name { + type leafref { + path "../config/name"; + // Requires YANG 1.1 + //require-instance true; + } + description + "Path name"; + } + + container config { + description + "Configuration parameters related to paths"; + uses p2p-path_config; + } + + container state { + config false; + description + "State parameters related to paths"; + uses p2p-path_config; + uses p2p-path_state; + } + + container candidate-secondary-paths { + description + "The set of candidate secondary paths which may be used + for this primary path. When secondary paths are specified + in the list the path of the secondary LSP in use must be + restricted to those path options referenced. The + priority of the secondary paths is specified within the + list. Higher priority values are less preferred - that is + to say that a path with priority 0 is the most preferred + path. In the case that the list is empty, any secondary + path option may be utilised when the current primary path + is in use."; + + list candidate-secondary-path { + key "secondary-path"; + + description + "List of secondary paths which may be utilised when the + current primary path is in use"; + + leaf secondary-path { + type leafref { + path "../config/secondary-path"; + } + description + "A reference to the secondary path option reference + which acts as the key of the candidate-secondary-path + list"; + } + + container config { + description + "Configuration parameters relating to the candidate + secondary path"; + + uses p2p-path-candidate-secondary-path-config; + } + + container state { + config false; + description + "Operational state parameters relating to the candidate + secondary path"; + + uses p2p-path-candidate-secondary-path-config; + uses p2p-path-candidate-secondary-path-state; + } + } + } + + uses te-path-placement-constraints-top; + + } + } + } + + grouping p2p-secondary-paths_top { + description + "Top level grouping for p2p secondary paths"; + + container p2p-secondary-paths { + description + "Secondary paths for the LSP"; + + list p2p-secondary-path { + key "name"; + description + "List of p2p primary paths for a tunnel"; + + leaf name { + type leafref { + path "../config/name"; + // Requires YANG 1.1 + //require-instance true; + } + description + "Path name"; + } + + container config { + description + "Configuration parameters related to paths"; + uses p2p-path_config; + } + + container state { + config false; + description + "State parameters related to paths"; + uses p2p-path_config; + uses p2p-path_state; + } + + uses te-path-placement-constraints-top; + } + } + } + + grouping te-tunnels_top { + description + "Top level grouping for TE tunnels"; + + container tunnels { + description + "Enclosing container for tunnels"; + list tunnel { + key "name"; + description + "List of TE tunnels. This list contains only the LSPs that the + current device originates (i.e., for which it is the head-end). + Where the signaling protocol utilised for an LSP allows a mid-point + or tail device to be aware of the LSP (e.g., RSVP-TE), then the + associated sessions are maintained per protocol"; + + leaf name { + type leafref { + path "../config/name"; + // Requires YANG 1.1 + //require-instance true; + } + description + "The tunnel name"; + } + + container config { + description + "Configuration parameters related to TE tunnels:"; + uses te-global-tunnel_config; + } + + container state { + config false; + description + "State parameters related to TE tunnels"; + uses te-global-tunnel_config; + uses te-tunnel_state; + + } + + uses te-tunnel-bandwidth_top; + uses te-tunnel-p2p_top; + // TODO - add the p2mp configuration + } + } + } + +// data definition statements + +// augment statements + +// rpc statements + +// notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls-types.yang b/yang/openconfig-nis/openconfig-mpls-types.yang new file mode 100644 index 000000000..3ccd2dbd2 --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls-types.yang @@ -0,0 +1,395 @@ +module openconfig-mpls-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/mpls-types"; + + prefix "oc-mpls-types"; + + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "General types for MPLS / TE data model"; + + oc-ext:openconfig-version "2.4.0"; + + revision "2017-06-21" { + description + "Add TC bits typedef."; + reference "2.4.0"; + } + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + // identity statements + + identity PATH_COMPUTATION_METHOD { + description + "base identity for supported path computation + mechanisms"; + } + + identity LOCALLY_COMPUTED { + base PATH_COMPUTATION_METHOD; + description + "indicates a constrained-path LSP in which the + path is computed by the local LER"; + } + + identity EXTERNALLY_QUERIED { + base PATH_COMPUTATION_METHOD; + description + "Constrained-path LSP in which the path is + obtained by querying an external source, such as a PCE server. + In the case that an LSP is defined to be externally queried, it may + also have associated explicit definitions (which are provided to the + external source to aid computation); and the path that is returned by + the external source is not required to provide a wholly resolved + path back to the originating system - that is to say, some local + computation may also be required"; + } + + identity EXPLICITLY_DEFINED { + base PATH_COMPUTATION_METHOD; + description + "constrained-path LSP in which the path is + explicitly specified as a collection of strict or/and loose + hops"; + } + + + // using identities rather than enum types to simplify adding new + // signaling protocols as they are introduced and supported + identity PATH_SETUP_PROTOCOL { + description + "base identity for supported MPLS signaling + protocols"; + } + + identity PATH_SETUP_RSVP { + base PATH_SETUP_PROTOCOL; + description + "RSVP-TE signaling protocol"; + } + + identity PATH_SETUP_SR { + base PATH_SETUP_PROTOCOL; + description + "Segment routing"; + } + + identity PATH_SETUP_LDP { + base PATH_SETUP_PROTOCOL; + description + "LDP - RFC 5036"; + } + + + identity PROTECTION_TYPE { + description + "base identity for protection type"; + } + + identity UNPROTECTED { + base PROTECTION_TYPE; + description + "no protection is desired"; + } + + identity LINK_PROTECTION_REQUIRED { + base PROTECTION_TYPE; + description + "link protection is desired"; + } + + identity LINK_NODE_PROTECTION_REQUESTED { + base PROTECTION_TYPE; + description + "node and link protection are both desired"; + } + + identity LSP_ROLE { + description + "Base identity for describing the role of + label switched path at the current node"; + } + + identity INGRESS { + base LSP_ROLE; + description + "Label switched path is an ingress (headend) + LSP"; + } + + identity EGRESS { + base LSP_ROLE; + description + "Label switched path is an egress (tailend) + LSP"; + } + + identity TRANSIT { + base LSP_ROLE; + description + "Label switched path is a transit LSP"; + } + + + identity TUNNEL_TYPE { + description + "Base identity from which specific tunnel types are + derived."; + } + + identity P2P { + base TUNNEL_TYPE; + description + "TE point-to-point tunnel type."; + } + + identity P2MP { + base TUNNEL_TYPE; + description + "TE point-to-multipoint tunnel type."; + } + + + identity LSP_OPER_STATUS { + description + "Base identity for LSP operational status"; + } + + identity DOWN { + base LSP_OPER_STATUS; + description + "LSP is operationally down or out of service"; + } + + identity UP { + base LSP_OPER_STATUS; + description + "LSP is operationally active and available + for traffic."; + } + + identity TUNNEL_ADMIN_STATUS { + description + "Base identity for tunnel administrative status"; + } + + identity ADMIN_DOWN { + base TUNNEL_ADMIN_STATUS; + description + "LSP is administratively down"; + } + + identity ADMIN_UP { + base TUNNEL_ADMIN_STATUS; + description + "LSP is administratively up"; + } + + identity NULL_LABEL_TYPE { + description + "Base identity from which specific null-label types are + derived."; + } + + identity EXPLICIT { + base NULL_LABEL_TYPE; + description + "Explicit null label is used."; + } + + identity IMPLICIT { + base NULL_LABEL_TYPE; + description + "Implicit null label is used."; + } + + identity LSP_METRIC_TYPE { + description + "Base identity for types of LSP metric specification"; + } + + identity LSP_METRIC_RELATIVE { + base LSP_METRIC_TYPE; + description + "The metric specified for the LSPs to which this identity refers + is specified as a relative value to the IGP metric cost to the + LSP's tail-end."; + } + + identity LSP_METRIC_ABSOLUTE { + base LSP_METRIC_TYPE; + description + "The metric specified for the LSPs to which this identity refers + is specified as an absolute value"; + } + + identity LSP_METRIC_INHERITED { + base LSP_METRIC_TYPE; + description + "The metric for for the LSPs to which this identity refers is + not specified explicitly - but rather inherited from the IGP + cost directly"; + } + + // typedef statements + typedef mpls-label { + type union { + type uint32 { + range 16..1048575; + } + type enumeration { + enum IPV4_EXPLICIT_NULL { + value 0; + description + "valid at the bottom of the label stack, + indicates that stack must be popped and packet forwarded + based on IPv4 header"; + } + enum ROUTER_ALERT { + value 1; + description + "allowed anywhere in the label stack except + the bottom, local router delivers packet to the local CPU + when this label is at the top of the stack"; + } + enum IPV6_EXPLICIT_NULL { + value 2; + description + "valid at the bottom of the label stack, + indicates that stack must be popped and packet forwarded + based on IPv6 header"; + } + enum IMPLICIT_NULL { + value 3; + description + "assigned by local LSR but not carried in + packets"; + } + enum ENTROPY_LABEL_INDICATOR { + value 7; + description + "Entropy label indicator, to allow an LSR + to distinguish between entropy label and applicaiton + labels RFC 6790"; + } + enum NO_LABEL { + description + "This value is utilised to indicate that the packet that + is forwarded by the local system does not have an MPLS + header applied to it. Typically, this is used at the + egress of an LSP"; + } + } + } + description + "type for MPLS label value encoding"; + reference "RFC 3032 - MPLS Label Stack Encoding"; + } + + typedef tunnel-type { + type enumeration { + enum P2P { + description + "point-to-point label-switched-path"; + } + enum P2MP { + description + "point-to-multipoint label-switched-path"; + } + enum MP2MP { + description + "multipoint-to-multipoint label-switched-path"; + } + } + description + "defines the tunnel type for the LSP"; + reference + "RFC 6388 - Label Distribution Protocol Extensions for + Point-to-Multipoint and Multipoint-to-Multipoint Label Switched + Paths + RFC 4875 - Extensions to Resource Reservation Protocol + - Traffic Engineering (RSVP-TE) for Point-to-Multipoint TE + Label Switched Paths (LSPs)"; + } + + typedef bandwidth-kbps { + type uint64; + units "Kbps"; + description + "Bandwidth values expressed in kilobits per second"; + } + + typedef bandwidth-mbps { + type uint64; + units "Mbps"; + description + "Bandwidth values expressed in megabits per second"; + } + + typedef bandwidth-gbps { + type uint64; + units "Gbps"; + description + "Bandwidth values expressed in gigabits per second"; + } + + typedef mpls-tc { + type uint8 { + range "0..7"; + } + description + "Values of the MPLS Traffic Class (formerly known as + Experimental, EXP) bits"; + } + + // grouping statements + + // data definition statements + + // augment statements + + // rpc statements + + // notification statements + +} diff --git a/yang/openconfig-nis/openconfig-mpls.yang b/yang/openconfig-nis/openconfig-mpls.yang new file mode 100644 index 000000000..8a0086169 --- /dev/null +++ b/yang/openconfig-nis/openconfig-mpls.yang @@ -0,0 +1,697 @@ +module openconfig-mpls { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/mpls"; + + prefix "oc-mpls"; + + + // import some basic types + import openconfig-mpls-types { prefix oc-mplst; } + import openconfig-mpls-rsvp { prefix oc-rsvp; } + import openconfig-mpls-ldp { prefix oc-ldp; } + import openconfig-types { prefix oc-types; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-extensions { prefix oc-ext; } + import openconfig-segment-routing { prefix oc-sr; } + + // include submodules + include openconfig-mpls-te; + include openconfig-mpls-igp; + include openconfig-mpls-static; + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module provides data definitions for configuration of + Multiprotocol Label Switching (MPLS) and associated protocols for + signaling and traffic engineering. + + RFC 3031: Multiprotocol Label Switching Architecture + + The MPLS / TE data model consists of several modules and + submodules as shown below. The top-level MPLS module describes + the overall framework. Three types of LSPs are supported: + + i) traffic-engineered (or constrained-path) + + ii) IGP-congruent (LSPs that follow the IGP path) + + iii) static LSPs which are not signaled + + The structure of each of these LSP configurations is defined in + corresponding submodules. Companion modules define the relevant + configuration and operational data specific to key signaling + protocols used in operational practice. + + + +-------+ + +---------------->| MPLS |<--------------+ + | +-------+ | + | ^ | + | | | + +----+-----+ +--------+-------+ +-----+-----+ + | TE LSPs | | IGP-based LSPs | |static LSPs| + | | | | | | + +----------+ +----------------+ +-----------+ + ^ ^ ^ ^ + | +----------------+ | +--------+ + | | | | + | +------+ +-+---+-+ +--+--+ + +---+ RSVP | |SEGMENT| | LDP | + +------+ |ROUTING| +-----+ + +-------+ + "; + + oc-ext:openconfig-version "2.3.0"; + + revision "2017-03-22" { + description + "Add RSVP calculated-absolute-subscription-bw"; + reference "2.3.0"; + } + + revision "2017-01-26" { + description + "Add RSVP Tspec, clarify units for RSVP, remove unused LDP"; + reference "2.2.0"; + } + + revision "2016-12-15" { + description + "Add additional MPLS parameters"; + reference "2.1.0"; + } + + revision "2016-09-01" { + description + "Revisions based on implementation feedback"; + reference "2.0.0"; + } + + revision "2016-08-08" { + description + "Public release of MPLS models"; + reference "1.0.1"; + } + + + // grouping statements + + grouping mpls-admin-group_config { + description + "configuration data for MPLS link admin groups"; + + leaf admin-group-name { + type string; + description + "name for mpls admin-group"; + } + + leaf bit-position { + type uint32; + description + "bit-position value for mpls admin-group. The value + for the admin group is an integer that represents one + of the bit positions in the admin-group bitmask. Values + between 0 and 31 are interpreted as the original limit + of 32 admin groups. Values >=32 are interpreted as + extended admin group values as per RFC7308."; + } + + } + + grouping mpls-admin-groups-top { + + description + "top-level mpls admin-groups config + and state containers"; + + container mpls-admin-groups { + description + "Top-level container for admin-groups configuration + and state"; + + list admin-group { + key "admin-group-name"; + description + "configuration of value to name mapping + for mpls affinities/admin-groups"; + + leaf admin-group-name { + type leafref { + path "../config/admin-group-name"; + } + description + "name for mpls admin-group"; + } + container config { + description + "Configurable items for admin-groups"; + uses mpls-admin-group_config; + } + + container state { + config false; + description + "Operational state for admin-groups"; + uses mpls-admin-group_config; + } + } + } + } + + grouping mpls-te-igp-flooding-bandwidth_config { + description + "Configurable items for igp flooding bandwidth + threshold configuration."; + leaf threshold-type { + type enumeration { + enum DELTA { + description + "DELTA indicates that the local + system should flood IGP updates when a + change in reserved bandwidth >= the specified + delta occurs on the interface."; + } + enum THRESHOLD_CROSSED { + description + "THRESHOLD-CROSSED indicates that + the local system should trigger an update (and + hence flood) the reserved bandwidth when the + reserved bandwidth changes such that it crosses, + or becomes equal to one of the threshold values."; + } + } + description + "The type of threshold that should be used to specify the + values at which bandwidth is flooded. DELTA indicates that + the local system should flood IGP updates when a change in + reserved bandwidth >= the specified delta occurs on the + interface. Where THRESHOLD_CROSSED is specified, the local + system should trigger an update (and hence flood) the + reserved bandwidth when the reserved bandwidth changes such + that it crosses, or becomes equal to one of the threshold + values"; + } + + leaf delta-percentage { + when "../threshold-type = 'DELTA'" { + description + "The percentage delta can only be specified when the + threshold type is specified to be a percentage delta of + the reserved bandwidth"; + } + type oc-types:percentage; + description + "The percentage of the maximum-reservable-bandwidth + considered as the delta that results in an IGP update + being flooded"; + } + + leaf threshold-specification { + when "../threshold-type = 'THRESHOLD_CROSSED'" { + description + "The selection of whether mirrored or separate threshold + values are to be used requires user specified thresholds to + be set"; + } + type enumeration { + enum MIRRORED_UP_DOWN { + description + "MIRRORED_UP_DOWN indicates that a single set of + threshold values should be used for both increasing + and decreasing bandwidth when determining whether + to trigger updated bandwidth values to be flooded + in the IGP TE extensions."; + } + enum SEPARATE_UP_DOWN { + description + "SEPARATE_UP_DOWN indicates that a separate + threshold values should be used for the increasing + and decreasing bandwidth when determining whether + to trigger updated bandwidth values to be flooded + in the IGP TE extensions."; + } + } + description + "This value specifies whether a single set of threshold + values should be used for both increasing and decreasing + bandwidth when determining whether to trigger updated + bandwidth values to be flooded in the IGP TE extensions. + MIRRORED-UP-DOWN indicates that a single value (or set of + values) should be used for both increasing and decreasing + values, where SEPARATE-UP-DOWN specifies that the increasing + and decreasing values will be separately specified"; + } + + leaf-list up-thresholds { + when "../threshold-type = 'THRESHOLD_CROSSED'" + + "and ../threshold-specification = 'SEPARATE_UP_DOWN'" { + description + "A list of up-thresholds can only be specified when the + bandwidth update is triggered based on crossing a + threshold and separate up and down thresholds are + required"; + } + type oc-types:percentage; + description + "The thresholds (expressed as a percentage of the maximum + reservable bandwidth) at which bandwidth updates are to be + triggered when the bandwidth is increasing."; + } + + leaf-list down-thresholds { + when "../threshold-type = 'THRESHOLD_CROSSED'" + + "and ../threshold-specification = 'SEPARATE_UP_DOWN'" { + description + "A list of down-thresholds can only be specified when the + bandwidth update is triggered based on crossing a + threshold and separate up and down thresholds are + required"; + } + type oc-types:percentage; + description + "The thresholds (expressed as a percentage of the maximum + reservable bandwidth) at which bandwidth updates are to be + triggered when the bandwidth is decreasing."; + } + + leaf-list up-down-thresholds { + when "../threshold-type = 'THRESHOLD_CROSSED'" + + "and ../threshold-specification = 'MIRRORED_UP_DOWN'" { + description + "A list of thresholds corresponding to both increasing + and decreasing bandwidths can be specified only when an + update is triggered based on crossing a threshold, and + the same up and down thresholds are required."; + } + type oc-types:percentage; + description + "The thresholds (expressed as a percentage of the maximum + reservable bandwidth of the interface) at which bandwidth + updates are flooded - used both when the bandwidth is + increasing and decreasing"; + } + } + + + grouping mpls-te-igp-flooding-bandwidth { + description + "Top level group for traffic engineering + database flooding options"; + container igp-flooding-bandwidth { + description + "Interface bandwidth change percentages + that trigger update events into the IGP traffic + engineering database (TED)"; + container config { + description + "Configuration parameters for TED + update threshold "; + uses mpls-te-igp-flooding-bandwidth_config; + } + container state { + config false; + description + "State parameters for TED update threshold "; + uses mpls-te-igp-flooding-bandwidth_config; + } + } + } + + + grouping te-lsp-delay_config { + description + "Group for the timers goerning the delay + in installation and cleanup of TE LSPs"; + + leaf install-delay { + type uint16 { + range 0..3600; + } + units seconds; + description + "delay the use of newly installed te lsp for a + specified amount of time."; + } + + leaf cleanup-delay { + type uint16; + units seconds; + description + "delay the removal of old te lsp for a specified + amount of time"; + } + } + + grouping te-interface-attributes-top { + description + "Top level grouping for attributes + for TE interfaces."; + + list interface { + key "interface-id"; + description + "List of TE interfaces"; + + leaf interface-id { + type leafref { + path "../config/interface-id"; + } + description + "Reference to the interface id list key"; + } + + container config { + description + "Configuration parameters related to TE interfaces:"; + uses te-interface-attributes_config; + } + + container state { + config false; + description + "State parameters related to TE interfaces"; + uses te-interface-attributes_config; + } + + uses oc-if:interface-ref; + + uses mpls-te-igp-flooding-bandwidth; + } + } + + grouping te-interface-attributes_config { + description + "global level definitions for interfaces + on which TE is run"; + + leaf interface-id { + type oc-if:interface-id; + description + "Id of the interface"; + } + + leaf te-metric { + type uint32; + description + "TE specific metric for the link"; + } + + leaf-list srlg-membership { + type leafref { + path "../../../../te-global-attributes/srlgs/srlg/name"; + } + description + "list of references to named shared risk link groups that the + interface belongs to."; + } + + leaf-list admin-group { + type string; + description + "list of admin groups (by name) on the interface"; + } + } + + grouping mpls-te-lsp-timers { + description + "Grouping for traffic engineering timers"; + container te-lsp-timers { + description + "Definition for delays associated with setup + and cleanup of TE LSPs"; + + container config { + description + "Configuration parameters related + to timers for TE LSPs"; + + uses te-lsp-delay_config; + uses te-tunnel-reoptimize_config; + } + + container state { + config false; + description + "State related to timers for TE LSPs"; + + uses te-lsp-delay_config; + uses te-tunnel-reoptimize_config; + } + } + } + + grouping mpls-global_config { + description + "Definition of global MPLS configuration parameters"; + + leaf null-label { + type identityref { + base oc-mplst:NULL_LABEL_TYPE; + } + default oc-mplst:IMPLICIT; + description + "The null-label type used, implicit or explicit"; + } + } + + grouping mpls-global-top { + description + "Top level grouping for global MPLS configuration "; + + container config { + description + "Top level global MPLS configuration"; + uses mpls-global_config; + } + + container state { + config false; + description + "Top level global MPLS state"; + uses mpls-global_config; + } + } + + grouping mpls-interfaces-top { + description + "Top level grouping for attributes + for MPLS-enabled interfaces."; + container interface-attributes { + description + "Parameters related to MPLS interfaces"; + list interface { + key "interface-id"; + description + "List of TE interfaces"; + + leaf interface-id { + type leafref { + path "../config/interface-id"; + } + description + "Reference to the interface id list key"; + } + + container config { + description + "Configuration parameters related to MPLS interfaces:"; + uses mpls-interface-attributes-config; + } + + container state { + config false; + description + "State parameters related to TE interfaces"; + uses mpls-interface-attributes-config; + } + + uses oc-if:interface-ref; + } + } + } + + grouping mpls-interface-attributes-config { + description + "global level definitions for interfaces + on which MPLS is run"; + + leaf interface-id { + type oc-if:interface-id; + description + "Indentifier for the MPLS interface"; + } + + leaf mpls-enabled { + type boolean; + default false; + description + "Enable MPLS forwarding on this interface"; + } + } + + grouping mpls-label-block-config { + description + "Configuration parameters relating to an MPLS label block."; + + leaf local-id { + type string; + description + "A local identifier for the global label block allocation."; + } + + leaf lower-bound { + type oc-mplst:mpls-label; + description + "Lower bound of the global label block. The block is defined to include + this label."; + } + + leaf upper-bound { + type oc-mplst:mpls-label; + description + "Upper bound for the global label block. The block is defined to include + this label."; + } + } + + grouping mpls-label-blocks-top { + description + "Top-level configuration and operational state parameters corresponding + to reserved label blocks."; + + container reserved-label-blocks { + description + "A range of labels starting with the start-label and up-to and including + the end label that should be allocated as reserved. These labels should + not be utilised by any dynamic label allocation on the local system unless + the allocating protocol is explicitly configured to specify that + allocation of labels should be out of the label block specified."; + + list reserved-label-block { + key "local-id"; + + description + "A range of labels starting with the start-label up to and including + the end label that should be allocated for use by a specific protocol."; + + leaf local-id { + type leafref { + path "../config/local-id"; + } + description + "A reference to a unique local identifier for this label block."; + } + + container config { + description + "Configuration parameters relating to the label block."; + + uses mpls-label-block-config; + } + + container state { + config false; + description + "State parameters relating to the label block."; + + uses mpls-label-block-config; + } + } + } + } + + grouping mpls-top { + description + "Top level grouping for MPLS configuration and state"; + + container mpls { + description + "Anchor point for mpls configuration and operational + data"; + + container global { + // entropy label support, label ranges will be added here. + description + "general mpls configuration applicable to any + type of LSP and signaling protocol - label ranges, + entropy label supportmay be added here"; + uses mpls-global-top; + uses mpls-interfaces-top; + uses mpls-label-blocks-top; + } + + container te-global-attributes { + description + "traffic-engineering global attributes"; + uses mpls-te-srlg-top; + uses mpls-admin-groups-top; + uses mpls-te-lsp-timers; + } + + container te-interface-attributes { + description + "traffic engineering attributes specific + for interfaces"; + uses te-interface-attributes-top; + } + + container signaling-protocols { + description + "top-level signaling protocol configuration"; + + uses oc-rsvp:rsvp-global; + uses oc-ldp:ldp-global; + uses oc-sr:sr-mpls-top; + } + + container lsps { + description + "LSP definitions and configuration"; + + container constrained-path { + description + "traffic-engineered LSPs supporting different + path computation and signaling methods"; + uses explicit-paths_top; + uses te-tunnels_top; + } + + container unconstrained-path { + description + "LSPs that use the IGP-determined path, i.e., non + traffic-engineered, or non constrained-path"; + + uses igp-lsp-common; + uses igp-lsp-setup; + } + + container static-lsps { + description + "statically configured LSPs, without dynamic + signaling"; + + uses static-lsp-top; + } + } + } + } + + uses mpls-top; + + // augment statements + + // rpc statements + + // notification statements +} diff --git a/yang/openconfig-nis/openconfig-network-instance-l2@2017-01-13.yang b/yang/openconfig-nis/openconfig-network-instance-l2@2017-01-13.yang new file mode 100644 index 000000000..23b0691b8 --- /dev/null +++ b/yang/openconfig-nis/openconfig-network-instance-l2@2017-01-13.yang @@ -0,0 +1,284 @@ +submodule openconfig-network-instance-l2 { + + belongs-to openconfig-network-instance { + prefix "oc-netinst"; + } + + + // import some basic types + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-interfaces { prefix "oc-if"; } + import ietf-yang-types { prefix "yang"; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains groupings which specifically relate to + Layer 2 network instance configuration and operational state + parameters."; + + oc-ext:openconfig-version "0.6.0"; + + revision "2017-01-13" { + description + "Add AFT to the network instance"; + reference "0.6.0"; + } + + revision "2016-12-15" { + description + "Add segment routing to network instance"; + reference "0.5.0"; + } + + revision "2016-11-10" { + description + "Update model to include IS-IS."; + reference "0.4.1"; + } + + revision "2016-10-12" { + description + "Update table connections"; + reference "0.4.0"; + } + + revision "2016-09-28" { + description + "Change L2 instance to submodule; add MAC table"; + reference "0.3.0"; + } + + revision "2016-08-11" { + description + "Resolve repeated container names in routing protocols"; + reference "0.2.3"; + } + + revision "2016-07-08" { + description + "Updated with refactored routing protocol models"; + reference "0.2.1"; + } + + revision "2016-03-29" { + description + "Initial revision"; + reference "0.2.0"; + } + + revision "2015-11-20" { + description + "Initial revision"; + reference "0.1.0"; + } + + grouping l2ni-instance { + description + "Configuration and operational state parameters relating + to a Layer 2 network instance"; + + container fdb { + description + "Operational state and configuration parameters relating to + the forwarding database of the network instance"; + + container config { + description + "Configuration parameters relating to the FDB"; + uses l2ni-fdb-mac-config; + } + container state { + config false; + description + "Operational state parameters relating to the FDB"; + uses l2ni-fdb-mac-config; + } + + uses l2ni-mac-table-top; + } + } + + grouping l2ni-instance-common-config { + description + "Common configuration options which are specific to Layer 2 + network instances"; + + leaf mtu { + type uint16; + description + "The maximum frame size which should be supported for this + instance for Layer 2 frames"; + } + + } + + grouping l2ni-fdb-mac-config { + description + "Parameters relating to FDB behaviour relating to MAC + addresses"; + + leaf mac-learning { + type boolean; + description + "When this leaf is set to true, MAC learning is enabled for + the network instance, such that MAC addresses are learned + from ingress frames and added to the FDB."; + } + + leaf mac-aging-time { + // Cisco supports one aging time for local and remote, but + // can specify this time is absolute or against inactivity. + // ALU SROS supports different aging times for local and remote + // but does not allow absolute/inactivity specification. + // JNPR supports only a single aging time, and no specification + // of whether inactivity/absolute is used. + // It is easy to augment new options in here for local remote + // and an extra leaf to allow specification of the type of aging + // so this is left as a single value. + type uint16; + units seconds; + description + "The number of seconds of inactivity after which the entry + in the local FDB is timed out."; + } + + leaf maximum-entries { + type uint16; + description + "The maximum number of MAC address entries that should be + accepted into the FDB"; + } + } + + grouping l2ni-encapsulation-config { + description + "Encapsulation related configuration parameters for a L2 + network instance"; + + leaf control-word { + type boolean; + description + "Whether the control-word should be used for the network + instance"; + reference "RFC3985"; + } + } + + grouping l2ni-mac-table-config { + description + "Configuration data for MAC table entries"; + + leaf mac-address { + type yang:mac-address; + description + "MAC address for the dynamic or static MAC table + entry"; + } + + leaf vlan { + //TODO(aashaikh): Consider whether this should just reflect the + //VLAN id or be a union type to also support displaying/setting + //the VLAN by name (i.e., global VLAN configured in the VLAN + // model). + type leafref { + path "../../../../../../vlans/vlan/config/vlan-id"; + } + description + "VLAN from which this MAC address was received"; + } + } + + grouping l2ni-mac-table-state { + description + "Operational state data for MAC table entries"; + + leaf age { + type uint64; + units seconds; + description + "The time in seconds since the MAC address has been in the + table"; + } + + leaf entry-type { + type enumeration { + enum STATIC { + description + "Statically programmed MAC table entry"; + } + enum DYNAMIC { + description + "Dynamically learned MAC table entry"; + } + } + description + "Indicates whether the entry was statically configured, or + dynamically learned."; + } + + } + + grouping l2ni-mac-table-top { + description + "Top-level grouping for MAC table list"; + + + container mac-table { + description + "Table of learned or statically configured MAC addresses and + corresponding VLANs in the bridge domain"; + + container entries { + description + "Enclosing container for list of MAC table entries"; + + list entry { + key "mac-address"; + description + "List of learned MAC addresses"; + + leaf mac-address { + type leafref { + path "../config/mac-address"; + } + description + "Reference to mac-address list key"; + } + + container config { + description + "Configuration data for MAC table entries"; + + uses l2ni-mac-table-config; + } + + container state { + + config false; + + description + "Operational state data for MAC table entries"; + + uses l2ni-mac-table-config; + uses l2ni-mac-table-state; + } + + container interface { + description + "Reference to the base and/or subinterface for the + MAC table entry"; + + uses oc-if:interface-ref; + } + } + } + } + } +} + diff --git a/yang/openconfig-nis/openconfig-network-instance-l3.yang b/yang/openconfig-nis/openconfig-network-instance-l3.yang new file mode 100644 index 000000000..72f901407 --- /dev/null +++ b/yang/openconfig-nis/openconfig-network-instance-l3.yang @@ -0,0 +1,101 @@ +module openconfig-network-instance-l3 { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/network-instance-l3"; + + prefix "oc-ni-l3"; + + // import some basic types + //import ietf-inet-types { prefix inet; } + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-types { prefix "octypes"; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module contains groupings which specifically relate to + Layer 2 network instance configuration and operational state + parameters."; + + oc-ext:openconfig-version "0.6.0"; + + revision "2017-01-13" { + description + "Add AFT to the network instance"; + reference "0.6.0"; + } + + revision "2016-12-15" { + description + "Add segment routing to network instance"; + reference "0.5.0"; + } + + revision "2016-11-10" { + description + "Update model to include IS-IS."; + reference "0.4.1"; + } + + revision "2016-09-28" { + description + "Change L2 instance to submodule; add MAC table"; + reference "0.3.0"; + } + + revision "2016-08-11" { + description + "Resolve repeated container names in routing protocols"; + reference "0.2.3"; + } + + revision "2016-07-08" { + description + "Updated with refactored routing protocol models"; + reference "0.2.1"; + } + + revision "2016-03-29" { + description + "Initial revision"; + reference "0.2.0"; + } + + revision "2016-03-14" { + description + "Initial revision"; + reference "0.1.0"; + } + + grouping l3ni-instance { + description + "Configuration and operational state parameters relevant + to network instances that include a Layer 3 type"; + + } + + grouping l3ni-instance-common-config { + description + "Configuration parameters that are common to L3 network + instances other than the default instance"; + + leaf-list enabled-address-families { + type identityref { + base octypes:ADDRESS_FAMILY; + } + description + "The address families that are to be enabled for this + network instance."; + } + } + + +} + diff --git a/yang/openconfig-nis/openconfig-network-instance-types.yang b/yang/openconfig-nis/openconfig-network-instance-types.yang new file mode 100644 index 000000000..75006d89d --- /dev/null +++ b/yang/openconfig-nis/openconfig-network-instance-types.yang @@ -0,0 +1,238 @@ +module openconfig-network-instance-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/network-instance-types"; + + prefix "oc-ni-types"; + + import openconfig-extensions { prefix "oc-ext"; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "Types associated with a network instance"; + + oc-ext:openconfig-version "0.5.0"; + + revision "2016-12-15" { + description + "Add segment routing to network instance"; + reference "0.5.0"; + } + + revision "2016-11-10" { + description + "Update model to include IS-IS."; + reference "0.4.1"; + } + + revision "2016-10-12" { + description + "Update table connections"; + reference "0.4.0"; + } + + revision "2016-09-28" { + description + "Change L2 instance to submodule; add MAC table"; + reference "0.3.0"; + } + + revision "2016-08-11" { + description + "Resolve repeated container names in routing protocols"; + reference "0.2.3"; + } + + revision "2016-07-08" { + description + "Updated with refactored routing protocol models"; + reference "0.2.1"; + } + + revision "2016-03-29" { + description + "Initial revision"; + reference "0.2.0"; + } + + revision "2015-10-18" { + description + "Initial revision"; + reference "0.1.0"; + } + + // identity statements + identity NETWORK_INSTANCE_TYPE { + description + "A base identity which can be extended to indicate different + types of network instance supported by a device."; + } + + identity DEFAULT_INSTANCE { + base NETWORK_INSTANCE_TYPE; + description + "A special routing instance which acts as the 'default' or + 'global' routing instance for a network device."; + } + + identity L3VRF { + base NETWORK_INSTANCE_TYPE; + description + "A private Layer 3 only routing instance which is formed of + one or more RIBs"; + } + + identity L2VSI { + base NETWORK_INSTANCE_TYPE; + description + "A private Layer 2 only switch instance which is formed of + one or more L2 forwarding tables"; + } + + identity L2P2P { + base NETWORK_INSTANCE_TYPE; + description + "A private Layer 2 only forwarding instance which acts as + a point to point connection between two endpoints"; + } + + identity L2L3 { + base NETWORK_INSTANCE_TYPE; + description + "A private Layer 2 and Layer 2 forwarding instance"; + } + + identity ENDPOINT_TYPE { + description + "Specification of the type of endpoint that is being associated + with a network instance"; + } + + identity LOCAL { + base ENDPOINT_TYPE; + description + "A local interface which is being associated with the endpoint"; + } + + identity REMOTE { + base ENDPOINT_TYPE; + description + "A remote interface which is being associated with the + endpoint"; + } + + identity LABEL_ALLOCATION_MODE { + description + "Base identity to be used to express types of label allocation + strategies to be used within a network instance"; + } + + identity PER_PREFIX { + base LABEL_ALLOCATION_MODE; + description + "A label is to be allocated per prefix entry in the RIB for the + network instance"; + } + + identity PER_NEXTHOP { + base LABEL_ALLOCATION_MODE; + description + "A label is to be allocated per nexthop entry in the RIB for + the network instance"; + } + + identity INSTANCE_LABEL { + base LABEL_ALLOCATION_MODE; + description + "A single label is to be used for the instance"; + } + + identity ENCAPSULATION { + description + "On the wire encapsulations that can be used when + differentiating network instances"; + } + + identity MPLS { + base ENCAPSULATION; + description + "Use MPLS labels to distinguish network instances on the wire"; + } + + identity VXLAN { + base ENCAPSULATION; + description + "Use VXLAN (RFC7348) VNIs to distinguish network instances on + the wire"; + } + + identity SIGNALLING_PROTOCOL { + description + "The signalling protocol that should be used to diseminate + entries within a forwarding instance"; + } + + identity LDP { + base SIGNALLING_PROTOCOL; + description + "Use LDP-based setup for signalling. Where the instance is + a point-to-point service this refers to RFC4447 ('Martini') + setup. Where the service is an L2VSI, or L2L3 instance it + refers to RFC4762 LDP-signalled VPLS instances"; + } + + identity BGP_VPLS { + base SIGNALLING_PROTOCOL; + description + "Use BGP-based signalling and autodiscovery for VPLS instances + as per RFC4761"; + } + + identity BGP_EVPN { + base SIGNALLING_PROTOCOL; + description + "Use BGP-based Ethernet VPN (RFC7432) based signalling for + the network instance"; + } + + // rjs note: + // this should move to openconfig-types when merged + typedef route-distinguisher { + type union { + // type 0: <2-byte administrator>:<4-byte assigned number> + type string { + pattern '(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|' + + '[1-9]?[1-9]?[0-9][0-9]|[1-9]):' + + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|' + + '[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9])'; + } + // type 1: :<2-byte assigned number> + type string { + pattern + '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' + + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]):' + + '(65[0-5][0-3][0-5]|[1-5][1-5][0-9][0-9][0-9]|' + + '[1-9]?[1-9]?[0-9][0-9]|[1-9])'; + } + // type 2: <4-byte as-number>:<2-byte assigned number> + type string { + pattern + '(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-5]|' + + '[0-3][0-9]{9}|[1-9][0-9]{1,8}|[1-9]):' + + '(65[0-5][0-3][0-5]|[1-5]{2}[0-9]{3}|' + + '[1-9]{0,2}[0-9][0-9]|[1-9])'; + } + } + description "A route distinguisher value"; + reference "RFC4364"; + } +} + diff --git a/yang/openconfig-nis/openconfig-network-instance.yang b/yang/openconfig-nis/openconfig-network-instance.yang new file mode 100644 index 000000000..56398525e --- /dev/null +++ b/yang/openconfig-nis/openconfig-network-instance.yang @@ -0,0 +1,1002 @@ +module openconfig-network-instance { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/network-instance"; + + prefix "oc-netinst"; + + // import some basic types + //import ietf-inet-types { prefix inet; } + import ietf-yang-types { prefix "yang"; } + import ietf-inet-types { prefix "inet"; } + import openconfig-network-instance-types { prefix "oc-ni-types"; } + import openconfig-policy-types { prefix "oc-pol-types"; } + import openconfig-routing-policy { prefix "oc-rpol"; } + import openconfig-local-routing { prefix "oc-loc-rt"; } + import openconfig-interfaces { prefix "oc-if"; } + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-network-instance-l3 { prefix "oc-ni-l3"; } + import openconfig-types { prefix "oc-types"; } + import openconfig-bgp { prefix "oc-bgp"; } + import openconfig-mpls { prefix "oc-mpls"; } + import openconfig-vlan { prefix "oc-vlan"; } + import openconfig-segment-routing { prefix "oc-sr"; } + import openconfig-isis { prefix "oc-isis"; } + import openconfig-aft { prefix "oc-aft"; } + + // include submodules + include openconfig-network-instance-l2; + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "An OpenConfig description of a network-instance. This may be + a Layer 3 forwarding construct such as a virtual routing and + forwarding (VRF) instance, or a Layer 2 instance such as a + virtual switch instance (VSI). Mixed Layer 2 and Layer 3 + instances are also supported."; + + oc-ext:openconfig-version "0.6.0"; + + revision "2017-01-13" { + description + "Add AFT to the network instance"; + reference "0.6.0"; + } + + revision "2016-12-15" { + description + "Add segment routing to network instance"; + reference "0.5.0"; + } + + revision "2016-11-10" { + description + "Add IS-IS to OpenConfig network instance"; + reference "0.4.1"; + } + + revision "2016-10-12" { + description + "Update table connections"; + reference "0.4.0"; + } + + revision "2016-09-28" { + description + "Change L2 instance to submodule; add MAC table"; + reference "0.3.0"; + } + + revision "2016-08-11" { + description + "Resolve repeated container names in routing protocols"; + reference "0.2.3"; + } + + revision "2016-07-08" { + description + "Updated with refactored routing protocol models"; + reference "0.2.1"; + } + + revision "2016-03-29" { + description + "Initial revision"; + reference "0.2.0"; + } + + revision "2015-10-18" { + description + "Initial revision"; + reference "0.1.0"; + } + + typedef network-instance-ref { + type leafref { + path "/network-instances/network-instance/config/name"; + } + description + "A re-usable type that can be referenced within other + modules that references a network instance."; + } + + grouping network-instance-top { + description + "Top-level grouping containing a list of network instances."; + + container network-instances { + description + "The L2, L3, or L2+L3 forwarding instances that are + configured on the local system"; + + list network-instance { + key "name"; + + description + "Network instances configured on the local system"; + + leaf name { + type leafref { + path "../config/name"; + } + description + "A unique name identifying the network instance"; + } + + uses l2ni-instance { + when "../type = 'L2VSI' or ../type = 'L2P2P'" + + " or ../type = 'L2L3' or ../type = 'DEFAULT_INSTANCE'" { + description + "Layer 2 configuration parameters included when + a network instance is a Layer 2 instance or a + combined L2L3 instance"; + } + } + + container config { + description + "Configuration parameters relating to a network + instance"; + uses network-instance-config; + uses network-instance-type-dependent-config; + } + + + container state { + config false; + description + "Operational state parameters relating to a network + instance"; + uses network-instance-config; + uses network-instance-type-dependent-config; + uses network-instance-state; + } + + container encapsulation { + when "../config/type != 'DEFAULT_INSTANCE'" { + description + "Only allow the encapsulation of the instance to be + set when the instance is not the default instance"; + } + description + "Configuration parameters relating to the encapsulation + used for the network instance"; + + container config { + description + "Configuration parameters relating to the encapsulation + of the network instance"; + + uses encapsulation-config; + + uses l2ni-encapsulation-config { + when "../../../type = 'L2VSI' or ../../../type = 'L2P2P' + or ../../../type = 'L2L3'" { + description + "Only allow L2 encapsulations to be set + when the instance is of a type that supports + L2"; + } + } + } + + container state { + config false; + description + "State parameters relating to the encapsulation of + the network instance"; + uses encapsulation-config; + + uses l2ni-encapsulation-config { + when "../../../type = 'L2VSI' or ../../../type = 'L2P2P' + or ../../../type = 'L2L3'" { + description + "Only allow L2 encapsulations to be set + when the instance is of a type that supports + L2"; + } + } + } + } + + container inter-instance-policies { + description + "Policies dictating how RIB or FIB entries are imported + to and exported from this instance"; + + uses oc-rpol:apply-policy-group; + } + + container table-connections { + description + "Policies dictating how RIB or FIB entries are propagated + between tables"; + + list table-connection { + key "src-protocol dst-protocol address-family"; + + description + "A list of connections between pairs of routing or + forwarding tables, the leaking of entries between + which is specified by the import policy. + + A connection connecting a source table to a destination + table implies that routes that match the policy specified + for the connection are available for the destination + protocol to advertise, or match within its policies."; + + leaf src-protocol { + type leafref { + path "../config/src-protocol"; + } + description + "The name of the protocol associated with the table + which should be utilised as the source of forwarding + or routing information"; + } + + leaf dst-protocol { + type leafref { + path "../config/dst-protocol"; + } + description + "The table to which routing entries should be + exported"; + } + + leaf address-family { + type leafref { + path "../config/address-family"; + } + description + "The address family associated with the connection"; + } + + container config { + description + "Configuration parameters relating to the connection + between tables"; + uses inter-table-policies-config; + } + container state { + config false; + description + "State parameters relating to the connection between + tables"; + uses inter-table-policies-config; + } + } + } + + container interfaces { + description + "The interfaces that are associated with this network + instance"; + + list interface { + key "id"; + unique "config/interface config/subinterface"; + + description + "An interface associated with the network instance"; + + leaf id { + type leafref { + path "../config/id"; + } + description + "A reference to an identifier for this interface which + acts as a key for this list"; + } + + container config { + description + "Configuration parameters relating to the associated + interface"; + uses instance-interfaces-config; + } + + container state { + config false; + description + "Operational state parameters relating to the + associated interface"; + + uses instance-interfaces-config; + uses instance-interfaces-state; + } + } + } + + container tables { + description + "The routing tables that are managed by this network + instance"; + + list table { + key "protocol address-family"; + + description + "A network instance manages one or more forwarding or + routing tables. These may reflect a Layer 2 forwarding + information base, a Layer 3 routing table, or an MPLS + LFIB. + + The table populated by a protocol within an instance is + identified by the protocol identifier (e.g., BGP, IS-IS) + and the address family (e.g., IPv4, IPv6) supported by + that protocol. Multiple instances of the same protocol + populate a single table -- such that + a single IS-IS or OSPF IPv4 table exists per network + instance. + + An implementation is expected to create entries within + this list when the relevant protocol context is enabled. + i.e., when a BGP instance is created with IPv4 and IPv6 + address families enabled, the protocol=BGP, + address-family=IPv4 table is created by the system."; + + leaf protocol { + type leafref { + path "../config/protocol"; + } + description + "A reference to the protocol that populates + the table"; + } + + leaf address-family { + type leafref { + path "../config/address-family"; + } + description + "A reference to the address-family that the + table represents"; + } + + container config { + description + "Configuration parameters relating to the + table"; + uses table-config; + } + + container state { + config false; + description + "State parameters related to the table"; + uses table-config; + } + } + } + + container connection-points { + description + "The set of connection points within a forwarding + instance"; + + list connection-point { + key "connection-point-id"; + + description + "A connection point within a Layer 2 network instance. + Each connection-point consists of a set of interfaces + only one of which is active at any one time. Other than + the specification of whether an interface is local + (i.e., exists within this network-instance), or remote, + all configuration and state parameters are common"; + + leaf connection-point-id { + type leafref { + path "../config/connection-point-id"; + } + description + "A locally significant reference for the + connection-point"; + } + + container config { + description + "Configuration parameters relating to a Layer 2 + network instance connection point"; + uses instance-connection-point-config; + } + container state { + config false; + description + "Operational state parameters relating to a Layer 2 + network instance connection point"; + + uses instance-connection-point-config; + uses instance-connection-point-state; + } + + container endpoints { + when "../config/type = 'L2P2P' " + + "or ../config/type = 'L2VSI'" { + description + "Configuration parameters to associate interfaces + into a common group for use in Layer 2 network + instances"; + } + + description + "The set of endpoints which are grouped within the + connection point"; + + list endpoint { + key "endpoint-id"; + + description + "A list of the endpoints (interfaces or remote + connection points that can be used for this + connection point). The active endpoint is selected + based on the precedence that it is configured + with"; + + leaf endpoint-id { + type leafref { + path "../config/endpoint-id"; + } + description + "A pointer to the configured identifier for the + endpoint"; + } + + container config { + description + "Configuration parameters relating to the + endpoint"; + uses instance-endpoint-config; + } + container state { + config false; + description + "Operational state parameters relating to the + endpoint"; + uses instance-endpoint-config; + uses instance-endpoint-state; + } + + container local { + when "../config/type = 'LOCAL'" { + description + "Only include the local configuration when + the endpoint is specified to be local to + the network element"; + } + + description + "Configuration and operational state parameters + relating to a local interface"; + + container config { + description + "Configuration parameters relating to a local + endpoint"; + uses instance-endpoint-local-config; + } + + container state { + config false; + description + "Operational state parameters relating to a + local endpoint"; + uses instance-endpoint-local-config; + } + } + + container remote { + when "../config/type = 'REMOTE'" { + description + "Only include the remote configuration when + the endpoint is specified to be remote to + the network element"; + } + + description + "Configuration and operational state parameters + relating to a remote interface"; + + container config { + description + "Configuration parameters relating to a remote + endpoint"; + uses instance-endpoint-remote-config; + } + + container state { + config false; + description + "Operational state parameters relating to + a remote endpoint"; + uses instance-endpoint-remote-config; + } + } + } + } + } + } + + uses oc-mpls:mpls-top { + when "../config/type = 'DEFAULT'" { + description + "MPLS configuration is only valid within the default + network instance."; + } + } + + uses oc-sr:sr-top { + when "../config/type = 'DEFAULT'" { + description + "Segment routing configuration is only valid with the default + network instance."; + } + } + + uses oc-vlan:vlan-top; + + uses oc-aft:aft-top; + + container protocols { + description + "The routing protocols that are enabled for this + network-instance."; + + list protocol { + key "identifier name"; + + description + "A process (instance) of a routing protocol. Some + systems may not support more than one instance of + a particular routing protocol"; + + leaf identifier { + type leafref { + path "../config/identifier"; + } + description + "The protocol name for the routing or forwarding + protocol to be instantiated"; + } + + leaf name { + type leafref { + path "../config/name"; + } + description + "An operator-assigned identifier for the routing + or forwarding protocol. For some processes this + leaf may be system defined."; + } + + container config { + description + "Configuration parameters relating to the routing + protocol instance"; + + uses protocols-config; + } + + container state { + config false; + description + "State parameters relating to the routing protocol + instance"; + + uses protocols-config; + uses protocols-state; + } + + uses oc-loc-rt:local-static-top { + when "../config/identifier = 'STATIC'" { + description + "Include static route parameters only when the + protocol is set to static"; + } + description + "Configuration and state parameters relating to + static routes"; + } + + uses oc-loc-rt:local-aggregate-top { + when "../config/identifier = 'LOCAL_AGGREGATE'" { + description + "Include aggregate route parameters only when the + protocol is set to aggregate"; + } + description + "Configuration and state parameters relating to + locally generated aggregate routes"; + } + + uses oc-bgp:bgp-top { + when "../config/identifier = 'BGP'" { + description + "Include BGP parameters only when the protocol + is of type BGP"; + } + description + "Configuration and state parameters relating to + Border Gateway Protocol (BGP)"; + } + + uses oc-isis:isis-top { + when "../config/identifier = 'ISIS'" { + description + "Include IS-IS configuration when the protocol is of type + IS-IS"; + } + description + "Configuration and state parameters relating to Intermediate + System to Intermediate System (IS-IS)."; + } + } + } + } + } + } + + grouping network-instance-type-dependent-config { + description + "Type dependent network instance configuration"; + + uses oc-ni-l3:l3ni-instance-common-config { + when "../type = 'L3VRF' or ../type = 'L2L3'" { + description + "Layer 3 VRF configuration parameters included when a + network instance is a L3VRF or combined L2L3 instance"; + } + } + + uses l2ni-instance-common-config { + when "../type = 'L2VSI' or ../type = 'L2P2P'" + + " or ../type = 'L2L3'" { + description + "Layer 2 configuration parameters included when + a network instance is a Layer 2 instance or a + combined L2L3 instance"; + } + } + } + + grouping instance-endpoint-config { + description + "Configuration data relating to an forwarding-instance + endpoint"; + + leaf endpoint-id { + type string; + description + "An identifier for the endpoint"; + } + + leaf precedence { + type uint16; + description + "The precedence of the endpoint - the lowest precendence + viable endpoint will be utilised as the active endpoint + within a connection"; + } + + leaf type { + type identityref { + base "oc-ni-types:ENDPOINT_TYPE"; + } + description + "The type of endpoint that is referred to by the current + endpoint"; + } + + } + + grouping instance-endpoint-local-config { + description + "Configuration parameters relating to an endpoint that is local + to the current system"; + + uses oc-if:interface-ref-common; + } + + grouping instance-endpoint-remote-config { + description + "Configuration parameters relating to an endpoint that is + remote from the local system"; + leaf remote-system { + type inet:ip-address; + description + "The IP address of the device which hosts the + remote end-point"; + } + + leaf virtual-circuit-identifier { + type uint32; + description + "The virtual-circuit identifier that identifies the + connection at the remote end-point"; + } + } + + grouping instance-endpoint-state { + description + "Operational state data relating to a forwarding-instance + endpoint"; + leaf active { + type boolean; + description + "When the backup endpoint is active, the value of this + parameter is set to true"; + } + } + + grouping instance-connection-point-config { + description + "Configuration data relating to a forwarding-instance + connection point"; + + leaf connection-point-id { + type string; + description + "An identifier for a connection point"; + } + } + + grouping instance-connection-point-state { + description + "Operational state data relating to a forwarding-instance + connection point"; + } + + grouping table-config { + description + "Config parameters relating to an L2/L2.5/L3 table that exists + within a network instance"; + + leaf protocol { + type leafref { + path "../../../../protocols/protocol/config/identifier"; + } + description + "Reference to the protocol that the table is associated with."; + } + + leaf address-family { + type identityref { + base oc-types:ADDRESS_FAMILY; + } + description + "The address family (IPv4, IPv6) of the table's entries"; + } + } + + grouping instance-interfaces-config { + description + "Configuration parameters related to an interface associated + with the network instance"; + + leaf id { + type string; + description + "A unique identifier for this interface - this is expressed + as a free-text string"; + } + + uses oc-if:interface-ref-common; + + leaf-list associated-address-families { + type identityref { + base oc-types:ADDRESS_FAMILY; + } + description + "The address families on the subinterface which are to be + associated with this network instance. When this leaf-list + is empty and the network instance requires Layer 3 information + the address families for which the network instance is + enabled should be imported. If the value of this leaf-list + is specified then the association MUST only be made for + those address families that are included in the list."; + } + } + + grouping instance-interfaces-state { + description + "Operational state parameters relating to an interface + associated with this network instance"; + } + + grouping inter-table-policies-config { + description + "Configuration entries that relate to how RIB or FIB entries + are propagated between tables within the same network + instance"; + + leaf src-protocol { + type leafref { + // we are at table-connections/table-connection/config/. + path "../../../../tables/table/config/protocol"; + } + description + "The source protocol for the table connection"; + } + + leaf address-family { + type leafref { + // we are at table-connections/table-connection/config/. + path "../../../../tables/" + + "table[protocol=current()/../src-protocol]/" + + "config/address-family"; + } + description + "The address family associated with the connection. This + must be defined for the source protocol. The target + address family is implicitly defined by the address family + specified for the source protocol."; + } + + leaf dst-protocol { + type leafref { + path "../../../../tables/table/config/protocol"; + } + description + "The destination protocol for the table connection"; + } + + uses oc-rpol:apply-policy-import-config; + } + + grouping network-instance-config { + description + "Configuration parameters relating to a top-level network + instance"; + + leaf name { + type string; + description + "An operator-assigned unique name for the forwarding + instance"; + } + + leaf type { + type identityref { + base "oc-ni-types:NETWORK_INSTANCE_TYPE"; + } + description + "The type of network instance. The value of this leaf + indicates the type of forwarding entries that should be + supported by this network instance"; + } + + leaf enabled { + type boolean; + description + "Whether the network instance should be configured to be + active on the network element"; + } + + leaf description { + type string; + description + "A free-form string to be used by the network operator to + describe the function of this network instance"; + } + + leaf router-id { + type yang:dotted-quad; + description + "A identifier for the local network instance - typically + used within associated routing protocols or signalling + routing information in another network instance"; + } + + leaf route-distinguisher { + type oc-ni-types:route-distinguisher; + description + "The route distinguisher that should be used for the local + VRF or VSI instance when it is signalled via BGP."; + } + } + + grouping network-instance-state { + description + "Operational state parameters relating to a network instance"; + } + + grouping protocols-config { + description + "Configuration parameters relating to a generic protocol + instance within a network instance"; + + leaf identifier { + type identityref { + base "oc-pol-types:INSTALL_PROTOCOL_TYPE"; + } + description + "The protocol identifier for the instance"; + } + + leaf name { + type string; + description + "A unique name for the protocol instance"; + } + + leaf enabled { + type boolean; + description + "A boolean value indicating whether the local protocol + instance is enabled."; + } + + leaf default-metric { + type uint32; + description + "The default metric within the RIB for entries that are + installed by this protocol instance. This value may + be overridden by protocol specific configuration options. + The lower the metric specified the more preferable the RIB + entry is to be selected for use within the network instance. + Where multiple entries have the same metric value then these + equal cost paths should be treated according to the specified + ECMP path selection behaviour for the instance"; + } + } + + grouping protocols-state { + description + "Operational state parameters relating to a protocol instance"; + } + + grouping instance-interface-association-config { + description + "Grouping containing leaves that are to be augmented into an + interface or subinterface to include mapping to a network + instance"; + + leaf network-instance { + type leafref { + path "/network-instances/network-instance/name"; + } + description + "The network instance that this interface is associated + with"; + } + } + + grouping encapsulation-config { + description + "Type agnostic configuration parameters relating to the + encapsulation of the network instance"; + + leaf encapsulation-type { + type identityref { + base oc-ni-types:ENCAPSULATION; + } + description + "The on-the-wire encapsulation that should be used when + sending traffic from this network instance"; + } + + // rjs: This is left here as I suspect that this can + // be used in EVPN. Need to validate implementations, otherwise + // move to L3. (TODO) + leaf label-allocation-mode { + type identityref { + base oc-ni-types:LABEL_ALLOCATION_MODE; + } + description + "The label allocation mode to be used for L3 entries + in the network instance"; + } + } + + uses network-instance-top; +} + diff --git a/yang/openconfig-nis/openconfig-packet-match-types.yang b/yang/openconfig-nis/openconfig-packet-match-types.yang new file mode 100644 index 000000000..73217cba5 --- /dev/null +++ b/yang/openconfig-nis/openconfig-packet-match-types.yang @@ -0,0 +1,293 @@ +module openconfig-packet-match-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/packet-match-types"; + + prefix "oc-pkt-match-types"; + + // import some basic types + import openconfig-inet-types { prefix oc-inet; } + import openconfig-extensions { prefix oc-ext; } + + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + www.openconfig.net"; + + description + "This module defines common types for use in models requiring + data definitions related to packet matches."; + + oc-ext:openconfig-version "1.0.0"; + + revision "2017-05-26" { + description + "Separated IP matches into AFs"; + reference "1.0.0"; + } + + revision "2016-08-08" { + description + "OpenConfig public release"; + reference "0.2.0"; + } + + revision "2016-04-27" { + description + "Initial revision"; + reference "TBD"; + } + + // extension statements + + // feature statements + + // identity statements + + + //TODO: should replace this with an official IEEE module + // when available. Only a select number of types are + // defined in this identity. + identity ETHERTYPE { + description + "Base identity for commonly used Ethertype values used + in packet header matches on Ethernet frames. The Ethertype + indicates which protocol is encapsulated in the Ethernet + payload."; + reference + "IEEE 802.3"; + } + + identity ETHERTYPE_IPV4 { + base ETHERTYPE; + description + "IPv4 protocol (0x0800)"; + } + + identity ETHERTYPE_ARP { + base ETHERTYPE; + description + "Address resolution protocol (0x0806)"; + } + + identity ETHERTYPE_VLAN { + base ETHERTYPE; + description + "VLAN-tagged frame (as defined by IEEE 802.1q) (0x8100). Note + that this value is also used to represent Shortest Path + Bridging (IEEE 801.1aq) frames."; + } + + identity ETHERTYPE_IPV6 { + base ETHERTYPE; + description + "IPv6 protocol (0x86DD)"; + } + + identity ETHERTYPE_MPLS { + base ETHERTYPE; + description + "MPLS unicast (0x8847)"; + } + + identity ETHERTYPE_LLDP { + base ETHERTYPE; + description + "Link Layer Discovery Protocol (0x88CC)"; + } + + identity ETHERTYPE_ROCE { + base ETHERTYPE; + description + "RDMA over Converged Ethernet (0x8915)"; + } + + + //TODO: should replace this with an official IANA module when + //available. Only a select set of protocols are defined with + //this identity. + identity IP_PROTOCOL { + description + "Base identity for commonly used IP protocols used in + packet header matches"; + reference + "IANA Assigned Internet Protocol Numbers"; + } + + identity IP_TCP { + base IP_PROTOCOL; + description + "Transmission Control Protocol (6)"; + } + + identity IP_UDP { + base IP_PROTOCOL; + description + "User Datagram Protocol (17)"; + } + + identity IP_ICMP { + base IP_PROTOCOL; + description + "Internet Control Message Protocol (1)"; + } + + identity IP_IGMP { + base IP_PROTOCOL; + description + "Internet Group Membership Protocol (2)"; + } + + identity IP_PIM { + base IP_PROTOCOL; + description + "Protocol Independent Multicast (103)"; + } + + identity IP_RSVP { + base IP_PROTOCOL; + description + "Resource Reservation Protocol (46)"; + } + + identity IP_GRE { + base IP_PROTOCOL; + description + "Generic Routing Encapsulation (47)"; + } + + identity IP_AUTH { + base IP_PROTOCOL; + description + "Authentication header, e.g., for IPSEC (51)"; + } + + identity IP_L2TP { + base IP_PROTOCOL; + description + "Layer Two Tunneling Protocol v.3 (115)"; + } + + + + identity TCP_FLAGS { + description + "Common TCP flags used in packet header matches"; + reference + "IETF RFC 793 - Transmission Control Protocol + IETF RFC 3168 - The Addition of Explicit Congestion + Notification (ECN) to IP"; + } + + identity TCP_SYN { + base TCP_FLAGS; + description + "TCP SYN flag"; + } + + identity TCP_FIN { + base TCP_FLAGS; + description + "TCP FIN flag"; + } + + identity TCP_RST { + base TCP_FLAGS; + description + "TCP RST flag"; + } + + identity TCP_PSH { + base TCP_FLAGS; + description + "TCP push flag"; + } + + identity TCP_ACK { + base TCP_FLAGS; + description + "TCP ACK flag"; + } + + identity TCP_URG { + base TCP_FLAGS; + description + "TCP urgent flag"; + } + + identity TCP_ECE { + base TCP_FLAGS; + description + "TCP ECN-Echo flag. If the SYN flag is set, indicates that + the TCP peer is ECN-capable, otherwise indicates that a + packet with Congestion Experienced flag in the IP header + is set"; + } + + identity TCP_CWR { + base TCP_FLAGS; + description + "TCP Congestion Window Reduced flag"; + } + + // typedef statements + + typedef port-num-range { + type union { + type string { + pattern '(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?' + + '[0-9]?)\.\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?' + + '[0-9]?[0-9]?)'; + } + type oc-inet:port-number; + type enumeration { + enum ANY { + description + "Indicates any valid port number (e.g., wildcard)"; + } + } + } + description + "Port numbers may be represented as a single value, + an inclusive range as .., or as ANY to + indicate a wildcard."; + } + + typedef ip-protocol-type { + type union { + type uint8 { + range 0..254; + } + type identityref { + base IP_PROTOCOL; + } + } + description + "The IP protocol number may be expressed as a valid protocol + number (integer) or using a protocol type defined by the + IP_PROTOCOL identity"; + } + + typedef ethertype-type { + type union { + type uint16 { + //Note range can only be expressed in decimal + //but value is expected in hex notation. + range 1..65535; + } + type identityref { + base ETHERTYPE; + } + } + description + "The Ethertype value may be expressed as a 16-bit number in + hexadecimal notation, or using a type defined by the + ETHERTYPE identity"; + } + +} \ No newline at end of file diff --git a/yang/openconfig-nis/openconfig-policy-types.yang b/yang/openconfig-nis/openconfig-policy-types.yang new file mode 100644 index 000000000..8e1fe366f --- /dev/null +++ b/yang/openconfig-nis/openconfig-policy-types.yang @@ -0,0 +1,178 @@ +module openconfig-policy-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/policy-types"; + + prefix "oc-pol-types"; + + // import some basic types + import ietf-yang-types { prefix yang; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module contains general data definitions for use in routing + policy. It can be imported by modules that contain protocol- + specific policy conditions and actions."; + + oc-ext:openconfig-version "2.0.1"; + + revision "2016-05-12" { + description + "OpenConfig public release"; + reference "2.0.1"; + } + + // identity statements + + identity ATTRIBUTE_COMPARISON { + description + "base type for supported comparison operators on route + attributes"; + } + + identity ATTRIBUTE_EQ { + base ATTRIBUTE_COMPARISON; + description "== comparison"; + } + + identity ATTRIBUTE_GE { + base ATTRIBUTE_COMPARISON; + description ">= comparison"; + } + + identity ATTRIBUTE_LE { + base ATTRIBUTE_COMPARISON; + description "<= comparison"; + } + + typedef match-set-options-type { + type enumeration { + enum ANY { + description "match is true if given value matches any member + of the defined set"; + } + enum ALL { + description "match is true if given value matches all + members of the defined set"; + } + enum INVERT { + description "match is true if given value does not match any + member of the defined set"; + } + } + default ANY; + description + "Options that govern the behavior of a match statement. The + default behavior is ANY, i.e., the given value matches any + of the members of the defined set"; + } + + typedef match-set-options-restricted-type { + type enumeration { + enum ANY { + description "match is true if given value matches any member + of the defined set"; + } + enum INVERT { + description "match is true if given value does not match any + member of the defined set"; + } + } + default ANY; + description + "Options that govern the behavior of a match statement. The + default behavior is ANY, i.e., the given value matches any + of the members of the defined set. Note this type is a + restricted version of the match-set-options-type."; + //TODO: restriction on enumerated types is only allowed in + //YANG 1.1. Until then, we will require this additional type + } + + grouping attribute-compare-operators { + description "common definitions for comparison operations in + condition statements"; + + leaf operator { + type identityref { + base ATTRIBUTE_COMPARISON; + } + description + "type of comparison to be performed"; + } + + leaf value { + type uint32; + description + "value to compare with the community count"; + } + } + + typedef tag-type { + type union { + type uint32; + type yang:hex-string; + } + description "type for expressing route tags on a local system, + including IS-IS and OSPF; may be expressed as either decimal or + hexidecimal integer"; + reference + "RFC 2178 OSPF Version 2 + RFC 5130 A Policy Control Mechanism in IS-IS Using + Administrative Tags"; + } + + identity INSTALL_PROTOCOL_TYPE { + description + "Base type for protocols which can install prefixes into the + RIB"; + } + + identity BGP { + base INSTALL_PROTOCOL_TYPE; + description "BGP"; + reference "RFC 4271"; + } + + identity ISIS { + base INSTALL_PROTOCOL_TYPE; + description "IS-IS"; + reference "ISO/IEC 10589"; + } + + identity OSPF { + base INSTALL_PROTOCOL_TYPE; + description "OSPFv2"; + reference "RFC 2328"; + } + + identity OSPF3 { + base INSTALL_PROTOCOL_TYPE; + description "OSPFv3"; + reference "RFC 5340"; + } + + identity STATIC { + base INSTALL_PROTOCOL_TYPE; + description "Locally-installed static route"; + } + + identity DIRECTLY_CONNECTED { + base INSTALL_PROTOCOL_TYPE; + description "A directly connected route"; + } + + identity LOCAL_AGGREGATE { + base INSTALL_PROTOCOL_TYPE; + description "Locally defined aggregate route"; + } +} diff --git a/yang/openconfig-nis/openconfig-routing-policy.yang b/yang/openconfig-nis/openconfig-routing-policy.yang new file mode 100644 index 000000000..77c2a054e --- /dev/null +++ b/yang/openconfig-nis/openconfig-routing-policy.yang @@ -0,0 +1,1114 @@ +module openconfig-routing-policy { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/routing-policy"; + + prefix "oc-rpol"; + + // import some basic types + import ietf-inet-types { prefix inet; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-policy-types { prefix oc-pol-types; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module describes a YANG model for routing policy + configuration. It is a limited subset of all of the policy + configuration parameters available in the variety of vendor + implementations, but supports widely used constructs for managing + how routes are imported, exported, and modified across different + routing protocols. This module is intended to be used in + conjunction with routing protocol configuration models (e.g., + BGP) defined in other modules. + + Route policy expression: + + Policies are expressed as a set of top-level policy definitions, + each of which consists of a sequence of policy statements. Policy + statements consist of simple condition-action tuples. Conditions + may include mutiple match or comparison operations, and similarly + actions may be multitude of changes to route attributes or a + final disposition of accepting or rejecting the route. + + Route policy evaluation: + + Policy definitions are referenced in routing protocol + configurations using import and export configuration statements. + The arguments are members of an ordered list of named policy + definitions which comprise a policy chain, and optionally, an + explicit default policy action (i.e., reject or accept). + + Evaluation of each policy definition proceeds by evaluating its + corresponding individual policy statements in order. When a + condition statement in a policy statement is satisfied, the + corresponding action statement is executed. If the action + statement has either accept-route or reject-route actions, policy + evaluation of the current policy definition stops, and no further + policy definitions in the chain are evaluated. + + If the condition is not satisfied, then evaluation proceeds to + the next policy statement. If none of the policy statement + conditions are satisfied, then evaluation of the current policy + definition stops, and the next policy definition in the chain is + evaluated. When the end of the policy chain is reached, the + default route disposition action is performed (i.e., reject-route + unless an an alternate default action is specified for the + chain). + + Policy 'subroutines' (or nested policies) are supported by + allowing policy statement conditions to reference another policy + definition which applies conditions and actions from the + referenced policy before returning to the calling policy + statement and resuming evaluation. If the called policy + results in an accept-route (either explicit or by default), then + the subroutine returns an effective true value to the calling + policy. Similarly, a reject-route action returns false. If the + subroutine returns true, the calling policy continues to evaluate + the remaining conditions (using a modified route if the + subroutine performed any changes to the route)."; + + oc-ext:openconfig-version "2.0.1"; + + revision "2016-05-12" { + description + "OpenConfig public release"; + reference "2.0.1"; + } + + + // typedef statements + + typedef default-policy-type { + type enumeration { + enum ACCEPT_ROUTE { + description "default policy to accept the route"; + } + enum REJECT_ROUTE { + description "default policy to reject the route"; + } + } + description "type used to specify default route disposition in + a policy chain"; + } + + + // grouping statements + + grouping prefix-set-config { + description + "Configuration data for prefix sets used in policy + definitions."; + + leaf prefix-set-name { + type string; + description + "name / label of the prefix set -- this is used to + reference the set in match conditions"; + } + + } + + grouping prefix-set-state { + description + "Operational state data for prefix sets"; + } + + grouping prefix-set-top { + description + "Top-level data definitions for a list of IPv4 or IPv6 + prefixes which are matched as part of a policy"; + + container prefix-sets { + description + "Enclosing container "; + + list prefix-set { + key "prefix-set-name"; + description + "List of the defined prefix sets"; + + leaf prefix-set-name { + type leafref { + path "../config/prefix-set-name"; + } + description + "Reference to prefix name list key"; + } + + container config { + description + "Configuration data for prefix sets"; + + uses prefix-set-config; + } + + container state { + + config false; + + description + "Operational state data "; + + uses prefix-set-config; + uses prefix-set-state; + } + + uses prefix-top; + } + } + } + + grouping prefix-config { + description + "Configuration data for a prefix definition"; + + leaf ip-prefix { + type inet:ip-prefix; + mandatory true; + description + "The prefix member in CIDR notation -- while the + prefix may be either IPv4 or IPv6, most + implementations require all members of the prefix set + to be the same address family. Mixing address types in + the same prefix set is likely to cause an error."; + } + + leaf masklength-range { + type string { + pattern '([0-9]+\.\.[0-9]+)|exact'; + } + description + "Defines a range for the masklength, or 'exact' if + the prefix has an exact length. + + Example: 10.3.192.0/21 through 10.3.192.0/24 would be + expressed as prefix: 10.3.192.0/21, + masklength-range: 21..24. + + Example: 10.3.192.0/21 would be expressed as + prefix: 10.3.192.0/21, + masklength-range: exact"; + } + } + + grouping prefix-state { + description + "Operational state data for prefix definitions"; + } + + grouping prefix-top { + description + "Top-level grouping for prefixes in a prefix list"; + + container prefixes { + description + "Enclosing container for the list of prefixes in a policy + prefix list"; + + list prefix { + key "ip-prefix masklength-range"; + description + "List of prefixes in the prefix set"; + + leaf ip-prefix { + type leafref { + path "../config/ip-prefix"; + } + description + "Reference to the ip-prefix list key."; + } + + leaf masklength-range { + type leafref { + path "../config/masklength-range"; + } + description + "Reference to the masklength-range list key"; + } + + container config { + description + "Configuration data for prefix definition"; + + uses prefix-config; + } + + container state { + + config false; + + description + "Operational state data for prefix definition"; + + uses prefix-config; + uses prefix-state; + } + } + } + } + + grouping neighbor-set-config { + description + "Configuration data for neighbor set definitions"; + + leaf neighbor-set-name { + type string; + description + "name / label of the neighbor set -- this is used to + reference the set in match conditions"; + } + + leaf-list address { + type inet:ip-address-no-zone; + description + "List of IP addresses in the neighbor set"; + } + } + + grouping neighbor-set-state { + description + "Operational state data for neighbor set definitions"; + } + + grouping neighbor-set-top { + description + "Top-level data definition for a list of IPv4 or IPv6 + neighbors which can be matched in a routing policy"; + + container neighbor-sets { + description + "Enclosing container for the list of neighbor set + definitions"; + + list neighbor-set { + key "neighbor-set-name"; + description + "List of defined neighbor sets for use in policies."; + + leaf neighbor-set-name { + type leafref { + path "../config/neighbor-set-name"; + } + description + "Reference to the neighbor set name list key."; + } + + container config { + description + "Configuration data for neighbor sets."; + + uses neighbor-set-config; + } + + container state { + + config false; + + description + "Operational state data for neighbor sets."; + + uses neighbor-set-config; + uses neighbor-set-state; + } + } + } + } + + grouping tag-set-config { + description + "Configuration data for tag set definitions."; + + leaf tag-set-name { + type string; + description + "name / label of the tag set -- this is used to reference + the set in match conditions"; + } + + leaf-list tag-value { + type oc-pol-types:tag-type; + description + "Value of the tag set member"; + } + } + + grouping tag-set-state { + description + "Operational state data for tag set definitions."; + } + + grouping tag-set-top { + description + "Top-level data definitions for a list of tags which can + be matched in policies"; + + container tag-sets { + description + "Enclosing container for the list of tag sets."; + + list tag-set { + key "tag-set-name"; + description + "List of tag set definitions."; + + leaf tag-set-name { + type leafref { + path "../config/tag-set-name"; + } + description + "Reference to the tag set name list key"; + } + + container config { + description + "Configuration data for tag sets"; + + uses tag-set-config; + } + + container state { + + config false; + + description + "Operational state data for tag sets"; + + uses tag-set-config; + uses tag-set-state; + } + } + } + } + + grouping generic-defined-sets { + description + "Data definitions for pre-defined sets of attributes used in + policy match conditions. These sets are generic and can + be used in matching conditions in different routing + protocols."; + + uses prefix-set-top; + uses neighbor-set-top; + uses tag-set-top; + } + + grouping match-set-options-group { + description + "Grouping containing options relating to how a particular set + should be matched"; + + leaf match-set-options { + type oc-pol-types:match-set-options-type; + description + "Optional parameter that governs the behaviour of the + match operation"; + } + } + + grouping match-set-options-restricted-group { + description + "Grouping for a restricted set of match operation modifiers"; + + leaf match-set-options { + type oc-pol-types:match-set-options-restricted-type; + description + "Optional parameter that governs the behaviour of the + match operation. This leaf only supports matching on ANY + member of the set or inverting the match. Matching on ALL is + not supported)"; + } + } + + grouping match-interface-condition-config { + description + "Configuration data for interface match condition"; + + uses oc-if:interface-ref-common; + } + + grouping match-interface-condition-state { + description + "Operational state data for interface match condition"; + } + + grouping match-interface-condition-top { + description + "Top-level grouping for the interface match condition"; + + container match-interface { + description + "Top-level container for interface match conditions"; + + container config { + description + "Configuration data for interface match conditions"; + + uses match-interface-condition-config; + } + + container state { + + config false; + + description + "Operational state data for interface match conditions"; + + uses match-interface-condition-config; + uses match-interface-condition-state; + } + + } + } + + grouping prefix-set-condition-config { + description + "Configuration data for prefix-set conditions"; + + leaf prefix-set { + type leafref { + path "/routing-policy/defined-sets/prefix-sets/" + + "prefix-set/prefix-set-name"; + //TODO: require-instance should be added when it's + //supported in YANG 1.1 + //require-instance true; + } + description "References a defined prefix set"; + } + uses match-set-options-restricted-group; + } + + grouping prefix-set-condition-state { + description + "Operational state data for prefix-set conditions"; + } + + grouping prefix-set-condition-top { + description + "Top-level grouping for prefix-set conditions"; + + container match-prefix-set { + description + "Match a referenced prefix-set according to the logic + defined in the match-set-options leaf"; + + container config { + description + "Configuration data for a prefix-set condition"; + + uses prefix-set-condition-config; + } + + container state { + + config false; + + description + "Operational state data for a prefix-set condition"; + + uses prefix-set-condition-config; + uses prefix-set-condition-state; + } + } + } + + grouping neighbor-set-condition-config { + description + "Configuration data for neighbor-set conditions"; + + leaf neighbor-set { + type leafref { + path "/routing-policy/defined-sets/neighbor-sets/" + + "neighbor-set/neighbor-set-name"; + //TODO: require-instance should be added when it's + //supported in YANG 1.1 + //require-instance true; + } + description "References a defined neighbor set"; + } + + uses match-set-options-restricted-group; + } + + grouping neighbor-set-condition-state { + description + "Operational state data for neighbor-set conditions"; + } + + grouping neighbor-set-condition-top { + description + "Top-level grouping for neighbor-set conditions"; + + container match-neighbor-set { + description + "Match a referenced neighbor set according to the logic + defined in the match-set-options-leaf"; + + container config { + description + "Configuration data "; + + uses neighbor-set-condition-config; + } + + container state { + + config false; + + description + "Operational state data "; + + uses neighbor-set-condition-config; + uses neighbor-set-condition-state; + } + } + } + + grouping tag-set-condition-config { + description + "Configuration data for tag-set condition statements"; + + leaf tag-set { + type leafref { + path "/routing-policy/defined-sets/tag-sets/tag-set" + + "/tag-set-name"; + //TODO: require-instance should be added when it's + //supported in YANG 1.1 + //require-instance true; + } + description "References a defined tag set"; + } + uses match-set-options-restricted-group; + } + + grouping tag-set-condition-state { + description + "Operational state data for tag-set condition statements"; + } + + grouping tag-set-condition-top { + description + "Top-level grouping for tag-set conditions"; + + container match-tag-set { + description + "Match a referenced tag set according to the logic defined + in the match-options-set leaf"; + + container config { + description + "Configuration data for tag-set conditions"; + + uses tag-set-condition-config; + } + + container state { + + config false; + + description + "Operational state data tag-set conditions"; + + uses tag-set-condition-config; + uses tag-set-condition-state; + } + } + } + + grouping generic-conditions { + description "Condition statement definitions for checking + membership in a generic defined set"; + + uses match-interface-condition-top; + uses prefix-set-condition-top; + uses neighbor-set-condition-top; + uses tag-set-condition-top; + + } + + grouping igp-generic-conditions { + description "grouping for IGP policy conditions"; + + } + + + grouping igp-conditions { + description "grouping for IGP-specific policy conditions"; + + container igp-conditions { + description "Policy conditions for IGP attributes"; + + uses igp-generic-conditions; + + } + } + + grouping generic-actions { + description + "Definitions for common set of policy action statements that + manage the disposition or control flow of the policy"; + + choice route-disposition { + description + "Select the final disposition for the route, either + accept or reject."; + leaf accept-route { + type empty; + description "accepts the route into the routing table"; + } + + leaf reject-route { + type empty; + description "rejects the route"; + } + } + } + + + grouping igp-actions-config { + description + "Configuration data for IGP policy actions"; + + leaf set-tag { + type oc-pol-types:tag-type; + description + "Set the tag value for OSPF or IS-IS routes."; + } + } + + grouping igp-actions-state { + description + "Operational state data for IGP policy actions "; + } + + grouping igp-actions-top { + description + "Top-level grouping "; + + container igp-actions { + description + "Actions to set IGP route attributes; these actions + apply to multiple IGPs"; + + container config { + description + "Configuration data "; + + uses igp-actions-config; + } + + container state { + + config false; + + description + "Operational state data "; + + uses igp-actions-config; + uses igp-actions-state; + } + } + } + + + grouping policy-conditions-config { + description + "Configuration data for general policy conditions, i.e., those + not related to match-sets"; + + leaf call-policy { + type leafref { + path "/oc-rpol:routing-policy/" + + "oc-rpol:policy-definitions/" + + "oc-rpol:policy-definition/oc-rpol:name"; + //TODO: require-instance should be added when + //it is supported in YANG 1.1 + //require-instance true; + } + description + "Applies the statements from the specified policy + definition and then returns control the current + policy statement. Note that the called policy may + itself call other policies (subject to + implementation limitations). This is intended to + provide a policy 'subroutine' capability. The + called policy should contain an explicit or a + default route disposition that returns an + effective true (accept-route) or false + (reject-route), otherwise the behavior may be + ambiguous and implementation dependent"; + } + + leaf install-protocol-eq { + type identityref { + base oc-pol-types:INSTALL_PROTOCOL_TYPE; + } + description + "Condition to check the protocol / method used to install + the route into the local routing table"; + } + } + + grouping policy-conditions-state { + description + "Operational state data for policy conditions"; + } + + grouping policy-conditions-top { + description + "Top-level grouping for policy conditions"; + + container conditions { + description + "Condition statements for the current policy statement"; + + container config { + description + "Configuration data for policy conditions"; + + uses policy-conditions-config; + } + + container state { + + config false; + + description + "Operational state data for policy conditions"; + + uses policy-conditions-config; + uses policy-conditions-state; + } + uses generic-conditions; + uses igp-conditions; + } + } + + grouping policy-statements-config { + description + "Configuration data for policy statements"; + + leaf name { + type string; + description + "name of the policy statement"; + } + } + + grouping policy-statements-state { + description + "Operational state data for policy statements"; + } + + + + grouping policy-actions-config { + description + "Configuration data for policy actions"; + + uses generic-actions; + } + + grouping policy-actions-state { + description + "Operational state data for policy actions"; + } + + grouping policy-actions-top { + description + "Top-level grouping for policy actions"; + + container actions { + description + "Top-level container for policy action statements"; + + container config { + description + "Configuration data for policy actions"; + + uses policy-actions-config; + } + + container state { + + config false; + + description + "Operational state data for policy actions"; + + uses policy-actions-config; + uses policy-actions-state; + } + + uses igp-actions-top; + } + } + + grouping policy-statements-top { + description + "Top-level grouping for the policy statements list"; + + container statements { + description + "Enclosing container for policy statements"; + + list statement { + key "name"; + // TODO: names of policy statements within a policy + // definition should probably be optional, however, YANG + // requires a unique id for lists + ordered-by user; + description + "Policy statements group conditions and actions + within a policy definition. They are evaluated in + the order specified (see the description of policy + evaluation at the top of this module."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to list key"; + } + + container config { + description + "Configuration data for policy statements"; + + uses policy-statements-config; + } + + container state { + + config false; + + description + "Operational state data for policy statements"; + + uses policy-statements-config; + uses policy-statements-state; + } + + uses policy-conditions-top; + uses policy-actions-top; + } + } + } + + grouping defined-sets-top { + description + "Top-level grouping for defined set definitions"; + + container defined-sets { + description + "Predefined sets of attributes used in policy match + statements"; + + uses generic-defined-sets; + } + } + + grouping policy-definitions-config { + description + "Configuration data for policy definitions"; + + leaf name { + type string; + description + "Name of the top-level policy definition -- this name + is used in references to the current policy"; + } + } + + grouping policy-definitions-state { + description + "Operational state data for policy definitions"; + } + + grouping policy-definitions-top { + description + "Top-level grouping for the policy definition list"; + + container policy-definitions { + description + "Enclosing container for the list of top-level policy + definitions"; + + list policy-definition { + key "name"; + description + "List of top-level policy definitions, keyed by unique + name. These policy definitions are expected to be + referenced (by name) in policy chains specified in import + or export configuration statements."; + + leaf name { + type leafref { + path "../config/name"; + } + description + "Reference to the list key"; + } + + container config { + description + "Configuration data for policy defintions"; + + uses policy-definitions-config; + } + + container state { + + config false; + + description + "Operational state data for policy definitions"; + + uses policy-definitions-config; + uses policy-definitions-state; + } + + uses policy-statements-top; + } + } + } + + grouping routing-policy-top { + description + "Top level container for OpenConfig routing policy"; + + container routing-policy { + description + "Top-level container for all routing policy configuration"; + + + uses defined-sets-top; + + uses policy-definitions-top; + } + } + + grouping apply-policy-import-config { + description + "Configuration data for applying import policies"; + + leaf-list import-policy { + type leafref { + path "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" + + "oc-rpol:policy-definition/oc-rpol:name"; + //TODO: require-instance should be added when it's + //supported in YANG 1.1 + //require-instance true; + } + ordered-by user; + description + "list of policy names in sequence to be applied on + receiving a routing update in the current context, e.g., + for the current peer group, neighbor, address family, + etc."; + } + + leaf default-import-policy { + type default-policy-type; + default REJECT_ROUTE; + description + "explicitly set a default policy if no policy definition + in the import policy chain is satisfied."; + } + + } + + grouping apply-policy-export-config { + description + "Configuration data for applying export policies"; + + leaf-list export-policy { + type leafref { + path "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" + + "oc-rpol:policy-definition/oc-rpol:name"; + //TODO: require-instance should be added when it's + //supported in YANG 1.1 + //require-instance true; + } + ordered-by user; + description + "list of policy names in sequence to be applied on + sending a routing update in the current context, e.g., + for the current peer group, neighbor, address family, + etc."; + } + + leaf default-export-policy { + type default-policy-type; + default REJECT_ROUTE; + description + "explicitly set a default policy if no policy definition + in the export policy chain is satisfied."; + } + } + + + grouping apply-policy-config { + description + "Configuration data for routing policies"; + + uses apply-policy-import-config; + uses apply-policy-export-config; + + } + + + + grouping apply-policy-state { + description + "Operational state associated with routing policy"; + + //TODO: identify additional state data beyond the intended + //policy configuration. + } + + grouping apply-policy-group { + description + "Top level container for routing policy applications. This + grouping is intended to be used in routing models where + needed."; + + container apply-policy { + description + "Anchor point for routing policies in the model. + Import and export policies are with respect to the local + routing table, i.e., export (send) and import (receive), + depending on the context."; + + container config { + description + "Policy configuration data."; + + uses apply-policy-config; + } + + container state { + + config false; + description + "Operational state for routing policy"; + + uses apply-policy-config; + uses apply-policy-state; + } + } + } + + uses routing-policy-top; + +} diff --git a/yang/openconfig-nis/openconfig-segment-routing.yang b/yang/openconfig-nis/openconfig-segment-routing.yang new file mode 100644 index 000000000..f19b2d891 --- /dev/null +++ b/yang/openconfig-nis/openconfig-segment-routing.yang @@ -0,0 +1,780 @@ +module openconfig-segment-routing { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/sr"; + prefix "oc-sr"; + + // import some basic types + import openconfig-extensions { prefix "oc-ext"; } + import openconfig-mpls-types { prefix "oc-mpls-t"; } + import openconfig-interfaces { prefix "oc-if"; } + import ietf-inet-types { prefix "inet"; } + import ietf-yang-types { prefix "yang"; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "Configuration and operational state parameters relating to the + segment routing. This module defines a number of elements which are + instantiated in multiple places throughout the OpenConfig collection + of models. + + Particularly: + - SRGB+LB dataplane instances - directly instantied by SR. + - SRGB+LB dataplane reservations - instantiated within MPLS and future SR + dataplanes. + - SR SID advertisements - instantiated within the relevant IGP. + - SR-specific counters - instantied within the relevant dataplane."; + + oc-ext:openconfig-version "0.0.3"; + + revision "2017-01-12" { + description + "Minor compliance fixes."; + reference "0.0.3"; + } + + revision "2016-12-15" { + description + "Updated revision of SR module."; + reference "0.0.2"; + } + + revision "2016-07-28" { + description + "Initial revision of SR module."; + reference "0.0.1"; + } + + typedef sr-dataplane-type { + type enumeration { + enum MPLS { + description + "The entity uses MPLS labels as Segment Identifiers."; + } + enum IPV6 { + description + "The entity uses IPv6 prefixes as Segment Identifiers."; + } + } + description + "Types of data plane that can be used to instantiate a Segment + Routing block of SIDs."; + } + + typedef sr-sid-type { + type union { + type oc-mpls-t:mpls-label; + type inet:ipv6-address-no-zone; + } + description + "The defined value of a segment identifier."; + } + + grouping srgb-config { + description + "Configuration parameters relating to the SRGB."; + + leaf local-id { + type string; + description + "Unique identifier for the segment routing global block on + the local system."; + } + + leaf dataplane-type { + type sr-dataplane-type; + description + "The dataplane being used to instantiate the SRGB. When MPLS is specified + the set of MPLS label blocks that are defined in the mpls-label-blocks + list are used to make up the SRGB. When IPv6 is specified, the set of IPv6 + prefixes specified in the ipv6-prefixes list are used."; + } + + leaf-list mpls-label-blocks { + when "../dataplane-type = 'MPLS'" { + description + "Allow the MPLS label block to be specified only for SRGBs that are + using the MPLS dataplane."; + } + type leafref { + // We are at /network-instances/network-instance/segment-routing/ + // srgbs/srgb/config/mpls-label-blocks + path "../../../../../mpls/global/reserved-label-blocks/" + + "reserved-label-block/config/local-id"; + } + description + "A list of refences to the label blocks that are used to make + up the SRGB."; + } + + leaf-list ipv6-prefixes { + when "../dataplane-type = 'IPV6'" { + description + "Allow IPv6 prefixes to be specified only when the dataplane + realisation of the SRGB is IPv6."; + } + type inet:ipv6-prefix; + description + "A list of IPv6 prefixes which are to be used for segment routing using + the IPv6 dataplane."; + } + } + + grouping srgb-state { + description + "Operational state parameters relating to the SRGB."; + + leaf size { + type uint32; + description + "The total number of SRGB entries that are available within the SRGB."; + } + + leaf used { + type uint32; + description + "The total number of SRGB entries that have already been alocated by + protocols referencing the SRGB."; + } + } + + grouping srlb-config { + description + "Configuration parameters relating to an SRLB."; + + leaf local-id { + type string; + description + "A unique local identifier used for the Segment Routing Local Block. + The identifier is used when referencing the SRLB within other + contexts."; + } + + leaf dataplane-type { + type sr-dataplane-type; + description + "The dataplane that is to be used for the Segment Routing Local Block. + When MPLS is specified, the local block corresponds to a block of MPLS + labels; when IPv6 is specified it corresponds to an IPv6 prefix."; + } + + leaf mpls-label-block { + when "../dataplane-type = 'MPLS'" { + description + "Allow the MPLS label block to be specified only for SRLBs that are + using the MPLS dataplane."; + } + type leafref { + path "../../../../../mpls/global/reserved-label-blocks/" + + "reserved-label-block/config/local-id"; + } + description + "A reference to the MPLS label block that is used to contain the + SIDs of the SRLB."; + } + + leaf ipv6-prefix { + when "../dataplane-type = 'IPV6'" { + description + "Allow IPv6 prefixes to be specified only when the dataplane + realisation of the SRGB is IPv6."; + } + type inet:ipv6-prefix; + description + "The IPv6 prefix that is used for the SRLB."; + } + } + + grouping sr-structural { + description + "Top-level structural grouping defining Segment Routing Global Blocks."; + + container srgbs { + description + "Configuration and operational state parameters relating to the + SRGBs defined for the system."; + + list srgb { + key "local-id"; + + description + "A single definition of an SRGB which may comprise of multiple + sets of dataplane addresses (IPv6 addresses, or MPLS labels)."; + + leaf local-id { + type leafref { + path "../config/local-id"; + } + description + "A reference to the identifier for the SRGB."; + } + + container config { + description + "Configuration parameters relating to the SRGB."; + uses srgb-config; + } + + container state { + config false; + description + "State parameters relating to the SRGB."; + uses srgb-config; + uses srgb-state; + } + } + } + + container srlbs { + description + "Configuration and operational state parameters relating to the + Segment Routing Local Blocks (SRLBs) defined for the system."; + + list srlb { + key "local-id"; + + description + "A definition of a Segment Routing Local Block, defined to be + a set of Segment Identifiers (specified as MPLS labels or + IPv6 addreses) that are defined for local allocation by the + system. A block may optionally be advertised into an IGP."; + + leaf local-id { + type leafref { + path "../config/local-id"; + } + description + "Reference to the local identifier used for the SRLB."; + } + + container config { + description + "Configuration parameters relating to the SRLB."; + uses srlb-config; + } + + container state { + config false; + description + "Operational state parmeters relating to the SRLB."; + uses srlb-config; + } + } + } + } + + grouping sr-mpls-top { + description + "Structural grouping defining SR definition within MPLS."; + + container segment-routing { + description + "MPLS-specific Segment Routing configuration and operational state + parameters"; + + container aggregate-sid-counters { + description + "Per-SID counters aggregated across all interfaces on the local system"; + + list aggregate-sid-counter { + key "mpls-label"; + config false; + + description + "Counters aggregated across all of the interfaces of the local + system corresponding to traffic received or forwarded with a + particular SID"; + + leaf mpls-label { + type leafref { + path "../state/mpls-label"; + } + description + "The MPLS label representing the segment identifier"; + } + + container state { + config false; + description + "State parameters for per-SID statistics"; + uses sr-mpls-sid-counters-state; + uses sr-mpls-common-counters; + } + } + } + + container interfaces { + description + "Interface related Segment Routing parameters."; + + list interface { + key "interface-id"; + + description + "Parameters and MPLS-specific configuration relating to Segment + Routing on an interface."; + + leaf interface-id { + type leafref { + path "../config/interface-id"; + } + description + "A reference to the ID for the interface for which SR is + configured"; + } + + container config { + description + "MPLS-specific Segment Routing configuration parameters + related to an interface."; + uses sr-mpls-interface-config; + } + + container state { + config false; + description + "MPLS-specific Segment Routing operational state parameters + related to an interface."; + uses sr-mpls-interface-config; + uses sr-mpls-interface-state; + } + + container sid-counters { + description + "Per-SID statistics for MPLS"; + + list sid-counter { + key "mpls-label"; + config false; + + description + "Per segment identifier counters for the MPLS dataplane."; + + leaf mpls-label { + type leafref { + path "../state/mpls-label"; + } + description + "The MPLS label representing the segment identifier"; + } + + container state { + config false; + description + "State parameters for per-SID statistics"; + uses sr-mpls-sid-counters-state; + uses sr-mpls-common-counters; + } + + container forwarding-classes { + description + "Per-SID per-forwarding class counters for Segment Routing."; + + list forwarding-class { + key "exp"; + config false; + + description + "SID entries for the forwarding class associated with the + referenced MPLS EXP."; + + leaf exp { + type leafref { + path "../state/exp"; + } + description + "Reference to the value of the EXP bits of the segment + identifier."; + } + + container state { + config false; + description + "Per-SID, per forwarding class counters for Segment Routing + with the MPLS dataplane"; + + uses sr-mpls-interface-sid-fc-state; + uses sr-mpls-common-counters; + } + } + } + } + } + uses oc-if:interface-ref; + } + } + } + } + + grouping sr-mpls-interface-config { + description + "MPLS-specific Segment Routing configuration for an interface"; + + leaf interface-id { + type string; + description + "A unique identifier for the interface."; + } + } + + grouping sr-mpls-interface-state { + description + "MPLS-specific Segment Routing operational state parameters for an + interface"; + + uses sr-mpls-common-counters; + } + + grouping sr-mpls-interface-sid-fc-state { + description + "Per-SID per forwarding class statistics for SR with the MPLS dataplane"; + + leaf exp { + type uint8 { + range "0..7"; + } + description + "The value of the MPLS EXP (experimental) or Traffic Class bits that the + SID statistics relate to. Packets received with a MPLS label value + equal to the SID's MPLS label and EXP bits equal to the this value + should be counted towards the associated ingress statistics. Packets + that are forwarded to the destination MPLS label corresponding to the + SID should be counted towards this value. In the egress direction, where + forwarding follows a SID value that requires PHP at the local node, + packets should still be counted towards the egress counters."; + } + } + + grouping sr-mpls-sid-counters-state { + description + "Per-SID statistics leaves"; + + leaf mpls-label { + type oc-mpls-t:mpls-label; + description + "The MPLS label used for the segment identifier"; + } + } + + grouping sr-mpls-common-counters { + description + "Per segment identifier counters used in the model"; + + leaf in-pkts { + type yang:counter64; + description + "A cumulative counter of the packets received within the context + which have matched a label corresponding to an SR Segment Identifier."; + } + + leaf in-octets { + type yang:counter64; + description + "The cumulative counter of the total bytes received within the context + which have matched a label corresponding to an SR Segment Identifier"; + } + + leaf out-pkts { + type yang:counter64; + description + "A cumulative counter of the total number of packets transmitted by + the local system within the context which have a label imposed that + corresponds to an Segment Identifier."; + } + + leaf out-octets { + type yang:counter64; + description + "A cumulative counter of the total bytes transmitted by the local + system within the context which have a label imported that + corresponds to an SR Segment Identifier."; + } + } + + grouping sr-igp-config { + description + "Configuration parameters relating to segment routing within an + IGP."; + + leaf enabled { + type boolean; + description + "When this leaf is set to true, the segment routing extensions are + utilised within the IGP."; + } + + leaf srgb { + type leafref { + path "../../../../../../../segment-routing/srgbs/srgb/config/local-id"; + } + description + "A reference to the Segment Routing Global Block (SRGB) that is + to be used by this IGP instance."; + } + + leaf srlb { + // Leaf is defined at + // /network-instances/network-instance/protocols/protocol//global/ + // segment-routing/config + type leafref { + path "../../../../../../../segment-routing/srlbs/srlb/config/local-id"; + } + description + "A reference to the Segment Routing Local Block (SRLB) that is to + be advertised by the IGP instance."; + } + } + + grouping sr-igp-top { + description + "Per-instance configuration and state parameters for Segment Routing + in an IGP."; + + container segment-routing { + description + "Configuration and operational state relating to segment routing."; + + container config { + description + "Configuration parameters relating to the configuration of segment + routing for the IGP instance."; + uses sr-igp-config; + } + + container state { + config false; + description + "Operational state parameters relating to segment routing for the + IGP instance."; + uses sr-igp-config; + } + } + } + + grouping sr-igp-interface-prefix-sid-config { + description + "Configuration parameters relating to an IGP prefix SID advertisement"; + + leaf prefix { + type inet:ip-prefix; + description + "The IP prefix for which the IGP prefix SID should be advertised. The + value specified is a local prefix on the interface which is advertised + into the IGP."; + } + + leaf sid-id { + type sr-sid-type; + description + "The Segment Identifier to be used when advertising the IGP Prefix SID."; + } + + leaf label-options { + type enumeration { + enum NO_PHP { + description + "When this value is specified, the penultimate hop must not pop + the Prefix-SID label before forwarding it to the local system."; + } + enum EXPLICIT_NULL { + description + "When set, the penultimate hop must swap the prefix SID for the + relevant explicit null label before forwarding the packet."; + } + } + description + "The options associated with the IGP prefix SID for MPLS. The value + of this leaf specifies the option that the SID should be advertised + into the IGP with."; + } + } + + grouping sr-igp-interface-adjsid-config { + description + "Configuration parameters relating to an Adj-SID on an interface"; + + leaf sid-id { + type union { + type sr-sid-type; + type enumeration { + enum DYNAMIC { + description + "The SID chosen for the Adjacency SID should be dynamically + allocated from the system's dynamic range of Segment + Identifiers. For MPLS, this range should be considered to be + those labels that do not fall within a reserved label block."; + } + } + } + description + "The value of the Adj-SID to be advertised. Where a static SID + identifier is specified, this should be advertised directly by the + system. Where the DYNAMIC value is specified, this should be treated + as a dynamically allocated value. When the MPLS data plane is in use + the dynamic value should not fall within a reserved-label-block."; + } + + leaf protection-eligible { + type boolean; + default true; + description + "Whether the Adj-SID should be considered to be eligible for protection + using IP or MPLS FRR during a network failure. When this value is set to + true, the B-flag of the Adj-SID is set to 1, and the local system should + provide FRR paths for the associated label forwarding entry. When it is + set to false, the local system must not provide FRR for the specified + LFIB entry."; + } + + leaf group { + type boolean; + default false; + description + "When set to true, the Adj-SID is indicated to be part of a group, and + the G flag is set to 1 in the corresponding advertisement in the IGP."; + } + + leaf neighbor { + type inet:ip-address; + description + "The remote system on the interface with which the Adj-SID is + associated."; + } + } + + grouping sr-igp-interface-adjsid-state { + description + "Operational state parameters relating to the adjacency SID for an + interface"; + + leaf allocated-dynamic-local { + type sr-sid-type; + description + "Where an Adjacency SID with a dynamic value is to be allocated by + the system, this leaf reports to the value of the Adj-SID allocated + to this interface."; + } + } + + grouping sr-igp-interface-top { + description + "Per-interface configuration and operational state relating to an + interface within the IGP."; + + container segment-routing { + description + "Configuration and operatioanl state parameters relating to segment + routing for an interface within the IGP."; + + container prefix-sids { + description + "Configuration and operational state parameters relating to + the advertisement of a segment routing IGP-Prefix SID for this + interface."; + + list prefix-sid { + key "prefix"; + + description + "An IGP prefix that should have a segment routing IGP-Prefix SID + allocated to it. The value of the SID is specified by the SID ID, + as an absolute value. If the absolute value falls within the SRGB, + the Global flag should be advertised by the system."; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + description + "Reference to the prefix for which the IGP-Prefix SID is to be + advertised"; + } + + container config { + description + "Configuration parameters for the IGP Prefix SID."; + uses sr-igp-interface-prefix-sid-config; + } + + container state { + config false; + description + "Operational state parameters for the IGP-Prefix SID."; + uses sr-igp-interface-prefix-sid-config; + } + } + } + + container adjacency-sids { + description + "Configuration and operational state parameters relating to + the advertisement of a segment routing adjacency SID for this + interface."; + + list adjacency-sid { + key "neighbor sid-id"; + + description + "An Adjacency SID to be advertised for the specified interface. + The Adj-SID's identifier (the SID ID) must be unique, with flags + specified indicating the parameters that should be set for the SID. + Where a SID value is specified that is allocated from the SRGB, the + global flag must be set by the system."; + + leaf sid-id { + type leafref { + path "../config/sid-id"; + } + description + "Reference to the segment identifier to be used by the local + system."; + } + + leaf neighbor { + type leafref { + path "../config/neighbor"; + } + description + "Reference to the neighbor with which the Adjacency SID is + associated."; + } + + container config { + description + "Configuraton parameters relating to the AdjSID."; + uses sr-igp-interface-adjsid-config; + } + + container state { + config false; + description + "Operational state parameters relating to the AdjSID."; + uses sr-igp-interface-adjsid-config; + uses sr-igp-interface-adjsid-state; + } + } + } + } + } + + grouping sr-top { + description + "Top level grouping for Segment Routing"; + + container segment-routing { + description + "Configuration and operational state parameters relating to + segment routing."; + + uses sr-structural; + } + } +} diff --git a/yang/openconfig-nis/openconfig-types.yang b/yang/openconfig-nis/openconfig-types.yang new file mode 100644 index 000000000..ecffdc2b0 --- /dev/null +++ b/yang/openconfig-nis/openconfig-types.yang @@ -0,0 +1,325 @@ +module openconfig-types { + yang-version "1"; + + namespace "http://openconfig.net/yang/openconfig-types"; + + prefix "oc-types"; + + // import statements + import openconfig-extensions { prefix oc-ext; } + + // meta + organization + "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module contains a set of general type definitions that + are used across OpenConfig models. It can be imported by modules + that make use of these types."; + + oc-ext:openconfig-version "0.3.2"; + + revision "2017-01-13" { + description + "Add ADDRESS_FAMILY identity"; + reference "0.3.2"; + } + + revision "2016-11-14" { + description + "Correct length of ieeefloat32"; + reference "0.3.1"; + } + + revision "2016-11-11" { + description + "Additional types - ieeefloat32 and routing-password"; + reference "0.3.0"; + } + + revision "2016-05-31" { + description + "OpenConfig public release"; + reference "0.2.0"; + } + + typedef percentage { + type uint8 { + range "0..100"; + } + description + "Integer indicating a percentage value"; + } + + typedef std-regexp { + type string; + description + "This type definition is a placeholder for a standard + definition of a regular expression that can be utilised in + OpenConfig models. Further discussion is required to + consider the type of regular expressions that are to be + supported. An initial proposal is POSIX compatible."; + } + + typedef timeticks64 { + type uint64; + description + "This type is based on the timeticks type defined in + RFC 6991, but with 64-bit width. It represents the time, + modulo 2^64, in hundredths of a second between two epochs."; + reference + "RFC 6991 - Common YANG Data Types"; + } + + typedef ieeefloat32 { + type binary { + length "32"; + } + description + "An IEEE 32-bit floating point number. The format of this number + is of the form: + 1-bit sign + 8-bit exponent + 24-bit fraction + The floating point value is calculated using: + (-1)**S * 2**(Exponent-127) * (1+Fraction)"; + } + + typedef routing-password { + type string; + description + "This type is indicative of a password that is used within + a routing protocol which can be returned in plain text to the + NMS by the local system. Such passwords are typically stored + as encrypted strings. Since the encryption used is generally + well known, it is possible to extract the original value from + the string - and hence this format is not considered secure. + Leaves specified with this type should not be modified by + the system, and should be returned to the end-user in plain + text. This type exists to differentiate passwords, which + may be sensitive, from other string leaves. It could, for + example, be used by the NMS to censor this data when + viewed by particular users."; + } + + grouping avg-min-max-stats-precision1 { + description + "Common nodes for recording average, minimum, and + maximum values for a statistic. These values all have + fraction-digits set to 1."; + + leaf avg { + type decimal64 { + fraction-digits 1; + } + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 1; + } + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 1; + } + description + "The maximum value of the statitic over the sampling + period"; + } + } + + grouping avg-min-max-instant-stats-precision1 { + description + "Common grouping for recording an instantaneous statistic value + in addition to avg-min-max stats"; + + leaf instant { + type decimal64 { + fraction-digits 1; + } + description + "The instantaneous value of the statistic."; + } + + uses avg-min-max-stats-precision1; + } + + grouping avg-min-max-instant-stats-precision2-dB { + description + "Common grouping for recording dB values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics"; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units dB; + description + "The maximum value of the statistic over the sampling + period"; + } + } + + grouping avg-min-max-instant-stats-precision2-dBm { + description + "Common grouping for recording dBm values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics"; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units dBm; + description + "The maximum value of the statistic over the sampling + period"; + } + } + + grouping avg-min-max-instant-stats-precision2-mA { + description + "Common grouping for recording mA values with 2 decimal + precision. Values include the instantaneous, average, + minimum, and maximum statistics"; + + leaf instant { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The instantaneous value of the statistic."; + } + + leaf avg { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The arithmetic mean value of the statistic over the + sampling period."; + } + + leaf min { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The minimum value of the statistic over the sampling + period"; + } + + leaf max { + type decimal64 { + fraction-digits 2; + } + units mA; + description + "The maximum value of the statistic over the sampling + period"; + } + } + + identity ADDRESS_FAMILY { + description + "A base identity for all address families"; + } + + identity IPV4 { + base ADDRESS_FAMILY; + description + "The IPv4 address family"; + } + + identity IPV6 { + base ADDRESS_FAMILY; + description + "The IPv6 address family"; + } + + identity MPLS { + base ADDRESS_FAMILY; + description + "The MPLS address family"; + } + + identity L2_ETHERNET { + base ADDRESS_FAMILY; + description + "The 802.3 Ethernet address family"; + } +} diff --git a/yang/openconfig-nis/openconfig-vlan-types.yang b/yang/openconfig-nis/openconfig-vlan-types.yang new file mode 100644 index 000000000..7713268b9 --- /dev/null +++ b/yang/openconfig-nis/openconfig-vlan-types.yang @@ -0,0 +1,180 @@ +module openconfig-vlan-types { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/vlan-types"; + + prefix "oc-vlan-types"; + + // import some basic types + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module defines configuration and state variables for VLANs, + in addition to VLAN parameters associated with interfaces"; + + oc-ext:openconfig-version "1.0.2"; + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + // extension statements + + // feature statements + + // identity statements + + identity TPID_TYPES { + description + "Base identity for TPID values that can override the VLAN + ethertype value"; + } + + identity TPID_0x8100 { + base TPID_TYPES; + description + "Default TPID value for 802.1q single-tagged VLANs."; + } + + identity TPID_0x8A88 { + base TPID_TYPES; + description + "TPID value for 802.1ad provider bridging, Q-in-Q, + or stacked VLANs"; + } + + identity TPID_0x9100 { + base TPID_TYPES; + description + "Alternate TPID value"; + } + + identity TPID_0X9200 { + base TPID_TYPES; + description + "Alternate TPID value"; + } + + // typedef statements + + // TODO: typedefs should be defined in a vlan-types.yang file. + typedef vlan-id { + type uint16 { + range 1..4094; + } + description + "Type definition representing a single-tagged VLAN"; + } + + typedef vlan-range { + type string { + // range specified as [lower]..[upper] + pattern '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.(409[0-4]|' + + '40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{1,2}|' + + '[1-9])$'; + } + description + "Type definition representing a range of single-tagged + VLANs. A range is specified as x..y where x and y are + valid VLAN IDs (1 <= vlan-id <= 4094). The range is + assumed to be inclusive, such that any VLAN-ID matching + x <= VLAN-ID <= y falls within the range."; + } + + typedef qinq-id { + type string { + pattern + '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)$'; + } + description + "Type definition representing a single double-tagged/QinQ VLAN + identifier. The format of a QinQ VLAN-ID is x.y where X is the + 'outer' VLAN identifier, and y is the 'inner' VLAN identifier. + Both x and y must be valid VLAN IDs (1 <= vlan-id <= 4094) + with the exception that y may be equal to a wildcard (*). In + cases where y is set to the wildcard, this represents all inner + VLAN identifiers where the outer VLAN identifier is equal to + x"; + } + + typedef qinq-id-range { + type union { + type string { + // match cases where the range is specified as x..y.z + pattern + '^(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.' + + '((409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])|\*)$'; + } + type string { + // match cases where the range is specified as x.y..z + pattern + '^(\*|(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9]))\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])\.\.' + + '(409[0-4]|40[0-8][0-9]|[1-3][0-9]{3}|' + + '[1-9][0-9]{1,2}|[1-9])$'; + } + } + description + "A type definition representing a range of double-tagged/QinQ + VLAN identifiers. The format of a QinQ VLAN-ID range can be + specified in three formats. Where the range is outer VLAN IDs + the range is specified as x..y.z. In this case outer VLAN + identifiers meeting the criteria x <= outer-vlan-id <= y are + accepted iff the inner VLAN-ID is equal to y - or any inner-tag + if the wildcard is specified. Alternatively the range can be + specified as x.y..z. In this case only VLANs with an + outer-vlan-id qual to x are accepted (x may again be the + wildcard). Inner VLANs are accepted if they meet the inequality + y <= inner-vlan-id <= z."; + } + + typedef vlan-mode-type { + type enumeration { + enum ACCESS { + description "Access mode VLAN interface (No 802.1q header)"; + } + enum TRUNK { + description "Trunk mode VLAN interface"; + } + } + description + "VLAN interface mode (trunk or access)"; + } + + typedef vlan-ref { + type union { + type vlan-id; + type string; + // TODO: string should be changed to leafref to reference + // an existing VLAN. this is not allowed in YANG 1.0 but + // is expected to be in YANG 1.1. + // type leafref { + // path "vlan:vlans/vlan:vlan/vlan:config/vlan:name"; + // } + } + description + "Reference to a VLAN by name or id"; + } + +} diff --git a/yang/openconfig-nis/openconfig-vlan.yang b/yang/openconfig-nis/openconfig-vlan.yang new file mode 100644 index 000000000..afc61fd5d --- /dev/null +++ b/yang/openconfig-nis/openconfig-vlan.yang @@ -0,0 +1,407 @@ +module openconfig-vlan { + + yang-version "1"; + + // namespace + namespace "http://openconfig.net/yang/vlan"; + + prefix "oc-vlan"; + + // import some basic types + import openconfig-vlan-types { prefix oc-vlan-types; } + import openconfig-interfaces { prefix oc-if; } + import openconfig-if-ethernet { prefix oc-eth; } + import openconfig-if-aggregate { prefix oc-lag; } + import iana-if-type { prefix ift; } + import openconfig-extensions { prefix oc-ext; } + + // meta + organization "OpenConfig working group"; + + contact + "OpenConfig working group + netopenconfig@googlegroups.com"; + + description + "This module defines configuration and state variables for VLANs, + in addition to VLAN parameters associated with interfaces"; + + oc-ext:openconfig-version "1.0.2"; + + revision "2016-05-26" { + description + "OpenConfig public release"; + reference "1.0.2"; + } + + + + // grouping statements + + grouping vlan-config { + description "VLAN configuration container."; + + leaf vlan-id { + type oc-vlan-types:vlan-id; + description "Interface VLAN id."; + } + + leaf name { + type string; + description "Interface VLAN name."; + } + + leaf status { + type enumeration { + enum ACTIVE { + description "VLAN is active"; + } + enum SUSPENDED { + description "VLAN is inactive / suspended"; + } + } + default ACTIVE; + description "Admin state of the VLAN"; + } + + leaf tpid { + type identityref { + base oc-vlan-types:TPID_TYPES; + } + default oc-vlan-types:TPID_0x8100; + description + "Optionally set the tag protocol identifier field (TPID) that + is accepted on the VLAN"; + } + + } + + grouping vlan-state { + description "State variables for VLANs"; + + } + + grouping vlan-members-state { + description + "List of interfaces / subinterfaces belonging to the VLAN."; + + container members { + description + "Enclosing container for list of member interfaces"; + + list member { + config false; + description + "List of references to interfaces / subinterfaces + associated with the VLAN."; + + uses oc-if:interface-ref-state; + } + } + } + + grouping vlan-ethernet-config { + description + "VLAN related configuration that is part of the physical + Ethernet interface."; + + leaf interface-mode { + type oc-vlan-types:vlan-mode-type; + description + "Set the interface to access or trunk mode for + VLANs"; + } + + leaf native-vlan { + when "interface-mode = 'TRUNK'" { + description + "Native VLAN is valid for trunk mode interfaces"; + } + type union { + type oc-vlan-types:vlan-id; + type oc-vlan-types:qinq-id; + } + description + "Set the native VLAN id for untagged frames arriving on + a trunk interface. This configuration is only valid on + a trunk interface."; + } + + leaf access-vlan { + when "interface-mode = 'ACCESS'" { + description + "Access VLAN assigned to the interfaces"; + } + type union { + type oc-vlan-types:vlan-id; + type oc-vlan-types:qinq-id; + } + description + "Assign the access vlan to the access port."; + } + + leaf-list trunk-vlans { + when "interface-mode = 'TRUNK'" { + description + "Allowed VLANs may be specified for trunk mode + interfaces."; + } + type union { + type oc-vlan-types:vlan-id; + type oc-vlan-types:vlan-range; + type oc-vlan-types:qinq-id; + type oc-vlan-types:qinq-id-range; + } + description + "Specify VLANs, or ranges thereof, that the interface may + carry when in trunk mode. If not specified, all VLANs are + allowed on the interface. Ranges are specified in the form + x..y, where x