Internet Engineering Task Force (IETF)                           L. Wang
Request for Comments: 8431                                    Individual
Category: Standards Track                                        M. Chen
ISSN: 2070-1721                                                   Huawei
                                                                 A. Dass
                                                                Ericsson
                                                      H. Ananthakrishnan
                                                                 Netflix
                                                                 S. Kini
                                                              Individual
                                                              N. Bahadur
                                                                    Uber
                                                          September 2018
        
Internet Engineering Task Force (IETF)                           L. Wang
Request for Comments: 8431                                    Individual
Category: Standards Track                                        M. Chen
ISSN: 2070-1721                                                   Huawei
                                                                 A. Dass
                                                                Ericsson
                                                      H. Ananthakrishnan
                                                                 Netflix
                                                                 S. Kini
                                                              Individual
                                                              N. Bahadur
                                                                    Uber
                                                          September 2018
        

A YANG Data Model for the Routing Information Base (RIB)

路由信息库(RIB)的YANG数据模型

Abstract

摘要

This document defines a YANG data model for the Routing Information Base (RIB) that aligns with the Interface to the Routing System (I2RS) RIB information model.

本文件定义了路由信息库(RIB)的数据模型,该模型与路由系统(I2RS)RIB信息模型的接口一致。

Status of This Memo

关于下段备忘

This is an Internet Standards Track document.

这是一份互联网标准跟踪文件。

This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 7841第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc8431.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问https://www.rfc-editor.org/info/rfc8431.

Copyright Notice

版权公告

Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2018 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(https://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

Table of Contents

目录

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
     1.1.  Requirements Language . . . . . . . . . . . . . . . . . .   3
     1.2.  Definitions and Abbreviations . . . . . . . . . . . . . .   3
     1.3.  Tree Diagrams . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Model Structure . . . . . . . . . . . . . . . . . . . . . . .   3
     2.1.  RIB Capability  . . . . . . . . . . . . . . . . . . . . .   8
     2.2.  Routing Instance and RIB  . . . . . . . . . . . . . . . .   8
     2.3.  Route . . . . . . . . . . . . . . . . . . . . . . . . . .   9
     2.4.  Nexthop . . . . . . . . . . . . . . . . . . . . . . . . .  11
     2.5.  RPC Operations  . . . . . . . . . . . . . . . . . . . . .  15
     2.6.  Notifications . . . . . . . . . . . . . . . . . . . . . .  20
   3.  YANG Module . . . . . . . . . . . . . . . . . . . . . . . . .  22
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  67
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .  67
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  68
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .  68
     6.2.  Informative References  . . . . . . . . . . . . . . . . .  69
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  70
   Contributors  . . . . . . . . . . . . . . . . . . . . . . . . . .  70
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  71
        
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
     1.1.  Requirements Language . . . . . . . . . . . . . . . . . .   3
     1.2.  Definitions and Abbreviations . . . . . . . . . . . . . .   3
     1.3.  Tree Diagrams . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Model Structure . . . . . . . . . . . . . . . . . . . . . . .   3
     2.1.  RIB Capability  . . . . . . . . . . . . . . . . . . . . .   8
     2.2.  Routing Instance and RIB  . . . . . . . . . . . . . . . .   8
     2.3.  Route . . . . . . . . . . . . . . . . . . . . . . . . . .   9
     2.4.  Nexthop . . . . . . . . . . . . . . . . . . . . . . . . .  11
     2.5.  RPC Operations  . . . . . . . . . . . . . . . . . . . . .  15
     2.6.  Notifications . . . . . . . . . . . . . . . . . . . . . .  20
   3.  YANG Module . . . . . . . . . . . . . . . . . . . . . . . . .  22
   4.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  67
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .  67
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  68
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .  68
     6.2.  Informative References  . . . . . . . . . . . . . . . . .  69
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  70
   Contributors  . . . . . . . . . . . . . . . . . . . . . . . . . .  70
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  71
        
1. Introduction
1. 介绍

The Interface to the Routing System (I2RS) [RFC7921] provides read and write access to the information and state within the routing process that exists inside the routing elements; this is achieved via protocol message exchange between I2RS clients and I2RS agents associated with the routing system. One of the functions of I2RS is to read and write data of the Routing Information Base (RIB). [I2RS-REQS] introduces a set of RIB use cases. The RIB information model is defined in [RFC8430].

路由系统(I2RS)[RFC7921]的接口提供对路由元素中存在的路由过程中的信息和状态的读写访问;这是通过I2RS客户端和与路由系统关联的I2RS代理之间的协议消息交换实现的。I2RS的功能之一是读取和写入路由信息库(RIB)的数据。[I2RS-REQS]介绍了一组肋骨用例。肋骨信息模型在[RFC8430]中定义。

This document defines a YANG data model [RFC7950] [RFC6991] for the RIB that satisfies the RIB use cases and aligns with the RIB information model.

本文档为肋骨定义了一个数据模型[RFC7950][RFC6991],该模型满足肋骨用例,并与肋骨信息模型一致。

1.1. Requirements Language
1.1. 需求语言

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“建议”、“不建议”、“可”和“可选”在所有大写字母出现时(如图所示)应按照BCP 14[RFC2119][RFC8174]所述进行解释。

1.2. Definitions and Abbreviations
1.2. 定义和缩写

RIB: Routing Information Base

路由信息库

FIB: Forwarding Information Base

转发信息库

RPC: Remote Procedure Call

远程过程调用

IM: Information Model. An abstract model of a conceptual domain, which is independent of a specific implementation or data representation.

IM:信息模型。概念域的抽象模型,独立于特定的实现或数据表示。

1.3. Tree Diagrams
1.3. 树形图

Tree diagrams used in this document follow the notation defined in [RFC8340].

本文档中使用的树形图遵循[RFC8340]中定义的符号。

2. Model Structure
2. 模型结构

The following figure shows an overview of the structure tree of the ietf-i2rs-rib module. To give a whole view of the structure tree, some details of the tree are omitted. The relevant details are introduced in the subsequent subsections.

下图显示了ietf-i2rs-rib模块结构树的概述。为了给出结构树的整体视图,省略了树的一些细节。相关细节将在随后的小节中介绍。

   module: ietf-i2rs-rib
      +--rw routing-instance
         +--rw name              string
         +--rw interface-list* [name]
         |  +--rw name if:interface-ref
         +--rw router-id?        yang:dotted-quad
         +--rw lookup-limit?     uint8
         +--rw rib-list* [name]
            +--rw name              string
            +--rw address-family address-family-definition
            +--rw ip-rpf-check?     boolean
            +--rw route-list* [route-index]
            |  +--rw route-index                uint64
            |  +--rw match
            |  |  +--rw (route-type)?
            |  |     +--:(ipv4)
            |  |     |  ...
            |  |     +--:(ipv6)
            |  |     |  ...
            |  |     +--:(mpls-route)
            |  |     |  ...
            |  |     +--:(mac-route)
            |  |     |  ...
            |  |     +--:(interface-route)
            |  |        ...
            |  +--rw nexthop
            |  |  +--rw nexthop-id?           uint32
            |  |  +--rw sharing-flag?         boolean
            |  |  +--rw (nexthop-type)?
            |  |     +--:(nexthop-base)
            |  |     |  ...
            |  |     +--:(nexthop-chain) {nexthop-chain}?
            |  |     |  ...
            |  |     +--:(nexthop-replicate) {nexthop-replicate}?
            |  |     |  ...
            |  |     +--:(nexthop-protection) {nexthop-protection}?
            |  |     |  ...
            |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
            |  |        ...
            |  +--rw route-status
            |  |  ...
            |  +--rw route-attributes
            |  |  ...
            |  +--rw route-vendor-attributes
            +--rw nexthop-list* [nexthop-member-id]
               +--rw nexthop-member-id uint32
        
   module: ietf-i2rs-rib
      +--rw routing-instance
         +--rw name              string
         +--rw interface-list* [name]
         |  +--rw name if:interface-ref
         +--rw router-id?        yang:dotted-quad
         +--rw lookup-limit?     uint8
         +--rw rib-list* [name]
            +--rw name              string
            +--rw address-family address-family-definition
            +--rw ip-rpf-check?     boolean
            +--rw route-list* [route-index]
            |  +--rw route-index                uint64
            |  +--rw match
            |  |  +--rw (route-type)?
            |  |     +--:(ipv4)
            |  |     |  ...
            |  |     +--:(ipv6)
            |  |     |  ...
            |  |     +--:(mpls-route)
            |  |     |  ...
            |  |     +--:(mac-route)
            |  |     |  ...
            |  |     +--:(interface-route)
            |  |        ...
            |  +--rw nexthop
            |  |  +--rw nexthop-id?           uint32
            |  |  +--rw sharing-flag?         boolean
            |  |  +--rw (nexthop-type)?
            |  |     +--:(nexthop-base)
            |  |     |  ...
            |  |     +--:(nexthop-chain) {nexthop-chain}?
            |  |     |  ...
            |  |     +--:(nexthop-replicate) {nexthop-replicate}?
            |  |     |  ...
            |  |     +--:(nexthop-protection) {nexthop-protection}?
            |  |     |  ...
            |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
            |  |        ...
            |  +--rw route-status
            |  |  ...
            |  +--rw route-attributes
            |  |  ...
            |  +--rw route-vendor-attributes
            +--rw nexthop-list* [nexthop-member-id]
               +--rw nexthop-member-id uint32
        
   rpcs:
      +---x rib-add
      |  +---w input
      |  |  +---w name        string
      |  |  +---w address-family      address-family-definition
      |  |  +---w ip-rpf-check?   boolean
      |  +--ro output
      |     +--ro result boolean
      |     +--ro reason? string
      +---x rib-delete
      |  +---w input
      |  |  +---w name string
      |  +--ro output
      |     +--ro result boolean
      |     +--ro reason? string
      +---x route-add
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-delete
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-update
      |  +---w input
      |  |  +---w return-failure-detail?           boolean
      |  |  +---w rib-name                         string
        
   rpcs:
      +---x rib-add
      |  +---w input
      |  |  +---w name        string
      |  |  +---w address-family      address-family-definition
      |  |  +---w ip-rpf-check?   boolean
      |  +--ro output
      |     +--ro result boolean
      |     +--ro reason? string
      +---x rib-delete
      |  +---w input
      |  |  +---w name string
      |  +--ro output
      |     +--ro result boolean
      |     +--ro reason? string
      +---x route-add
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-delete
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-update
      |  +---w input
      |  |  +---w return-failure-detail?           boolean
      |  |  +---w rib-name                         string
        
      |  |  +---w (match-options)?
      |  |     +--:(match-route-prefix)
      |  |     |  ...
      |  |     +--:(match-route-attributes)
      |  |     |  ...
      |  |     +--:(match-route-vendor-attributes) {...}?
      |  |     |  ...
      |  |     +--:(match-nexthop)
      |  |        ...
      |  +--ro output
      |     +--ro success-count uint32
      |     +--ro failed-count uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x nh-add
      |  +---w input
      |  |  +---w rib-name              string
      |  |  +---w nexthop-id?           uint32
      |  |  +---w sharing-flag?         boolean
      |  |  +---w (nexthop-type)?
      |  |     +--:(nexthop-base)
      |  |     |  ...
      |  |     +--:(nexthop-chain) {nexthop-chain}?
      |  |     |  ...
      |  |     +--:(nexthop-replicate) {nexthop-replicate}?
      |  |     |  ...
      |  |     +--:(nexthop-protection) {nexthop-protection}?
      |  |     |  ...
      |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
      |  |        ...
      |  +--ro output
      |     +--ro result        boolean
      |     +--ro reason?       string
      |     +--ro nexthop-id?   uint32
      +---x nh-delete
         +---w input
         |  +---w rib-name              string
         |  +---w nexthop-id?           uint32
         |  +---w sharing-flag?         boolean
         |  +---w (nexthop-type)?
         |     +--:(nexthop-base)
         |     |  ...
         |     +--:(nexthop-chain) {nexthop-chain}?
         |     |  ...
         |     +--:(nexthop-replicate) {nexthop-replicate}?
         |     |  ...
        
      |  |  +---w (match-options)?
      |  |     +--:(match-route-prefix)
      |  |     |  ...
      |  |     +--:(match-route-attributes)
      |  |     |  ...
      |  |     +--:(match-route-vendor-attributes) {...}?
      |  |     |  ...
      |  |     +--:(match-nexthop)
      |  |        ...
      |  +--ro output
      |     +--ro success-count uint32
      |     +--ro failed-count uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x nh-add
      |  +---w input
      |  |  +---w rib-name              string
      |  |  +---w nexthop-id?           uint32
      |  |  +---w sharing-flag?         boolean
      |  |  +---w (nexthop-type)?
      |  |     +--:(nexthop-base)
      |  |     |  ...
      |  |     +--:(nexthop-chain) {nexthop-chain}?
      |  |     |  ...
      |  |     +--:(nexthop-replicate) {nexthop-replicate}?
      |  |     |  ...
      |  |     +--:(nexthop-protection) {nexthop-protection}?
      |  |     |  ...
      |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
      |  |        ...
      |  +--ro output
      |     +--ro result        boolean
      |     +--ro reason?       string
      |     +--ro nexthop-id?   uint32
      +---x nh-delete
         +---w input
         |  +---w rib-name              string
         |  +---w nexthop-id?           uint32
         |  +---w sharing-flag?         boolean
         |  +---w (nexthop-type)?
         |     +--:(nexthop-base)
         |     |  ...
         |     +--:(nexthop-chain) {nexthop-chain}?
         |     |  ...
         |     +--:(nexthop-replicate) {nexthop-replicate}?
         |     |  ...
        
         |     +--:(nexthop-protection) {nexthop-protection}?
         |     |  ...
         |     +--:(nexthop-load-balance) {nexthop-load-balance}?
         |        ...
         +--ro output
            +--ro result boolean
            +--ro reason? string
   notifications:
      +---n nexthop-resolution-status-change
      |  +--ro nexthop
      |  |  +--ro nexthop-id?           uint32
      |  |  +--ro sharing-flag?         boolean
      |  |  +--ro (nexthop-type)?
      |  |     +--:(nexthop-base)
      |  |     |  ...
      |  |     +--:(nexthop-chain) {nexthop-chain}?
      |  |     |  ...
      |  |     +--:(nexthop-replicate) {nexthop-replicate}?
      |  |     |  ...
      |  |     +--:(nexthop-protection) {nexthop-protection}?
      |  |     |  ...
      |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
      |  |        ...
      |  +--ro nexthop-state nexthop-state-definition
      +---n route-change
         +--ro rib-name                 string
         +--ro address-family               address-family-definition
         +--ro route-index              uint64
         +--ro match
         |  +--ro (route-type)?
         |     +--:(ipv4)
         |     |  ...
         |     +--:(ipv6)
         |     |  ...
         |     +--:(mpls-route)
         |     |  ...
         |     +--:(mac-route)
         |     |  ...
         |     +--:(interface-route)
         |        ...
         +--ro route-installed-state route-installed-state-definition
         +--ro route-state         route-state-definition
         +--ro route-change-reasons* [route-change-reason]
            +--ro route-change-reason    route-change-reason-definition
        
         |     +--:(nexthop-protection) {nexthop-protection}?
         |     |  ...
         |     +--:(nexthop-load-balance) {nexthop-load-balance}?
         |        ...
         +--ro output
            +--ro result boolean
            +--ro reason? string
   notifications:
      +---n nexthop-resolution-status-change
      |  +--ro nexthop
      |  |  +--ro nexthop-id?           uint32
      |  |  +--ro sharing-flag?         boolean
      |  |  +--ro (nexthop-type)?
      |  |     +--:(nexthop-base)
      |  |     |  ...
      |  |     +--:(nexthop-chain) {nexthop-chain}?
      |  |     |  ...
      |  |     +--:(nexthop-replicate) {nexthop-replicate}?
      |  |     |  ...
      |  |     +--:(nexthop-protection) {nexthop-protection}?
      |  |     |  ...
      |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
      |  |        ...
      |  +--ro nexthop-state nexthop-state-definition
      +---n route-change
         +--ro rib-name                 string
         +--ro address-family               address-family-definition
         +--ro route-index              uint64
         +--ro match
         |  +--ro (route-type)?
         |     +--:(ipv4)
         |     |  ...
         |     +--:(ipv6)
         |     |  ...
         |     +--:(mpls-route)
         |     |  ...
         |     +--:(mac-route)
         |     |  ...
         |     +--:(interface-route)
         |        ...
         +--ro route-installed-state route-installed-state-definition
         +--ro route-state         route-state-definition
         +--ro route-change-reasons* [route-change-reason]
            +--ro route-change-reason    route-change-reason-definition
        

Figure 1: Overview of I2RS RIB Module Structure

图1:I2RS肋骨模块结构概述

2.1. RIB Capability
2.1. 肋骨能力

RIB capability negotiation is very important because not all of the hardware will be able to support all kinds of nexthops, and there might be a limitation on how many levels of lookup can be practically performed. Therefore, a RIB data model needs to specify a way for an external entity to learn about the functional capabilities of a network device.

RIB能力协商非常重要,因为并非所有硬件都能够支持所有类型的Nexthop,而且实际执行的查找级别可能有限制。因此,RIB数据模型需要指定外部实体了解网络设备功能能力的方式。

At the same time, nexthop chains can be used to specify multiple headers over a packet before that particular packet is forwarded. Not every network device will be able to support all kinds of nexthop chains along with the arbitrary number of headers that are chained together. The RIB data model needs a way to expose the nexthop chaining capability supported by a given network device.

同时,nexthop链可用于在转发特定数据包之前指定数据包上的多个报头。不是每个网络设备都能够支持所有类型的nexthop链以及链接在一起的任意数量的头。RIB数据模型需要一种方法来公开给定网络设备支持的nexthop链接功能。

This module uses the feature and if-feature statements to achieve above capability advertisement.

此模块使用feature和if feature语句来实现上述功能。

2.2. Routing Instance and RIB
2.2. 布线实例与加强筋

A routing instance, in the context of the RIB information model, is a collection of RIBs, interfaces, and routing protocol parameters. A routing instance creates a logical slice of the router and can allow multiple different logical slices, across a set of routers, to communicate with each other. The routing protocol parameters control the information available in the RIBs. More details about a routing instance can be found in Section 2.2 of [RFC8430].

在RIB信息模型的上下文中,路由实例是RIB、接口和路由协议参数的集合。路由实例创建路由器的逻辑片,并允许多个不同的逻辑片跨一组路由器相互通信。路由协议参数控制肋骨中可用的信息。有关路由实例的更多详细信息,请参见[RFC8430]的第2.2节。

For a routing instance, there can be multiple RIBs. Therefore, this model uses "list" to express the RIBs. The structure tree is shown below:

对于布管实例,可以有多个加强筋。因此,该模型使用“列表”来表示肋骨。结构树如下图所示:

   +--rw routing-instance
      +--rw name              string
      +--rw interface-list* [name]
      |  +--rw name if:interface-ref
      +--rw router-id?        yang:dotted-quad
      +--rw lookup-limit?     uint8
      +--rw rib-list* [name]
         +--rw name            string
         +--rw address-family      address-family-definition
         +--rw ip-rpf-check?   boolean
         +--rw route-list* [route-index]
            ... // refer to Section 2.3
        
   +--rw routing-instance
      +--rw name              string
      +--rw interface-list* [name]
      |  +--rw name if:interface-ref
      +--rw router-id?        yang:dotted-quad
      +--rw lookup-limit?     uint8
      +--rw rib-list* [name]
         +--rw name            string
         +--rw address-family      address-family-definition
         +--rw ip-rpf-check?   boolean
         +--rw route-list* [route-index]
            ... // refer to Section 2.3
        

Figure 2: Routing Instance Structure

图2:路由实例结构

2.3. Route
2.3. 路线

A route is essentially a match condition and an action following that match. The match condition specifies the kind of route (e.g., IPv4, MPLS, Media Access Control (MAC), Interface, etc.) and the set of fields to match on.

路由本质上是一个匹配条件和匹配后的操作。匹配条件指定路由类型(例如,IPv4、MPLS、媒体访问控制(MAC)、接口等)和要匹配的字段集。

A route MUST contain the ROUTE_PREFERENCE attribute (see Section 2.3 of [RFC8430]).

路由必须包含路由首选项属性(见[RFC8430]第2.3节)。

In addition, a route MUST associate with the following status attributes in responses to a RIB writing/reading operation:

此外,管线必须与以下状态属性关联,以响应肋骨写入/读取操作:

o Active: Indicates whether a route has at least one fully resolved nexthop and is therefore eligible for installation in the FIB.

o 活动:指示路由是否至少有一个完全解析的nexthop,因此有资格安装在FIB中。

o Installed: Indicates whether the route got installed in the FIB.

o 已安装:指示路由是否已安装在FIB中。

o Reason: Indicates the specific reason that caused the failure, e.g., "Not authorized".

o 原因:表示导致故障的具体原因,例如“未授权”。

In addition, a route can be associated with one or more optional route-attributes (e.g., route-vendor-attributes).

此外,路线可以与一个或多个可选路线属性(例如,路线供应商属性)相关联。

A RIB will have a number of routes, so the routes are expressed as a list under a specific RIB. Each RIB has its own route list.

一个加强筋将有多条管线,因此这些管线将表示为特定加强筋下的列表。每根肋骨都有自己的路线列表。

   +--rw route-list* [route-index]
      +--rw route-index                uint64
      +--rw match
      |  +--rw (route-type)?
      |     +--:(ipv4)
      |     |  +--rw ipv4
      |     |     +--rw (ip-route-match-type)?
      |     |        +--:(dest-ipv4-address)
      |     |        |  ...
      |     |        +--:(src-ipv4-address)
      |     |        |  ...
      |     |        +--:(dest-src-ipv4-address)
      |     |           ...
      |     +--:(ipv6)
      |     |  +--rw ipv6
      |     |     +--rw (ip-route-match-type)?
      |     |        +--:(dest-ipv6-address)
      |     |        |  ...
      |     |        +--:(src-ipv6-address)
      |     |        |  ...
      |     |        +--:(dest-src-ipv6-address)
      |     |           ...
      |     +--:(mpls-route)
      |     |  +--rw mpls-label              uint32
      |     +--:(mac-route)
      |     |  +--rw mac-address             uint32
      |     +--:(interface-route)
      |        +--rw interface-identifier if:interface-ref
      +--rw nexthop
      |  ...(refer to Section 2.4)
        
   +--rw route-list* [route-index]
      +--rw route-index                uint64
      +--rw match
      |  +--rw (route-type)?
      |     +--:(ipv4)
      |     |  +--rw ipv4
      |     |     +--rw (ip-route-match-type)?
      |     |        +--:(dest-ipv4-address)
      |     |        |  ...
      |     |        +--:(src-ipv4-address)
      |     |        |  ...
      |     |        +--:(dest-src-ipv4-address)
      |     |           ...
      |     +--:(ipv6)
      |     |  +--rw ipv6
      |     |     +--rw (ip-route-match-type)?
      |     |        +--:(dest-ipv6-address)
      |     |        |  ...
      |     |        +--:(src-ipv6-address)
      |     |        |  ...
      |     |        +--:(dest-src-ipv6-address)
      |     |           ...
      |     +--:(mpls-route)
      |     |  +--rw mpls-label              uint32
      |     +--:(mac-route)
      |     |  +--rw mac-address             uint32
      |     +--:(interface-route)
      |        +--rw interface-identifier if:interface-ref
      +--rw nexthop
      |  ...(refer to Section 2.4)
        

Figure 3: Routes Structure

图3:路线结构

2.4. Nexthop
2.4. 下一步

A nexthop represents an object resulting from a route lookup. As illustrated in Figure 4 of [RFC8430], to support various use cases (e.g., load-balancing, protection, multicast, or a combination of them), the nexthop is modeled as a multilevel structure and supports recursion. The first level of the nexthop includes the following four types:

nexthop表示路由查找产生的对象。如[RFC8430]图4所示,为了支持各种用例(例如,负载平衡、保护、多播或它们的组合),nexthop被建模为多级结构并支持递归。nexthop的第一级包括以下四种类型:

o Base: The "base" nexthop is the foundation of all other nexthop types. It includes the following basic nexthops:

o 基础:“基础”NEXTHOP是所有其他NEXTHOP类型的基础。它包括以下基本步骤:

* nexthop-id

* 下一个id

* IPv4 address

* IPv4地址

* IPv6 address

* IPv6地址

* egress-interface

* 出口接口

* egress-interface with IPv4 address

* 具有IPv4地址的出口接口

* egress-interface with IPv6 address

* 具有IPv6地址的出口接口

* egress-interface with MAC address

* 具有MAC地址的出口接口

* logical-tunnel

* 逻辑隧道

* tunnel-encapsulation

* 隧道封装

* tunnel-decapsulation

* 隧道脱封

* rib-name

* 肋骨名称

o Chain: The "chain" nexthop provides a way to perform multiple operations on a packet by logically combining them.

o 链:“链”nexthop提供了一种通过逻辑组合对数据包执行多个操作的方法。

o Load-Balance: The "load-balance" nexthop is designed for a load-balance case where it normally will have multiple weighted nexthops.

o 负载平衡:“负载平衡”nexthop是为负载平衡情况而设计的,通常会有多个加权nexthop。

o Protection: The "protection" nexthop is designed for a protection scenario where it normally will have primary and standby nexthop.

o 保护:“保护”nexthop是为保护场景而设计的,在这种场景中,它通常有主nexthop和备用nexthop。

o Replicate: The "replicate" nexthop is designed for multiple destinations forwarding.

o 复制:“复制”下一步是为多个目的地转发而设计的。

The structure tree of nexthop is shown in the following figures.

nexthop的结构树如下图所示。

   +--rw nexthop
   |  +--rw nexthop-id?           uint32
   |  +--rw sharing-flag?         boolean
   |  +--rw (nexthop-type)?
   |     +--:(nexthop-base)
   |     |  ...(refer to Figure 5)
   |     +--:(nexthop-chain) {nexthop-chain}?
   |     |  +--rw nexthop-chain
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     +--:(nexthop-replicate) {nexthop-replicate}?
   |     |  +--rw nexthop-replicate
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     +--:(nexthop-protection) {nexthop-protection}?
   |     |  +--rw nexthop-protection
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     |        +--rw nexthop-preference nexthop-preference-definition
   |     +--:(nexthop-load-balance) {nexthop-load-balance}?
   |        +--rw nexthop-lb
   |           +--rw nexthop-list* [nexthop-member-id]
   |              +--rw nexthop-member-id uint32
   |              +--rw nexthop-lb-weight nexthop-lb-weight-definition
        
   +--rw nexthop
   |  +--rw nexthop-id?           uint32
   |  +--rw sharing-flag?         boolean
   |  +--rw (nexthop-type)?
   |     +--:(nexthop-base)
   |     |  ...(refer to Figure 5)
   |     +--:(nexthop-chain) {nexthop-chain}?
   |     |  +--rw nexthop-chain
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     +--:(nexthop-replicate) {nexthop-replicate}?
   |     |  +--rw nexthop-replicate
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     +--:(nexthop-protection) {nexthop-protection}?
   |     |  +--rw nexthop-protection
   |     |     +--rw nexthop-list* [nexthop-member-id]
   |     |        +--rw nexthop-member-id uint32
   |     |        +--rw nexthop-preference nexthop-preference-definition
   |     +--:(nexthop-load-balance) {nexthop-load-balance}?
   |        +--rw nexthop-lb
   |           +--rw nexthop-list* [nexthop-member-id]
   |              +--rw nexthop-member-id uint32
   |              +--rw nexthop-lb-weight nexthop-lb-weight-definition
        

Figure 4: Nexthop Structure

图4:Nexthop结构

Figure 5 (as shown below) is a subtree of nexthop. It's under the nexthop base node and shows the structure of the "base" nexthop.

图5(如下所示)是nexthop的子树。它位于nexthop base节点下,显示“base”nexthop的结构。

+--:(nexthop-base)
|  +--rw nexthop-base
|     +--rw (nexthop-base-type)?
|        +--:(special-nexthop)
|        |  +--rw special? special-nexthop-definition
|        +--:(egress-interface-nexthop)
|        |  +--rw outgoing-interface if:interface-ref
|        +--:(ipv4-address-nexthop)
|        |  +--rw ipv4-address inet:ipv4-address
|        +--:(ipv6-address-nexthop)
|        |  +--rw ipv6-address inet:ipv6-address
|        +--:(egress-interface-ipv4-nexthop)
|        |  +--rw egress-interface-ipv4-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ipv4-address       inet:ipv4-address
        
+--:(nexthop-base)
|  +--rw nexthop-base
|     +--rw (nexthop-base-type)?
|        +--:(special-nexthop)
|        |  +--rw special? special-nexthop-definition
|        +--:(egress-interface-nexthop)
|        |  +--rw outgoing-interface if:interface-ref
|        +--:(ipv4-address-nexthop)
|        |  +--rw ipv4-address inet:ipv4-address
|        +--:(ipv6-address-nexthop)
|        |  +--rw ipv6-address inet:ipv6-address
|        +--:(egress-interface-ipv4-nexthop)
|        |  +--rw egress-interface-ipv4-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ipv4-address       inet:ipv4-address
        
|        +--:(egress-interface-ipv6-nexthop)
|        |  +--rw egress-interface-ipv6-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ipv6-address       inet:ipv6-address
|        +--:(egress-interface-mac-nexthop)
|        |  +--rw egress-interface-mac-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ieee-mac-address yang:mac-address
|        +--:(tunnel-encapsulation-nexthop) {nexthop-tunnel}?
|        |  +--rw tunnel-encapsulation
|        |     +--rw (tunnel-type)?
|        |        +--:(ipv4) {ipv4-tunnel}?
|        |        |  +--rw ipv4-header
|        |        |     +--rw src-ipv4-address inet:ipv4-address
|        |        |     +--rw dest-ipv4-address inet:ipv4-address
|        |        |     +--rw protocol          uint8
|        |        |     +--rw ttl?              uint8
|        |        |     +--rw dscp?             uint8
|        |        +--:(ipv6) {ipv6-tunnel}?
|        |        |  +--rw ipv6-header
|        |        |     +--rw src-ipv6-address inet:ipv6-address
|        |        |     +--rw dest-ipv6-address inet:ipv6-address
|        |        |     +--rw next-header       uint8
|        |        |     +--rw traffic-class? uint8
|        |        |     +--rw flow-label?
|        |        |             inet:ipv6-flow-label
|        |        |     +--rw hop-limit?        uint8
|        |        +--:(mpls) {mpls-tunnel}?
|        |        |  +--rw mpls-header
|        |        |     +--rw label-operations* [label-oper-id]
|        |        |        +--rw label-oper-id uint32
|        |        |        +--rw (label-actions)?
|        |        |           +--:(label-push)
|        |        |           |  +--rw label-push
|        |        |           |     +--rw label        uint32
|        |        |           |     +--rw s-bit?       boolean
|        |        |           |     +--rw tc-value? uint8
|        |        |           |     +--rw ttl-value? uint8
|        |        |           +--:(label-swap)
|        |        |              +--rw label-swap
|        |        |                 +--rw out-label     uint32
|        |        |                 +--rw ttl-action?
|        |        |                         ttl-action-definition
|        |        +--:(gre) {gre-tunnel}?
|        |        |  +--rw gre-header
|        |        |     +--rw (dest-address-type)?
        
|        +--:(egress-interface-ipv6-nexthop)
|        |  +--rw egress-interface-ipv6-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ipv6-address       inet:ipv6-address
|        +--:(egress-interface-mac-nexthop)
|        |  +--rw egress-interface-mac-address
|        |     +--rw outgoing-interface if:interface-ref
|        |     +--rw ieee-mac-address yang:mac-address
|        +--:(tunnel-encapsulation-nexthop) {nexthop-tunnel}?
|        |  +--rw tunnel-encapsulation
|        |     +--rw (tunnel-type)?
|        |        +--:(ipv4) {ipv4-tunnel}?
|        |        |  +--rw ipv4-header
|        |        |     +--rw src-ipv4-address inet:ipv4-address
|        |        |     +--rw dest-ipv4-address inet:ipv4-address
|        |        |     +--rw protocol          uint8
|        |        |     +--rw ttl?              uint8
|        |        |     +--rw dscp?             uint8
|        |        +--:(ipv6) {ipv6-tunnel}?
|        |        |  +--rw ipv6-header
|        |        |     +--rw src-ipv6-address inet:ipv6-address
|        |        |     +--rw dest-ipv6-address inet:ipv6-address
|        |        |     +--rw next-header       uint8
|        |        |     +--rw traffic-class? uint8
|        |        |     +--rw flow-label?
|        |        |             inet:ipv6-flow-label
|        |        |     +--rw hop-limit?        uint8
|        |        +--:(mpls) {mpls-tunnel}?
|        |        |  +--rw mpls-header
|        |        |     +--rw label-operations* [label-oper-id]
|        |        |        +--rw label-oper-id uint32
|        |        |        +--rw (label-actions)?
|        |        |           +--:(label-push)
|        |        |           |  +--rw label-push
|        |        |           |     +--rw label        uint32
|        |        |           |     +--rw s-bit?       boolean
|        |        |           |     +--rw tc-value? uint8
|        |        |           |     +--rw ttl-value? uint8
|        |        |           +--:(label-swap)
|        |        |              +--rw label-swap
|        |        |                 +--rw out-label     uint32
|        |        |                 +--rw ttl-action?
|        |        |                         ttl-action-definition
|        |        +--:(gre) {gre-tunnel}?
|        |        |  +--rw gre-header
|        |        |     +--rw (dest-address-type)?
        
|        |        |     |  +--:(ipv4)
|        |        |     |  |  +--rw ipv4-dest inet:ipv4-address
|        |        |     |  +--:(ipv6)
|        |        |     |     +--rw ipv6-dest inet:ipv6-address
|        |        |     +--rw protocol-type uint16
|        |        |     +--rw key?          uint64
|        |        +--:(nvgre) {nvgre-tunnel}?
|        |        |  +--rw nvgre-header
|        |        |     +--rw (nvgre-type)?
|        |        |     |  +--:(ipv4)
|        |        |     |  |  +--rw src-ipv4-address inet:ipv4-address
|        |        |     |  |  +--rw dest-ipv4-address inet:ipv4-address
|        |        |     |  |  +--rw protocol          uint8
|        |        |     |  |  +--rw ttl?              uint8
|        |        |     |  |  +--rw dscp?             uint8
|        |        |     |  +--:(ipv6)
|        |        |     |     +--rw src-ipv6-address inet:ipv6-address
|        |        |     |     +--rw dest-ipv6-address inet:ipv6-address
|        |        |     |     +--rw next-header       uint8
|        |        |     |     +--rw traffic-class?    uint8
|        |        |     |     +--rw flow-label?
|        |        |     |             inet:ipv6-flow-label
|        |        |     |     +--rw hop-limit?        uint8
|        |        |     +--rw virtual-subnet-id uint32
|        |        |     +--rw flow-id?          uint8
|        |        +--:(vxlan) {vxlan-tunnel}?
|        |           +--rw vxlan-header
|        |              +--rw (vxlan-type)?
|        |              |  +--:(ipv4)
|        |              |  |  +--rw src-ipv4-address inet:ipv4-address
|        |              |  |  +--rw dest-ipv4-address inet:ipv4-address
|        |              |  |  +--rw protocol             uint8
|        |              |  |  +--rw ttl?                 uint8
|        |              |  |  +--rw dscp?                uint8
|        |              |  +--:(ipv6)
|        |              |     +--rw src-ipv6-address inet:ipv6-address
|        |              |     +--rw dest-ipv6-address inet:ipv6-address
|        |              |     +--rw next-header          uint8
|        |              |     +--rw traffic-class?       uint8
|        |              |     +--rw flow-label? inet:ipv6-flow-label
|        |              |     +--rw hop-limit?           uint8
|        |              +--rw vxlan-identifier     uint32
|        +--:(tunnel-decapsulation-nexthop) {nexthop-tunnel}?
|        |  +--rw tunnel-decapsulation
|        |     +--rw (tunnel-type)?
        
|        |        |     |  +--:(ipv4)
|        |        |     |  |  +--rw ipv4-dest inet:ipv4-address
|        |        |     |  +--:(ipv6)
|        |        |     |     +--rw ipv6-dest inet:ipv6-address
|        |        |     +--rw protocol-type uint16
|        |        |     +--rw key?          uint64
|        |        +--:(nvgre) {nvgre-tunnel}?
|        |        |  +--rw nvgre-header
|        |        |     +--rw (nvgre-type)?
|        |        |     |  +--:(ipv4)
|        |        |     |  |  +--rw src-ipv4-address inet:ipv4-address
|        |        |     |  |  +--rw dest-ipv4-address inet:ipv4-address
|        |        |     |  |  +--rw protocol          uint8
|        |        |     |  |  +--rw ttl?              uint8
|        |        |     |  |  +--rw dscp?             uint8
|        |        |     |  +--:(ipv6)
|        |        |     |     +--rw src-ipv6-address inet:ipv6-address
|        |        |     |     +--rw dest-ipv6-address inet:ipv6-address
|        |        |     |     +--rw next-header       uint8
|        |        |     |     +--rw traffic-class?    uint8
|        |        |     |     +--rw flow-label?
|        |        |     |             inet:ipv6-flow-label
|        |        |     |     +--rw hop-limit?        uint8
|        |        |     +--rw virtual-subnet-id uint32
|        |        |     +--rw flow-id?          uint8
|        |        +--:(vxlan) {vxlan-tunnel}?
|        |           +--rw vxlan-header
|        |              +--rw (vxlan-type)?
|        |              |  +--:(ipv4)
|        |              |  |  +--rw src-ipv4-address inet:ipv4-address
|        |              |  |  +--rw dest-ipv4-address inet:ipv4-address
|        |              |  |  +--rw protocol             uint8
|        |              |  |  +--rw ttl?                 uint8
|        |              |  |  +--rw dscp?                uint8
|        |              |  +--:(ipv6)
|        |              |     +--rw src-ipv6-address inet:ipv6-address
|        |              |     +--rw dest-ipv6-address inet:ipv6-address
|        |              |     +--rw next-header          uint8
|        |              |     +--rw traffic-class?       uint8
|        |              |     +--rw flow-label? inet:ipv6-flow-label
|        |              |     +--rw hop-limit?           uint8
|        |              +--rw vxlan-identifier     uint32
|        +--:(tunnel-decapsulation-nexthop) {nexthop-tunnel}?
|        |  +--rw tunnel-decapsulation
|        |     +--rw (tunnel-type)?
        
|        |        +--:(ipv4) {ipv4-tunnel}?
|        |        |  +--rw ipv4-decapsulation
|        |        |     +--rw ipv4-decapsulation
|        |        |             tunnel-decapsulation-action-definition
|        |        |     +--rw ttl-action?   ttl-action-definition
|        |        +--:(ipv6) {ipv6-tunnel}?
|        |        |  +--rw ipv6-decapsulation
|        |        |     +--rw ipv6-decapsulation
|        |        |             tunnel-decapsulation-action-definition
|        |        |     +--rw hop-limit-action?
|        |        |             hop-limit-action-definition
|        |        +--:(mpls) {mpls-tunnel}?
|        |           +--rw label-pop
|        |              +--rw label-pop     mpls-label-action-definition
|        |              +--rw ttl-action?   ttl-action-definition
|        +--:(logical-tunnel-nexthop) {nexthop-tunnel}?
|        |  +--rw logical-tunnel
|        |     +--rw tunnel-type tunnel-type-definition
|        |     +--rw tunnel-name string
|        +--:(rib-name-nexthop)
|        |  +--rw rib-name?                        string
|        +--:(nexthop-identifier)
|           +--rw nexthop-ref                      nexthop-ref
        
|        |        +--:(ipv4) {ipv4-tunnel}?
|        |        |  +--rw ipv4-decapsulation
|        |        |     +--rw ipv4-decapsulation
|        |        |             tunnel-decapsulation-action-definition
|        |        |     +--rw ttl-action?   ttl-action-definition
|        |        +--:(ipv6) {ipv6-tunnel}?
|        |        |  +--rw ipv6-decapsulation
|        |        |     +--rw ipv6-decapsulation
|        |        |             tunnel-decapsulation-action-definition
|        |        |     +--rw hop-limit-action?
|        |        |             hop-limit-action-definition
|        |        +--:(mpls) {mpls-tunnel}?
|        |           +--rw label-pop
|        |              +--rw label-pop     mpls-label-action-definition
|        |              +--rw ttl-action?   ttl-action-definition
|        +--:(logical-tunnel-nexthop) {nexthop-tunnel}?
|        |  +--rw logical-tunnel
|        |     +--rw tunnel-type tunnel-type-definition
|        |     +--rw tunnel-name string
|        +--:(rib-name-nexthop)
|        |  +--rw rib-name?                        string
|        +--:(nexthop-identifier)
|           +--rw nexthop-ref                      nexthop-ref
        

Figure 5: Nexthop Base Structure

图5:Nexthop基础结构

2.5. RPC Operations
2.5. RPC操作

This module defines the following RPC operations:

此模块定义以下RPC操作:

o rib-add: Add a RIB to a routing instance. The following are passed as the input parameters: the name of the RIB, the address family of the RIB, and (optionally) whether the RPF check is enabled. The output is the result of the add operation:

o 添加加强筋:将加强筋添加到布管实例。以下内容作为输入参数传递:加强筋的名称、加强筋的地址族,以及(可选)是否启用RPF检查。输出是添加操作的结果:

* true - success

* 真正的成功

* false - failed (when failed, the I2RS agent may return the specific reason that caused the failure)

* false-失败(失败时,I2RS代理可能返回导致失败的特定原因)

o rib-delete: Delete a RIB from a routing instance. When a RIB is deleted, all routes installed in the RIB will be deleted. A rib-name is passed as the input parameter. The output is the result of the delete operation:

o 加强筋删除:从布线实例中删除加强筋。删除加强筋后,将删除安装在加强筋中的所有管线。肋骨名称作为输入参数传递。输出是删除操作的结果:

* true - success

* 真正的成功

* false - failed (when failed, the I2RS agent may return the specific reason that caused the failure)

* false-失败(失败时,I2RS代理可能返回导致失败的特定原因)

o route-add: Add a route or a set of routes to a RIB. The following are passed as the input parameters: the name of the RIB, the route prefix(es), the route-attributes, the route-vendor-attributes, the nexthop, and the "whether to return failure details" indication. Before calling the route-add rpc, it is required to call the nh-add rpc to create and/or return the nexthop identifier. However, in situations when the nexthop already exists and the nexthop-id is known, this action is not expected. The output is a combination of the route operation states while querying the appropriate node in the data tree, which includes:

o 管线添加:向肋骨添加一条管线或一组管线。以下内容作为输入参数传递:RIB名称、路由前缀、路由属性、路由供应商属性、nexthop和“是否返回故障详细信息”指示。在调用route add rpc之前,需要调用nh add rpc来创建和/或返回nexthop标识符。但是,在nexthop已经存在并且nexthop id已知的情况下,不需要执行此操作。输出是查询数据树中相应节点时路由操作状态的组合,包括:

* success-count: the number of routes that were successfully added;

* 成功计数:成功添加的路由数;

* failed-count: the number of the routes that failed to be added; and,

* 失败计数:添加失败的路由数;和

* failure-detail: this shows the specific routes that failed to be added.

* 失败详细信息:显示未能添加的特定路由。

o route-delete: Delete a route or a set of routes from a RIB. The following are passed as the input parameters: the name of the RIB, the route prefix(es), and the "whether to return failure details" indication. The output is a combination of route operation states, which includes:

o 管线删除:从加强筋中删除一条管线或一组管线。以下内容作为输入参数传递:肋骨名称、路线前缀和“是否返回故障详细信息”指示。输出是路由操作状态的组合,包括:

* success-count: the number of routes that were successfully deleted;

* 成功计数:成功删除的路由数;

* failed-count: the number of the routes that failed to be deleted; and,

* 失败计数:删除失败的路由数;和

* failure-detail: this shows the specific routes that failed to be deleted.

* 失败详细信息:显示无法删除的特定路由。

o route-update: Update a route or a set of routes. The following are passed as the input parameters: the name of the RIB, the route prefix(es), the route-attributes, the route-vendor-attributes, or the nexthop. The match conditions can be either route prefix(es), route-attributes, route-vendor-attributes, or nexthops. The update actions include the following: update the nexthops, update the route-attributes, and update the route-vendor-attributes. The output is a combination of the route operation states, which includes:

o 路由更新:更新一条路由或一组路由。以下内容作为输入参数传递:肋骨名称、管线前缀、管线属性、管线供应商属性或下一个路径。匹配条件可以是路由前缀、路由属性、路由供应商属性或下一个路径。更新操作包括以下内容:更新下一步、更新路线属性和更新路线供应商属性。输出是路由操作状态的组合,包括:

* success-count: the number of routes that were successfully updated;

* 成功计数:成功更新的路由数;

* failed-count: the number of the routes that failed to be updated; and,

* 失败计数:更新失败的路由数;和

* failure-detail: this shows the specific routes that failed to be updated.

* 失败详细信息:显示未能更新的特定路由。

o nh-add: Add a nexthop to a RIB. The following are passed as the input parameters: the name of the RIB and the nexthop. The network node is required to allocate a nexthop identifier to the nexthop. The outputs include the result of the nexthop add operation.

o nh添加:将下一个添加到肋骨。以下内容作为输入参数传递:肋骨的名称和下一个顶点。网络节点需要为nexthop分配nexthop标识符。输出包括nexthop add操作的结果。

* true - success (when success, a nexthop identifier will be returned to the I2RS client)

* true-成功(成功时,将向I2RS客户端返回下一个THOP标识符)

* false - failed (when failed, the I2RS agent may return the specific reason that caused the failure)

* false-失败(失败时,I2RS代理可能返回导致失败的特定原因)

o nh-delete: Delete a nexthop from a RIB. The following are passed as the input parameters: the name of the RIB and a nexthop or nexthop identifier. The output is the result of the delete operation:

o nh delete:从肋骨中删除下一个顶点。以下内容作为输入参数传递:肋骨的名称和nexthop或nexthop标识符。输出是删除操作的结果:

* true - success

* 真正的成功

* false - failed (when failed, the I2RS agent may return the specific reason that caused the failure)

* false-失败(失败时,I2RS代理可能返回导致失败的特定原因)

The structure tree of rpcs is shown in following figure.

rpcs的结构树如下图所示。

   rpcs:
      +---x rib-add
      |  +---w input
      |  |  +---w rib-name        string
      |  |  +---w address-family      address-family-definition
      |  |  +---w ip-rpf-check?   boolean
      |  +--ro output
      |     +--ro result uint32
      |     +--ro reason? string
      +---x rib-delete
      |  +---w input
      |  |  +---w rib-name string
      |  +--ro output
      |     +--ro result uint32
      |     +--ro reason? string
      +---x route-add
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-delete
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
        
   rpcs:
      +---x rib-add
      |  +---w input
      |  |  +---w rib-name        string
      |  |  +---w address-family      address-family-definition
      |  |  +---w ip-rpf-check?   boolean
      |  +--ro output
      |     +--ro result uint32
      |     +--ro reason? string
      +---x rib-delete
      |  +---w input
      |  |  +---w rib-name string
      |  +--ro output
      |     +--ro result uint32
      |     +--ro reason? string
      +---x route-add
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x route-delete
      |  +---w input
      |  |  +---w return-failure-detail?   boolean
      |  |  +---w rib-name                 string
      |  |  +---w routes
      |  |     +---w route-list* [route-index]
      |  |        ...
      |  +--ro output
      |     +--ro success-count     uint32
      |     +--ro failed-count      uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
        
      +---x route-update
      |  +---w input
      |  |  +---w return-failure-detail?           boolean
      |  |  +---w rib-name                         string
      |  |  +---w (match-options)?
      |  |     +--:(match-route-prefix)
      |  |     |  ...
      |  |     +--:(match-route-attributes)
      |  |     |  ...
      |  |     +--:(match-route-vendor-attributes) {...}?
      |  |     |  ...
      |  |     +--:(match-nexthop)
      |  |        ...
      |  +--ro output
      |     +--ro success-count uint32
      |     +--ro failed-count uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x nh-add
      |  +---w input
      |  |  +---w rib-name              string
      |  |  +---w nexthop-id?           uint32
      |  |  +---w sharing-flag?         boolean
      |  |  +---w (nexthop-type)?
      |  |     ...
      |  +--ro output
      |     +--ro result        uint32
      |     +--ro reason?       string
      |     +--ro nexthop-id?   uint32
      +---x nh-delete
         +---w input
         |  +---w rib-name              string
         |  +---w nexthop-id?           uint32
         |  +---w sharing-flag?         boolean
         |  +---w (nexthop-type)?
         |     ...
         +--ro output
            +--ro result uint32
            +--ro reason? string
        
      +---x route-update
      |  +---w input
      |  |  +---w return-failure-detail?           boolean
      |  |  +---w rib-name                         string
      |  |  +---w (match-options)?
      |  |     +--:(match-route-prefix)
      |  |     |  ...
      |  |     +--:(match-route-attributes)
      |  |     |  ...
      |  |     +--:(match-route-vendor-attributes) {...}?
      |  |     |  ...
      |  |     +--:(match-nexthop)
      |  |        ...
      |  +--ro output
      |     +--ro success-count uint32
      |     +--ro failed-count uint32
      |     +--ro failure-detail
      |        +--ro failed-routes* [route-index]
      |           +--ro route-index uint32
      |           +--ro error-code? uint32
      +---x nh-add
      |  +---w input
      |  |  +---w rib-name              string
      |  |  +---w nexthop-id?           uint32
      |  |  +---w sharing-flag?         boolean
      |  |  +---w (nexthop-type)?
      |  |     ...
      |  +--ro output
      |     +--ro result        uint32
      |     +--ro reason?       string
      |     +--ro nexthop-id?   uint32
      +---x nh-delete
         +---w input
         |  +---w rib-name              string
         |  +---w nexthop-id?           uint32
         |  +---w sharing-flag?         boolean
         |  +---w (nexthop-type)?
         |     ...
         +--ro output
            +--ro result uint32
            +--ro reason? string
        

Figure 6: RPCs Structure

图6:RPCs结构

2.6. Notifications
2.6. 通知

Asynchronous notifications are sent by the RIB manager of a network device to an external entity when some event triggers on the network device. An implementation of this RIB data model MUST support sending two kinds of asynchronous notifications.

当网络设备上触发某些事件时,网络设备的RIB管理器会向外部实体发送异步通知。此RIB数据模型的实现必须支持发送两种异步通知。

1. Route change notification:

1. 路线更改通知:

o Installed (indicates whether the route got installed in the FIB)

o 已安装(指示路由是否已安装在FIB中)

o Active (indicates whether a route has at least one fully resolved nexthop and is therefore eligible for installation in the FIB)

o 活动(指示路由是否至少有一个完全解析的nexthop,因此有资格安装在FIB中)

o Reason (e.g., "Not authorized")

o 原因(例如,“未授权”)

2. Nexthop resolution status notification

2. 下一步解决方案状态通知

Nexthops can be fully resolved or unresolved.

下一个问题可以完全解决,也可以不解决。

A resolved nexthop has an adequate level of information to send the outgoing packet towards the destination by forwarding it on an interface to a directly connected neighbor.

解析的nexthop具有足够的信息级别,可以通过接口将传出数据包转发给直接连接的邻居,从而将其发送到目的地。

An unresolved nexthop is something that requires the RIB manager to determine the final resolved nexthop. In one example, a nexthop could be an IP address. The RIB manager would resolve how to reach that IP address, e.g., by checking if that particular IP address is reachable by regular IP forwarding, by an MPLS tunnel, or by both. If the RIB manager cannot resolve the nexthop, then the nexthop remains in an unresolved state and is NOT a suitable candidate for installation in the FIB.

未解决的下一个问题需要RIB经理确定最终解决的下一个问题。在一个示例中,nexthop可以是IP地址。RIB管理器将解决如何访问该IP地址的问题,例如,通过检查该特定IP地址是否可通过常规IP转发、MPLS隧道或两者都可访问。如果RIB管理器无法解析nexthop,则nexthop仍处于未解析状态,不适合安装在FIB中。

An implementation of this RIB data model MUST support sending route-change notifications whenever a route transitions between the following states:

此RIB数据模型的实现必须支持在路由在以下状态之间转换时发送路由更改通知:

o from the active state to the inactive state

o 从活动状态到非活动状态

o from the inactive state to the active state

o 从非活动状态到活动状态

o from the installed state to the uninstalled state

o 从已安装状态到已卸载状态

o from the uninstalled state to the installed state

o 从未安装状态到已安装状态

A single notification MAY be used when a route transitions from inactive/uninstalled to active/installed or in the other direction.

当路由从非活动/已卸载转换为活动/已安装或以其他方向转换时,可以使用单个通知。

The structure tree of notifications is shown in the following figure.

通知的结构树如下图所示。

   notifications:
        +---n nexthop-resolution-status-change
        |  +--ro nexthop
        |  |  +--ro nexthop-id            uint32
        |  |  +--ro sharing-flag          boolean
        |  |  +--ro (nexthop-type)?
        |  |     +--:(nexthop-base)
        |  |     |  ...
        |  |     +--:(nexthop-chain) {nexthop-chain}?
        |  |     |  ...
        |  |     +--:(nexthop-replicate) {nexthop-replicate}?
        |  |     |  ...
        |  |     +--:(nexthop-protection) {nexthop-protection}?
        |  |     |  ...
        |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
        |  |        ...
        |  +--ro nexthop-state nexthop-state-definition
        +---n route-change
           +--ro rib-name                 string
           +--ro address-family           address-family-definition
           +--ro route-index              uint64
           +--ro match
           |  +--ro (route-type)?
           |     +--:(ipv4)
           |     |  ...
           |     +--:(ipv6)
           |     |  ...
           |     +--:(mpls-route)
           |     |  ...
           |     +--:(mac-route)
           |     |  ...
           |     +--:(interface-route)
           |        ...
           +--ro route-installed-state route-installed-state-definition
           +--ro route-state              route-state-definition
           +--ro route-change-reason      route-change-reason-definition
        
   notifications:
        +---n nexthop-resolution-status-change
        |  +--ro nexthop
        |  |  +--ro nexthop-id            uint32
        |  |  +--ro sharing-flag          boolean
        |  |  +--ro (nexthop-type)?
        |  |     +--:(nexthop-base)
        |  |     |  ...
        |  |     +--:(nexthop-chain) {nexthop-chain}?
        |  |     |  ...
        |  |     +--:(nexthop-replicate) {nexthop-replicate}?
        |  |     |  ...
        |  |     +--:(nexthop-protection) {nexthop-protection}?
        |  |     |  ...
        |  |     +--:(nexthop-load-balance) {nexthop-load-balance}?
        |  |        ...
        |  +--ro nexthop-state nexthop-state-definition
        +---n route-change
           +--ro rib-name                 string
           +--ro address-family           address-family-definition
           +--ro route-index              uint64
           +--ro match
           |  +--ro (route-type)?
           |     +--:(ipv4)
           |     |  ...
           |     +--:(ipv6)
           |     |  ...
           |     +--:(mpls-route)
           |     |  ...
           |     +--:(mac-route)
           |     |  ...
           |     +--:(interface-route)
           |        ...
           +--ro route-installed-state route-installed-state-definition
           +--ro route-state              route-state-definition
           +--ro route-change-reason      route-change-reason-definition
        

Figure 7: Notifications Structure

图7:通知结构

3. YANG Module
3. 阳模

This YANG module references [RFC2784], [RFC7348], [RFC7637], and [RFC8344].

该模块参考[RFC2784]、[RFC7348]、[RFC7637]和[RFC8344]。

   <CODE BEGINS> file "ietf-i2rs-rib@2018-09-13.yang"
        
   <CODE BEGINS> file "ietf-i2rs-rib@2018-09-13.yang"
        
   module ietf-i2rs-rib {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-i2rs-rib";
     prefix iir;
        
   module ietf-i2rs-rib {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-i2rs-rib";
     prefix iir;
        
     import ietf-inet-types {
       prefix inet;
       reference "RFC 6991";
     }
     import ietf-interfaces {
       prefix if;
       reference "RFC 8344";
     }
     import ietf-yang-types {
       prefix yang;
       reference "RFC 6991";
     }
        
     import ietf-inet-types {
       prefix inet;
       reference "RFC 6991";
     }
     import ietf-interfaces {
       prefix if;
       reference "RFC 8344";
     }
     import ietf-yang-types {
       prefix yang;
       reference "RFC 6991";
     }
        
     organization
       "IETF I2RS (Interface to Routing System) Working Group";
     contact
       "WG Web:   <https://datatracker.ietf.org/wg/i2rs/>
        WG List:  <mailto:i2rs@ietf.org>
        
     organization
       "IETF I2RS (Interface to Routing System) Working Group";
     contact
       "WG Web:   <https://datatracker.ietf.org/wg/i2rs/>
        WG List:  <mailto:i2rs@ietf.org>
        
        Editor:   Lixing Wang
                  <mailto:wang_little_star@sina.com>
        
        Editor:   Lixing Wang
                  <mailto:wang_little_star@sina.com>
        
        Editor:   Mach(Guoyi) Chen
                  <mailto:mach.chen@huawei.com>
        
        Editor:   Mach(Guoyi) Chen
                  <mailto:mach.chen@huawei.com>
        
        Editor:   Amit Dass
                  <mailto:dass.amit@gmail.com>
        
        Editor:   Amit Dass
                  <mailto:dass.amit@gmail.com>
        
        Editor:   Hariharan Ananthakrishnan
                  <mailto:hari@netflix.com>
        
        Editor:   Hariharan Ananthakrishnan
                  <mailto:hari@netflix.com>
        
        Editor:   Sriganesh Kini
                  <mailto:sriganeshkini@gmail.com>
        
        Editor:   Sriganesh Kini
                  <mailto:sriganeshkini@gmail.com>
        
        Editor:   Nitin Bahadur
                  <mailto:nitin_bahadur@yahoo.com>";
        
        Editor:   Nitin Bahadur
                  <mailto:nitin_bahadur@yahoo.com>";
        

description "This module defines a YANG data model for Routing Information Base (RIB) that aligns with the I2RS RIB information model.

description“该模块为路由信息库(RIB)定义了一个与I2RS RIB信息模型一致的数据模型。

Copyright (c) 2018 IETF Trust and the persons identified as authors of the code. All rights reserved.

版权所有(c)2018 IETF信托基金和被确定为代码作者的人员。版权所有。

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).

根据IETF信托有关IETF文件的法律规定第4.c节规定的简化BSD许可证中包含的许可条款,允许以源代码和二进制格式重新分发和使用,无论是否修改(http://trustee.ietf.org/license-info).

This version of this YANG module is part of RFC 8341; see the RFC itself for full legal notices.";

该模块的此版本是RFC 8341的一部分;有关完整的法律通知,请参见RFC本身。“;

     revision 2018-09-13 {
       description
         "initial revision";
       reference "RFC 8431";
     }
        
     revision 2018-09-13 {
       description
         "initial revision";
       reference "RFC 8431";
     }
        

//Features

//特征

     feature nexthop-tunnel {
       description
         "This feature means that a node supports
          tunnel nexthop capability.";
     }
        
     feature nexthop-tunnel {
       description
         "This feature means that a node supports
          tunnel nexthop capability.";
     }
        
     feature nexthop-chain {
       description
         "This feature means that a node supports
          chain nexthop capability.";
     }
        
     feature nexthop-chain {
       description
         "This feature means that a node supports
          chain nexthop capability.";
     }
        
     feature nexthop-protection {
       description
         "This feature means that a node supports
          protection nexthop capability.";
     }
        
     feature nexthop-protection {
       description
         "This feature means that a node supports
          protection nexthop capability.";
     }
        
     feature nexthop-replicate {
       description
         "This feature means that a node supports
          replicate nexthop capability.";
        
     feature nexthop-replicate {
       description
         "This feature means that a node supports
          replicate nexthop capability.";
        

}

}

     feature nexthop-load-balance {
       description
         "This feature means that a node supports
          load-balance nexthop capability.";
     }
        
     feature nexthop-load-balance {
       description
         "This feature means that a node supports
          load-balance nexthop capability.";
     }
        
     feature ipv4-tunnel {
       description
         "This feature means that a node supports
          IPv4 tunnel encapsulation capability.";
     }
        
     feature ipv4-tunnel {
       description
         "This feature means that a node supports
          IPv4 tunnel encapsulation capability.";
     }
        
     feature ipv6-tunnel {
       description
         "This feature means that a node supports
          IPv6 tunnel encapsulation capability.";
     }
        
     feature ipv6-tunnel {
       description
         "This feature means that a node supports
          IPv6 tunnel encapsulation capability.";
     }
        
     feature mpls-tunnel {
       description
         "This feature means that a node supports
          MPLS tunnel encapsulation capability.";
     }
        
     feature mpls-tunnel {
       description
         "This feature means that a node supports
          MPLS tunnel encapsulation capability.";
     }
        
     feature vxlan-tunnel {
       description
         "This feature means that a node supports
          Virtual eXtensible Local Area Network
          (VXLAN) tunnel encapsulation capability.";
       reference "RFC 7348";
     }
        
     feature vxlan-tunnel {
       description
         "This feature means that a node supports
          Virtual eXtensible Local Area Network
          (VXLAN) tunnel encapsulation capability.";
       reference "RFC 7348";
     }
        
     feature gre-tunnel {
       description
         "This feature means that a node supports
          GRE tunnel encapsulation capability.";
       reference "RFC 2784";
     }
        
     feature gre-tunnel {
       description
         "This feature means that a node supports
          GRE tunnel encapsulation capability.";
       reference "RFC 2784";
     }
        
     feature nvgre-tunnel {
       description
         "This feature means that a node supports
          Network Virtualization Using GRE (NVGRE)
          tunnel encapsulation capability.";
       reference "RFC 7637";
     }
        
     feature nvgre-tunnel {
       description
         "This feature means that a node supports
          Network Virtualization Using GRE (NVGRE)
          tunnel encapsulation capability.";
       reference "RFC 7637";
     }
        
     feature route-vendor-attributes {
       description
         "This feature means that a node supports
          route vendor attributes.";
     }
        
     feature route-vendor-attributes {
       description
         "This feature means that a node supports
          route vendor attributes.";
     }
        

//Identities and Type Definitions

//标识和类型定义

identity mpls-label-action { description "Base identity from which all MPLS label operations are derived.

标识mpls标签操作{description“派生所有mpls标签操作的基本标识。

          The MPLS label stack operations include:
          push - to add a new label to a label stack
          pop -  to pop the top label from a label stack
          swap - to exchange the top label of a label
                 stack with a new label";
     }
        
          The MPLS label stack operations include:
          push - to add a new label to a label stack
          pop -  to pop the top label from a label stack
          swap - to exchange the top label of a label
                 stack with a new label";
     }
        
     identity label-push {
       base mpls-label-action;
       description
         "MPLS label stack operation: push.";
     }
        
     identity label-push {
       base mpls-label-action;
       description
         "MPLS label stack operation: push.";
     }
        
     identity label-pop {
       base mpls-label-action;
       description
         "MPLS label stack operation: pop.";
     }
        
     identity label-pop {
       base mpls-label-action;
       description
         "MPLS label stack operation: pop.";
     }
        
     identity label-swap {
       base mpls-label-action;
       description
         "MPLS label stack operation: swap.";
     }
        
     identity label-swap {
       base mpls-label-action;
       description
         "MPLS label stack operation: swap.";
     }
        
     typedef mpls-label-action-definition {
       type identityref {
         base mpls-label-action;
       }
       description
         "MPLS label action definition.";
     }
        
     typedef mpls-label-action-definition {
       type identityref {
         base mpls-label-action;
       }
       description
         "MPLS label action definition.";
     }
        

identity tunnel-decapsulation-action { description

标识隧道解除封装操作{说明

         "Base identity from which all tunnel decapsulation
          actions are derived.
          Tunnel decapsulation actions include
          ipv4-decapsulation (to decapsulate an IPv4 tunnel)
          ipv6-decapsulation (to decapsulate an IPv6 tunnel)";
     }
        
         "Base identity from which all tunnel decapsulation
          actions are derived.
          Tunnel decapsulation actions include
          ipv4-decapsulation (to decapsulate an IPv4 tunnel)
          ipv6-decapsulation (to decapsulate an IPv6 tunnel)";
     }
        
     identity ipv4-decapsulation {
       base tunnel-decapsulation-action;
       description
         "IPv4 tunnel decapsulation.";
     }
        
     identity ipv4-decapsulation {
       base tunnel-decapsulation-action;
       description
         "IPv4 tunnel decapsulation.";
     }
        
     identity ipv6-decapsulation {
       base tunnel-decapsulation-action;
       description
         "IPv6 tunnel decapsulation.";
     }
        
     identity ipv6-decapsulation {
       base tunnel-decapsulation-action;
       description
         "IPv6 tunnel decapsulation.";
     }
        
     typedef tunnel-decapsulation-action-definition {
       type identityref {
         base tunnel-decapsulation-action;
       }
       description
         "Tunnel decapsulation definition.";
     }
        
     typedef tunnel-decapsulation-action-definition {
       type identityref {
         base tunnel-decapsulation-action;
       }
       description
         "Tunnel decapsulation definition.";
     }
        
     identity ttl-action {
       description
         "Base identity from which all TTL
          actions are derived.";
     }
        
     identity ttl-action {
       description
         "Base identity from which all TTL
          actions are derived.";
     }
        
     identity no-action {
       base ttl-action;
       description
         "Do nothing regarding the TTL.";
     }
        
     identity no-action {
       base ttl-action;
       description
         "Do nothing regarding the TTL.";
     }
        
     identity copy-to-inner {
       base ttl-action;
       description
         "Copy the TTL of the outer header
          to the inner header.";
     }
        
     identity copy-to-inner {
       base ttl-action;
       description
         "Copy the TTL of the outer header
          to the inner header.";
     }
        
     identity decrease-and-copy-to-inner {
       base ttl-action;
        
     identity decrease-and-copy-to-inner {
       base ttl-action;
        
       description
         "Decrease TTL by one and copy the TTL
          to the inner header.";
     }
        
       description
         "Decrease TTL by one and copy the TTL
          to the inner header.";
     }
        
     identity decrease-and-copy-to-next {
       base ttl-action;
       description
         "Decrease TTL by one and copy the TTL
          to the next header; for example, when
          MPLS label swapping, decrease the TTL
          of the in_label and copy it to the
          out_label.";
     }
        
     identity decrease-and-copy-to-next {
       base ttl-action;
       description
         "Decrease TTL by one and copy the TTL
          to the next header; for example, when
          MPLS label swapping, decrease the TTL
          of the in_label and copy it to the
          out_label.";
     }
        
     typedef ttl-action-definition {
       type identityref {
         base ttl-action;
       }
       description
         "TTL action definition.";
     }
        
     typedef ttl-action-definition {
       type identityref {
         base ttl-action;
       }
       description
         "TTL action definition.";
     }
        
     identity hop-limit-action {
       description
         "Base identity from which all hop limit
          actions are derived.";
     }
        
     identity hop-limit-action {
       description
         "Base identity from which all hop limit
          actions are derived.";
     }
        
     identity hop-limit-no-action {
       base hop-limit-action;
       description
         "Do nothing regarding the hop limit.";
     }
        
     identity hop-limit-no-action {
       base hop-limit-action;
       description
         "Do nothing regarding the hop limit.";
     }
        
     identity hop-limit-copy-to-inner {
       base hop-limit-action;
       description
         "Copy the hop limit of the outer header
          to the inner header.";
     }
        
     identity hop-limit-copy-to-inner {
       base hop-limit-action;
       description
         "Copy the hop limit of the outer header
          to the inner header.";
     }
        
     typedef hop-limit-action-definition {
       type identityref {
         base hop-limit-action;
       }
       description
         "IPv6 hop limit action definition.";
        
     typedef hop-limit-action-definition {
       type identityref {
         base hop-limit-action;
       }
       description
         "IPv6 hop limit action definition.";
        

}

}

     identity special-nexthop {
       description
         "Base identity from which all special
          nexthops are derived.";
     }
        
     identity special-nexthop {
       description
         "Base identity from which all special
          nexthops are derived.";
     }
        
     identity discard {
       base special-nexthop;
       description
         "This indicates that the network
          device should drop the packet and
          increment a drop counter.";
     }
        
     identity discard {
       base special-nexthop;
       description
         "This indicates that the network
          device should drop the packet and
          increment a drop counter.";
     }
        
     identity discard-with-error {
       base special-nexthop;
       description
         "This indicates that the network
          device should drop the packet,
          increment a drop counter, and send
          back an appropriate error message
          (like ICMP error).";
     }
        
     identity discard-with-error {
       base special-nexthop;
       description
         "This indicates that the network
          device should drop the packet,
          increment a drop counter, and send
          back an appropriate error message
          (like ICMP error).";
     }
        
     identity receive {
       base special-nexthop;
       description
         "This indicates that the traffic is
          destined for the network device, e.g.,
          protocol packets or Operations,
          Administration, and Maintenance (OAM) packets.
          All locally destined traffic SHOULD be
          throttled to avoid a denial-of-service
          attack on the router's control plane.  An
          optional rate-limiter can be specified
          to indicate how to throttle traffic
          destined for the control plane.";
     }
        
     identity receive {
       base special-nexthop;
       description
         "This indicates that the traffic is
          destined for the network device, e.g.,
          protocol packets or Operations,
          Administration, and Maintenance (OAM) packets.
          All locally destined traffic SHOULD be
          throttled to avoid a denial-of-service
          attack on the router's control plane.  An
          optional rate-limiter can be specified
          to indicate how to throttle traffic
          destined for the control plane.";
     }
        
     identity cos-value {
       base special-nexthop;
       description
         "Cos-value special nexthop.";
     }
        
     identity cos-value {
       base special-nexthop;
       description
         "Cos-value special nexthop.";
     }
        

typedef special-nexthop-definition {

typedef特殊下一步定义{

       type identityref {
         base special-nexthop;
       }
       description
         "Special nexthop definition.";
     }
        
       type identityref {
         base special-nexthop;
       }
       description
         "Special nexthop definition.";
     }
        
     identity ip-route-match-type {
       description
         "Base identity from which all route
          match types are derived.
          The route match type could be:
          match source, or
          match destination, or
          match source and destination.";
     }
        
     identity ip-route-match-type {
       description
         "Base identity from which all route
          match types are derived.
          The route match type could be:
          match source, or
          match destination, or
          match source and destination.";
     }
        
     identity match-ip-src {
       base ip-route-match-type;
       description
         "Source route match type.";
     }
        
     identity match-ip-src {
       base ip-route-match-type;
       description
         "Source route match type.";
     }
        
     identity match-ip-dest {
       base ip-route-match-type;
       description
         "Destination route match type";
     }
        
     identity match-ip-dest {
       base ip-route-match-type;
       description
         "Destination route match type";
     }
        
     identity match-ip-src-dest {
       base ip-route-match-type;
       description
         "Source and Destination route match type";
     }
        
     identity match-ip-src-dest {
       base ip-route-match-type;
       description
         "Source and Destination route match type";
     }
        
     typedef ip-route-match-type-definition {
       type identityref {
         base ip-route-match-type;
       }
       description
         "IP route match type definition.";
     }
        
     typedef ip-route-match-type-definition {
       type identityref {
         base ip-route-match-type;
       }
       description
         "IP route match type definition.";
     }
        
     identity address-family {
       description
         "Base identity from which all RIB
          address families are derived.";
     }
        
     identity address-family {
       description
         "Base identity from which all RIB
          address families are derived.";
     }
        
     identity ipv4-address-family {
       base address-family;
       description
         "IPv4 RIB address family.";
     }
        
     identity ipv4-address-family {
       base address-family;
       description
         "IPv4 RIB address family.";
     }
        
     identity ipv6-address-family {
       base address-family;
       description
         "IPv6 RIB address family.";
     }
        
     identity ipv6-address-family {
       base address-family;
       description
         "IPv6 RIB address family.";
     }
        
     identity mpls-address-family {
       base address-family;
       description
         "MPLS RIB address family.";
     }
        
     identity mpls-address-family {
       base address-family;
       description
         "MPLS RIB address family.";
     }
        
     identity ieee-mac-address-family {
       base address-family;
       description
         "MAC RIB address family.";
     }
        
     identity ieee-mac-address-family {
       base address-family;
       description
         "MAC RIB address family.";
     }
        
     typedef address-family-definition {
       type identityref {
         base address-family;
       }
       description
         "RIB address family definition.";
     }
        
     typedef address-family-definition {
       type identityref {
         base address-family;
       }
       description
         "RIB address family definition.";
     }
        
     identity route-type {
       description
         "Base identity from which all route types
          are derived.";
     }
        
     identity route-type {
       description
         "Base identity from which all route types
          are derived.";
     }
        
     identity ipv4-route {
       base route-type;
       description
         "IPv4 route type.";
     }
        
     identity ipv4-route {
       base route-type;
       description
         "IPv4 route type.";
     }
        
     identity ipv6-route {
       base route-type;
       description
         "IPv6 route type.";
        
     identity ipv6-route {
       base route-type;
       description
         "IPv6 route type.";
        

}

}

     identity mpls-route {
       base route-type;
       description
         "MPLS route type.";
     }
        
     identity mpls-route {
       base route-type;
       description
         "MPLS route type.";
     }
        
     identity ieee-mac {
       base route-type;
       description
         "MAC route type.";
     }
        
     identity ieee-mac {
       base route-type;
       description
         "MAC route type.";
     }
        
     identity interface {
       base route-type;
       description
         "Interface route type.";
     }
        
     identity interface {
       base route-type;
       description
         "Interface route type.";
     }
        
     typedef route-type-definition {
       type identityref {
         base route-type;
       }
       description
         "Route type definition.";
     }
        
     typedef route-type-definition {
       type identityref {
         base route-type;
       }
       description
         "Route type definition.";
     }
        
     identity tunnel-type {
       description
         "Base identity from which all tunnel
          types are derived.";
     }
        
     identity tunnel-type {
       description
         "Base identity from which all tunnel
          types are derived.";
     }
        
     identity ipv4-tunnel {
       base tunnel-type;
       description
         "IPv4 tunnel type";
     }
        
     identity ipv4-tunnel {
       base tunnel-type;
       description
         "IPv4 tunnel type";
     }
        
     identity ipv6-tunnel {
       base tunnel-type;
       description
         "IPv6 tunnel type";
     }
        
     identity ipv6-tunnel {
       base tunnel-type;
       description
         "IPv6 tunnel type";
     }
        
     identity mpls-tunnel {
       base tunnel-type;
        
     identity mpls-tunnel {
       base tunnel-type;
        
       description
         "MPLS tunnel type";
     }
        
       description
         "MPLS tunnel type";
     }
        
     identity gre-tunnel {
       base tunnel-type;
       description
         "GRE tunnel type";
     }
        
     identity gre-tunnel {
       base tunnel-type;
       description
         "GRE tunnel type";
     }
        
     identity vxlan-tunnel {
       base tunnel-type;
       description
         "VXLAN tunnel type";
     }
        
     identity vxlan-tunnel {
       base tunnel-type;
       description
         "VXLAN tunnel type";
     }
        
     identity nvgre-tunnel {
       base tunnel-type;
       description
         "NVGRE tunnel type";
     }
        
     identity nvgre-tunnel {
       base tunnel-type;
       description
         "NVGRE tunnel type";
     }
        
     typedef tunnel-type-definition {
       type identityref {
         base tunnel-type;
       }
       description
         "Tunnel type definition.";
     }
        
     typedef tunnel-type-definition {
       type identityref {
         base tunnel-type;
       }
       description
         "Tunnel type definition.";
     }
        
     identity route-state {
       description
         "Base identity from which all route
          states are derived.";
     }
        
     identity route-state {
       description
         "Base identity from which all route
          states are derived.";
     }
        
     identity active {
       base route-state;
       description
         "Active state.";
     }
        
     identity active {
       base route-state;
       description
         "Active state.";
     }
        
     identity inactive {
       base route-state;
       description
         "Inactive state.";
     }
        
     identity inactive {
       base route-state;
       description
         "Inactive state.";
     }
        
     typedef route-state-definition {
       type identityref {
         base route-state;
       }
       description
         "Route state definition.";
     }
        
     typedef route-state-definition {
       type identityref {
         base route-state;
       }
       description
         "Route state definition.";
     }
        
     identity nexthop-state {
       description
         "Base identity from which all nexthop
          states are derived.";
     }
        
     identity nexthop-state {
       description
         "Base identity from which all nexthop
          states are derived.";
     }
        
     identity resolved {
       base nexthop-state;
       description
         "Resolved nexthop state.";
     }
        
     identity resolved {
       base nexthop-state;
       description
         "Resolved nexthop state.";
     }
        
     identity unresolved {
       base nexthop-state;
       description
         "Unresolved nexthop state.";
     }
        
     identity unresolved {
       base nexthop-state;
       description
         "Unresolved nexthop state.";
     }
        
     typedef nexthop-state-definition {
       type identityref {
         base nexthop-state;
       }
       description
         "Nexthop state definition.";
     }
        
     typedef nexthop-state-definition {
       type identityref {
         base nexthop-state;
       }
       description
         "Nexthop state definition.";
     }
        
     identity route-installed-state {
       description
         "Base identity from which all route
          installed states are derived.";
     }
        
     identity route-installed-state {
       description
         "Base identity from which all route
          installed states are derived.";
     }
        
     identity uninstalled {
       base route-installed-state;
       description
         "Uninstalled state.";
     }
        
     identity uninstalled {
       base route-installed-state;
       description
         "Uninstalled state.";
     }
        
     identity installed {
       base route-installed-state;
        
     identity installed {
       base route-installed-state;
        
       description
         "Installed state.";
     }
        
       description
         "Installed state.";
     }
        
     typedef route-installed-state-definition {
       type identityref {
         base route-installed-state;
       }
       description
         "Route installed state definition.";
     }
        
     typedef route-installed-state-definition {
       type identityref {
         base route-installed-state;
       }
       description
         "Route installed state definition.";
     }
        

//Route Change Reason Identities

//路由更改原因标识

     identity route-change-reason {
       description
         "Base identity from which all route change
          reasons are derived.";
     }
        
     identity route-change-reason {
       description
         "Base identity from which all route change
          reasons are derived.";
     }
        
     identity lower-route-preference {
       base route-change-reason;
       description
         "This route was installed in the FIB because it had
          a lower route preference value (and thus was more
          preferred) than the route it replaced.";
     }
        
     identity lower-route-preference {
       base route-change-reason;
       description
         "This route was installed in the FIB because it had
          a lower route preference value (and thus was more
          preferred) than the route it replaced.";
     }
        
     identity higher-route-preference {
       base route-change-reason;
       description
         "This route was uninstalled from the FIB because it had
          a higher route preference value (and thus was less
          preferred) than the route that replaced it.";
     }
        
     identity higher-route-preference {
       base route-change-reason;
       description
         "This route was uninstalled from the FIB because it had
          a higher route preference value (and thus was less
          preferred) than the route that replaced it.";
     }
        
     identity resolved-nexthop {
       base route-change-reason;
       description
         "This route was made active because at least
          one of its nexthops was resolved.";
     }
        
     identity resolved-nexthop {
       base route-change-reason;
       description
         "This route was made active because at least
          one of its nexthops was resolved.";
     }
        
     identity unresolved-nexthop {
       base route-change-reason;
       description
         "This route was made inactive because all of
          its nexthops are unresolved.";
        
     identity unresolved-nexthop {
       base route-change-reason;
       description
         "This route was made inactive because all of
          its nexthops are unresolved.";
        

}

}

     typedef route-change-reason-definition {
       type identityref {
         base route-change-reason;
       }
       description
         "Route change reason definition.";
     }
        
     typedef route-change-reason-definition {
       type identityref {
         base route-change-reason;
       }
       description
         "Route change reason definition.";
     }
        
     typedef nexthop-preference-definition {
       type uint8 {
         range "1..99";
       }
       description
         "Nexthop-preference is used for protection schemes.
          It is an integer value between 1 and 99.  Lower
          values are preferred.  To download N
          nexthops to the FIB, the N nexthops with the lowest
          value are selected.  If there are more than N
          nexthops that have the same preference, an
          implementation of the I2RS client should select N
          nexthops and download them.  As for how to select
          the nexthops, this is left to the implementations.";
     }
        
     typedef nexthop-preference-definition {
       type uint8 {
         range "1..99";
       }
       description
         "Nexthop-preference is used for protection schemes.
          It is an integer value between 1 and 99.  Lower
          values are preferred.  To download N
          nexthops to the FIB, the N nexthops with the lowest
          value are selected.  If there are more than N
          nexthops that have the same preference, an
          implementation of the I2RS client should select N
          nexthops and download them.  As for how to select
          the nexthops, this is left to the implementations.";
     }
        
     typedef nexthop-lb-weight-definition {
       type uint8 {
         range "1..99";
       }
       description
         "Nexthop-lb-weight is used for load-balancing.
          Each list member SHOULD be assigned a weight
          between 1 and 99.  The weight determines the
          proportion of traffic to be sent over a nexthop
          used for forwarding as a ratio of the weight of
          this nexthop divided by the sum of the weights
          of all the nexthops of this route that are used
          for forwarding.  To perform equal load-balancing,
          one MAY specify a weight of 0 for all the member
          nexthops.  The value 0 is reserved for equal
          load-balancing and, if applied, MUST be applied
          to all member nexthops.
          Note that the weight of 0 is special because of
          historical reasons.  It's typically used in
          hardware devices to signify ECMP.";
     }
        
     typedef nexthop-lb-weight-definition {
       type uint8 {
         range "1..99";
       }
       description
         "Nexthop-lb-weight is used for load-balancing.
          Each list member SHOULD be assigned a weight
          between 1 and 99.  The weight determines the
          proportion of traffic to be sent over a nexthop
          used for forwarding as a ratio of the weight of
          this nexthop divided by the sum of the weights
          of all the nexthops of this route that are used
          for forwarding.  To perform equal load-balancing,
          one MAY specify a weight of 0 for all the member
          nexthops.  The value 0 is reserved for equal
          load-balancing and, if applied, MUST be applied
          to all member nexthops.
          Note that the weight of 0 is special because of
          historical reasons.  It's typically used in
          hardware devices to signify ECMP.";
     }
        
     typedef nexthop-ref {
       type leafref {
         path  "/iir:routing-instance" +
               "/iir:rib-list" +
               "/iir:route-list" +
               "/iir:nexthop" +
               "/iir:nexthop-id";
       }
       description
         "A nexthop reference that provides
          an indirection reference to a nexthop.";
     }
        
     typedef nexthop-ref {
       type leafref {
         path  "/iir:routing-instance" +
               "/iir:rib-list" +
               "/iir:route-list" +
               "/iir:nexthop" +
               "/iir:nexthop-id";
       }
       description
         "A nexthop reference that provides
          an indirection reference to a nexthop.";
     }
        

//Groupings

//分组

     grouping route-prefix {
       description
         "The common attributes used for all types of route prefixes.";
       leaf route-index {
         type uint64;
         mandatory true;
         description
           "Route index.";
       }
       container match {
         description
           "The match condition specifies the
            kind of route (IPv4, MPLS, etc.)
            and the set of fields to match on.";
         choice route-type {
           description
             "Route types: IPv4, IPv6, MPLS, MAC, etc.";
           case ipv4 {
             description
               "IPv4 route case.";
             container ipv4 {
               description
                 "IPv4 route match.";
               choice ip-route-match-type {
                 description
                   "IP route match type options:
                    match source, or
                    match destination, or
                    match source and destination.";
                 case dest-ipv4-address {
                   leaf dest-ipv4-prefix {
                     type inet:ipv4-prefix;
                     mandatory true;
        
     grouping route-prefix {
       description
         "The common attributes used for all types of route prefixes.";
       leaf route-index {
         type uint64;
         mandatory true;
         description
           "Route index.";
       }
       container match {
         description
           "The match condition specifies the
            kind of route (IPv4, MPLS, etc.)
            and the set of fields to match on.";
         choice route-type {
           description
             "Route types: IPv4, IPv6, MPLS, MAC, etc.";
           case ipv4 {
             description
               "IPv4 route case.";
             container ipv4 {
               description
                 "IPv4 route match.";
               choice ip-route-match-type {
                 description
                   "IP route match type options:
                    match source, or
                    match destination, or
                    match source and destination.";
                 case dest-ipv4-address {
                   leaf dest-ipv4-prefix {
                     type inet:ipv4-prefix;
                     mandatory true;
        
                     description
                       "An IPv4 destination address as the match.";
                   }
                 }
                 case src-ipv4-address {
                   leaf src-ipv4-prefix {
                     type inet:ipv4-prefix;
                     mandatory true;
                     description
                       "An IPv4 source address as the match.";
                   }
                 }
                 case dest-src-ipv4-address {
                   container dest-src-ipv4-address {
                     description
                       "A combination of an IPv4 source and
                        an IPv4 destination address as the match.";
                     leaf dest-ipv4-prefix {
                       type inet:ipv4-prefix;
                       mandatory true;
                       description
                         "The IPv4 destination address of the match.";
                     }
                     leaf src-ipv4-prefix {
                       type inet:ipv4-prefix;
                       mandatory true;
                       description
                         "The IPv4 source address of the match.";
                     }
                   }
                 }
               }
             }
           }
           case ipv6 {
             description
               "IPv6 route case.";
             container ipv6 {
               description
                 "IPv6 route match.";
               choice ip-route-match-type {
                 description
                   "IP route match type options:
                    match source,
                    match destination, or
                    match source and destination.";
                 case dest-ipv6-address {
                   leaf dest-ipv6-prefix {
        
                     description
                       "An IPv4 destination address as the match.";
                   }
                 }
                 case src-ipv4-address {
                   leaf src-ipv4-prefix {
                     type inet:ipv4-prefix;
                     mandatory true;
                     description
                       "An IPv4 source address as the match.";
                   }
                 }
                 case dest-src-ipv4-address {
                   container dest-src-ipv4-address {
                     description
                       "A combination of an IPv4 source and
                        an IPv4 destination address as the match.";
                     leaf dest-ipv4-prefix {
                       type inet:ipv4-prefix;
                       mandatory true;
                       description
                         "The IPv4 destination address of the match.";
                     }
                     leaf src-ipv4-prefix {
                       type inet:ipv4-prefix;
                       mandatory true;
                       description
                         "The IPv4 source address of the match.";
                     }
                   }
                 }
               }
             }
           }
           case ipv6 {
             description
               "IPv6 route case.";
             container ipv6 {
               description
                 "IPv6 route match.";
               choice ip-route-match-type {
                 description
                   "IP route match type options:
                    match source,
                    match destination, or
                    match source and destination.";
                 case dest-ipv6-address {
                   leaf dest-ipv6-prefix {
        
                     type inet:ipv6-prefix;
                     mandatory true;
                     description
                       "An IPv6 destination address as the match.";
                   }
                 }
                 case src-ipv6-address {
                   leaf src-ipv6-prefix {
                     type inet:ipv6-prefix;
                     mandatory true;
                     description
                       "An IPv6 source address as the match.";
                   }
                 }
                 case dest-src-ipv6-address {
                   container dest-src-ipv6-address {
                     description
                       "A combination of an IPv6 source and
                        an IPv6 destination address as the match.";
                     leaf dest-ipv6-prefix {
                       type inet:ipv6-prefix;
                       mandatory true;
                       description
                         "The IPv6 destination address of the match.";
                     }
                     leaf src-ipv6-prefix {
                       type inet:ipv6-prefix;
                       mandatory true;
                       description
                         "The IPv6 source address of the match.";
                     }
                   }
                 }
               }
             }
           }
           case mpls-route {
             description
               "MPLS route case.";
             leaf mpls-label {
               type uint32;
               mandatory true;
               description
                 "The label used for matching.";
             }
           }
           case mac-route {
             description
        
                     type inet:ipv6-prefix;
                     mandatory true;
                     description
                       "An IPv6 destination address as the match.";
                   }
                 }
                 case src-ipv6-address {
                   leaf src-ipv6-prefix {
                     type inet:ipv6-prefix;
                     mandatory true;
                     description
                       "An IPv6 source address as the match.";
                   }
                 }
                 case dest-src-ipv6-address {
                   container dest-src-ipv6-address {
                     description
                       "A combination of an IPv6 source and
                        an IPv6 destination address as the match.";
                     leaf dest-ipv6-prefix {
                       type inet:ipv6-prefix;
                       mandatory true;
                       description
                         "The IPv6 destination address of the match.";
                     }
                     leaf src-ipv6-prefix {
                       type inet:ipv6-prefix;
                       mandatory true;
                       description
                         "The IPv6 source address of the match.";
                     }
                   }
                 }
               }
             }
           }
           case mpls-route {
             description
               "MPLS route case.";
             leaf mpls-label {
               type uint32;
               mandatory true;
               description
                 "The label used for matching.";
             }
           }
           case mac-route {
             description
        
               "MAC route case.";
             leaf mac-address {
               type yang:mac-address;
               mandatory true;
               description
                 "The MAC address used for matching.";
             }
           }
           case interface-route {
             description
               "Interface route case.";
             leaf interface-identifier {
               type if:interface-ref;
               mandatory true;
               description
                 "The interface used for matching.";
             }
           }
         }
       }
     }
        
               "MAC route case.";
             leaf mac-address {
               type yang:mac-address;
               mandatory true;
               description
                 "The MAC address used for matching.";
             }
           }
           case interface-route {
             description
               "Interface route case.";
             leaf interface-identifier {
               type if:interface-ref;
               mandatory true;
               description
                 "The interface used for matching.";
             }
           }
         }
       }
     }
        
     grouping route {
       description
         "The common attributes used for all types of routes.";
       uses route-prefix;
       container nexthop {
         description
           "The nexthop of the route.";
         uses nexthop;
       }
       //In the information model, it is called route-statistic
       container route-status {
         description
           "The status information of the route.";
         leaf route-state {
           type route-state-definition;
           config false;
           description
             "Indicate a route's state: active or inactive.";
         }
         leaf route-installed-state {
           type route-installed-state-definition;
           config false;
           description
             "Indicate that a route's installed states:
              installed or uninstalled.";
         }
        
     grouping route {
       description
         "The common attributes used for all types of routes.";
       uses route-prefix;
       container nexthop {
         description
           "The nexthop of the route.";
         uses nexthop;
       }
       //In the information model, it is called route-statistic
       container route-status {
         description
           "The status information of the route.";
         leaf route-state {
           type route-state-definition;
           config false;
           description
             "Indicate a route's state: active or inactive.";
         }
         leaf route-installed-state {
           type route-installed-state-definition;
           config false;
           description
             "Indicate that a route's installed states:
              installed or uninstalled.";
         }
        
         leaf route-reason {
           type route-change-reason-definition;
           config false;
           description
             "Indicate the reason that caused the route change.";
         }
       }
       container route-attributes {
         description
           "Route attributes.";
         uses route-attributes;
       }
       container route-vendor-attributes {
         description
           "Route vendor attributes.";
         uses route-vendor-attributes;
       }
     }
        
         leaf route-reason {
           type route-change-reason-definition;
           config false;
           description
             "Indicate the reason that caused the route change.";
         }
       }
       container route-attributes {
         description
           "Route attributes.";
         uses route-attributes;
       }
       container route-vendor-attributes {
         description
           "Route vendor attributes.";
         uses route-vendor-attributes;
       }
     }
        
     grouping nexthop-list {
       description
         "A generic nexthop list.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthops.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
       }
     }
        
     grouping nexthop-list {
       description
         "A generic nexthop list.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthops.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
       }
     }
        
     grouping nexthop-list-p {
       description
         "A nexthop list with preference parameter.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthop.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
        
     grouping nexthop-list-p {
       description
         "A nexthop list with preference parameter.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthop.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
        
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
         leaf nexthop-preference {
           type nexthop-preference-definition;
           mandatory true;
           description
             "Nexthop-preference is used for protection schemes.
              It is an integer value between 1 and 99.  Lower
              values are more preferred.  To download a
              primary/standby/tertiary group to the FIB, the
              nexthops that are resolved and are most preferred
              are selected.";
         }
       }
     }
        
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
         leaf nexthop-preference {
           type nexthop-preference-definition;
           mandatory true;
           description
             "Nexthop-preference is used for protection schemes.
              It is an integer value between 1 and 99.  Lower
              values are more preferred.  To download a
              primary/standby/tertiary group to the FIB, the
              nexthops that are resolved and are most preferred
              are selected.";
         }
       }
     }
        
     grouping nexthop-list-w {
       description
         "A nexthop list with a weight parameter.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthop.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
         leaf nexthop-lb-weight {
           type nexthop-lb-weight-definition;
           mandatory true;
           description
             "The weight of a nexthop of
              the load-balance nexthops.";
         }
       }
     }
        
     grouping nexthop-list-w {
       description
         "A nexthop list with a weight parameter.";
       list nexthop-list {
         key "nexthop-member-id";
         description
           "A list of nexthop.";
         leaf nexthop-member-id {
           type uint32;
           mandatory true;
           description
             "A nexthop identifier that points
              to a nexthop list member.
              A nexthop list member is a nexthop.";
         }
         leaf nexthop-lb-weight {
           type nexthop-lb-weight-definition;
           mandatory true;
           description
             "The weight of a nexthop of
              the load-balance nexthops.";
         }
       }
     }
        
     grouping nexthop {
       description
         "The nexthop structure.";
       leaf nexthop-id {
         type uint32;
        
     grouping nexthop {
       description
         "The nexthop structure.";
       leaf nexthop-id {
         type uint32;
        
         description
           "An identifier that refers to a nexthop.";
       }
       leaf sharing-flag {
         type boolean;
         description
           "To indicate whether a nexthop is sharable
            or non-sharable:
            true  - sharable (which means the nexthop can be
                    shared with other routes)
            false - non-sharable (which means the nexthop can
                    not be shared with other routes)";
       }
       choice nexthop-type {
         description
           "Nexthop type options.";
         case nexthop-base {
           container nexthop-base {
             description
               "The base nexthop.";
             uses nexthop-base;
           }
         }
         case nexthop-chain {
           if-feature "nexthop-chain";
           container nexthop-chain {
             description
               "A chain nexthop.";
             uses nexthop-list;
           }
         }
         case nexthop-replicate {
           if-feature "nexthop-replicate";
           container nexthop-replicate {
             description
               "A replicate nexthop.";
             uses nexthop-list;
           }
         }
         case nexthop-protection {
           if-feature "nexthop-protection";
           container nexthop-protection {
             description
               "A protection nexthop.";
             uses nexthop-list-p;
           }
         }
         case nexthop-load-balance {
        
         description
           "An identifier that refers to a nexthop.";
       }
       leaf sharing-flag {
         type boolean;
         description
           "To indicate whether a nexthop is sharable
            or non-sharable:
            true  - sharable (which means the nexthop can be
                    shared with other routes)
            false - non-sharable (which means the nexthop can
                    not be shared with other routes)";
       }
       choice nexthop-type {
         description
           "Nexthop type options.";
         case nexthop-base {
           container nexthop-base {
             description
               "The base nexthop.";
             uses nexthop-base;
           }
         }
         case nexthop-chain {
           if-feature "nexthop-chain";
           container nexthop-chain {
             description
               "A chain nexthop.";
             uses nexthop-list;
           }
         }
         case nexthop-replicate {
           if-feature "nexthop-replicate";
           container nexthop-replicate {
             description
               "A replicate nexthop.";
             uses nexthop-list;
           }
         }
         case nexthop-protection {
           if-feature "nexthop-protection";
           container nexthop-protection {
             description
               "A protection nexthop.";
             uses nexthop-list-p;
           }
         }
         case nexthop-load-balance {
        
           if-feature "nexthop-load-balance";
           container nexthop-lb {
             description
               "A load-balance nexthop.";
             uses nexthop-list-w;
           }
         }
       }
     }
        
           if-feature "nexthop-load-balance";
           container nexthop-lb {
             description
               "A load-balance nexthop.";
             uses nexthop-list-w;
           }
         }
       }
     }
        
     grouping nexthop-base {
       description
         "The base nexthop.";
       choice nexthop-base-type {
         description
           "Nexthop base type options.";
         case special-nexthop {
           leaf special {
             type special-nexthop-definition;
             description
               "A special nexthop.";
           }
         }
         case egress-interface-nexthop {
           leaf outgoing-interface {
             type if:interface-ref;
             mandatory true;
             description
               "The nexthop is an outgoing interface.";
           }
         }
         case ipv4-address-nexthop {
           leaf ipv4-address {
             type inet:ipv4-address;
             mandatory true;
             description
               "The nexthop is an IPv4 address.";
           }
         }
         case ipv6-address-nexthop {
           leaf ipv6-address {
             type inet:ipv6-address;
             mandatory true;
             description
               "The nexthop is an IPv6 address.";
           }
         }
         case egress-interface-ipv4-nexthop {
        
     grouping nexthop-base {
       description
         "The base nexthop.";
       choice nexthop-base-type {
         description
           "Nexthop base type options.";
         case special-nexthop {
           leaf special {
             type special-nexthop-definition;
             description
               "A special nexthop.";
           }
         }
         case egress-interface-nexthop {
           leaf outgoing-interface {
             type if:interface-ref;
             mandatory true;
             description
               "The nexthop is an outgoing interface.";
           }
         }
         case ipv4-address-nexthop {
           leaf ipv4-address {
             type inet:ipv4-address;
             mandatory true;
             description
               "The nexthop is an IPv4 address.";
           }
         }
         case ipv6-address-nexthop {
           leaf ipv6-address {
             type inet:ipv6-address;
             mandatory true;
             description
               "The nexthop is an IPv6 address.";
           }
         }
         case egress-interface-ipv4-nexthop {
        
           container egress-interface-ipv4-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
             }
             leaf ipv4-address {
               type inet:ipv4-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  an IPv4 address.";
             }
             description
               "The nexthop is an egress-interface and an IP
                address.  This can be used in cases where, e.g.,
                the IP address is a link-local address.";
           }
         }
         case egress-interface-ipv6-nexthop {
           container egress-interface-ipv6-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
             }
             leaf ipv6-address {
               type inet:ipv6-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  an IPv6 address.";
             }
             description
               "The nexthop is an egress-interface and an IP
                address.  This can be used in cases where, e.g.,
                the IP address is a link-local address.";
           }
         }
         case egress-interface-mac-nexthop {
           container egress-interface-mac-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
        
           container egress-interface-ipv4-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
             }
             leaf ipv4-address {
               type inet:ipv4-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  an IPv4 address.";
             }
             description
               "The nexthop is an egress-interface and an IP
                address.  This can be used in cases where, e.g.,
                the IP address is a link-local address.";
           }
         }
         case egress-interface-ipv6-nexthop {
           container egress-interface-ipv6-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
             }
             leaf ipv6-address {
               type inet:ipv6-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  an IPv6 address.";
             }
             description
               "The nexthop is an egress-interface and an IP
                address.  This can be used in cases where, e.g.,
                the IP address is a link-local address.";
           }
         }
         case egress-interface-mac-nexthop {
           container egress-interface-mac-address {
             leaf outgoing-interface {
               type if:interface-ref;
               mandatory true;
               description
                 "Name of the outgoing interface.";
        
             }
             leaf ieee-mac-address {
               type yang:mac-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  a specific MAC address.";
             }
             description
               "The egress-interface must be an Ethernet
                interface.  Address resolution is not required
                for this nexthop.";
           }
         }
         case tunnel-encapsulation-nexthop {
           if-feature "nexthop-tunnel";
           container tunnel-encapsulation {
             uses tunnel-encapsulation;
             description
               "This can be an encapsulation representing an IP
                tunnel, MPLS tunnel, or others as defined in the info
                model.  An optional egress-interface can be chained
                to the tunnel encapsulation to indicate which
                interface to send the packet out on.  The
                egress-interface is useful when the network device
                contains Ethernet interfaces and one needs to
                perform address resolution for the IP packet.";
           }
         }
         case tunnel-decapsulation-nexthop {
           if-feature "nexthop-tunnel";
           container tunnel-decapsulation {
             uses tunnel-decapsulation;
             description
               "This is to specify the decapsulation of a tunnel
                header.";
           }
         }
         case logical-tunnel-nexthop {
           if-feature "nexthop-tunnel";
           container logical-tunnel {
             uses logical-tunnel;
             description
               "This can be an MPLS Label Switched Path (LSP)
                or a GRE tunnel (or others as defined in this
                document) that is represented by a unique
                identifier (e.g., name).";
           }
        
             }
             leaf ieee-mac-address {
               type yang:mac-address;
               mandatory true;
               description
                 "The nexthop points to an interface with
                  a specific MAC address.";
             }
             description
               "The egress-interface must be an Ethernet
                interface.  Address resolution is not required
                for this nexthop.";
           }
         }
         case tunnel-encapsulation-nexthop {
           if-feature "nexthop-tunnel";
           container tunnel-encapsulation {
             uses tunnel-encapsulation;
             description
               "This can be an encapsulation representing an IP
                tunnel, MPLS tunnel, or others as defined in the info
                model.  An optional egress-interface can be chained
                to the tunnel encapsulation to indicate which
                interface to send the packet out on.  The
                egress-interface is useful when the network device
                contains Ethernet interfaces and one needs to
                perform address resolution for the IP packet.";
           }
         }
         case tunnel-decapsulation-nexthop {
           if-feature "nexthop-tunnel";
           container tunnel-decapsulation {
             uses tunnel-decapsulation;
             description
               "This is to specify the decapsulation of a tunnel
                header.";
           }
         }
         case logical-tunnel-nexthop {
           if-feature "nexthop-tunnel";
           container logical-tunnel {
             uses logical-tunnel;
             description
               "This can be an MPLS Label Switched Path (LSP)
                or a GRE tunnel (or others as defined in this
                document) that is represented by a unique
                identifier (e.g., name).";
           }
        
         }
         case rib-name-nexthop {
           leaf rib-name {
             type string;
             description
               "A nexthop pointing to a RIB indicates that the
                route lookup needs to continue in the specified
                RIB.  This is a way to perform chained lookups.";
           }
         }
         case nexthop-identifier {
           leaf nexthop-ref {
             type nexthop-ref;
             mandatory true;
             description
               "A nexthop reference that points to a nexthop.";
           }
         }
       }
     }
        
         }
         case rib-name-nexthop {
           leaf rib-name {
             type string;
             description
               "A nexthop pointing to a RIB indicates that the
                route lookup needs to continue in the specified
                RIB.  This is a way to perform chained lookups.";
           }
         }
         case nexthop-identifier {
           leaf nexthop-ref {
             type nexthop-ref;
             mandatory true;
             description
               "A nexthop reference that points to a nexthop.";
           }
         }
       }
     }
        
     grouping route-vendor-attributes {
       description
         "Route vendor attributes.";
     }
        
     grouping route-vendor-attributes {
       description
         "Route vendor attributes.";
     }
        
     grouping logical-tunnel {
       description
         "A logical tunnel that is identified
          by a type and a tunnel name.";
       leaf tunnel-type {
         type tunnel-type-definition;
         mandatory true;
         description
           "A tunnel type.";
       }
       leaf tunnel-name {
         type string;
         mandatory true;
         description
           "A tunnel name that points to a logical tunnel.";
       }
     }
        
     grouping logical-tunnel {
       description
         "A logical tunnel that is identified
          by a type and a tunnel name.";
       leaf tunnel-type {
         type tunnel-type-definition;
         mandatory true;
         description
           "A tunnel type.";
       }
       leaf tunnel-name {
         type string;
         mandatory true;
         description
           "A tunnel name that points to a logical tunnel.";
       }
     }
        
     grouping ipv4-header {
       description
         "The IPv4 header encapsulation information.";
       leaf src-ipv4-address {
        
     grouping ipv4-header {
       description
         "The IPv4 header encapsulation information.";
       leaf src-ipv4-address {
        
         type inet:ipv4-address;
         mandatory true;
         description
           "The source IP address of the header.";
       }
       leaf dest-ipv4-address {
         type inet:ipv4-address;
         mandatory true;
         description
           "The destination IP address of the header.";
       }
       leaf protocol {
         type uint8;
         mandatory true;
         description
           "The protocol id of the header.";
       }
       leaf ttl {
         type uint8;
         description
           "The TTL of the header.";
       }
       leaf dscp {
         type uint8;
         description
           "The Differentiated Services Code Point
            (DSCP) field of the header.";
       }
     }
        
         type inet:ipv4-address;
         mandatory true;
         description
           "The source IP address of the header.";
       }
       leaf dest-ipv4-address {
         type inet:ipv4-address;
         mandatory true;
         description
           "The destination IP address of the header.";
       }
       leaf protocol {
         type uint8;
         mandatory true;
         description
           "The protocol id of the header.";
       }
       leaf ttl {
         type uint8;
         description
           "The TTL of the header.";
       }
       leaf dscp {
         type uint8;
         description
           "The Differentiated Services Code Point
            (DSCP) field of the header.";
       }
     }
        
     grouping ipv6-header {
       description
         "The IPv6 header encapsulation information.";
       leaf src-ipv6-address {
         type inet:ipv6-address;
         mandatory true;
         description
           "The source IP address of the header.";
       }
       leaf dest-ipv6-address {
         type inet:ipv6-address;
         mandatory true;
         description
           "The destination IP address of the header.";
       }
       leaf next-header {
         type uint8;
         mandatory true;
        
     grouping ipv6-header {
       description
         "The IPv6 header encapsulation information.";
       leaf src-ipv6-address {
         type inet:ipv6-address;
         mandatory true;
         description
           "The source IP address of the header.";
       }
       leaf dest-ipv6-address {
         type inet:ipv6-address;
         mandatory true;
         description
           "The destination IP address of the header.";
       }
       leaf next-header {
         type uint8;
         mandatory true;
        
         description
           "The next header of the IPv6 header.";
       }
       leaf traffic-class {
         type uint8;
         description
           "The traffic class value of the header.";
       }
       leaf flow-label {
         type inet:ipv6-flow-label;
         description
           "The flow label of the header.";
       }
       leaf hop-limit {
         type uint8 {
           range "1..255";
         }
         description
           "The hop limit of the header.";
       }
     }
        
         description
           "The next header of the IPv6 header.";
       }
       leaf traffic-class {
         type uint8;
         description
           "The traffic class value of the header.";
       }
       leaf flow-label {
         type inet:ipv6-flow-label;
         description
           "The flow label of the header.";
       }
       leaf hop-limit {
         type uint8 {
           range "1..255";
         }
         description
           "The hop limit of the header.";
       }
     }
        
     grouping nvgre-header {
       description
         "The NVGRE header encapsulation information.";
       choice nvgre-type {
         description
           "NVGRE can use either an IPv4
            or an IPv6 header for encapsulation.";
         case ipv4 {
           uses ipv4-header;
         }
         case ipv6 {
           uses ipv6-header;
         }
       }
       leaf virtual-subnet-id {
         type uint32;
         mandatory true;
         description
           "The subnet identifier of the NVGRE header.";
       }
       leaf flow-id {
         type uint8;
         description
           "The flow identifier of the NVGRE header.";
       }
     }
        
     grouping nvgre-header {
       description
         "The NVGRE header encapsulation information.";
       choice nvgre-type {
         description
           "NVGRE can use either an IPv4
            or an IPv6 header for encapsulation.";
         case ipv4 {
           uses ipv4-header;
         }
         case ipv6 {
           uses ipv6-header;
         }
       }
       leaf virtual-subnet-id {
         type uint32;
         mandatory true;
         description
           "The subnet identifier of the NVGRE header.";
       }
       leaf flow-id {
         type uint8;
         description
           "The flow identifier of the NVGRE header.";
       }
     }
        
     grouping vxlan-header {
       description
         "The VXLAN encapsulation header information.";
       choice vxlan-type {
         description
           "NVGRE can use either an IPv4
            or an IPv6 header for encapsulation.";
         case ipv4 {
           uses ipv4-header;
         }
         case ipv6 {
           uses ipv6-header;
         }
       }
       leaf vxlan-identifier {
         type uint32;
         mandatory true;
         description
           "The VXLAN identifier of the VXLAN header.";
       }
     }
        
     grouping vxlan-header {
       description
         "The VXLAN encapsulation header information.";
       choice vxlan-type {
         description
           "NVGRE can use either an IPv4
            or an IPv6 header for encapsulation.";
         case ipv4 {
           uses ipv4-header;
         }
         case ipv6 {
           uses ipv6-header;
         }
       }
       leaf vxlan-identifier {
         type uint32;
         mandatory true;
         description
           "The VXLAN identifier of the VXLAN header.";
       }
     }
        
     grouping gre-header {
       description
         "The GRE encapsulation header information.";
       choice dest-address-type {
         description
           "GRE options: IPv4 and IPv6";
         case ipv4 {
           leaf ipv4-dest {
             type inet:ipv4-address;
             mandatory true;
             description
               "The destination IP address of the GRE header.";
           }
         }
         case ipv6 {
           leaf ipv6-dest {
             type inet:ipv6-address;
             mandatory true;
             description
               "The destination IP address of the GRE header.";
           }
         }
       }
       leaf protocol-type {
         type uint16;
         mandatory true;
        
     grouping gre-header {
       description
         "The GRE encapsulation header information.";
       choice dest-address-type {
         description
           "GRE options: IPv4 and IPv6";
         case ipv4 {
           leaf ipv4-dest {
             type inet:ipv4-address;
             mandatory true;
             description
               "The destination IP address of the GRE header.";
           }
         }
         case ipv6 {
           leaf ipv6-dest {
             type inet:ipv6-address;
             mandatory true;
             description
               "The destination IP address of the GRE header.";
           }
         }
       }
       leaf protocol-type {
         type uint16;
         mandatory true;
        
         description
           "The protocol type of the GRE header.";
       }
       leaf key {
         type uint64;
         description
           "The GRE key of the GRE header.";
       }
     }
        
         description
           "The protocol type of the GRE header.";
       }
       leaf key {
         type uint64;
         description
           "The GRE key of the GRE header.";
       }
     }
        
     grouping mpls-header {
       description
         "The MPLS encapsulation header information.";
       list label-operations {
         key "label-oper-id";
         description
           "Label operations.";
         leaf label-oper-id {
           type uint32;
           description
             "An optional identifier that points
              to a label operation.";
         }
         choice label-actions {
           description
             "Label action options.";
           case label-push {
             container label-push {
               description
                 "Label push operation.";
               leaf label {
                 type uint32;
                 mandatory true;
                 description
                   "The label to be pushed.";
               }
               leaf s-bit {
                 type boolean;
                 description
                   "The s-bit ('Bottom of Stack' bit) of the label to be
                    pushed.";
               }
               leaf tc-value {
                 type uint8;
                 description
                   "The traffic class value of the label to be pushed.";
               }
               leaf ttl-value {
        
     grouping mpls-header {
       description
         "The MPLS encapsulation header information.";
       list label-operations {
         key "label-oper-id";
         description
           "Label operations.";
         leaf label-oper-id {
           type uint32;
           description
             "An optional identifier that points
              to a label operation.";
         }
         choice label-actions {
           description
             "Label action options.";
           case label-push {
             container label-push {
               description
                 "Label push operation.";
               leaf label {
                 type uint32;
                 mandatory true;
                 description
                   "The label to be pushed.";
               }
               leaf s-bit {
                 type boolean;
                 description
                   "The s-bit ('Bottom of Stack' bit) of the label to be
                    pushed.";
               }
               leaf tc-value {
                 type uint8;
                 description
                   "The traffic class value of the label to be pushed.";
               }
               leaf ttl-value {
        
                 type uint8;
                 description
                   "The TTL value of the label to be pushed.";
               }
             }
           }
           case label-swap {
             container label-swap {
               description
                 "Label swap operation.";
               leaf in-label {
                 type uint32;
                 mandatory true;
                 description
                   "The label to be swapped.";
               }
               leaf out-label {
                 type uint32;
                 mandatory true;
                 description
                   "The out MPLS label.";
               }
               leaf ttl-action {
                 type ttl-action-definition;
                 description
                   "The label TTL actions:
                    - No-action
                    - Copy to inner label
                    - Decrease (the in-label)
                      by 1 and copy to the out-label";
               }
             }
           }
         }
       }
     }
        
                 type uint8;
                 description
                   "The TTL value of the label to be pushed.";
               }
             }
           }
           case label-swap {
             container label-swap {
               description
                 "Label swap operation.";
               leaf in-label {
                 type uint32;
                 mandatory true;
                 description
                   "The label to be swapped.";
               }
               leaf out-label {
                 type uint32;
                 mandatory true;
                 description
                   "The out MPLS label.";
               }
               leaf ttl-action {
                 type ttl-action-definition;
                 description
                   "The label TTL actions:
                    - No-action
                    - Copy to inner label
                    - Decrease (the in-label)
                      by 1 and copy to the out-label";
               }
             }
           }
         }
       }
     }
        
     grouping tunnel-encapsulation {
       description
         "Tunnel encapsulation information.";
       choice tunnel-type {
         description
           "Tunnel options for nexthops.";
         case ipv4 {
           if-feature "ipv4-tunnel";
           container ipv4-header {
             uses ipv4-header;
             description
        
     grouping tunnel-encapsulation {
       description
         "Tunnel encapsulation information.";
       choice tunnel-type {
         description
           "Tunnel options for nexthops.";
         case ipv4 {
           if-feature "ipv4-tunnel";
           container ipv4-header {
             uses ipv4-header;
             description
        
               "IPv4 header.";
           }
         }
         case ipv6 {
           if-feature "ipv6-tunnel";
           container ipv6-header {
             uses ipv6-header;
             description
               "IPv6 header.";
           }
         }
         case mpls {
           if-feature "mpls-tunnel";
           container mpls-header {
             uses mpls-header;
             description
               "MPLS header.";
           }
         }
         case gre {
           if-feature "gre-tunnel";
           container gre-header {
             uses gre-header;
             description
               "GRE header.";
           }
         }
         case nvgre {
           if-feature "nvgre-tunnel";
           container nvgre-header {
             uses nvgre-header;
             description
               "NVGRE header.";
           }
         }
         case vxlan {
           if-feature "vxlan-tunnel";
           container vxlan-header {
             uses vxlan-header;
             description
               "VXLAN header.";
           }
         }
       }
     }
        
               "IPv4 header.";
           }
         }
         case ipv6 {
           if-feature "ipv6-tunnel";
           container ipv6-header {
             uses ipv6-header;
             description
               "IPv6 header.";
           }
         }
         case mpls {
           if-feature "mpls-tunnel";
           container mpls-header {
             uses mpls-header;
             description
               "MPLS header.";
           }
         }
         case gre {
           if-feature "gre-tunnel";
           container gre-header {
             uses gre-header;
             description
               "GRE header.";
           }
         }
         case nvgre {
           if-feature "nvgre-tunnel";
           container nvgre-header {
             uses nvgre-header;
             description
               "NVGRE header.";
           }
         }
         case vxlan {
           if-feature "vxlan-tunnel";
           container vxlan-header {
             uses vxlan-header;
             description
               "VXLAN header.";
           }
         }
       }
     }
        

grouping tunnel-decapsulation { description

分组隧道去封装{说明

         "Tunnel decapsulation information.";
       choice tunnel-type {
         description
           "Nexthop tunnel type options.";
         case ipv4 {
           if-feature "ipv4-tunnel";
           container ipv4-decapsulation {
             description
               "IPv4 decapsulation.";
             leaf ipv4-decapsulation {
               type tunnel-decapsulation-action-definition;
               mandatory true;
               description
                 "IPv4 decapsulation operations.";
             }
             leaf ttl-action {
               type ttl-action-definition;
               description
                 "The TTL actions:
                  no-action or copy to inner header.";
             }
           }
         }
         case ipv6 {
           if-feature "ipv6-tunnel";
           container ipv6-decapsulation {
             description
               "IPv6 decapsulation.";
             leaf ipv6-decapsulation {
               type tunnel-decapsulation-action-definition;
               mandatory true;
               description
                 "IPv6 decapsulation operations.";
             }
             leaf hop-limit-action {
               type hop-limit-action-definition;
               description
                 "The hop limit actions:
                  no-action or copy to inner header.";
             }
           }
         }
         case mpls {
           if-feature "mpls-tunnel";
           container label-pop {
             description
               "MPLS decapsulation.";
             leaf label-pop {
        
         "Tunnel decapsulation information.";
       choice tunnel-type {
         description
           "Nexthop tunnel type options.";
         case ipv4 {
           if-feature "ipv4-tunnel";
           container ipv4-decapsulation {
             description
               "IPv4 decapsulation.";
             leaf ipv4-decapsulation {
               type tunnel-decapsulation-action-definition;
               mandatory true;
               description
                 "IPv4 decapsulation operations.";
             }
             leaf ttl-action {
               type ttl-action-definition;
               description
                 "The TTL actions:
                  no-action or copy to inner header.";
             }
           }
         }
         case ipv6 {
           if-feature "ipv6-tunnel";
           container ipv6-decapsulation {
             description
               "IPv6 decapsulation.";
             leaf ipv6-decapsulation {
               type tunnel-decapsulation-action-definition;
               mandatory true;
               description
                 "IPv6 decapsulation operations.";
             }
             leaf hop-limit-action {
               type hop-limit-action-definition;
               description
                 "The hop limit actions:
                  no-action or copy to inner header.";
             }
           }
         }
         case mpls {
           if-feature "mpls-tunnel";
           container label-pop {
             description
               "MPLS decapsulation.";
             leaf label-pop {
        
               type mpls-label-action-definition;
               mandatory true;
               description
                 "Pop a label from the label stack.";
             }
             leaf ttl-action {
               type ttl-action-definition;
               description
                 "The label TTL action.";
             }
           }
         }
       }
     }
        
               type mpls-label-action-definition;
               mandatory true;
               description
                 "Pop a label from the label stack.";
             }
             leaf ttl-action {
               type ttl-action-definition;
               description
                 "The label TTL action.";
             }
           }
         }
       }
     }
        
     grouping route-attributes {
       description
         "Route attributes.";
       leaf route-preference {
         type uint32;
         mandatory true;
         description
           "ROUTE_PREFERENCE: This is a numerical value that
            allows for comparing routes from different
            protocols.  Static configuration is also
            considered a protocol for the purpose of this
            field.  It is also known as administrative-distance.
            The lower the value, the higher the preference.";
       }
       leaf local-only {
         type boolean;
         mandatory true;
         description
           "Indicate whether the attribute is local only.";
       }
       container address-family-route-attributes {
         description
           "Address-family-related route attributes.";
         choice route-type {
           description
             "Address-family-related route attributes. Future
              documents should specify these attributes by augmenting
              the cases in this choice.";
           case ip-route-attributes {
           }
           case mpls-route-attributes {
           }
           case ethernet-route-attributes {
        
     grouping route-attributes {
       description
         "Route attributes.";
       leaf route-preference {
         type uint32;
         mandatory true;
         description
           "ROUTE_PREFERENCE: This is a numerical value that
            allows for comparing routes from different
            protocols.  Static configuration is also
            considered a protocol for the purpose of this
            field.  It is also known as administrative-distance.
            The lower the value, the higher the preference.";
       }
       leaf local-only {
         type boolean;
         mandatory true;
         description
           "Indicate whether the attribute is local only.";
       }
       container address-family-route-attributes {
         description
           "Address-family-related route attributes.";
         choice route-type {
           description
             "Address-family-related route attributes. Future
              documents should specify these attributes by augmenting
              the cases in this choice.";
           case ip-route-attributes {
           }
           case mpls-route-attributes {
           }
           case ethernet-route-attributes {
        
           }
         }
       }
     }
        
           }
         }
       }
     }
        
     container routing-instance {
       description
         "A routing instance, in the context of
          the RIB information model, is a collection
          of RIBs, interfaces, and routing parameters.";
       leaf name {
         type string;
         description
           "The name of the routing instance.  This MUST
            be unique across all routing instances in
            a given network device.";
       }
       list interface-list {
         key "name";
         description
           "This represents the list of interfaces associated
            with this routing instance.  The interface list helps
            constrain the boundaries of packet forwarding.
            Packets coming on these interfaces are directly
            associated with the given routing instance.  The
            interface list contains a list of identifiers with
            each identifier uniquely identifying an interface.";
         leaf name {
           type if:interface-ref;
           description
             "A reference to the name of a network-layer interface.";
         }
       }
       leaf router-id {
         type yang:dotted-quad;
         description
           "Router ID: The 32-bit number in the form of a dotted quad.";
       }
       leaf lookup-limit {
         type uint8;
         description
           "A limit on how many levels of a lookup can be performed.";
       }
       list rib-list {
         key "name";
         description
           "A list of RIBs that are associated with the routing
            instance.";
        
     container routing-instance {
       description
         "A routing instance, in the context of
          the RIB information model, is a collection
          of RIBs, interfaces, and routing parameters.";
       leaf name {
         type string;
         description
           "The name of the routing instance.  This MUST
            be unique across all routing instances in
            a given network device.";
       }
       list interface-list {
         key "name";
         description
           "This represents the list of interfaces associated
            with this routing instance.  The interface list helps
            constrain the boundaries of packet forwarding.
            Packets coming on these interfaces are directly
            associated with the given routing instance.  The
            interface list contains a list of identifiers with
            each identifier uniquely identifying an interface.";
         leaf name {
           type if:interface-ref;
           description
             "A reference to the name of a network-layer interface.";
         }
       }
       leaf router-id {
         type yang:dotted-quad;
         description
           "Router ID: The 32-bit number in the form of a dotted quad.";
       }
       leaf lookup-limit {
         type uint8;
         description
           "A limit on how many levels of a lookup can be performed.";
       }
       list rib-list {
         key "name";
         description
           "A list of RIBs that are associated with the routing
            instance.";
        
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of each RIB.";
         }
         leaf address-family {
           type address-family-definition;
           mandatory true;
           description
             "The address family of a RIB.";
         }
         leaf ip-rpf-check {
           type boolean;
           description
             "Each RIB can be optionally associated with a
              ENABLE_IP_RPF_CHECK attribute that enables Reverse
              Path Forwarding (RPF) checks on all IP routes in that
              RIB.   An RPF check is used to
              prevent spoofing and limit malicious traffic.";
         }
         list route-list {
           key "route-index";
           description
             "A list of routes of a RIB.";
           uses route;
         }
         // This is a list that maintains the nexthops added to the RIB.
         uses nexthop-list;
       }
     }
        
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of each RIB.";
         }
         leaf address-family {
           type address-family-definition;
           mandatory true;
           description
             "The address family of a RIB.";
         }
         leaf ip-rpf-check {
           type boolean;
           description
             "Each RIB can be optionally associated with a
              ENABLE_IP_RPF_CHECK attribute that enables Reverse
              Path Forwarding (RPF) checks on all IP routes in that
              RIB.   An RPF check is used to
              prevent spoofing and limit malicious traffic.";
         }
         list route-list {
           key "route-index";
           description
             "A list of routes of a RIB.";
           uses route;
         }
         // This is a list that maintains the nexthops added to the RIB.
         uses nexthop-list;
       }
     }
        

//RPC Operations

//RPC操作

     rpc rib-add {
       description
         "To add a RIB to an instance";
       input {
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of the RIB
              that is to be added.";
         }
         leaf address-family {
           type address-family-definition;
           mandatory true;
        
     rpc rib-add {
       description
         "To add a RIB to an instance";
       input {
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of the RIB
              that is to be added.";
         }
         leaf address-family {
           type address-family-definition;
           mandatory true;
        
           description
             "The address family of the RIB.";
         }
         leaf ip-rpf-check {
           type boolean;
           description
             "Each RIB can be optionally associated with an
              ENABLE_IP_RPF_CHECK attribute that enables
              RPF checks on all IP routes in that
              RIB.   An RPF check is used to
              prevent spoofing and limit malicious traffic.";
         }
       }
       output {
         leaf result {
           type boolean;
           mandatory true;
           description
             "Return the result of the rib-add operation.
              true  - success;
              false - failed";
         }
         leaf reason {
           type string;
           description
             "The specific reason that caused the failure.";
         }
       }
     }
        
           description
             "The address family of the RIB.";
         }
         leaf ip-rpf-check {
           type boolean;
           description
             "Each RIB can be optionally associated with an
              ENABLE_IP_RPF_CHECK attribute that enables
              RPF checks on all IP routes in that
              RIB.   An RPF check is used to
              prevent spoofing and limit malicious traffic.";
         }
       }
       output {
         leaf result {
           type boolean;
           mandatory true;
           description
             "Return the result of the rib-add operation.
              true  - success;
              false - failed";
         }
         leaf reason {
           type string;
           description
             "The specific reason that caused the failure.";
         }
       }
     }
        
     rpc rib-delete {
       description
         "To delete a RIB from a routing instance.
          After deleting the RIB, all routes installed
          in the RIB will be deleted as well.";
       input {
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of the RIB
              that is to be deleted.";
         }
       }
       output {
         leaf result {
           type boolean;
           mandatory true;
        
     rpc rib-delete {
       description
         "To delete a RIB from a routing instance.
          After deleting the RIB, all routes installed
          in the RIB will be deleted as well.";
       input {
         leaf name {
           type string;
           mandatory true;
           description
             "A reference to the name of the RIB
              that is to be deleted.";
         }
       }
       output {
         leaf result {
           type boolean;
           mandatory true;
        
           description
             "Return the result of the rib-delete operation.
              true  - success;
              false - failed";
         }
         leaf reason {
           type string;
           description
             "The specific reason that caused failure.";
         }
       }
     }
        
           description
             "Return the result of the rib-delete operation.
              true  - success;
              false - failed";
         }
         leaf reason {
           type string;
           description
             "The specific reason that caused failure.";
         }
       }
     }
        
     grouping route-operation-state {
       description
         "Route operation state.";
       leaf success-count {
         type uint32;
         mandatory true;
         description
           "The numbers of routes that are successfully
            added/deleted/updated.";
       }
       leaf failed-count {
         type uint32;
         mandatory true;
         description
           "The numbers of the routes that fail
            to be added/deleted/updated.";
       }
       container failure-detail {
         description
           "The failure detail reflects the reason why a route
            operation fails.  It is an array that includes the route
            index and error code of the failed route.";
         list failed-routes {
           key "route-index";
           description
             "The list of failed routes.";
           leaf route-index {
             type uint32;
             description
               "The route index of the failed route.";
           }
           leaf error-code {
             type uint32;
             description
               "The error code that reflects the failure reason.
        
     grouping route-operation-state {
       description
         "Route operation state.";
       leaf success-count {
         type uint32;
         mandatory true;
         description
           "The numbers of routes that are successfully
            added/deleted/updated.";
       }
       leaf failed-count {
         type uint32;
         mandatory true;
         description
           "The numbers of the routes that fail
            to be added/deleted/updated.";
       }
       container failure-detail {
         description
           "The failure detail reflects the reason why a route
            operation fails.  It is an array that includes the route
            index and error code of the failed route.";
         list failed-routes {
           key "route-index";
           description
             "The list of failed routes.";
           leaf route-index {
             type uint32;
             description
               "The route index of the failed route.";
           }
           leaf error-code {
             type uint32;
             description
               "The error code that reflects the failure reason.
        
                0 - Reserved
                1 - Trying to add a repeat route
                2 - Trying to delete or update a route that does not
                  exist
                3 - Malformed route attributes";
           }
         }
       }
     }
        
                0 - Reserved
                1 - Trying to add a repeat route
                2 - Trying to delete or update a route that does not
                  exist
                3 - Malformed route attributes";
           }
         }
       }
     }
        
     rpc route-add {
       description
         "To add a route or a list of routes to a RIB";
       input {
         leaf return-failure-detail {
           type boolean;
           default "false";
           description
             "Whether to return the failure detail.
              true  - return the failure detail
              false - do not return the failure detail
              The default is false.";
         }
         leaf rib-name {
           type string;
           mandatory true;
           description
             "A reference to the name of a RIB.";
         }
         container routes {
           description
             "The routes to be added to the RIB.";
           list route-list {
             key "route-index";
             description
               "The list of routes to be added.";
             uses route-prefix;
             container route-attributes {
               uses route-attributes;
               description
                 "The route attributes.";
             }
             container route-vendor-attributes {
               if-feature "route-vendor-attributes";
               uses route-vendor-attributes;
               description
                 "The route vendor attributes.";
             }
        
     rpc route-add {
       description
         "To add a route or a list of routes to a RIB";
       input {
         leaf return-failure-detail {
           type boolean;
           default "false";
           description
             "Whether to return the failure detail.
              true  - return the failure detail
              false - do not return the failure detail
              The default is false.";
         }
         leaf rib-name {
           type string;
           mandatory true;
           description
             "A reference to the name of a RIB.";
         }
         container routes {
           description
             "The routes to be added to the RIB.";
           list route-list {
             key "route-index";
             description
               "The list of routes to be added.";
             uses route-prefix;
             container route-attributes {
               uses route-attributes;
               description
                 "The route attributes.";
             }
             container route-vendor-attributes {
               if-feature "route-vendor-attributes";
               uses route-vendor-attributes;
               description
                 "The route vendor attributes.";
             }
        
             container nexthop {
               uses nexthop;
               description
                 "The nexthop of the added route.";
             }
           }
         }
       }
       output {
         uses route-operation-state;
       }
     }
        
             container nexthop {
               uses nexthop;
               description
                 "The nexthop of the added route.";
             }
           }
         }
       }
       output {
         uses route-operation-state;
       }
     }
        
     rpc route-delete {
       description
         "To delete a route or a list of routes from a RIB";
       input {
         leaf return-failure-detail {
           type boolean;
           default "false";
           description
             "Whether to return the failure detail.
              true  - return the failure detail
              false - do not return the failure detail
              The default is false.";
         }
         leaf rib-name {
           type string;
           mandatory true;
           description
             "A reference to the name of a RIB.";
         }
         container routes {
           description
             "The routes to be added to the RIB.";
           list route-list {
             key "route-index";
             description
               "The list of routes to be deleted.";
             uses route-prefix;
           }
         }
       }
       output {
         uses route-operation-state;
       }
     }
        
     rpc route-delete {
       description
         "To delete a route or a list of routes from a RIB";
       input {
         leaf return-failure-detail {
           type boolean;
           default "false";
           description
             "Whether to return the failure detail.
              true  - return the failure detail
              false - do not return the failure detail
              The default is false.";
         }
         leaf rib-name {
           type string;
           mandatory true;
           description
             "A reference to the name of a RIB.";
         }
         container routes {
           description
             "The routes to be added to the RIB.";
           list route-list {
             key "route-index";
             description
               "The list of routes to be deleted.";
             uses route-prefix;
           }
         }
       }
       output {
         uses route-operation-state;
       }
     }
        
     grouping route-update-options {
       description
         "Update options:
          1. update the nexthop
          2. update the route attributes
          3. update the route-vendor-attributes";
       choice update-options {
         description
           "Update options:
            1. update the nexthop
            2. update the route attributes
            3. update the route-vendor-attributes";
         case update-nexthop {
           container updated-nexthop {
             uses nexthop;
             description
               "The nexthop used for updating.";
           }
         }
         case update-route-attributes {
           container updated-route-attr {
             uses route-attributes;
             description
               "The route attributes used for updating.";
           }
         }
         case update-route-vendor-attributes {
           container updated-route-vendor-attr {
             uses route-vendor-attributes;
             description
               "The vendor route attributes used for updating.";
           }
         }
       }
     }
        
     grouping route-update-options {
       description
         "Update options:
          1. update the nexthop
          2. update the route attributes
          3. update the route-vendor-attributes";
       choice update-options {
         description
           "Update options:
            1. update the nexthop
            2. update the route attributes
            3. update the route-vendor-attributes";
         case update-nexthop {
           container updated-nexthop {
             uses nexthop;
             description
               "The nexthop used for updating.";
           }
         }
         case update-route-attributes {
           container updated-route-attr {
             uses route-attributes;
             description
               "The route attributes used for updating.";
           }
         }
         case update-route-vendor-attributes {
           container updated-route-vendor-attr {
             uses route-vendor-attributes;
             description
               "The vendor route attributes used for updating.";
           }
         }
       }
     }
        

rpc route-update { description "To update a route or a list of routes of a RIB. The inputs: 1. The match conditions, which could be: a. route prefix, b. route attributes, or c. nexthop. 2. The update parameters to be used: a. new nexthop, b. new route attributes, or c. nexthop.

rpc route update{description“更新RIB的路由或路由列表。输入:1.匹配条件,可以是:a.路由前缀、b.路由属性或c.下一个路径。2.要使用的更新参数:a.新下一个路径、b.新路由属性或c.下一个路径。

          Actions:
            1. update the nexthop
            2. update the route attributes
          The outputs:
            success-count - the number of routes updated
            failed-count - the number of routes fail to update
            failure-detail - the detail failure info
         ";
       input {
         leaf return-failure-detail {
           type boolean;
           default "false";
           description
             "Whether to return the failure detail.
              true  - return the failure detail
              false - do not return the failure detail
              The default is false.";
         }
         leaf rib-name {
           type string;
           mandatory true;
           description
             "A reference to the name of a RIB.";
         }
         choice match-options {
           description
             "Match options.";
           case match-route-prefix {
             description
               "Update the routes that match the route
                prefix(es) condition.";
             container input-routes {
               description
                 "The matched routes to be updated.";
               list route-list {
                 key "route-index";
                 description
                   "The list of routes to be updated.";
                 uses route-prefix;
                 uses route-update-options;
               }
             }
           }
           case match-route-attributes {